cicc not found when using mexcuda

Hi,
I am trying to compile a cuda file into a mex file via the command:
mexcuda -v -g test.cu
where test.cu is a simple hello world program.
I am using Ubuntu 20.04
I get the following error messages:
Trying MEX options '/usr/local/MATLAB/R2020a/toolbox/parallel/gpu/extern/src/mex/glnxa64/nvcc_g++.xml'...SUCCESS
mex -largeArrayDims -f /usr/local/MATLAB/R2020a/toolbox/parallel/gpu/extern/src/mex/glnxa64/nvcc_g++.xml NVCC_FLAGS="" -v -g test.cu
Verbose mode is on.
... Looking for compiler 'nvcc' ...
... Looking for environment variable 'MW_NVCC_PATH' ...No.
... Looking for environment variable 'CUDA_BIN_PATH' ...No.
... Looking for environment variable 'CUDA_PATH' ...No.
... Executing command 'which nvcc' ...Yes ('/usr/bin/nvcc').
... Executing command '(((if [ -z ${MW_ALLOW_ANY_CUDA} ]; then false; else true; fi;) || /usr/bin/nvcc --version | egrep -E 'release 10.1') > /dev/null) && echo /usr/bin/nvcc' ...Yes ('/usr/bin/nvcc').
... Executing command '(((if [ -z ${MW_ALLOW_ANY_CUDA} ]; then false; else true; fi;) || /usr/bin/nvcc --version | egrep -E 'release 10.1') > /dev/null) && echo /usr/bin/nvcc' ...Yes ('/usr/bin/nvcc').
... Looking for folder '/usr' ...Yes.
... Looking for environment variable 'MW_NVCC_PATH' ...No.
... Looking for environment variable 'CUDA_BIN_PATH' ...No.
... Looking for environment variable 'CUDA_PATH' ...No.
... Executing command 'which nvcc' ...Yes ('/usr/bin/nvcc').
... Executing command '(((if [ -z ${MW_ALLOW_ANY_CUDA} ]; then false; else true; fi;) || /usr/bin/nvcc --version | egrep -E 'release 10.1') > /dev/null) && echo /usr/bin/nvcc' ...Yes ('/usr/bin/nvcc').
... Executing command '(((if [ -z ${MW_ALLOW_ANY_CUDA} ]; then false; else true; fi;) || /usr/bin/nvcc --version | egrep -E 'release 10.1') > /dev/null) && echo /usr/bin/nvcc' ...Yes ('/usr/bin/nvcc').
... Looking for folder '/usr/nvvm/libdevice' ...No.
... Looking for file '/usr/local/MATLAB/R2020a/sys/cuda/glnxa64/cuda/bin/nvcc' ...Yes.
... Looking for folder '/usr/local/MATLAB/R2020a/bin/glnxa64' ...Yes.
... Looking for environment variable 'MW_NVCC_PATH' ...No.
... Looking for environment variable 'CUDA_BIN_PATH' ...No.
... Looking for environment variable 'CUDA_PATH' ...No.
... Executing command 'which nvcc' ...Yes ('/usr/bin/nvcc').
... Executing command '(((if [ -z ${MW_ALLOW_ANY_CUDA} ]; then false; else true; fi;) || /usr/bin/nvcc --version | egrep -E 'release 10.1') > /dev/null) && echo /usr/bin/nvcc' ...Yes ('/usr/bin/nvcc').
... Executing command '(((if [ -z ${MW_ALLOW_ANY_CUDA} ]; then false; else true; fi;) || /usr/bin/nvcc --version | egrep -E 'release 10.1') > /dev/null) && echo /usr/bin/nvcc' ...Yes ('/usr/bin/nvcc').
... Looking for folder '/usr/lib64' ...Yes.
... Executing command 'which g++' ...Yes ('/usr/bin/g++').
... Executing command 'g++ -print-file-name=libstdc++.so' ...Yes ('/usr/lib/gcc/x86_64-linux-gnu/8/libstdc++.so').
... Executing command 'g++ -dumpversion' ...Yes ('8').
... Executing command 'which g++' ...Yes ('/usr/bin/g++').
... Looking for folder '/usr' ...Yes.
... Executing command 'g++ -dumpmachine' ...Yes ('x86_64-linux-gnu').
Found installed compiler 'nvcc'.
Set PATH = :/usr/nvvm/bin:/usr/bin:;/usr/local/cuda-8.0/bin:/home/simon/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/cuda-8.0/bin
Set INCLUDE = :/usr/lib/gcc/x86_64-linux-gnu/8/include;/usr/include/c++/8;/usr/include/c++/8/x86_64-linux-gnu;/usr/include/c++/8/backward;:/usr/lib/gcc/x86_64-linux-gnu/8/include;/usr/include/c++/8;/usr/include/c++/8/x86_64-linux-gnu;/usr/include/c++/8/backward;
Options file details
-------------------------------------------------------------------
Compiler location: /usr/bin/nvcc
Options file: /usr/local/MATLAB/R2020a/toolbox/parallel/gpu/extern/src/mex/glnxa64/nvcc_g++.xml
CMDLINE2 : /usr/bin/g++ -pthread -Wl,--no-undefined -shared -g -Wl,--version-script,"/usr/local/MATLAB/R2020a/extern/lib/glnxa64/c_exportsmexfileversion.map" /tmp/mex_22266400607270_177416/test.o /tmp/mex_22266400607270_177416/c_mexapi_version.o -Wl,--as-needed -Wl,-rpath-link,/usr/lib64 -L"/usr/lib64" -Wl,-rpath-link,/usr/lib64 -L"/usr/lib64" -Wl,-rpath-link,/usr/local/MATLAB/R2020a/bin/glnxa64 -L"/usr/local/MATLAB/R2020a/bin/glnxa64" -Wl,-rpath-link,/usr/local/MATLAB/R2020a/extern/bin/glnxa64 -L"/usr/local/MATLAB/R2020a/extern/bin/glnxa64" -lMatlabDataArray -lmx -lmex -lmat -lm -lc -lstdc++ -lmwgpu /usr/lib64/libcudart.so.* -o test.mexa64
CXX : /usr/bin/nvcc
DEFINES : -DMX_COMPAT_64 -DMATLAB_DEFAULT_RELEASE=R2017b -DUSE_MEX_CMD --compiler-options=-D_GNU_SOURCE,-DMATLAB_MEX_FILE
MATLABMEX : -DMATLAB_MEX_FILE
NVCCFLAGS : -gencode=arch=compute_30,code=sm_30 -gencode=arch=compute_50,code=sm_50 -gencode=arch=compute_60,code=sm_60 -gencode=arch=compute_70,code=\"sm_70,compute_70\" -std=c++11 --dont-use-profile -ldir /usr/local/MATLAB/R2020a/bin/glnxa64
CFLAGS : --compiler-options=-fexceptions,-fPIC,-fno-omit-frame-pointer,-pthread,-fwrapv
CXXFLAGS : --compiler-options=-fexceptions,-fPIC,-fno-omit-frame-pointer,-pthread,-fwrapv
INCLUDE : -I"/usr/local/MATLAB/R2020a/extern/include" -I"/usr/local/MATLAB/R2020a/simulink/include" -I"/usr/local/MATLAB/R2020a/toolbox/parallel/gpu/extern/include/" -I"/usr/include"
CXXOPTIMFLAGS : -O2 -DNDEBUG
CXXDEBUGFLAGS : -g
LDXX : /usr/bin/g++
LDFLAGS : -pthread -Wl,--no-undefined
LDTYPE : -shared
LINKEXPORT : -Wl,--version-script,"/usr/local/MATLAB/R2020a/extern/lib/glnxa64/mexFunction.map"
LINKEXPORTVER : -Wl,--version-script,"/usr/local/MATLAB/R2020a/extern/lib/glnxa64/c_exportsmexfileversion.map"
LINKLIBS : -Wl,--as-needed -Wl,-rpath-link,/usr/lib64 -L"/usr/lib64" -Wl,-rpath-link,/usr/lib64 -L"/usr/lib64" -Wl,-rpath-link,/usr/local/MATLAB/R2020a/bin/glnxa64 -L"/usr/local/MATLAB/R2020a/bin/glnxa64" -Wl,-rpath-link,/usr/local/MATLAB/R2020a/extern/bin/glnxa64 -L"/usr/local/MATLAB/R2020a/extern/bin/glnxa64" -lMatlabDataArray -lmx -lmex -lmat -lm -lc -lstdc++ -lmwgpu /usr/lib64/libcudart.so.*
NVVMIR_LIBRARY : --dont-use-profile -ldir /usr/local/MATLAB/R2020a/bin/glnxa64
LDOPTIMFLAGS : -O
LDDEBUGFLAGS : -g
MWCPPLIB : "/usr/local/MATLAB/R2020a/sys/os/glnxa64/libstdc++.so.6"
OBJEXT : .o
LDEXT : .mexa64
SETENV : CC="gcc"
CXX="/usr/bin/nvcc"
CFLAGS="--compiler-options=-fexceptions,-fPIC,-fno-omit-frame-pointer,-pthread,-fwrapv -DMX_COMPAT_64 -DMATLAB_DEFAULT_RELEASE=R2017b -DUSE_MEX_CMD --compiler-options=-D_GNU_SOURCE,-DMATLAB_MEX_FILE"
CXXFLAGS="--compiler-options=-fexceptions,-fPIC,-fno-omit-frame-pointer,-pthread,-fwrapv -DMX_COMPAT_64 -DMATLAB_DEFAULT_RELEASE=R2017b -DUSE_MEX_CMD --compiler-options=-D_GNU_SOURCE,-DMATLAB_MEX_FILE"
COPTIMFLAGS="-O2 -DNDEBUG"
CXXOPTIMFLAGS="-O2 -DNDEBUG"
CDEBUGFLAGS="-g"
CXXDEBUGFLAGS="-g"
LD="gcc"
LDXX="/usr/bin/g++"
LDFLAGS="-pthread -Wl,--no-undefined -shared -Wl,--as-needed -Wl,-rpath-link,/usr/lib64 -L"/usr/lib64" -Wl,-rpath-link,/usr/lib64 -L"/usr/lib64" -Wl,-rpath-link,/usr/local/MATLAB/R2020a/bin/glnxa64 -L"/usr/local/MATLAB/R2020a/bin/glnxa64" -Wl,-rpath-link,/usr/local/MATLAB/R2020a/extern/bin/glnxa64 -L"/usr/local/MATLAB/R2020a/extern/bin/glnxa64" -lMatlabDataArray -lmx -lmex -lmat -lm -lc -lstdc++ -lmwgpu /usr/lib64/libcudart.so.* -Wl,--version-script,"/usr/local/MATLAB/R2020a/extern/lib/glnxa64/mexFunction.map""
LDDEBUGFLAGS="-g"
CUDA_ROOT : /usr
LIBDEVICE : /usr/local/MATLAB/R2020a/bin/glnxa64
CUDA_LIBS : /usr/lib64
GCC : /usr/bin/g++
CPPLIB_DIR : /usr/lib/gcc/x86_64-linux-gnu/8/libstdc++.so
VER : 8
GCCDIR : /usr
GCC_TARGET : x86_64-linux-gnu
MATLABROOT : /usr/local/MATLAB/R2020a
ARCH : glnxa64
SRC : "/home/simon/temp/temp_mexcuda/test.cu";"/usr/local/MATLAB/R2020a/extern/version/c_mexapi_version.c"
OBJ : /tmp/mex_22266400607270_177416/test.o;/tmp/mex_22266400607270_177416/c_mexapi_version.o
OBJS : /tmp/mex_22266400607270_177416/test.o /tmp/mex_22266400607270_177416/c_mexapi_version.o
SRCROOT : /home/simon/temp/temp_mexcuda/test
DEF : /tmp/mex_22266400607270_177416/test.def
EXP : "test.exp"
LIB : "test.lib"
EXE : test.mexa64
ILK : "test.ilk"
MANIFEST : "test.mexa64.manifest"
TEMPNAME : test
EXEDIR :
EXENAME : test
NVCC_FLAGS :
OPTIM : -g
LINKOPTIM : -g
CMDLINE1_0 : /usr/bin/nvcc -c -DMX_COMPAT_64 -DMATLAB_DEFAULT_RELEASE=R2017b -DUSE_MEX_CMD --compiler-options=-D_GNU_SOURCE,-DMATLAB_MEX_FILE -I"/usr/local/MATLAB/R2020a/extern/include" -I"/usr/local/MATLAB/R2020a/simulink/include" -I"/usr/local/MATLAB/R2020a/toolbox/parallel/gpu/extern/include/" -I"/usr/include" -gencode=arch=compute_30,code=sm_30 -gencode=arch=compute_50,code=sm_50 -gencode=arch=compute_60,code=sm_60 -gencode=arch=compute_70,code=\"sm_70,compute_70\" -std=c++11 --dont-use-profile -ldir /usr/local/MATLAB/R2020a/bin/glnxa64 --compiler-options=-fexceptions,-fPIC,-fno-omit-frame-pointer,-pthread,-fwrapv -g "/home/simon/temp/temp_mexcuda/test.cu" -o /tmp/mex_22266400607270_177416/test.o
CMDLINE1_1 : /usr/bin/nvcc -c -DMX_COMPAT_64 -DMATLAB_DEFAULT_RELEASE=R2017b -DUSE_MEX_CMD --compiler-options=-D_GNU_SOURCE,-DMATLAB_MEX_FILE -I"/usr/local/MATLAB/R2020a/extern/include" -I"/usr/local/MATLAB/R2020a/simulink/include" -I"/usr/local/MATLAB/R2020a/toolbox/parallel/gpu/extern/include/" -I"/usr/include" -gencode=arch=compute_30,code=sm_30 -gencode=arch=compute_50,code=sm_50 -gencode=arch=compute_60,code=sm_60 -gencode=arch=compute_70,code=\"sm_70,compute_70\" -std=c++11 --dont-use-profile -ldir /usr/local/MATLAB/R2020a/bin/glnxa64 --compiler-options=-fexceptions,-fPIC,-fno-omit-frame-pointer,-pthread,-fwrapv -g "/usr/local/MATLAB/R2020a/extern/version/c_mexapi_version.c" -o /tmp/mex_22266400607270_177416/c_mexapi_version.o
CMDLINE3_0 : rm -f /tmp/mex_22266400607270_177416/test.o
CMDLINE3_1 : rm -f /tmp/mex_22266400607270_177416/c_mexapi_version.o
-------------------------------------------------------------------
Building with 'nvcc'.
/usr/bin/nvcc -c -DMX_COMPAT_64 -DMATLAB_DEFAULT_RELEASE=R2017b -DUSE_MEX_CMD --compiler-options=-D_GNU_SOURCE,-DMATLAB_MEX_FILE -I"/usr/local/MATLAB/R2020a/extern/include" -I"/usr/local/MATLAB/R2020a/simulink/include" -I"/usr/local/MATLAB/R2020a/toolbox/parallel/gpu/extern/include/" -I"/usr/include" -gencode=arch=compute_30,code=sm_30 -gencode=arch=compute_50,code=sm_50 -gencode=arch=compute_60,code=sm_60 -gencode=arch=compute_70,code=\"sm_70,compute_70\" -std=c++11 --dont-use-profile -ldir /usr/local/MATLAB/R2020a/bin/glnxa64 --compiler-options=-fexceptions,-fPIC,-fno-omit-frame-pointer,-pthread,-fwrapv -g "/home/simon/temp/temp_mexcuda/test.cu" -o /tmp/mex_22266400607270_177416/test.o
Error using mex
sh: 1: cicc: not found
Error in mexcuda (line 166)
[varargout{1:nargout}] = mex(mexArguments{:});
Error in untitled (line 1)
mexcuda -v -g test.cu

