LLNL / blt

A streamlined CMake build system foundation for developing HPC software
BSD 3-Clause "New" or "Revised" License
257 stars 59 forks source link

`blt_hip_smoke` does not compile #700

Open gzagaris opened 1 week ago

gzagaris commented 1 week ago

Hello,

I am trying to compile with HIP and it seems that CMake attempts to compile the blt_hip_smoke test using the host-compiler.

My host-config looks like this:

#---------------------------------------------------------------------------------------------------
# Compiler settings
#---------------------------------------------------------------------------------------------------
set(CMAKE_C_COMPILER "/opt/cray/pe/gcc/12.2.0/snos/bin/gcc" CACHE PATH "Path to the C compiler." )
set(CMAKE_CXX_COMPILER "/opt/cray/pe/gcc/12.2.0/snos/bin/g++" CACHE PATH "Path to the C++ compiler." )

...

#---------------------------------------------------------------------------------------------------
# ROCM / HIP 
#---------------------------------------------------------------------------------------------------
set(ENABLE_HIP ON CACHE BOOL "")
set(ROCM_ROOT_DIR "/opt/rocm-5.7.0" CACHE PATH "")
set(HIP_ROOT_DIR "${ROCM_ROOT_DIR}/hip" CACHE PATH "")
set(HIP_CXX_COMPILER "${HIP_ROOT_DIR}/bin/hipcc" CACHE PATH "")
set(CMAKE_HIP_COMPILER "${ROCM_ROOT_DIR}/llvm/bin/clang++" CACHE FILEPATH "")

set(CMAKE_HIP_ARCHITECTURES "gfx90a" CACHE STRING "")
set(AMDGPU_TARGETS "gfx90a" CACHE STRING "")
set(GPU_TARGETS "gfx90a" CACHE STRING "")

I configure with CMake successfully, but, I see the following warnings:

-- Creating BLT HIP targets...
CMake Deprecation Warning at /opt/rocm-5.7.0/lib/cmake/hip/hip-config.cmake:20 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.
Call Stack (most recent call first):
  contrib/blt/cmake/thirdparty/BLTSetupHIP.cmake:38 (find_package)
  contrib/blt/cmake/BLTSetupTargets.cmake:108 (include)
  contrib/blt/cmake/SetupThirdParty.cmake:6 (include)
  contrib/blt/SetupBLT.cmake:129 (include)
  CMakeLists.txt:39 (mint_blt_setup)

CMake Deprecation Warning at /opt/rocm-5.7.0/lib/cmake/hip/hip-config-amd.cmake:21 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.
Call Stack (most recent call first):
  /opt/rocm-5.7.0/lib/cmake/hip/hip-config.cmake:150 (include)
  contrib/blt/cmake/thirdparty/BLTSetupHIP.cmake:38 (find_package)
  contrib/blt/cmake/BLTSetupTargets.cmake:108 (include)
  contrib/blt/cmake/SetupThirdParty.cmake:6 (include)
  contrib/blt/SetupBLT.cmake:129 (include)
  ...

When building, e.g., with make -j, or just make make blt_hip_smoke/fast

I get the following error:

Building CXX object blt/tests/smoke/CMakeFiles/blt_hip_smoke.dir/blt_hip_smoke.cpp.o
g++: error: unrecognized command-line option '--rocm-path=/opt/rocm-5.7.0'
g++: error: unrecognized command-line option '--offload-arch=gfx90a'
make[1]: *** [blt/tests/smoke/CMakeFiles/blt_hip_smoke.dir/build.make:76: blt/tests/smoke/CMakeFiles/blt_hip_smoke.dir/blt_hip_smoke.cpp.o] Error 1

Any ideas? Am I missing any flags?

I tried this with blt v0.5.3 and the latest v0.6.2.

Thank you for all your help.

white238 commented 1 week ago

Unfortunately we are still on the original way to handle HIP which requires you to have your main compiler be the HIP compiler. See example here:

https://github.com/LLNL/blt/blob/develop/host-configs/llnl/toss_4_x86_64_ib_cray/clang%4016.0.0_hip.cmake

It is on our shortlist to fix.

gzagaris commented 1 week ago

Unfortunately we are still on the original way to handle HIP which requires you to have your main compiler be the HIP compiler. See example here:

https://github.com/LLNL/blt/blob/develop/host-configs/llnl/toss_4_x86_64_ib_cray/clang%4016.0.0_hip.cmake

It is on our shortlist to fix.

Ugh...bummer, thanks @white238 !