diff --git a/CMakeLists.txt b/CMakeLists.txt index 6db75f2397..1b3cf21430 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) #------------------------------------------------------------------------------- diff --git a/tests/test_automation/github-actions/ci/run_step.sh b/tests/test_automation/github-actions/ci/run_step.sh index dd13162638..ddc27092e1 100755 --- a/tests/test_automation/github-actions/ci/run_step.sh +++ b/tests/test_automation/github-actions/ci/run_step.sh @@ -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" @@ -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) ]] diff --git a/tests/test_automation/github-actions/ci/run_step_ornl-sulfur-2.sh b/tests/test_automation/github-actions/ci/run_step_ornl-sulfur-2.sh index 757c521a67..7c3031f3df 100755 --- a/tests/test_automation/github-actions/ci/run_step_ornl-sulfur-2.sh +++ b/tests/test_automation/github-actions/ci/run_step_ornl-sulfur-2.sh @@ -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++ @@ -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 \