hipBLAS
hipBLAS copied to clipboard
Revamp how libomp.so is found
An upstream llvm change enables
LLVM_ENABLE_PER_TARGET_RUNTIME_DIR by default for the openmp build. This installs the openmp libraries into
/opt/rocm-ver/llvm/lib/x86_64-unknown-linux-gnu
instead of /opt/rocm-ver/llvm/lib
. Currenty, hipBLAS only uses /lib.
Since hipBLAS uses gcc by default, find_package(OpenMP)
will locate libgomp from the gnu installation. We would prefer to use libomp from the ROCm install. Query amdclang to find LLVM_TARGET_TRIPLE and use as a suffix for find_library(omp)
.
On the other hand, the user can choose to use hipcc, which allows find_package(OpenMP)
to properly locate libomp inside ROCm llvm.
To include legacy support, I left the hardcoded -L HIP_CLANG_ROOT
as a fallback.
This would be much simpler if hipBLAS defaulted to hipcc as the cmake compiler.
Summary of proposed changes:
- If compiler is gcc, query amdclang for LLVM_TARGET_TRIPLE and use as suffix for
find_library(omp)
. - If compiler is hipcc, use
find_package(OpenMP)
. - If cmake cannot find libomp.so then fallback to using
-L HIP_CLANG_ROOT/lib
. - Allow proper detection of new lib installation subdirectory (i.e. x86_64-unknown-linux-gnu).
- Removed dependency on
find_package(LLVM)
due torocm-llvm-dev/devel
not being installed by default on various operating systems, which would not have the cmake config files.
Hi @estewart08 are you still active on this?
I am going to pick this effort back up, so I would prefer it to stay open for now.
@estewart08 if picking this up again for next release time is ticking....