Skip to content

Commit

Permalink
Merge pull request #4550 from kidder/python_preload
Browse files Browse the repository at this point in the history
Add preload of jemalloc library to spectre script
  • Loading branch information
wthrowe authored Jan 6, 2023
2 parents 51a509a + 0e3e487 commit f05a287
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cmake/SpectrePythonExecutable.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
# Distributed under the MIT License.
# See LICENSE.txt for details.

PYTHONPATH="@PYTHONPATH@" @Python_EXECUTABLE@ \
PYTHONPATH="@PYTHONPATH@" @JEMALLOC_PRELOAD@ @Python_EXECUTABLE@ \
-m @PYTHON_SCRIPT_LOCATION@ "$@"
4 changes: 4 additions & 0 deletions cmake/SpectreSetupPythonPackage.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ configure_or_symlink_py_file(
)
# Also link the main entry point to bin/
set(PYTHON_SCRIPT_LOCATION "spectre")
set(JEMALLOC_PRELOAD "")
if(BUILD_PYTHON_BINDINGS AND "${JEMALLOC_LIB_TYPE}" STREQUAL SHARED)
set(JEMALLOC_PRELOAD "LD_PRELOAD=\${LD_PRELOAD}\${LD_PRELOAD:+:}${JEMALLOC_LIBRARIES}")
endif()
configure_file(
"${CMAKE_SOURCE_DIR}/cmake/SpectrePythonExecutable.sh"
"${CMAKE_BINARY_DIR}/tmp/spectre")
Expand Down

0 comments on commit f05a287

Please sign in to comment.