Error using mex: No supported compiler or SDK was found.

I have MATLAB 2014a and VS 2012 ultimate, I don't know why this is happening. I am trying to compile a cuda file. Please help.
I ran mex -setup -v and this was the output:
>> mex -setup -v
Verbose mode is on.
... Looking for compiler 'Intel C++ Composer XE 2011 with Microsoft SDK 7.1 (C)' ...
... Looking for environment variable 'ICPP_COMPILER12' ...No.
Did not find installed compiler 'Intel C++ Composer XE 2011 with Microsoft SDK 7.1 (C)'.
... Looking for compiler 'Intel C++ Composer XE 2011 with Microsoft Visual Studio 2008 (C)' ...
... Looking for environment variable 'ICPP_COMPILER12' ...No.
Did not find installed compiler 'Intel C++ Composer XE 2011 with Microsoft Visual Studio 2008 (C)'.
... Looking for compiler 'Intel C++ Composer XE 2011 with Microsoft Visual Studio 2010 (C)' ...
... Looking for environment variable 'ICPP_COMPILER12' ...No.
Did not find installed compiler 'Intel C++ Composer XE 2011 with Microsoft Visual Studio 2010 (C)'.
... Looking for compiler 'Intel C++ Composer XE 2013 with Microsoft SDK 7.1' ...
... Looking for environment variable 'ICPP_COMPILER14' ...No.
... Looking for environment variable 'ICPP_COMPILER13' ...No.
Did not find installed compiler 'Intel C++ Composer XE 2013 with Microsoft SDK 7.1'.
... Looking for compiler 'Intel C++ Composer XE 2013 with Microsoft Visual Studio 2010 (C)' ...
... Looking for environment variable 'ICPP_COMPILER14' ...No.
... Looking for environment variable 'ICPP_COMPILER13' ...No.
Did not find installed compiler 'Intel C++ Composer XE 2013 with Microsoft Visual Studio 2010 (C)'.
... Looking for compiler 'Intel C++ Composer XE 2013 with Microsoft Visual Studio 2012 (C)' ...
... Looking for environment variable 'ICPP_COMPILER14' ...No.
... Looking for environment variable 'ICPP_COMPILER13' ...No.
Did not find installed compiler 'Intel C++ Composer XE 2013 with Microsoft Visual Studio 2012 (C)'.
... Looking for compiler 'Microsoft Visual C++ 2012 (C)' ...
... Looking for registry setting 'HKLM\SOFTWARE\Microsoft\VisualStudio\SxS\VS7' 11.0 ...Yes ('C:\Program Files (x86)\Microsoft Visual Studio 11.0\').
... Looking for file 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\amd64\cl.exe' ...Yes.
... Looking for folder 'C:\Program Files (x86)\Microsoft Visual Studio 11.0' ...Yes.
... Looking for registry setting 'HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v8.0' InstallationFolder ...No.
... Looking for registry setting 'HKCU\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v8.0' InstallationFolder ...No.
... Looking for registry setting 'HKLM\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v8.0' InstallationFolder ...Yes ('C:\Program Files (x86)\Windows Kits\8.0\').
... Looking for registry setting 'HKLM\SOFTWARE\Microsoft\VisualStudio\SxS\VS7' 11.0 ...Yes ('C:\Program Files (x86)\Microsoft Visual Studio 11.0\').
... Looking for registry setting 'HKLM\SOFTWARE\Microsoft\VisualStudio\SxS\VC7' 11.0 ...No.
... Looking for registry setting 'HKCU\SOFTWARE\Microsoft\VisualStudio\SxS\VC7' 11.0 ...No.
... Looking for registry setting 'HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VC7' 11.0 ...Yes ('C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\').
... Looking for environment variable 'VS110COMNTOOLS' ...Yes ('C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\').
... Looking for file 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\devenv.exe' ...Yes.
... Looking for registry setting 'HKLM\SOFTWARE\Microsoft\VisualStudio\SxS\VS7' 11.0 ...Yes ('C:\Program Files (x86)\Microsoft Visual Studio 11.0\').
... Looking for file 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat' ...Yes.
... Looking for folder 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC' ...Yes.
Found installed compiler 'Microsoft Visual C++ 2012 (C)'.
... Looking for compiler 'Microsoft Visual C++ 2008 (C)' ...
... Looking for environment variable 'VS90COMNTOOLS' ...No.
Did not find installed compiler 'Microsoft Visual C++ 2008 (C)'.
... Looking for compiler 'Microsoft Visual C++ 2010 (C)' ...
... Looking for environment variable 'VS100COMNTOOLS' ...No.
Did not find installed compiler 'Microsoft Visual C++ 2010 (C)'.
... Looking for compiler 'Microsoft Visual C++ 2013 Professional (C)' ...
... 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 'Microsoft Visual C++ 2013 Professional (C)'.
... Looking for compiler 'Microsoft Windows SDK 7.1 (C)' ...
... Looking for registry setting 'HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.1' InstallationFolder ...No.
Did not find installed compiler 'Microsoft Windows SDK 7.1 (C)'.
... Looking for compiler 'Microsoft Visual C++ 2012 (C)' ...
... Looking for registry setting 'HKLM\SOFTWARE\Microsoft\VisualStudio\SxS\VS7' 11.0 ...Yes ('C:\Program Files (x86)\Microsoft Visual Studio 11.0\').
... Looking for file 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\amd64\cl.exe' ...Yes.
... Looking for folder 'C:\Program Files (x86)\Microsoft Visual Studio 11.0' ...Yes.
... Looking for registry setting 'HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v8.0' InstallationFolder ...No.
... Looking for registry setting 'HKCU\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v8.0' InstallationFolder ...No.
... Looking for registry setting 'HKLM\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v8.0' InstallationFolder ...Yes ('C:\Program Files (x86)\Windows Kits\8.0\').
... Looking for registry setting 'HKLM\SOFTWARE\Microsoft\VisualStudio\SxS\VS7' 11.0 ...Yes ('C:\Program Files (x86)\Microsoft Visual Studio 11.0\').
... Looking for registry setting 'HKLM\SOFTWARE\Microsoft\VisualStudio\SxS\VC7' 11.0 ...No.
... Looking for registry setting 'HKCU\SOFTWARE\Microsoft\VisualStudio\SxS\VC7' 11.0 ...No.
... Looking for registry setting 'HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VC7' 11.0 ...Yes ('C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\').
... Looking for environment variable 'VS110COMNTOOLS' ...Yes ('C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\').
... Looking for file 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\devenv.exe' ...Yes.
... Looking for registry setting 'HKLM\SOFTWARE\Microsoft\VisualStudio\SxS\VS7' 11.0 ...Yes ('C:\Program Files (x86)\Microsoft Visual Studio 11.0\').
... Looking for file 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat' ...Yes.
... Looking for folder 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC' ...Yes.
Found installed compiler 'Microsoft Visual C++ 2012 (C)'.
MEX configured to use 'Microsoft Visual C++ 2012 (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. In the near future
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 language, select one from the following:
mex -setup C++
mex -setup FORTRAN
>>

Réponses (3)

Hi,
compiling a .cu file in MATLAB is not possible out of the box (mex -setup does not configure the compiler for compilation of CUDA code). You would need some further steps. See here or run in MATLAB
>>web(fullfile(docroot, 'distcomp/run-mex-functions-containing-cuda-code.html#btrgjh3-1'))
In addition you would need to adjust that XML file to match VS 2012 because it's configured for VS 2010.

5 commentaires

Jordan
Jordan le 14 Juil 2014
Modifié(e) : Jordan le 14 Juil 2014
Thanks for the reply. So I followed that web guide exactly. I configured the XML file (original version posted below)
<?xml version="1.0" encoding="UTF-8" ?>
<!-- Copyright 2013 The MathWorks, Inc. -->
<config
Name="NVIDIA CUDA Compiler"
ShortName="nvcc"
Manufacturer="NVIDIA"
Version="5.5"
Language="CUDA"
Priority="A"
Location="$NVCC" >
<Details
CompilerExecutable="$COMPILER"
CompilerDefines="$COMPDEFINES"
CompilerFlags="$COMPFLAGS"
OptimizationFlags="$OPTIMFLAGS"
DebugFlags="$DEBUGFLAGS"
IncludeFlags="$INCLUDE"
LinkerExecutable="$LINKER"
LinkerFlags="$LINKFLAGS"
LinkerLibraries="$LINKLIBS"
LinkerOptimizationFlags="$LINKOPTIMFLAGS"
LinkerDebugFlags="$LINKDEBUGFLAGS"
CommandLineShell="$VCVARSALLDIR\VCVARSALL.BAT "
CommandLineShellArg=" amd64 "
CompilerDefineFormatter="--compiler-options=/D%s"
LinkerLibrarySwitchFormatter="lib%s.lib;%s.lib"
LinkerPathFormatter="/LIBPATH:%s"
LibrarySearchPath="$$LIB;$$LIBPATH;$$PATH;$$INCLUDE;$MATLABROOT\extern\lib\$ARCH\microsoft"
/>
<!-- Switch guide: http://msdn.microsoft.com/en-us/library/fwkeyyhe(v=vs.71).aspx -->
<vars
CMDLINE100="$COMPILER -c $COMPFLAGS $OPTIM $COMPDEFINES $INCLUDE $SRC -o $OBJ"
CMDLINE200="$LINKER $LINKFLAGS $LINKTYPE $LINKOPTIM $LINKEXPORT $LINKLIBS $OBJS /out:$EXE"
CMDLINE250="mt -outputresource:$EXE;2 -manifest $MANIFEST"
CMDLINE300="del $OBJ $EXP $LIB $MANIFEST $ILK"
COMPILER="nvcc"
COMPFLAGS="-gencode=arch=compute_13,code=sm_13 -gencode=arch=compute_20,code=sm_20 -gencode=arch=compute_30,code=&#92;"sm_30,compute_30&#92;" --compiler-options=/c,/GR,/W3,/EHs,/nologo,/MD"
COMPDEFINES="--compiler-options=/D_CRT_SECURE_NO_DEPRECATE,/D_SCL_SECURE_NO_DEPRECATE,/D_SECURE_SCL=0,$MATLABMEX"
MATLABMEX="/DMATLAB_MEX_FILE"
OPTIMFLAGS="--compiler-options=/O2,/Oy-,/DNDEBUG"
INCLUDE="-I"$MATLABROOT\extern\include" -I"$MATLABROOT\simulink\include""
DEBUGFLAGS="--compiler-options=/Z7"
LINKER="link"
LINKFLAGS="/nologo /manifest"
LINKTYPE="/DLL "
LINKEXPORT="/EXPORT:mexFunction"
LINKLIBS="/LIBPATH:"$MATLABROOT\extern\lib\$ARCH\microsoft" libmx.lib libmex.lib libmat.lib gpu.lib cudart.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib"
LINKDEBUGFLAGS="/debug /PDB:"$TEMPNAME$LDEXT.pdb""
LINKOPTIMFLAGS=""
OBJEXT=".obj"
LDEXT=".mexw64"
SETENV="set COMPILER=$COMPILER
set COMPFLAGS=$COMPFLAGS $COMPDEFINES
set OPTIMFLAGS=$OPTIMFLAGS
set DEBUGFLAGS=$DEBUGFLAGS
set LINKER=$LINKER
set LINKFLAGS=$LINKFLAGS /export:%ENTRYPOINT% $LINKTYPE $LINKLIBS $LINKEXPORT
set LINKDEBUGFLAGS=/debug /PDB:"%OUTDIR%%MEX_NAME%$LDEXT.pdb"
set NAME_OUTPUT=/out:"%OUTDIR%%MEX_NAME%%MEX_EXT%""
/>
<locationFinder>
<VSROOT>
<and>
<envVarExists name="VS100COMNTOOLS" />
<fileExists name="$$\..\..\VC\bin\amd64\cl.exe" />
<dirExists name="$$\..\..\.." />
</and>
</VSROOT>
<SDKROOT>
<or>
<hklmExists path="SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0A" name="InstallationFolder" />
<hkcuExists path="SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0A" name="InstallationFolder" />
</or>
</SDKROOT>
<PROF_ENV>
<and>
<envVarExists name="VS100COMNTOOLS" />
<fileExists name="$$\..\IDE\devenv.exe" />
<not>
<fileExists name="$$\..\IDE\VCExpress.exe" />
</not>
</and>
</PROF_ENV>
<VCVARSALLDIR>
<and>
<envVarExists name="VS100COMNTOOLS" />
<fileExists name="$$\..\..\VC\vcvarsall.bat" />
<dirExists name="$$"/>
</and>
</VCVARSALLDIR>
<CUDA_LIB_PATH>
<or>
<and>
<envVarExists name="CUDA_LIB_PATH"/>
<fileExists name="$$\cudart.lib" />
<dirExists name="$$" />
</and>
<and>
<envVarExists name="CUDA_PATH"/>
<fileExists name="$$\lib\x64\cudart.lib" />
<dirExists name="$$" />
</and>
</or>
</CUDA_LIB_PATH>
<CUDA_BIN_PATH>
<or>
<and>
<envVarExists name="CUDA_BIN_PATH"/>
<fileExists name="$$\nvcc.exe" />
<dirExists name="$$" />
</and>
<and>
<envVarExists name="CUDA_PATH"/>
<fileExists name="$$\bin\nvcc.exe" />
<dirExists name="$$" />
</and>
<and>
<envVarExists name="MW_NVCC_PATH"/>
<fileExists name="$$\nvcc.exe" />
<dirExists name="$$" />
</and>
<and>
<fileExists name="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v5.5\bin\nvcc.exe" />
<dirExists name="$$" />
</and>
</or>
</CUDA_BIN_PATH>
</locationFinder>
<env
PATH="$CUDA_BIN_PATH;$VSROOT\VC\Bin\amd64;$VSROOT\VC\Bin\VCPackages;$VSROOT\Common7\IDE;$VSROOT\Common7\Tools;$VSROOT\Common7\Tools\bin;$SDKROOT\Bin\x64;$SDKROOT\Bin\win64\x64;$SDKROOT\Bin;$PATH"
INCLUDE="$VSROOT\VC\ATLMFC\INCLUDE;$VSROOT\VC\INCLUDE;$SDKROOT\include;$MATLABROOT\extern\include;$MATLABROOT\toolbox\distcomp\gpu\extern\include"
LIB="$VSROOT\VC\ATLMFC\LIB\amd64;$VSROOT\VC\Lib\amd64;$SDKROOT\Lib\X64;$MATLABROOT\lib\$ARCH;$CUDA_LIB_PATH"
LIBPATH=""$VSROOT\VC\Lib\amd64""
/>
</config>
So that the line "<envVarExists name="VS100COMNTOOLS" />" is now "<envVarExists name="VS110COMNTOOLS" />"
Did I do the XML update correctly? I am still getting errors. I posted the complete error in a response above.
Many thanks.
Where did you copy that XML file to? From the output above it seemed like the normal xml file (the one mex -setup creates) was picked up. In addition do you have a CUDA Toolkit installed? If not please do so by downloading it from here. If yes, make sure the locations and paths in that xml file are matching your CUDA Toolkit installation.
The same folder as the cuda file that I was trying to compile. I have the CUDA toolkit, yes.
Do what Ken said above. It seems like your have a mexopts.bat file which has a higher priority than any other xml file. Remove it ( C:\Users\Jordan Bonilla\AppData\Roaming\MathWorks\MATLAB\R2014a\mexopts.bat ) and try again.
I made some tweaks and now I am getting the error that the source file is unrecognized... I am just going to call mathworks

Connectez-vous pour commenter.

Titus Edelhofer
Titus Edelhofer le 14 Juil 2014

0 votes

Hi Jordan,
to me this looks fine: you configured mex to use Microsoft Visual C++ 2012 (as in the text directly before the warning about large arrays). You shouldn't have any problems, at least none that I can see ;-).
Titus
Thanks for the reply. I should also mention that this error happened when I attempted to compile a cuda file using the command:
mex myfile.cu

4 commentaires

Hi Jordan,
but I don't see an error? Please try
mex -v myfile.cu
and post the output of this command ...
Titus
Here it is. Thanks in advance.
>> mex -v mexex.cu
***************************************************************************
Warning: Neither -compatibleArrayDims nor -largeArrayDims is selected.
Using -compatibleArrayDims. In the future, MATLAB will require
the use of -largeArrayDims and remove the -compatibleArrayDims
option. For more information, see:
http://www.mathworks.com/help/matlab/matlab_external/upgrading-mex-files-to-use-64-bit-api.html
****************************************************************************
-> Default options filename found in C:\Users\Jordan Bonilla\AppData\Roaming\MathWorks\MATLAB\R2014a
----------------------------------------------------------------
-> Options file = C:\Users\Jordan Bonilla\AppData\Roaming\MathWorks\MATLAB\R2014a\mexopts.bat
MATLAB = C:\Program Files\MATLAB\R2014a
-> COMPILER = cl
-> Compiler flags:
COMPFLAGS = /c /GR /W3 /EHs /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE /nologo /MD
OPTIMFLAGS = /O2 /Oy- /DNDEBUG
DEBUGFLAGS = /Z7
arguments =
Name switch = /Fo
-> Pre-linking commands =
-> LINKER = link
-> Link directives:
LINKFLAGS = /dll /export:mexFunction /LIBPATH:"C:\Program Files\MATLAB\R2014a\extern\lib\win64\microsoft" libmx.lib libmex.lib libmat.lib /MACHINE:X64 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /manifest /incremental:NO /implib:"C:\Users\JORDAN~1\AppData\Local\Temp\mex_HXqDGl\templib.x" /MAP:"mexex.mexw64.map"
LINKDEBUGFLAGS = /debug /PDB:"mexex.mexw64.pdb"
LINKFLAGSPOST =
Name directive = /out:"mexex.mexw64"
File link directive =
Lib. link directive =
Rsp file indicator = @
-> Resource Compiler = rc /fo "mexversion.res"
-> Resource Linker =
----------------------------------------------------------------
--> cl /c /GR /W3 /EHs /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE /nologo /MD /FoC:\Users\JORDAN~1\AppData\Local\Temp\mex_HXqDGl\mexex.obj -I"C:\Program Files\MATLAB\R2014a\extern\include" -I"C:\Program Files\MATLAB\R2014a\simulink\include" /O2 /Oy- /DNDEBUG -DMX_COMPAT_32 mexex.cu
cl : Command line warning D9024 : unrecognized source file type 'mexex.cu', object file assumed
cl : Command line warning D9027 : source file 'mexex.cu' ignored
cl : Command line warning D9021 : no action performed
C:\PROGRA~1\MATLAB\R2014A\BIN\MEX.PL: Error: Compile of 'mexex.cu' failed.
Unable to complete successfully.
>>
Try removing/renaming the mexopts.bat file cited above, then rerun MEX with -v... Any change?
no change. I'm just gonna open a support request with mathworks.

Connectez-vous pour commenter.

Catégories

Produits

Question posée :

le 14 Juil 2014

Commenté :

le 17 Juil 2014

Community Treasure Hunt

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

Start Hunting!

Translated by