ROCm / rocThrust

ROCm Thrust - run Thrust dependent software on AMD GPUs
https://rocm.docs.amd.com/projects/rocThrust/en/latest/
Apache License 2.0
100 stars 44 forks source link

C++ compiler should not be enforced globally #238

Open dmikushin opened 2 years ago

dmikushin commented 2 years ago

When doing add_subdirectory(ThirdParty/rocThrust) from a project, rocThrust fails to install rocprim with the following error message:

CMake Error at cmake/VerifyCompiler.cmake:29 (message):
  On ROCm platform 'hipcc' or HIP-aware Clang must be used as C++ compiler.
Call Stack (most recent call first):
  CMakeLists.txt:82 (include)

Please correct me, if I'm wrong: this message requests that the CMAKE_CXX_COMPILER must be hipcc. I believe this requirement contradicts with the way how modern CMake is designed. Starting from CMake 3.18/3.23, CUDA and HIP are CMake "languages" that could be enabled with e.g. enable_language(HIP). The hipcc compiler is then provided by CMAKE_HIP_COMPILER, independently of the main CMAKE_CXX_COMPILER. Furthermore, CMake chooses the C++ compiler variant, depending on the file extension (.cpp, .cu, .hip, etc.). In order to comply with this flexibility of CMake, rocThrust should not post this error, and instead check for CMAKE_HIP_COMPILER, and use it internally if it wishes so.

doctorcolinsmith commented 2 years ago

This can be resolved in our build scripts after we update the minimum CMake version to 3.21.

doctorcolinsmith commented 2 years ago

@mfep Please take a look at this.

saadrahim commented 2 years ago

@dmikushin Our libraries are transitioning to better support for cmake's HIP language support. I appreciate your bug report. A fix will be targeted for a future release.

doctorcolinsmith commented 1 year ago

This item is still in progress. A fix will should appear in a future release.

StewMH commented 4 months ago

Would you just consider making this a warning for now anyway? It's not easy to work around in our builds (a large project supporting multiple GPU/CPU backends).