Mexcuda error on Windows 10 (Matlab 2016b)
3 次查看(过去 30 天)
显示 更早的评论
Hi, I'm using Windows 10, here is the compilers used by mex (as you can see I'm using Visual studio C++ 2015):
>> mex -setup c++
MEX configured to use 'Microsoft Visual C++ 2015 Professional' 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 C++ compiler, select one from the following:
MinGW64 Compiler (C++) mex -setup:'C:\Program Files\MATLAB_R2016b\bin\win64\mexopts\mingw64_g++.xml' C++
Microsoft Visual C++ 2015 Professional mex -setup:C:\Users\LENOVO\AppData\Roaming\MathWorks\MATLAB\R2016b\mex_C++_win64.xml C++
And here is the result using gpuDevice: >
> gpuDevice
ans =
CUDADevice with properties:
Name: 'Quadro M1000M'
Index: 1
ComputeCapability: '5.0'
SupportsDouble: 1
DriverVersion: 8
ToolkitVersion: 7.5000
MaxThreadsPerBlock: 1024
MaxShmemPerBlock: 49152
MaxThreadBlockSize: [1024 1024 64]
MaxGridSize: [2.1475e+09 65535 65535]
SIMDWidth: 32
TotalMemory: 2.1475e+09
AvailableMemory: 1.6919e+09
MultiprocessorCount: 4
ClockRateKHz: 1071500
ComputeMode: 'Default'
GPUOverlapsTransfers: 1
KernelExecutionTimeout: 1
CanMapHostMemory: 1
DeviceSupported: 1
DeviceSelected: 1
And on Windows command prompt, the result when I checked for nvcc:
C:\Users\LENOVO>nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2016 NVIDIA Corporation
Built on Mon_Jan__9_17:32:33_CST_2017
Cuda compilation tools, release 8.0, V8.0.60
however there seems to be some warnings:
C:\Users\LENOVO>nvcc
nvcc warning : The 'compute_20', 'sm_20', and 'sm_21' architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
nvcc fatal : No input files specified; use option --help for more information
Anyway, when I tried to use mexcuda to compile mexGPUExample.cu, an error showed up:
>> 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_R2016b\toolbox\distcomp\gpu\extern\src\mex\win64\nvcc_msvcpp2013.xml'...FAILED
Trying MEX options 'C:\Program Files\MATLAB_R2016b\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_R2016b\toolbox\distcomp\gpu\extern\src\mex\win64\nvcc_msvcpp2013.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. For options, visit
http://www.mathworks.com/support/compilers/R2016b/win64.html.
Error in mexcuda (line 157)
[varargout{1:nargout}] = mex(mexArguments{:});
But I already installed Visual C++ 2015 compiler, which is supported by the CUDA compiler (according to : https://www.mathworks.com/matlabcentral/answers/270635-mexcuda-error-on-windows-10-matlab-2015-b) . I'm perplexed :( Please help me, thank you very much
0 个评论
回答(3 个)
Joss Knight
2017-3-23
编辑:Joss Knight
2017-3-23
MATLAB R2016b requires CUDA 7.5, which doesn't support Visual Studio 2015. So the first thing it's doing is checking for a version of Visual Studio you can use, which you don't have.
This Answer provides a workaround to force MATLAB to use CUDA 8.0 and Visual Studio 14:
0 个评论
Kishore Rajendran
2017-5-4
- Install Visual Studio 2013.
- Then install CUDA 7.5 (custom install, select cuda toolkit and visual studio integration). At this stage, if you have the correct VS version recognizable by CUDA 7.5 installer for the visual studio integration, it won't throw a warning message.
- Then finally, run 'mex -setup c++' in Matlab command window, and change your default compiler to Microsoft Visual C++ 2013. Once you have Matlab set to communicate with VS2013 for mex compilation, it will pick the CL (for .c and .cpp) and NVCC (for .cu) compilers associated with VS2013.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!