错误1:
错误使用 vl_compilenn>nvcc_compile (line 615)
Command "D:\Program Files\MATLAB\CUDA\9.1\bin\nvcc" -c -o "D:\Program Files\MATLAB\matconvnet\matlab\mex\.build\bits\data.obj" "D:\Program
Files\MATLAB\matconvnet\matlab\src\bits\data.cu" -DENABLE_GPU -DENABLE_DOUBLE -DENABLE_CUDNN -I"local\cudnn-9.1\include" -O -DNDEBUG
-D_FORCE_INLINES --std=c++11 -I"D:\Program Files\MATLAB\R2016b\extern\include" -I"D:\Program
Files\MATLAB\R2016b\toolbox\distcomp\gpu\extern\include" -gencode=arch=compute_61,code=\"sm_61,compute_61\" --compiler-options=/MD
--compiler-bindir="C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\..\VC\bin" failed.
出错 vl_compilenn (line 487)
nvcc_compile(opts, srcs{i}, objfile, flags) ;
仔细看了一遍,发现没看懂。
其实翻译成人类语言就是:在data.cu处 找不到'cudnn.h'
那么问题就很好解决了
将自己下载的local文件夹下的cudnn文件夹下的\cuda\include下的cudnn.h复制粘贴到你所装的CUDA根目录下的\include下 你一打开就可以看到是CUDA专门放h头文件的文件夹对吧 所以放这里就好了 就可以解决这个问题了。
错误2:
错误使用 mex
MEX 找不到使用 -l 选项指定的库 'cudnn'。MEX 查找具有以下名称之一的文件:
cudnn.lib
libcudnn.lib
请使用 -L 选项指定此库的路径。
出错 vl_compilenn>mex_link (line 627)
mex(args{:}) ;
出错 vl_compilenn (line 500)
mex_link(opts, objs, flags.mex_dir, flags) ;
解决方法:
1.大神做法:读的懂程序的大神按照上述方法改吧。
2. 简单粗暴:将你所下载的local下的cudnn下的\cuda\lib\x64的cudnn.lib复制粘贴到CUDA根目录下的\lib\x64下就好了
错误3:
解决方法1:
1.25版本(以及之后)的MatConvNet中的vl_compilenn.m文件中在506行增加了这样的判断
if strcmp(arch, 'win64') && opts.enableCudnn
这要求&&符号前后都是逻辑值,所以在运行vl_compilenn函数中'enableCudnn'后面要跟true,而不是跟'true',即编译语句为:
vl_compilenn('enableGpu', true, ...
'cudaRoot', 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0', ...
'cudaMethod', 'nvcc',...
'enableCudnn', true, ...
'cudnnRoot', 'xxx\cuDNN-9.1'); //这里的xxx填写你的cuDNN的路径
否则会报Operands to the || and && operators must be convertible to logical scalar values的错误。
解决办法1,原文博客:
https://www.cnblogs.com/qq552048250/p/7857122.html
解决方法2:
if strcmp(arch, 'win64') && opts.enableCudnn
两个变量左边是逻辑变量(1 或 0),右边返回变量是(true)
把 && 修改成 & 就可以了,如下:
if strcmp(arch, 'win64') & (opts.enableCudnn)
解决办法2,原文博客:
https://blog.csdn.net/xueshanchina/article/details/78808159
错误4:
错误使用 copyfile
未找到匹配的文件。
出错 vl_compilenn (line 508)
copyfile(fullfile(opts.cudnnRoot, 'bin', '*.dll'), flags.mex_dir);
vl_compilenn源程序中是这么描述的:
解决方法:
vl_compilenn('enableGpu', true, ...
'cudaRoot', ' D:\Program Files\MATLAB\CUDA\9.1(你的CUDA路径)', ...
'cudaMethod', 'nvcc',...
'enableCudnn', true, ...
'cudnnRoot', ' D:\Program Files\MATLAB\matconvnet\local\cudnn-9.1(你的CUDNN全路径)');
使用时的错误:
错误使用 vl_nnconv
An input is not a numeric array (or GPU support not compiled).
An input is not a numeric array (or GPU support not compiled)
该错误发生在vl_simplenn.m中前向传播计算res.x的时候。
此处会出现一个问题,vl_compilenn.m对于旧版本(表示不知道旧版本是哪个)和新版本(v7.05)关于函数mex_compile会有区别:
对于旧版本:
对于新版本:
解决办法1(对于旧版本):
更改vl_compilenn.m文件的mex_compile函数。
将 mopts = {'-outdir', fileparts(tgt), src, '-c', mex_opts{:}} ;
更改为 mopts = {'-outdir', fileparts(tgt), src, '-c', mex_opts{:}, '-largeArrayDims'} ; 然后再对GPU版本重新编译 。解决办法原文博客:https://www.cnblogs.com/qq552048250/p/7857122.html
解决方法2:
运行 vl_compilenn('enableGpu', true)参考网站:https://github.com/vlfeat/matconvnet/issues/99