Hi,
I have a question regarding cmake and cuda. I installed CUDA 23.1 and I load the module file in my .bashrc file
module load ~/Install_nvhpc/version_23.1/modulefiles/nvhpc/23.1
When i check the nvcc --version and which nvcc, i get correct results. Now I made one .cu file and one main.cpp file. I used cmake (version 3.19.8) with the following CMakeLists.txt
cmake_minimum_required( VERSION 3.3.2)
# set compilers
set (CMAKE_CXX_COMPILER nvc++ )
set (CMAKE_C_COMPILER nvc )
set (PROJECT "dummy")
set(CUDA_TOOLKIT_ROOT_DIR ~/Install_nvhpc/version_23.1/Linux_x86_64/23.1/cuda)
project (${PROJECT} LANGUAGES C CXX)
include(CheckLanguage)
check_language(CUDA)
if(CMAKE_CUDA_COMPILER)
enable_language(CUDA)
endif()
file(GLOB dummy_executable_srcs
# "*.h"
# "*.cpp"
# "*.cuh"
"*.cu"
)
add_executable(dummy ${dummy_executable_srcs} main.cpp)
target_compile_options(dummy PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:--gpu-architecture=sm_86>)
set_target_properties(dummy PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
However, when I run cmake …, I get the following output.
-- The C compiler identification is PGI 23.1.0
-- The CXX compiler identification is PGI 23.1.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /home/Ism/Install_nvhpc/version_23.1/Linux_x86_64/23.1/compilers/bin/nvc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /home/Ism/Install_nvhpc/version_23.1/Linux_x86_64/23.1/compilers/bin/nvc++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for a CUDA compiler
-- Looking for a CUDA compiler - NOTFOUND
-- Configuring done
-- Generating done
Subsequent compilation generates catastrophic error about cuda.h
Similarly, when i try to build Thrust using
cmake -DTHRUST_INCLUDE_CUB_CMAKE=ON …
I get the below error
CMake Error at /home/Ism/Install_nvhpc/cmake/3.19.8/share/cmake-3.19/Modules/CMakeDetermineCUDACompiler.cmake:187 (message):
Couldn't find CUDA library root.
I guess it has something to do with non-standard installation location of cmake and HPC SDK. I want to use CUB library in Thrust but I am unable to resolve this cmake issue. Please help me.