Mexcuda Error on Windows 10 (Matlab 2015 b)

5 views (last 30 days)
Mahdi Roozbahani
Mahdi Roozbahani on 29 Feb 2016
Commented: Joss Knight on 14 Mar 2016
I already installed MingW64 compiler based on Matlab instruction, and installed Cuda v7.5. I am able to use Matlab GPU in-built syntax like GPUarray and ..., but when it comes to compile mexcuda "mexGPUExample.cpu", I get the following error:
>> mexcuda -v mexGPUExample.cu
Warning: The selected C++ compiler is not supported for CUDA compilation. Searching for a supported compiler.
> In mexcuda (line 89)
Trying MEX options 'C:\Program Files\MATLAB\R2015b\toolbox\distcomp\gpu\extern\src\mex\win64\nvcc_msvc120.xml'...FAILED
Trying MEX options 'C:\Program Files\MATLAB\R2015b\toolbox\distcomp\gpu\extern\src\mex\win64\nvcc_msvc110.xml'...FAILED
Warning: No supported host compiler found, or other problem with the environment.
Continuing with selected compiler to provide detailed diagnosis.
> In mexcuda (line 130)
mex -largeArrayDims -f C:\Program Files\MATLAB\R2015b\toolbox\distcomp\gpu\extern\src\mex\win64\nvcc_msvc120.xml NVCC_FLAGS="" -v mexGPUExample.cu
Verbose mode is on.
... Looking for compiler 'NVIDIA CUDA Compiler' ...
... Looking for registry setting 'HKLM\SOFTWARE\Microsoft\VisualStudio\SxS\VS7' 12.0 ...No.
... Looking for registry setting 'HKCU\SOFTWARE\Microsoft\VisualStudio\SxS\VS7' 12.0 ...No.
... Looking for registry setting 'HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7' 12.0 ...No.
... Looking for registry setting 'HKCU\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7' 12.0 ...No.
Did not find installed compiler 'NVIDIA CUDA Compiler'.
Error using mex
No supported compiler or SDK was found. You can install the freely available MinGW-w64 C/C++ compiler; see Install MinGW-w64 Compiler. For more options, see
http://www.mathworks.com/support/compilers/R2015b/win64.html.
Error in mexcuda (line 157)
[varargout{1:nargout}] = mex(mexArguments{:});

Answers (2)

Joss Knight
Joss Knight on 2 Mar 2016
Edited: Joss Knight on 2 Mar 2016
As you can see from the first line of your output, your chosen host compiler is not supported by the CUDA compiler (nvcc) and you don't have a supported compiler installed (namely, MS Visual Studio).
I'm not sure what people do nowadays when they need a free version of MSVC, is it the community edition? Perhaps that will work for you.
Also worth pointing out, you'll need the 7.0 version of the CUDA toolkit to work with R2015b.

Richa Gupta
Richa Gupta on 2 Mar 2016
Edited: Richa Gupta on 2 Mar 2016
This error might be when "mexcuda" has trouble locating the NVIDIA compiler (nvcc), it might be installed in a non-default location. You can specify the location of nvcc on your system by storing it in the environment variable "MW_NVCC_PATH". You can set this variable using the MATLAB "setenv" command. For example,
>> setenv('MW_NVCC_PATH','<installed location>\CUDA\bin')
After you execute the above command, restart MATLAB and then compile the example using "mexcuda".
Note: Please use CUDA Toolkit version 7.0 as the R2015b parallel computing products are now using CUDA Toolkit version 7.0. Please refer to the header "Upgraded CUDA Toolkit version" in the documentation link below for release notes of Parallel Computing toolbox for release R2015b. http://www.mathworks.com/help/distcomp/release-notes.html#R2015b
  2 Comments
Joss Knight
Joss Knight on 8 Mar 2016
I think the main point is that MingW64 is not supported by the CUDA compiler, and therefore not by mexcuda.
Joss Knight
Joss Knight on 14 Mar 2016
Oh, and by the way, if you restart MATLAB after calling setenv, your environment variable will be reset to the state it was in when you called MATLAB, so don't do that. Just call setenv and carry on.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!