vlfeat / matconvnet

MatConvNet: CNNs for MATLAB
Other
1.4k stars 752 forks source link

error in vl_compilenn('enableGpu',true) #1239

Open supreet21 opened 4 years ago

supreet21 commented 4 years ago

I am using Cuda toolkit 10.2 and MatLab 2019b with visual studio 2019 compiler as well as parallel computing toolbox. The error was generated after I run the command above.

Error using vl_compilenn>search_cuda_devkit (line 715) Could not find a valid NVCC executable\n

Error in vl_compilenn (line 279) if isempty(opts.cudaRoot), opts.cudaRoot = search_cuda_devkit(opts) ; end

Any help and guidance will be much appreciated. Thank you in advance.

jotaf98 commented 4 years ago

Hi, you need to locate the nvcc executable in your system and pass that folder in as an extra option: vl_compilenn(..., 'cudaRoot', '<the_path>')

If that option is not given then search_cuda_devkit will look for it in a few usual places (though it's not guaranteed as many systems are different).

supreet21 commented 4 years ago

thanks

> vl_compilenn('enableGpu', true, 'cudaRoot', 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2') this command solved the problem

supreet21 commented 4 years ago

But there is another issue.

Warning: Support for toolboxdir('distcomp') will be removed in a future release. Use toolboxdir('parallel') instead.

In toolboxdir (line 49) In vl_compilenn (line 367) Warning: CL.EXE not found in PATH. Trying to guess out of mex setup. In vl_compilenn>check_clpath (line 650) In vl_compilenn (line 426) 'cl.exe' is not recognized as an internal or external command, operable program or batch file. Error using vl_compilenn>check_clpath (line 656) Unable to find cl.exe

Error in vl_compilenn (line 426) cl_path = fileparts(check_clpath()); % check whether cl.exe in path

then solved the problem by referring to the following link. https://stackoverflow.com/questions/40226354/matconvnet-error-cl-exe-not-found

changes made were

1.for 1st trail cl_path = 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\bin\Hostx64\x64' after line(646)

  1. And in the 2nd trail

    addpath(fullfile('C:', 'Program Files (x86)', 'Microsoft Visual Studio', '2017', 'Professional', 'VC', 'Tools', 'MSVC', '14.16.27023', 'bin', 'Hostx64', 'x64'));

supreet21 commented 4 years ago

But following this we encounter with another issue

on execution of the command

vl_compilenn('enableGpu', true, 'cudaRoot', 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2') or vl_compilenn('enableGpu', true, 'cudaRoot', 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2','EnableImreadJpeg', false)

Warning: Support for toolboxdir('distcomp') will be removed in a future release. Use toolboxdir('parallel') instead.

In toolboxdir (line 49) In vl_compilenn (line 367) nvcc fatal : '-DNDEBUG': expected a number Error using vl_compilenn>nvcc_compile (line 615) Command "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\bin\nvcc" -c -o "C:\Users\Hp\AppData\Roaming\MathWorks\MATLAB Add-Ons\Collections\vlfeat_matconvnet\vlfeat-matconvnet-1e5ae7b\matlab\mex.build\bits\data.obj" "C:\Users\Hp\AppData\Roaming\MathWorks\MATLAB Add-Ons\Collections\vlfeat_matconvnet\vlfeat-matconvnet-1e5ae7b\matlab\src\bits\data.cu" -DENABLE_GPU -DENABLE_DOUBLE -O -DNDEBUG -D_FORCE_INLINES --std=c++11 -I"C:\Program Files\MATLAB\R2019b\extern\include" -I"C:\Program Files\MATLAB\R2019b\toolbox\parallel\gpu\extern\include" -gencode=arch=compute_50,code=\"sm_50,compute_50\" --compiler-options=/MD --compiler-bindir="C:\ProgramData\MATLAB\SupportPackages\R2019b\3P.instrset\mingw_w64.instrset\VC\bin" failed.

Error in vl_compilenn (line 487) nvcc_compile(opts, srcs{i}, objfile, flags) ;

vishwa91 commented 3 years ago

You may want to try the following:

  1. Comment flags.base{end+1} = '-O0' on line 340
  2. Switch to mex_cuda -- vl_compilenn('verbose', 1, 'enableGpu', true, 'cudaRoot', 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2', 'CudaMethod', 'mex')

This worked for me on Windows 10.

NikolaiSkuratov commented 3 years ago

Thank you very much, vishwa91! I was about to give up, but your ssuggestion helped me to work out the problem.