使用vs2017给matlab做编译器的时候出现的问题

图片说明
我在复现这个里面的
https://github.com/cszn/IRCNN
目前是matlab2016b和vs2017
输入代码这些
mex -setup
mex -setup:'C:\Program files\MATLAB\R2016b\bin\win64\mexopts\msvc2017.xml' C

mex -setup C++
mex -setup:'C:\Program files\MATLAB\R2016b\bin\win64\mexopts\msvcpp2017.xml' C++

cd 'C:\Program files\MATLAB\R2016b\matconvnet\matconvnet-1.0-beta25'
addpath matlab

%run this
vl_compilenn('enableGpu', true, 'cudaMethod', 'nvcc', ...
'cudaRoot', 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0', ...
'enableCudnn', true, 'cudnnRoot', 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0') ;


你有没有安装cuda sdk8.0和cudnn,你的计算机有没有和cudnn兼容的NVIDIA的显示卡(需要GTX 650以上档次。)

CUDNN目录不要包含空格。

下面是在stackoverflow上的解答, 供题主参考:

Answer by Joss Knight

This appears to be a bug in MatConvNet's vl_compilenn function preventing it from working when your cudnn include path contains spaces. In my version lines 298-301 say:

if opts.enableCudnn,
flags.cc{end+1} = '-DENABLE_CUDNN' ;
flags.cc{end+1} = ['-I' opts.cudnnIncludeDir] ;
end
The third line is missing quotes, so change it to:

if opts.enableCudnn,
flags.cc{end+1} = '-DENABLE_CUDNN' ;
flags.cc{end+1} = ['-I"' opts.cudnnIncludeDir '"'] ;
end
The actual lines of code may be slightly different in your version of vl_compilenn.

This is a very bad error and I can see similar mistakes being made through that file, which makes me think that somehow under normal circumstances this is not a problem and it's only cropping up on your system for some reason.