When I try to use mexcuda I get the error:
Warning: Version 9.0 of the CUDA toolkit could not be found. If installed, set MW_NVCC_PATH environment variable to location of nvcc compiler. > In mexcuda (line 157) Error using mexNo supported compiler was found. For options, visit https://www.mathworks.com/support/compilers.Error in mexcuda (line 157) [varargout{1:nargout}] = mex(mexArguments{:});
This happens even if I call:
setenv('MW_NVCC_PATH','C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\bin')
prior to mexcuda just like the error suggests I do. So what is the problem here? Matlab obviously knowns where CUDA 9.0 is located…
If I do a verbose mexuda attempt this is what I get:
>> mexcuda -v mycudafcn.cuTrying MEX options 'D:\Matlab 2018a\toolbox\distcomp\gpu\extern\src\mex\win64\nvcc_msvcpp2015.xml'...FAILEDTrying MEX options 'D:\Matlab 2018a\toolbox\distcomp\gpu\extern\src\mex\win64\nvcc_msvcpp2017.xml'...FAILEDTrying MEX options 'D:\Matlab 2018a\toolbox\distcomp\gpu\extern\src\mex\win64\nvcc_msvcpp2013.xml'...FAILEDTrying MEX options 'D:\Matlab 2018a\toolbox\distcomp\gpu\extern\src\mex\win64\nvcc_msvcpp2012.xml'...FAILEDWarning: 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 D:\Matlab 2018a\toolbox\distcomp\gpu\extern\src\mex\win64\nvcc_msvcpp2015.xml NVCC_FLAGS="" -v mycudafcn.cu Verbose mode is on.... Looking for compiler 'NVIDIA CUDA Compiler' ...... Looking for registry setting 'HKLM\SOFTWARE\Microsoft\VisualStudio\SxS\VC7' 14.0 ...No.... Looking for registry setting 'HKCU\SOFTWARE\Microsoft\VisualStudio\SxS\VC7' 14.0 ...No.... Looking for registry setting 'HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VC7' 14.0 ...Yes ('D:\Visual Studio 2015\VC\').... Looking for file 'D:\Visual Studio 2015\VC\bin\amd64\cl.exe' ...Yes.... Looking for folder 'D:\Visual Studio 2015\VC' ...Yes.... Looking for registry setting 'HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v8.1' InstallationFolder ...No.... Looking for registry setting 'HKCU\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v8.1' InstallationFolder ...No.... Looking for registry setting 'HKLM\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v8.1' InstallationFolder ...Yes ('C:\Program Files (x86)\Windows Kits\8.1\').... Looking for registry setting 'HKLM\SOFTWARE\Microsoft\VisualStudio\SxS\VS7' 14.0 ...Yes ('D:\Visual Studio 2015\').... Looking for registry setting 'HKLM\SOFTWARE\Microsoft\VisualStudio\SxS\VC7' 14.0 ...No.... Looking for registry setting 'HKCU\SOFTWARE\Microsoft\VisualStudio\SxS\VC7' 14.0 ...No.... Looking for registry setting 'HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VC7' 14.0 ...Yes ('D:\Visual Studio 2015\VC\').... Looking for registry setting 'HKLM\SOFTWARE\Microsoft\VisualStudio\SxS\VC7' 14.0 ...No.... Looking for registry setting 'HKCU\SOFTWARE\Microsoft\VisualStudio\SxS\VC7' 14.0 ...No.... Looking for registry setting 'HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VC7' 14.0 ...Yes ('D:\Visual Studio 2015\VC\').... Looking for file 'D:\Visual Studio 2015\VC\vcvarsall.bat' ...Yes.... Looking for folder 'D:\Visual Studio 2015\VC' ...Yes.... Looking for registry setting 'HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows Kits\Installed Roots' KitsRoot10 ...Yes ('C:\Program Files (x86)\Windows Kits\10\').... Looking for registry setting 'HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows Kits\Installed Roots' KitsRoot10 ...Yes ('C:\Program Files (x86)\Windows Kits\10\').... Executing command 'echo off&set "sdkversion="&(for /f %a IN ('dir "C:\Program Files (x86)\Windows Kits\10\include\" /b /ad-h /on') do ( @if exist "C:\Program Files (x86)\Windows Kits\10\include\%a\ucrt\" set "sdkversion=%a" ))&call echo %sdkversion%' ...Yes ('10.0.14393.0').... Looking for environment variable 'MW_NVCC_PATH' ...No.... Looking for environment variable 'CUDA_LIB_PATH' ...No.... Looking for environment variable 'CUDA_PATH' ...Yes ('C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0').... Looking for file 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\lib\x64\cudart.lib' ...Yes.... Looking for folder 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\lib\x64' ...Yes.... Looking for environment variable 'MW_NVCC_PATH' ...No.... Looking for environment variable 'CUDA_BIN_PATH' ...No.... Looking for environment variable 'CUDA_PATH' ...Yes ('C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0').... Looking for file 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\bin\nvcc.exe' ...Yes.... Executing command 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\bin\nvcc --version | findstr /c:"release 9.0" > NUL && echo C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\bin' ...No.... Looking for environment variable 'MW_NVCC_PATH' ...No.... Looking for environment variable 'CUDA_BIN_PATH' ...No.... Looking for environment variable 'CUDA_PATH' ...Yes ('C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0').... Looking for file 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\bin\nvcc.exe' ...Yes.... Executing command '"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\bin\nvcc" --version | findstr /c:"release 9.0" > NUL && echo C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\bin' ...No.Did not find installed compiler 'NVIDIA CUDA Compiler'.Warning: Version 9.0 of the CUDA toolkit could not be found. If installed, set MW_NVCC_PATH environment variable to location of nvcc compiler.> In mexcuda (line 157) Error using mexNo supported compiler was found. For options, visit https://www.mathworks.com/support/compilers.Error in mexcuda (line 157) [varargout{1:nargout}] = mex(mexArguments{:});
Compiling with mexcuda worked fine about a week ago. Since then I must have updated a driver or something which has broken the frustratingly fragile connection Matlab has with visual studio and CUDA. So far I have tried:
- Uninstalling and reinstalling CUDA 9.0 several times
- Uninstalling and reinstalling Visual studio 2015 several times
- Uninstalling and reinstalling Visual studio 2017
- Uninstalling and reinstalling Matlab 2018a
Any ideas on what I can do to get mexcuda to work again? Can I manually enter the paths matlab is unable to find in some other way than with setenv?
Compiling C code with normal mex works fine, the only problem I have is with mexcuda. Im using Matlab2018a.
Best Answer