hipcl icon indicating copy to clipboard operation
hipcl copied to clipboard

CMake integration

Open Kerilk opened this issue 4 years ago • 5 comments

Hello,

Disclaimer: I am no expert in CMake...

We are currently trying to run hipcl on our test base: https://github.com/jz10/hip-test_suite Most simple examples are fine, and auto-tools build systems can also be configured without too much issues. Problems start arising when trying to build CMake based projects. The FindHIP.cmake of hipcl file seems to have diverged quite a bit from what HIP proposes nowadays: https://github.com/ROCm-Developer-Tools/HIP/blob/main/cmake/FindHIP.cmake In most cases this causes cmake to crash when a macro like hip_add_executable is missing, or reject hipcl:

  The following configuration files were considered but not accepted:

    /soft/compilers/hipcl/master-202010107/lib/hipcl/cmake/hip-config.cmake, version: unknown

As I already mentioned, I am no CMake expert so I don't feel confident adequately solving those issues. Nonetheless, it seems like a worthwhile investment, as hipcl is becoming increasingly stable, using it with bigger projects seems the likely next step.

Thanks

Kerilk avatar Jan 19 '21 22:01 Kerilk

CMake should be now more compatible with upstream HIP in master, although i have only tried it on a few samples. Please try it out and see if it works. You'll need to do a reinstall hipcl (there's no need to recompile clang+llvm).

franz avatar Feb 08 '21 07:02 franz

Thanks, we'll try this out and let you know.

Kerilk avatar Feb 08 '21 16:02 Kerilk

Thanks for this!

We tried it out on our system and it works to build more things than it used to! However, I was hoping that I could more or less use the exact same CMakeLists.txt from AMD hip to compile hipcl code.

I ran into one main issue: one of the codes I was trying to build with HIPCL uses the hip::device target from find_package(hip) to add compilation flags. hipcl doesn't define hip::device, but it defines just "hip::hipcl". Are there any plans to also define hip::device for hipcl so we can more easily use the same CMakeLists.txt as AMD hip?

I can respond with the CMakeLists.txt if that would help. Thanks!

colleeneb avatar Feb 25 '21 21:02 colleeneb

Ping on this!

colleeneb avatar Mar 04 '21 17:03 colleeneb

Sorry, i'm not aware of what is "hip::device" and what should it provide. Haven't seen it in the HIP CMake code. We could add an empty target but i'm not sure if that would work.

franz avatar Mar 16 '21 07:03 franz