ginkgo icon indicating copy to clipboard operation
ginkgo copied to clipboard

Issue about compiling Ginkgo with rocm 6.0

Open tpadioleau opened this issue 1 year ago • 2 comments

I recently had trouble compiling Ginkgo 1.6 with rocm 6.0. At first I had an issue with cmake that could not find a function called hip_add_library. After setting CMAKE_MODULE_PATH, I encountered /opt/rocm/hip/../llvm/bin/clang: not found because the directory hip does not exist in /opt/rocm. After creating this directory, I encountered

/ginkgo/hip/base/types.hip.hpp:46:10: fatal error: 'hipblas.h' file not found
#include <hipblas.h>

Are you aware of such problems ?

I attach two docker files, one that builds fine with rocm 5.7.3 (Dockerfile-rocm5.7.3.txt) and the one failing with rocm 6.0 (Dockerfile-rocm6.0.txt). Please let me know if you find something wrong in these files.

tpadioleau avatar Jan 16 '24 14:01 tpadioleau

Thanks a lot for the report and the details! I believe this is normal, we have not yet tested ROCm 6.0 and thankfully, ROCm 6.0 now enforces the FHS standard within its directory. This is generally good news as many things can be simplified, but we have not proofed our CMake build system for that yet.

Alternatively, maybe we can finally adopt the native HIP language support within CMake, and rewrite (simplify) our CMake HIP build system, which should also sidestep the issue.

tcojean avatar Jan 16 '24 14:01 tcojean

Ok thanks the quick reply!

tpadioleau avatar Jan 16 '24 16:01 tpadioleau

I can confirm that #1334 works on ROCm 6.0.2

upsj avatar Feb 21 '24 15:02 upsj

I managed to build ginkgo 1.7.0 with ROCm 6.0 by setting the following env vars. That is, without benchmarks which are affected by #1566

export ROCM_PATH=/opt/rocm
export HIP_PATH="$ROCM_PATH"
export HIP_THRUST_PATH="$HIP_PATH"/include

lahwaacz avatar Mar 09 '24 17:03 lahwaacz

Should be fixed by #1334

upsj avatar Apr 12 '24 16:04 upsj

@upsj hip_path.cmake still defaults to /opt/rocm/hip for HIP_PATH which does not work with ROCm 6.0:

https://github.com/ginkgo-project/ginkgo/blob/a8a407f35887c480af66500c20dc53a41d2f7604/cmake/hip_path.cmake#L3

Furthermore, hip.cmake has a code path where $ENV{HIP_PATH}/.. is used for `ROCM_PATH:

https://github.com/ginkgo-project/ginkgo/blob/a8a407f35887c480af66500c20dc53a41d2f7604/cmake/hip.cmake#L20

It would be nice if Ginkgo could auto-detect ROCm version and use the correct paths for 6.0 by default :wink:

lahwaacz avatar Apr 13 '24 10:04 lahwaacz

Actually, do you need any special handling for the paths at all? CMake can auto-detect ROCm/HIP just fine...

lahwaacz avatar Apr 13 '24 11:04 lahwaacz

The only reason we need this right now is to enable autodetection of the hipBLAS/... paths, but that should be handled correctly by an environment where they are all part of the CMAKE_PREFIX_PATH. So hopefully we don't need it at all.

upsj avatar Apr 13 '24 11:04 upsj