Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicitly set OpenMP runtime library rpath like other normal libraries #5192

Merged
merged 4 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,18 @@ if(QMC_OMP)
FATAL_ERROR "No compiler support for OpenMP found. Switching to a compiler with OpenMP support is recommended."
"Alternatively, you will need to run CMake configure with -DQMC_OMP=OFF")
endif()

# explicitly set OpenMP runtime library rpath like other normal libraries.
list(GET OpenMP_CXX_LIBRARIES 0 OpenMP_LIBRARY_FILE)
if(OpenMP_LIBRARY_FILE)
cmake_path(GET OpenMP_LIBRARY_FILE PARENT_PATH OpenMP_LIBRARY_DIR)
list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES ${OpenMP_LIBRARY_DIR} isSystemDir)
if("${isSystemDir}" STREQUAL "-1")
message(STATUS "Append OpenMP runtime library path ${OpenMP_LIBRARY_DIR}")
list(APPEND CMAKE_BUILD_RPATH ${OpenMP_LIBRARY_DIR})
list(APPEND CMAKE_INSTALL_RPATH ${OpenMP_LIBRARY_DIR})
endif("${isSystemDir}" STREQUAL "-1")
endif()
endif(QMC_OMP)

#-------------------------------------------------------------------------------
Expand Down
4 changes: 1 addition & 3 deletions tests/test_automation/github-actions/ci/run_step.sh
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,6 @@ case "$1" in

if [[ "${GH_JOBNAME}" =~ (Clang16-NoMPI-Offload) ]]
then
echo "Adding /usr/lib/llvm-12/lib/ to LD_LIBRARY_PATH to enable libomptarget.so"
export LD_LIBRARY_PATH=/usr/lib/llvm-12/lib/:${LD_LIBRARY_PATH}
export KMP_TEAMS_THREAD_LIMIT=1
# Run only unit tests (reasonable for CI)
TEST_LABEL="-L unit"
Expand Down Expand Up @@ -342,7 +340,7 @@ case "$1" in

if [[ "${GH_JOBNAME}" =~ (AFQMC-Offload) ]]
then
export LD_LIBRARY_PATH=/opt/llvm/15.0.0/lib:/usr/lib64/openmpi/lib:${LD_LIBRARY_PATH}
export LD_LIBRARY_PATH=/usr/lib64/openmpi/lib:${LD_LIBRARY_PATH}
fi

if [[ "${GH_JOBNAME}" =~ (Intel21) ]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ case "$1" in

echo "Set PATHs to cuda-11.2"
export PATH=$HOME/opt/cuda/11.2/bin:$PATH
export LD_LIBRARY_PATH=$LLVM_DIR/lib:$LD_LIBRARY_PATH
export OMPI_CC=$LLVM_DIR/bin/clang
export OMPI_CXX=$LLVM_DIR/bin/clang++

Expand All @@ -78,7 +77,6 @@ case "$1" in
cmake -GNinja \
-DCMAKE_C_COMPILER=/usr/lib64/openmpi/bin/mpicc \
-DCMAKE_CXX_COMPILER=/usr/lib64/openmpi/bin/mpicxx \
-DCMAKE_EXE_LINKER_FLAGS="-L $LLVM_DIR/lib" \
-DMPIEXEC_EXECUTABLE=/usr/lib64/openmpi/bin/mpirun \
-DBOOST_ROOT=$BOOST_DIR \
-DBUILD_AFQMC=ON \
Expand Down
Loading