Reputation: 59
I'm trying to use MATLAB's CUDA to compile some on-GPU code. When I run the command
mexcuda -largeArrayDims mexThSpkPC.cu
I get the following error:
>> mexcuda -largeArrayDims mexThSpkPC.cu
Building with 'nvcc'.
Error using mex
In file included from /usr/include/cuda_runtime.h:83,
from <command-line>:
/usr/include/crt/host_config.h:138:2: error: #error -- unsupported GNU version! gcc versions later than
8 are not supported!
138 | #error -- unsupported GNU version! gcc versions later than 8 are not supported!
| ^~~~~
Error in mexcuda (line 166)
[varargout{1:nargout}] = mex(mexArguments{:});
What's strange is that I've installed nvidia-cuda-toolkit
from apt, and it pulls in gcc
version 8 as well as g++
. So they're there on my system. How do I get MATLAB (or the nvida CUDA compiler) to find the right version of gcc
/g++
? I'm using Ubuntu 20.04.
Upvotes: 1
Views: 362
Reputation: 59
After doing some digging, I discovered that the MATLAB code looks for the CUDA_PATH
environment variable. So starting matlab as:
CUDA_PATH=/usr/lib/nvidia-cuda-toolkit matlab
solves the problem for me!
Upvotes: 1