4 Commenti

Hello Simon,
I can see from the output you attached that you are using a local installation of the CUDA Toolkit. Could you please use the environment variable MW_NVCC_PATH to specify the location of the NVCC?
For example:
setenv('MW_NVCC_PATH','/usr/local/CUDA/bin')
Let us know if that works.
Cheers,
Linda
Simon Zhang
Simon Zhang il 20 Ago 2020
Modificato: Simon Zhang il 20 Ago 2020
whereis nvcc
tells me nvcc is located at /usr/bin/nvcc. I tried:
setenv('MW_NVCC_PATH','/usr/bin')
and am getting the same error. This is the only place nvcc is located.
I originally installed nvcc for Ubuntu via
sudo apt-get install cuda
my cuda toolkit version is 10.1 and gcc version is 8.4.0. I have no problems compiling with nvcc alone (without any MATLAB dependencies) and mex seems to work fine.
Hello Simon,
have you also updated PATH as described in the post-installation actions in NVIDIA's installation guide:
Cheers,
Linda
yes, in fact I install CUDA 11 and updated PATH as in the postinstallation instructions:
I am still getting the same error as before: cicc not found.

Accedi per commentare.

Risposte (1)

Linda Koletsou Soulti
Linda Koletsou Soulti il 24 Ago 2020
Spostato: Edric Ellis il 5 Feb 2026 alle 9:23

1 voto

Hello Simon,
better install the version of the CUDA toolkit consistent with the ToolkitVersion property of the gpuDevice object for the MATLAB version you use.
Can you also set MW_NVCC_PATH to point to the path you use to update PATH?
For example:
setenv('MW_NVCC_PATH','/usr/local/cuda-10.1/bin')
Cheers,
Linda

1 Commento

Simon Zhang
Simon Zhang il 24 Ago 2020
Spostato: Edric Ellis il 5 Feb 2026 alle 9:24
Hi Linda,
The solution for me was as follows:
$whereis nvidia-cuda-toolkit
/usr/lib/nvidia-cuda-toolkit
in matlab:
>> setenv('MW_NVCC_PATH', '/usr/lib/nvidia-cuda-toolkit/bin')
>> mexcuda helloworld.cu
Building with 'nvcc'.
MEX completed successfully.

Accedi per commentare.

Categorie

Tag

Richiesto:

il 19 Ago 2020

Modificato:

il 5 Feb 2026 alle 19:56

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by