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

Add LLVM_DEFAULT_TARGET_TRIPLE to find new location of -lomp #839

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
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
13 changes: 13 additions & 0 deletions clients/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,21 @@ if( BUILD_CLIENTS_BENCHMARKS OR BUILD_CLIENTS_TESTS)
if (TARGET OpenMP::OpenMP_CXX)
set( COMMON_LINK_LIBS "OpenMP::OpenMP_CXX")
if(HIP_PLATFORM STREQUAL amd)
if (NOT WIN32)
execute_process(
OUTPUT_STRIP_TRAILING_WHITESPACE
COMMAND bash -c "${HIP_CLANG_ROOT}/bin/amdclang --version | grep -oP '(?<=Target: ).+'"
OUTPUT_VARIABLE LLVM_DEFAULT_TARGET_TRIPLE
)
if(LLVM_DEFAULT_TARGET_TRIPLE)
list( APPEND COMMON_LINK_LIBS "-L\"${HIP_CLANG_ROOT}/lib/${LLVM_DEFAULT_TARGET_TRIPLE}\"")
endif()
Comment on lines +130 to +132
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume you have no way to add this into OpenMP::OpenMP_CXX as that would be cleaner approach. I thought we were moving to use /bin/amdclang as well. Otherwise appears fine

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The find_package(OpenMP) is actually using FindOpenMP.cmake from the cmake install itself. From what I have seen, it is finding libgomp.so from a system package and not ROCm. Passing a custom CMAKE_PREFIX_PATH will not work either for this as they turn off these search paths in FindOpenMP.cmake. This is probably why the -L /lib had to be added in the first place. The openmp install does not have a config file to query either.

As far as using amdclang, I can make that change.

endif()
list( APPEND COMMON_LINK_LIBS "-L\"${HIP_CLANG_ROOT}/lib\"")
if (NOT WIN32)
if(LLVM_DEFAULT_TARGET_TRIPLE)
list( APPEND COMMON_LINK_LIBS "-Wl,-rpath=${HIP_CLANG_ROOT}/lib/${LLVM_DEFAULT_TARGET_TRIPLE}")
endif()
list( APPEND COMMON_LINK_LIBS "-Wl,-rpath=${HIP_CLANG_ROOT}/lib -lomp")
else()
list( APPEND COMMON_LINK_LIBS "libomp")
Expand Down