cuda-samples
cuda-samples copied to clipboard
nvcc path appears to be hardcoded as "/usr/local/cuda/bin/nvcc", mambaforge path is "~/mambaforge/bin"
I'm trying to compile the samples on Ubuntu 22.04 (minimal) after installing CUDA toolkit with mambaforge. I believe compile is failing due to the different location of nvcc.
~/mambaforge/cuda-samples$ make
make[1]: Entering directory '/home/user/mambaforge/cuda-samples/0_Simple/matrixMulCUBLAS'
>>> GCC Version is greater or equal to 5.1.0 <<<
/usr/local/cuda/bin/nvcc -ccbin g++ -I../../common/inc -m64 --threads 0 --std=c++11 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_37,code=sm_37 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_75,code=sm_75 -gencode arch=compute_80,code=sm_80 -gencode arch=compute_86,code=sm_86 -gencode arch=compute_86,code=compute_86 -o matrixMulCUBLAS.o -c matrixMulCUBLAS.cpp
make[1]: /usr/local/cuda/bin/nvcc: No such file or directory
make[1]: *** [Makefile:349: matrixMulCUBLAS.o] Error 127
make[1]: Leaving directory '/home/user/mambaforge/cuda-samples/0_Simple/matrixMulCUBLAS'
make: *** [Makefile:51: 0_Simple/matrixMulCUBLAS/Makefile.ph_build] Error 2
I tried the naive solution of copying nvcc to the expected directory, but then I get further compile errors.
/usr/local/cuda/bin/nvcc -ccbin g++ -m64 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_37,code=sm_37 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_75,code=sm_75 -gencode arch=compute_80,code=sm_80 -gencode arch=compute_86,code=sm_86 -gencode arch=compute_86,code=compute_86 -o matrixMulCUBLAS matrixMulCUBLAS.o -lcublas
nvcc warning : The 'compute_35', 'compute_37', 'compute_50', 'sm_35', 'sm_37' and 'sm_50' architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
cc1plus: fatal error: /usr/local/cuda/bin/crt/link.stub: No such file or directory
[How] Can I make this work correctly with CUDA toolkit from mambaforge?
I was do:
apt install nvidia-cuda-toolkit
mkdir /usr/local/cuda
cd /usr/local/cuda
ln -s /usr/lib/nvidia-cuda-toolkit/bin bin
ln -s /usr/include include
ln -s /usr/lib/x86_64-linux-gnu lib64
ln -s /usr/share share
Hi @alwayssummer .
I just went trough the same problem. The solution is to set the environment variable CUDA_PATH to wherever you have the toolkit installed.
For example, I'm on Debian 11 and doing:
:~/Documents/cuda-samples$ CUDA_PATH=/usr make
compiles just fine.
In your particular case I guess you'll have to set it to CUDA_PATH="~/.conda/envs/cuda"
or whatever your conda enviroment is located.
Hi @alwayssummer .
I just went trough the same problem. The solution is to set the environment variable CUDA_PATH to wherever you have the toolkit installed. For example, I'm on Debian 11 and doing:
:~/Documents/cuda-samples$ CUDA_PATH=/usr make
compiles just fine.In your particular case I guess you'll have to set it to
CUDA_PATH="~/.conda/envs/cuda"
or whatever your conda enviroment is located.
Yes, this worked for me. I ran which nvcc
and then added the path (without the trailing bin/
)
export CUDA_PATH="/path/to/the/nvidia/compiler"