Getting error for NVIDIA CudNN with Matlab 2019b in Windows 10
Mostrar comentarios más antiguos
Hi,
I have installed Cuda9.2 along with cudNN following the instruction given in NVIDIA site in Windows 10. I am going to use deep learning in MATLAB 2019b.
When I used ---> coder.checkGpuInstall('full')
I got the below error and messages:
Compatible GPU : PASSED
CUDA Environment : PASSED
Runtime : PASSED
cuFFT : PASSED
cuSOLVER : PASSED
cuBLAS : PASSED
cuDNN Environment : FAILED (Unable to find the 'NVIDIA_CUDNN' environment variable. Set 'NVIDIA_CUDNN' to point to the root directory of a NVIDIA cuDNN installation.)
TensorRT Environment : FAILED (Unable to find the 'NVIDIA_TENSORRT' environment variable. Set 'NVIDIA_TENSORRT' to point to the root directory of a TensorRT installation.)
Profiling Environment : PASSED
Basic Code Generation : FAILED (Test GPU code generation failed with the error 'emlc:compilationError'. View report for further information: View report)
ans =
struct with fields:
gpu: 1
cuda: 1
cudnn: 0
tensorrt: 0
basiccodegen: 0
basiccodeexec: 0
deepcodegen: 0
deepcodeexec: 0
tensorrtdatatype: 0
profiling: 1
Can anyone please help to resolve the issue?
With regards
7 comentarios
abdul kaleem siddiqi
el 29 de Abr. de 2020
same issue
Susama Bagchi
el 29 de Abr. de 2020
shuang zhou
el 20 de Ag. de 2020
- download and install cudnn https://developer.nvidia.com/cudnn
- download and install tensorrt https://developer.nvidia.com/tensorrt
- add cudnn and tensorrt to system environment variables list then you will get info below.
- run coder.checkGpuInstall('full')
>> getenv('NVIDIA_CUDNN')
'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2'
>> getenv('NVIDIA_TENSORRT')
'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\TensorRT-7.1.3.4'
struct with fields:
gpu: 1
cuda: 1
cudnn: 1
tensorrt: 1
basiccodegen: 1
basiccodeexec: 1
deepcodegen: 0
deepcodeexec: 0
tensorrtdatatype: 1
profiling: 1
kang yang
el 18 de Sept. de 2020
Excuse me, has your problem been solved, I also encountered the same problem
>> setenv('NVIDIA_CUDNN','C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0')
>> getenv('NVIDIA_CUDNN')
ans =
'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0'
>> coder.checkGpuInstall('full')
Compatible GPU : PASSED
CUDA Environment : PASSED
Runtime : PASSED
cuFFT : PASSED
cuSOLVER : PASSED
cuBLAS : PASSED
cuDNN Environment : PASSED
TensorRT Environment : FAILED (Unable to find the 'NVIDIA_TENSORRT' environment variable. Set 'NVIDIA_TENSORRT' to point to the root directory of a TensorRT installation.)
Profiling Environment : PASSED
Basic Code Generation : FAILED (Test GPU code generation failed with the error 'emlc:compilationError'. View report for further information: View report)
ans =
다음 필드를 포함한 struct:
gpu: 1
cuda: 1
cudnn: 1
tensorrt: 0
basiccodegen: 0
basiccodeexec: 0
deepcodegen: 0
deepcodeexec: 0
tensorrtdatatype: 0
profiling: 1
ChrisLyu
el 8 de Oct. de 2020
ChrisLyu
el 8 de Oct. de 2020
Run Matlab as administrator.
Respuesta aceptada
Más respuestas (8)
yulei ji
el 25 de Mayo de 2020
1 voto
I have the same problem.
coder.checkGpuInstall()
Compatible GPU : PASSED
CUDA Environment : PASSED
Runtime : PASSED
cuFFT : PASSED
cuSOLVER : PASSED
cuBLAS : PASSED
cuDNN Environment : PASSED (Warning: Deep learning code generation has been tested with cuDNN v7.5. The provided cuDNN library v7.6 may not be fully compatible.)
Basic Code Generation : FAILED (Test GPU code generation failed with the error 'emlc:compilationError'. View report for further information: View report)
What shuold I do
2 comentarios
Susama Bagchi
el 25 de Mayo de 2020
Lo jungle
el 26 de Dic. de 2021
have you solve this probelm?
Tuong
el 15 de Mzo. de 2024
This is how I do it on Matlab R2023b + Window 10 x64
First I install CUDA 11.8
Then I install CUDNN 9.0 (it would be better to use CUDNN 8.7)
Then I do 3 copy steps
Copy step 1:
Copy all files from C:\Program Files\NVIDIA\CUDNN\v9.0\bin\11.8\ to C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\bin\
Copy step 2:
Copy all files from C:\Program Files\NVIDIA\CUDNN\v9.0\include\11.8\ to C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\include\
Copy step 3:
Copy all file from C:\Program Files\NVIDIA\CUDNN\v9.0\lib\11.8\x64\ to C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\lib\x64\
Now I add the environment variables like this

