hipBLAS icon indicating copy to clipboard operation
hipBLAS copied to clipboard

Revamp how libomp.so is found

Open estewart08 opened this issue 10 months ago • 3 comments

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 to rocm-llvm-dev/devel not being installed by default on various operating systems, which would not have the cmake config files.

estewart08 avatar Apr 19 '24 22:04 estewart08

Hi @estewart08 are you still active on this?

TorreZuk avatar May 31 '24 16:05 TorreZuk

I am going to pick this effort back up, so I would prefer it to stay open for now.

estewart08 avatar May 31 '24 20:05 estewart08

@estewart08 if picking this up again for next release time is ticking....

TorreZuk avatar Jul 10 '24 16:07 TorreZuk