Unable to compile cuda file with MATLAB 2017a, VS2017 and cuda 9

3 views (last 30 days)
I'm trying to compile one .cu file with MATLAB 2017a, cuda version 9 and Visual studio 2017. It is showing
>>mexcuda -v moveVariableToCUDA.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\R2017a\toolbox\distcomp\gpu\extern\src\mex\win64\nvcc_msvcpp2015.xml'...FAILED
Trying MEX options 'C:\Program Files\MATLAB\R2017a\toolbox\distcomp\gpu\extern\src\mex\win64\nvcc_msvcpp2013.xml'...FAILED
Trying MEX options 'C:\Program Files\MATLAB\R2017a\toolbox\distcomp\gpu\extern\src\mex\win64\nvcc_msvcpp2012.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\R2017a\toolbox\distcomp\gpu\extern\src\mex\win64\nvcc_msvcpp2015.xml NVCC_FLAGS="" -v moveVariableToCUDA.cu
Verbose mode is on.
... Looking for compiler 'NVIDIA CUDA Compiler' ...
... Looking for registry setting 'HKLM\SOFTWARE\Microsoft\VisualStudio\SxS\VS7' 14.0 ...No.
... Looking for registry setting 'HKCU\SOFTWARE\Microsoft\VisualStudio\SxS\VS7' 14.0 ...No.
... Looking for registry setting 'HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7' 14.0 ...Yes ('C:\Program Files (x86)\Microsoft Visual Studio 14.0\').
... Looking for file 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\cl.exe' ...Yes.
... Looking for folder 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\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 ...No.
... Looking for registry setting 'HKCU\SOFTWARE\Microsoft\VisualStudio\SxS\VS7' 14.0 ...No.
... Looking for registry setting 'HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7' 14.0 ...Yes ('C:\Program Files (x86)\Microsoft Visual Studio 14.0\').
... 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 ('C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\').
... Looking for environment variable 'VS140COMNTOOLS' ...Yes ('C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\').
... Looking for file 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe' ...No.
*Did not find installed compiler 'NVIDIA CUDA Compiler'*.
Error using mex
No supported compiler or SDK was found. For options, visit http://www.mathworks.com/support/compilers/R2017a/.
Error in mexcuda (line 157)
[varargout{1:nargout}] = mex(mexArguments{:});
  3 Comments
AMIT KASANA
AMIT KASANA on 18 Jan 2018
But mex -setup is giving me following output. I'm using VS2017 for mexopencv and matconvnet. It's 3rd time when i have uninstalled and reinstalled VS2017.
MEX configured to use 'Microsoft Visual C++ 2017 (C)' for C language compilation.
Warning: The MATLAB C and Fortran API has changed to support MATLAB
variables with more than 2^32-1 elements. You will be required
to update your code to utilize the new API.
You can find more information about this at:
http://www.mathworks.com/help/matlab/matlab_external/upgrading-mex-files-to-use-64-bit-api.html.
To choose a different C compiler, select one from the following:
MinGW64 Compiler (C) mex -setup:'C:\Program Files\MATLAB\R2017a\bin\win64\mexopts\mingw64.xml' C
Microsoft Visual C++ 2017 (C) mex -setup:C:\Users\ipcv16\AppData\Roaming\MathWorks\MATLAB\R2017a\mex_C_win64.xml C
To choose a different language, select one from the following:
mex -setup C++
mex -setup FORTRAN
Walter Roberson
Walter Roberson on 18 Jan 2018
Could you check under C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7 to see if there is a devenv.exe somewhere there? It appears to be a key front-end for compiling for VS.

Sign in to comment.

Answers (1)

Andreas Hösl
Andreas Hösl on 1 Feb 2018
Hmmm it might not be connected but I had the problem that Matlab insists on a specific CUDA toolkit. 2017b, as far as I know, starts to support CUDA 8, 2017a doesn´t. Anyway, in my case adapting the config file nvcc_msvcpp (in the log it looks for it under "C:\Program Files\MATLAB\R2017a\toolbox\distcomp\gpu\extern\src\mex\win64\nvcc_msvcpp2015.xml'...FAILED") worked: copy it to a local folder, and look which compiler and CUDA version it requires. Replace by what you have and hope for the best. Compile with -f nvcc_msvcpp201x_custom.xml.

Categories

Find more on MATLAB Compiler in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!