UniHD-CEG/cuda-flux

'cuda_runtime.h' file not found

mahmoodn opened this issue · 1 comments

Although CUDA_HOME is set, the build system can not find cuda_runtime.h.

$ ls $CUDA_HOME/include/cuda_runtime*
/home/mnaderan/cuda-10.1.168/include/cuda_runtime_api.h
/home/mnaderan/cuda-10.1.168/include/cuda_runtime.h
$ which nvcc
/home/mnaderan/cuda-10.1.168/bin/nvcc

Being more precise, with the following commands

$ export LLVM_INCLUDE_DIRS=/home/mnaderan/tools/clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-18.04/include/
$ export PATH=$HOME/tools/clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-18.04/bin:$HOME/tools/re2c/bin:$PATH
$ export LD_LIBRARY_PATH=$HOME/tools/clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-18.04/lib:$LD_LIBRARY_PATH
$ cmake -DCMAKE_INSTALL_PREFIX=../  .. 

I get this error

$ make install
Scanning dependencies of target hostRuntime
[  8%] Generating ../inc/hostRuntime.h
/home/mnaderan/cuda-flux/lib/hostRuntime.cpp:3:10: fatal error: 'cuda_runtime.h' file not found
#include <cuda_runtime.h>
         ^~~~~~~~~~~~~~~~
1 error generated.

How can I fix that?

Hi mahmood,

when building cuda flux clang++ is used to compile the hostRuntime of cuda flux. When using nvcc the cuda includes are built in and don't have do be specified. This is not the case for clang++

My environment looks like this:

CC=/opt/llvm-master/bin/clang
CXX=/opt/llvm-master/bin/clang++
C_INCLUDE_PATH=/usr/local/cuda-10.1/include:/opt/llvm-master/include
CPLUS_INCLUDE_PATH=/usr/local/cuda-10.1/include:/opt/llvm-master/include
CUDA_PATH=/usr/local/cuda-10.1
LD_LIBRARY_PATH=/usr/local/cuda-10.1/lib64:/opt/llvm-master/lib
LIBRARY_PATH=/usr/local/cuda-10.1/lib64:/opt/llvm-master/lib
LLVM_DIR=/opt/llvm-master/lib/cmake/llvm

I suggest the following solution for you:

export C_INCLUDE_PATH=/home/mnaderan/cuda-10.1.168/include/:$C_INCLUDE_PATH
export CPLUS_INCLUDE_PATH=/home/mnaderan/cuda-10.1.168/include/:$CPLUS_INCLUDE_PATH

Best Regards
Lorenz