pyRMSD icon indicating copy to clipboard operation
pyRMSD copied to clipboard

With path to cuda correctly specified in build_conf/default.conf I get "sh: 1: nvcc: not found"

Open pgoetz opened this issue 4 years ago • 1 comments

Hi -

I'm trying to compile pyRMSD to use CUDA and have run into a bit of a snag. Here is my build_conf/default.conf file:

{ "CUDA_BASE": "/usr/local/cuda", "CUDA_INCLUDE_FOLDER": "include",
"CUDA_LIBRARIES_FOLDER": "lib64",
"CUDA_ARCHITECHTURE": "sm_61",
"CUDA_LIBRARY":"cudart", "PYTHON_EXTENSION_OPTIONS": "-pthread -g -fno-strict-aliasing -fmessage-length=0 -O3 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -fPIC", "PYTHON_INCLUDE_FOLDER": "AUTO", "PYTHON_LIBRARY_FOLDER": "AUTO", "PYTHON_LIBRARY" : "python2.7", "OPENMP_OPTION" : "-fopenmp", "NUMPY_INCLUDE" : "AUTO" , "PYTHON_EXTENSION_LINKING_OPTIONS": "-pthread -shared", "CUDA_OPTIONS": "-O3 -use_fast_math --gpu-architecture %s --compiler-options '-fPIC'", "DEFINE_USE_CUDA": "-DUSE_CUDA" }

As you can see, this should afford the build the ability to find nvcc:

root@tarantula:~/pyRMSD# ls -l /usr/local/cuda/bin/nvcc -rwxr-xr-x 1 root root 190880 Sep 18 2018 /usr/local/cuda/bin/nvcc

However, when I try to run either

python build.py --build --cuda double or pythong build.py --build --cuda single

The build fails because it can't find nvcc:

nvcc -O3 -use_fast_math --gpu-architecture sm_61 --compiler-options '-fPIC' -DCUDA_PRECISION_SINGLE -I/usr/local/cuda/include -c QCPCUDAKernel.cu sh: 1: nvcc: not found

Any thoughts on what I need to do to make this work? The only possible issue is that /usr/local/cuda is a symlink?

root@tarantula:~/pyRMSD# ls -l /usr/local/cuda lrwxrwxrwx 1 root root 8 Feb 13 07:14 /usr/local/cuda -> cuda-9.1

but surely that shouldn't matter.

pgoetz avatar Jun 29 '20 19:06 pgoetz

Hi -

Going to answer my own question in case someone comes along with the same issue. The problem was that nvcc has to be locatable via your path. Depending on where you have CUDA installed, this should resolve the issue:

export PATH=/usr/local/cuda/bin:$PATH

Depending on what version of CUDA you're trying to compile against, there is a good chance that the version of gcc which came with your system is too new for CUDA, and you'll get a message like this when trying to build:

#error – unsupported GNU version! gcc versions later than 6 are not supported!

The easiest way to resolve this is to install the version of gcc/G++ CUDA wants and then link it directly into the CUDA bin directory. I'll give specific instructions for Ubuntu 18.04, which should allow you to figure out what to to do for your distro:

# apt install gcc-6  g++-6
# ln -s /usr/bin/gcc-6  /usr/local/cuda/bin/gcc
# ln -s /usr/bin/g+±6  /usr/local/cuda/bin/g++

After taking these steps I was able to build successfully using the command:

python build.py --build --cuda single

pgoetz avatar Jun 30 '20 15:06 pgoetz