HIP: -DCMAKE_HIP_PLATFORM=nvidia fails without env HIP_PLATFORM=nvidia
Hi,
I'm currently trying out the new feature CMAKE_HIP_PLATFORM in cmake-3.28-rc1. Everything works flawless on the AMD system when I use -DCMAKE_HIP_PLATFORM=amd. However, on the Nvidia system I run into a problem when using -DCMAKE_HIP_PLATFORM=nvidia will still attempt to configure the project for amd.
I use this example project for demonstration (rocm version 5.7.1): https://gitlab.kitware.com/michael.panzlaff/cmake-hip-platform-bugdemo
Running
$ cmake -S . -B build -DCMAKE_HIP_PLATFORM=nvidia
will raise an error. However, the following does appear to work:
$ HIP_PLATFORM=nvidia cmake -S . -B build -DCMAKE_HIP_PLATFORM=nvidia
To me having to declare both variables appears to be counterintuitive. I'm not sure whether cmake hip support is at fault or the rocm cmake file.
cmake error output:
-- The CXX compiler identification is GNU 12.1.0
-- The C compiler identification is GNU 12.1.0
-- The HIP compiler identification is NVIDIA 12.1.105
Can't exec "/home/hpc/ihpc/ihpc112h/rocm/install/llvm/bin/clang++": No such file or directory at /home/hpc/ihpc/ihpc112h/rocm/install/bin//hipconfig.pl line 71.
Use of uninitialized value $HIP_CLANG_INCLUDE in concatenation (.) or string at /home/hpc/ihpc/ihpc112h/rocm/install/bin//hipconfig.pl line 80.
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /apps/SPACK/0.18.0/opt/linux-almalinux8-zen/gcc-8.5.0/gcc-12.1.0-aqjaxi6qzz4fjsdz6fyxpivbenk6akth/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /apps/SPACK/0.18.0/opt/linux-almalinux8-zen/gcc-8.5.0/gcc-12.1.0-aqjaxi6qzz4fjsdz6fyxpivbenk6akth/bin/gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting HIP compiler ABI info
-- Detecting HIP compiler ABI info - done
-- Check for working HIP compiler: /apps/SPACK/0.19.1/opt/linux-almalinux8-zen/gcc-8.5.0/cuda-12.1.1-nekgnnonum23hyldot34gqw76j42mzil/bin/nvcc - skipped
-- Detecting HIP compile features
-- Detecting HIP compile features - done
CMake Deprecation Warning at /home/hpc/ihpc/ihpc112h/rocm/install/lib64/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):
CMakeLists.txt:17 (find_package)
Can't exec "/home/hpc/ihpc/ihpc112h/rocm/install/llvm/bin/clang++": No such file or directory at /home/hpc/ihpc/ihpc112h/rocm/install/bin//hipconfig.pl line 71.
Use of uninitialized value $HIP_CLANG_INCLUDE in concatenation (.) or string at /home/hpc/ihpc/ihpc112h/rocm/install/bin//hipconfig.pl line 80.
CMake Deprecation Warning at /home/hpc/ihpc/ihpc112h/rocm/install/lib64/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):
/home/hpc/ihpc/ihpc112h/rocm/install/lib64/cmake/hip/hip-config.cmake:150 (include)
CMakeLists.txt:17 (find_package)
CMake Error at /home/hpc/ihpc/ihpc112h/cmake/install_alex/share/cmake-3.28/Modules/CMakeFindDependencyMacro.cmake:76 (find_package):
By not providing "FindAMDDeviceLibs.cmake" in CMAKE_MODULE_PATH this
project has asked CMake to find a package configuration file provided by
"AMDDeviceLibs", but CMake did not find one.
Could not find a package configuration file provided by "AMDDeviceLibs"
with any of the following names:
AMDDeviceLibsConfig.cmake
amddevicelibs-config.cmake
Add the installation prefix of "AMDDeviceLibs" to CMAKE_PREFIX_PATH or set
"AMDDeviceLibs_DIR" to a directory containing one of the above files. If
"AMDDeviceLibs" provides a separate development package or SDK, be sure it
has been installed.
Call Stack (most recent call first):
/home/hpc/ihpc/ihpc112h/rocm/install/lib64/cmake/hip/hip-config-amd.cmake:67 (find_dependency)
/home/hpc/ihpc/ihpc112h/rocm/install/lib64/cmake/hip/hip-config.cmake:150 (include)
CMakeLists.txt:17 (find_package)
-- Configuring incomplete, errors occurred!
cmake output when HIP_PLATFORM=nvidia
environment variable is set:
-- The CXX compiler identification is GNU 12.1.0
-- The C compiler identification is GNU 12.1.0
-- The HIP compiler identification is NVIDIA 12.1.105
Can't exec "/home/hpc/ihpc/ihpc112h/rocm/install/llvm/bin/clang++": No such file or directory at /home/hpc/ihpc/ihpc112h/rocm/install/bin//hipconfig.pl line 71.
Use of uninitialized value $HIP_CLANG_INCLUDE in concatenation (.) or string at /home/hpc/ihpc/ihpc112h/rocm/install/bin//hipconfig.pl line 80.
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /apps/SPACK/0.18.0/opt/linux-almalinux8-zen/gcc-8.5.0/gcc-12.1.0-aqjaxi6qzz4fjsdz6fyxpivbenk6akth/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /apps/SPACK/0.18.0/opt/linux-almalinux8-zen/gcc-8.5.0/gcc-12.1.0-aqjaxi6qzz4fjsdz6fyxpivbenk6akth/bin/gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting HIP compiler ABI info
-- Detecting HIP compiler ABI info - done
-- Check for working HIP compiler: /apps/SPACK/0.19.1/opt/linux-almalinux8-zen/gcc-8.5.0/cuda-12.1.1-nekgnnonum23hyldot34gqw76j42mzil/bin/nvcc - skipped
-- Detecting HIP compile features
-- Detecting HIP compile features - done
CMake Deprecation Warning at /home/hpc/ihpc/ihpc112h/rocm/install/lib64/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):
CMakeLists.txt:17 (find_package)
CMake Deprecation Warning at /home/hpc/ihpc/ihpc112h/rocm/install/lib64/cmake/hip/hip-config-nvidia.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):
/home/hpc/ihpc/ihpc112h/rocm/install/lib64/cmake/hip/hip-config.cmake:154 (include)
CMakeLists.txt:17 (find_package)
-- Configuring done (3.6s)
-- Generating done (0.1s)
-- Build files have been written to: /home/hpc/ihpc/ihpc112h/test/build