.cu file compilation error (while mex -setup works, mexcuda gives unsupported compiler error although nvcc compiler is installed in my PC)
8 次查看(过去 30 天)
显示 更早的评论
I'm trying to compile CUDA Mex file with .cu extension with MATLAB 2018b, CUDA Toolkit version 9.1 and Visual Studio 2015 Professional. The Graphics Processing Unit in my PC is GeForce GTX 1050. In Matlab, When I call the command gpuDevice, I have the output as follows
>> gpuDevice
ans =
CUDADevice with properties:
Name: 'GeForce GTX 1050'
Index: 1
ComputeCapability: '6.1'
SupportsDouble: 1
DriverVersion: 10
ToolkitVersion: 9.1000
MaxThreadsPerBlock: 1024
MaxShmemPerBlock: 49152
MaxThreadBlockSize: [1024 1024 64]
MaxGridSize: [2.1475e+09 65535 65535]
SIMDWidth: 32
TotalMemory: 4.2950e+09
AvailableMemory: 3.4635e+09
MultiprocessorCount: 5
ClockRateKHz: 1493000
ComputeMode: 'Default'
GPUOverlapsTransfers: 1
KernelExecutionTimeout: 1
CanMapHostMemory: 1
DeviceSupported: 1
DeviceSelected: 1
If I tries compiling a default mexGPUExample.cu, it is showing
>> 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\R2018b\toolbox\distcomp\gpu\extern\src\mex\win64\nvcc_msvcpp2017.xml'...FAILED
Trying MEX options 'C:\Program Files\MATLAB\R2018b\toolbox\distcomp\gpu\extern\src\mex\win64\nvcc_msvcpp2013.xml'...FAILED
Trying MEX options 'C:\Program Files\MATLAB\R2018b\toolbox\distcomp\gpu\extern\src\mex\win64\nvcc_msvcpp2012.xml'...FAILED
Trying MEX options 'C:\Program Files\MATLAB\R2018b\toolbox\distcomp\gpu\extern\src\mex\win64\nvcc_msvcpp2015.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\R2018b\toolbox\distcomp\gpu\extern\src\mex\win64\nvcc_msvcpp2017.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' 15.0 ...No.
... Looking for registry setting 'HKCU\SOFTWARE\Microsoft\VisualStudio\SxS\VS7' 15.0 ...No.
... Looking for registry setting 'HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7' 15.0 ...No.
... Looking for registry setting 'HKCU\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7' 15.0 ...No.
Did not find installed compiler 'NVIDIA CUDA Compiler'.
Error using mex
No supported compiler was found. For options, visit https://www.mathworks.com/support/compilers.
Error in mexcuda (line 157)
[varargout{1:nargout}] = mex(mexArguments{:});
I also tried
setenv('MW_NVCC_PATH','C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.1\bin')
Compiling failed.
In Matlab environment, I type the commands below it didn't work again
>> !nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2017 NVIDIA Corporation
Built on Fri_Nov__3_21:08:12_Central_Daylight_Time_2017
Cuda compilation tools, release 9.1, V9.1.85
How can I tackle this issue?
1 个评论
Joss Knight
2019-2-2
It's hard to say because your currently selected host compiler is MSVC 2017, which you don't have. Use mex -setup to select Visual Studio 2015, then run in verbose mode again so we can see exactly what is failing. Or just type
mexcuda -f "C:\Program Files\MATLAB\R2018b\toolbox\distcomp\gpu\extern\src\mex\win64\nvcc_msvcpp2015.xml" -v mexGPUExample.cu
and show us what the output was again.
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 GPU Computing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!