Restart my computer and open matlab again. I then type
gpuEnvObj = coder.gpuEnvConfig;
gpuEnvObj.BasicCodegen = 1;
gpuEnvObj.BasicCodeexec = 1;
gpuEnvObj.DeepLibTarget = 'cudnn'; % it can be changed to 'tensort'
gpuEnvObj.DeepCodeexec = 1;
gpuEnvObj.DeepCodegen = 1;
results = coder.checkGpuInstall(gpuEnvObj)
Another test is to use gpucoderSetup on the matlab command prompt

You can then run checks
Jaya Shankar
el 15 de Mzo. de 2020
Editada: Jaya Shankar
el 15 de Mzo. de 2020
0 votos
Hi Susama
Looks like the requisite environments for CUDNN and TENSORRT are not set correctly on your windows.
These environment variables should point to the location on your computer where these libraries were installed as described here
You can confirm if they are set correctly by running the following commands in MATLAB session
>> getenv('NVIDIA_CUDNN')
>> getenv('NVIDIA_TENSORRT')
If the above commands return empty , make sure to set the variables through you Windows's environment variable settings found via Control Panel ->System and Security->System->Advanced System settings.
Jaya
1 comentario
Susama Bagchi
el 15 de Mzo. de 2020
Sourabh Kondapaka
el 20 de Mzo. de 2020
0 votos
Ensure that cuDNN library is installed in the correct directory.
Check Nvidia’s official documentation for installing in Windows :
These environment variables should point to the location on your computer where these libraries were installed as described here:
Important Note: The Operating system ( in your case , Windows 10) only uses environment variables which were made available when the system has started. So in order for windows 10 to be able to start using the new environment variables which you had just set you need restart your system. In other words, in order to use the new or edited environment variables you will need to restart your system.
4 comentarios
Susama Bagchi
el 20 de Mzo. de 2020
Sourabh Kondapaka
el 27 de Mzo. de 2020
The below link contains the approach for installing cudnn and then setting the environment variables in the Control Panel.
After this step it would be better to restart your PC and then check if the environment variables are available to Windows OS by following Jaya Shankar's Answer above.
Steps:
1) Follow the instructions in the above link for installing cuDNN library.
2) Set the environment variables by going to the control panel. Steps for this are also available in the same link and can be easily found online.
3) Restart your PC then open Matlab and check if the OS is able to access the environment variables by following Jaya Shankar's answer.
Ritesh Panday
el 31 de Mzo. de 2021
Hi Sourabh, i've followed the steps on Nvidia's webpage, but the environment variable for cuDNN doesn't seem to autoset. I even tried adding it myself, but Matlab is not detecting it. As well, i'm getting the following error:
Error using coder.checkGpuInstall (line 33)
One or more of the system checks did not pass, with the following errors ...
cuDNN Environment: (Unable to find cuDNN header files in directory 'C:\Program Files\NVIDIA GPU Computing
Toolkit\CUDA\cuda\include'. Check that the cuDNN headers are installed with the specified cuDNN SDK.)
Error in PedestrianDetectionExample (line 31)
coder.checkGpuInstall(envCfg);
I've tried all sorts of troubleshooting available in matlab forums, but they're not helping. This is really urgent, so i'd appreciate any help. Thank you!
Susama Bagchi
el 2 de Abr. de 2021
Stefano Marrone
el 18 de Jul. de 2020
0 votos
Hi, same problem here.
coder.checkGpuInstall
Compatible GPU : PASSED
CUDA Environment : PASSED
Runtime : PASSED
cuFFT : PASSED
cuSOLVER : PASSED
cuBLAS : PASSED
cuDNN Environment : PASSED
Basic Code Generation : FAILED (Test GPU code generation failed with the error 'emlc:compilationError'. View report for further information: View report)
ans =
struct with fields:
gpu: 1
cuda: 1
cudnn: 1
tensorrt: 0
basiccodegen: 0
basiccodeexec: 0
deepcodegen: 0
deepcodeexec: 0
tensorrtdatatype: 0
profiling: 0
Did you solve it?
4 comentarios
Susama Bagchi
el 19 de Sept. de 2020
Sipho Frank Sithole
el 18 de Nov. de 2020
Good day as per the above conversation I am also having difficulty using the GPU coder on matlab, I did run matlab as administrator but still getting the same results. My GPU is GTX 1070, downloaded the latest cuda v11,1 and latest cudnn. However the GPU coder returns failed massage same as above comments "Basic Code Generation : FAILED (Test GPU code generation failed with the error 'emlc:compilationError'. View report for further information: View report)" Your help will be highly appreciated. I did download Visual studio 2019, I see that you have to link certain files but do not really know how. I am fairly new and working on a deep learning project.

Ali Al-Saegh
el 12 de En. de 2021
Hello,
Please anyone solved this problem, please help me.
Basic Code Generation : FAILED (Test GPU code generation failed with the error 'emlc:compilationError'. View report for further information: View report)
Lo jungle
el 26 de Dic. de 2021
also help me too
Sehairi K.
el 5 de Sept. de 2021
Hello
try this
% specify the CUDA install directory, you must have already copied cudnn files there
setenv('NVIDIA_CUDNN','C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.3')
% specify the TensorRT path
setenv('NVIDIA_TENSORRT','C:\Program Files\NVIDIA GPU Computing Toolkit\TensorRT-8.0.3.4.Windows10.x86_64.cuda-11.3.cudnn8.2\TensorRT-8.0.3.4')
coder.checkGpuInstall('full')
gpu: 1
cuda: 1
cudnn: 1
tensorrt: 1
basiccodegen: 1
basiccodeexec: 1
deepcodegen: 0
deepcodeexec: 0
tensorrtdatatype: 1
profiling: 1
muhammad ahmad
el 17 de Nov. de 2021
0 votos
how did you resolve deepcodegen and deepcodeexec . do i need to install opencv for it
if so how can i do this
1 comentario
Hariprasad Ravishankar
el 3 de Dic. de 2021
Hi Muhammad,
You do not need to install OpenCV. You can resolve deepcodegen and deepcodeexec by downloading NVIDIA CuDNN and NVIDIA TensorRT libraries and setting the environment variables 'NVIDIA_CUDNN' and 'NVIDIA_TENSORRT' to point to the install folder.
Here is the documentation page of the config settings to test deepcodegen and deepcodeexec using coder.checkGpuInstall, for reference
Kunal Khandelwal
el 20 de Feb. de 2026
0 votos
i am tying to use GPU Coder.
mex -setup C++
MEX configured to use 'MinGW64 Compiler (C++)' for C++ language compilation.
>> gpuEnvObj = coder.gpuEnvConfig;
gpuEnvObj.BasicCodegen = 1;
gpuEnvObj.BasicCodeexec = 1;
gpuEnvObj.DeepLibTarget = 'tensorrt';
gpuEnvObj.DeepCodeexec = 1;
gpuEnvObj.DeepCodegen = 1;
results = coder.checkGpuInstall(gpuEnvObj)
Compatible GPU : PASSED
CUDA Environment : PASSED
Runtime : PASSED
cuFFT : PASSED
cuSOLVER : PASSED
cuBLAS : PASSED
cuDNN Environment : PASSED
TensorRT Environment : PASSED
Host Compiler : FAILED (Unable to find a supported C++ host compiler. For a list of supported compilers, see supported compilers)
results =
struct with fields:
gpu: 1
cuda: 1
cudnn: 1
tensorrt: 1
hostcompiler: 0
basiccodegen: 0
basiccodeexec: 0
deepcodegen: 0
tensorrtdatatype: 0
deepcodeexec: 0
I have alreadyinstalled MinGW and Visual Studio
Can I get some help
Categorías
Más información sobre Get Started with GPU Coder en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

