GPU coder :basic Code Generation failed

Visual studio 2019
MATLAB 2022A
CUDA 11.6,When I test
coder.checkGpuInstall:
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.)
Basic Code Generation : FAILED (GPU code generation failed with the error 'emlc:compilationError'. View report for further information: View report)
ans =
包含以下字段的 struct:
gpu: 1
cuda: 1
cudnn: 0
tensorrt: 0
basiccodegen: 0
basiccodeexec: 0
deepcodegen: 0
deepcodeexec: 0
tensorrtdatatype: 0
profiling: 0
If I type in following codes in the commander line
gpuEnvObj = coder.gpuEnvConfig;
gpuEnvObj.GpuId = 0;
gpuEnvObj.BasicCodegen = 1;
gpuEnvObj.BasicCodeexec = 1;
results = coder.checkGpuInstall(gpuEnvObj)
the results is
Compatible GPU : FAILED (Invalid CUDA device id: 1. Select a device id from the range 0:0.)
CUDA Environment : PASSED
Runtime : PASSED
cuFFT : PASSED
cuSOLVER : PASSED
cuBLAS : PASSED
Basic Code Generation : FAILED (GPU code generation failed with the error 'emlc:compilationError'. View report for further information: View report)
results =
包含以下字段的 struct:
gpu: 1
cuda: 1
cudnn: 0
tensorrt: 0
basiccodegen: 0
basiccodeexec: 0
deepcodegen: 0
deepcodeexec: 0
tensorrtdatatype: 0
profiling: 0
>>mex -setup
MEX 配置为使用 'Microsoft Visual C++ 2019 (C)' 以进行 C 语言编译。
要选择不同的 C 编译器,请从以下选项中选择一种命令:
Microsoft Visual C++ 2019 (C) mex -setup:C:\Users\sunla\AppData\Roaming\MathWorks\MATLAB\R2022a\mex_C_win64.xml C
Microsoft Visual C++ 2022 (C) mex -setup:D:\MATLAB2022a\bin\win64\mexopts\msvc2022.xml C
要选择不同的语言,请从以下选项中选择一种命令:
mex -setup C++
mex -setup FORTRAN
I looked throught the answers about 'emlc:compilationError' and "Invalid CUDA device", but no answer could figures out my problem.
what wrong with my gpu coder?

2 comentarios

Chao Luo
Chao Luo el 10 de Oct. de 2022
Hi Caiwei,
Could you also show us the error message in the report by clicking "View report"?
Thanks,
Chao
Hi Caiwei,
From the error message (Invalid CUDA device id: 1. Select a device id from the range 0:0.) it seems that the GpuId might have been 1?
Can you try running
>> gpuDeviceCount
and
>> gpuDeviceTable
to see if MATLAB is able to identify your gpu?

Iniciar sesión para comentar.

Respuestas (2)

Walter Roberson
Walter Roberson el 29 de Sept. de 2022
Editada: Walter Roberson el 4 de Dic. de 2024

0 votos

I think Cuda Toolkit 11.6 is not supported in your release. I am having difficulty finding the toolkit version that is supported: 11.0 for the release before yours.

9 comentarios

zhou caiwei
zhou caiwei el 29 de Sept. de 2022
I can run mexcuda and gpu mexw64 file. The fault occurs only when I use gpu coder
After I settle down the tensorrt and cudnn,the report becomes:
>>> gpuEnvObj = coder.gpuEnvConfig;
gpuEnvObj.GpuId = 0;
gpuEnvObj.DeepLibTarget = 'tensorrt';
gpuEnvObj.DeepCodegen = 1;
gpuEnvObj.DeepCodeexec = 1;
coder.checkGpuInstall(gpuEnvObj)
>>>
Runtime : PASSED
cuFFT : PASSED
cuSOLVER : PASSED
cuBLAS : PASSED
cuDNN Environment : PASSED (Warning: Deep learning code generation has been tested with cuDNN v8.1. The provided cuDNN library v8.5 may not be fully compatible.)
TensorRT Environment : PASSED (Warning: Deep learning code generation has been tested with TensorRT v7.2. The provided TensorRT library v8.4 may not be fully compatible.)
Deep Learning (TensorRT) Code Generation: FAILED (Test GPU code generation failed with the error 'emlc:compilationError'. View report for further information: View report)
zhou caiwei
zhou caiwei el 29 de Sept. de 2022
So, how do you think if I install MATLAB 2022b? could MATLAB 2022b release solve my problem?
zhou caiwei
zhou caiwei el 29 de Sept. de 2022
Name: 'NVIDIA GeForce RTX 3090'
Index: 1
ComputeCapability: '8.6'
SupportsDouble: 1
DriverVersion: 11.6000
ToolkitVersion: 11
MaxThreadsPerBlock: 1024
MaxShmemPerBlock: 49152
MaxThreadBlockSize: [1024 1024 64]
MaxGridSize: [2.1475e+09 65535 65535]
SIMDWidth: 32
TotalMemory: 2.5769e+10
AvailableMemory: 2.4283e+10
MultiprocessorCount: 82
ClockRateKHz: 1695000
ComputeMode: 'Default'
GPUOverlapsTransfers: 1
KernelExecutionTimeout: 1
CanMapHostMemory: 1
DeviceSupported: 1
DeviceAvailable: 1
DeviceSelected: 1
Walter Roberson
Walter Roberson el 29 de Sept. de 2022
I think the 3090 is too new to be supported in your release unless you turn on forward compatibility.
zhou caiwei
zhou caiwei el 30 de Sept. de 2022
definitely yes! I downloaded MATLAB2022a and all the test passed!
Walter Roberson
Walter Roberson el 30 de Sept. de 2022
Do you perhaps means it works in R2022b ??
zhou caiwei
zhou caiwei el 30 de Sept. de 2022
MATLAB2022a is proved to be qualified
Walter Roberson
Walter Roberson el 24 de Oct. de 2022
See also https://www.mathworks.com/matlabcentral/answers/1825838-gpu-support-for-rtx-4090#comment_2430013 which indicates that R2021a is enough to generally use the RTX 3090, but that using GPU Coder could have problems, with a work-around suggestion there.

Iniciar sesión para comentar.

zhou caiwei
zhou caiwei el 30 de Sept. de 2022

0 votos

However, I'm not sure if other error would happens

3 comentarios

wtg Wtg
wtg Wtg el 4 de Dic. de 2024
Editada: wtg Wtg el 4 de Dic. de 2024
Could you instruct me how you solved the problem ?
I always got the following error messages for the Deep code gen & exec tests :
>> coder.checkGpuInstall
Compatible GPU : PASSED
CUDA Environment : PASSED
Runtime : PASSED
cuFFT : PASSED
cuSOLVER : PASSED
cuBLAS : PASSED
cuDNN Environment : PASSED
Host Compiler : PASSED
Basic Code Generation : PASSED
Basic Code Execution : PASSED
gpu: 1
cuda: 1
cudnn: 1
tensorrt: 0
hostcompiler: 1
basiccodegen: 1
basiccodeexec: 1
deepcodegen: 0
tensorrtdatatype: 0
deepcodeexec: 0
Deep Learning (cuDNN) Code Generation: FAILED (GPU code generation failed with an error. View report for further information: View report
Report shows :
Calling cade generaion implementation function 'xxx' is from user function '... DeepLearningNetwork' is Not Supported.
....
Regards, Wtg
Justin Hontz
Justin Hontz el 4 de Dic. de 2024
@wtg Wtg For better visibility and organization, please create a new MATLAB Answers thread for the issue you are encountering.
wtg Wtg
wtg Wtg el 4 de Dic. de 2024
I had created a new Ask with a subject named "GPU coder check fail for deep learning cuDNN code generation and execution".

Iniciar sesión para comentar.

Categorías

Más información sobre Get Started with GPU Coder en Centro de ayuda y File Exchange.

Productos

Versión

R2022a

Preguntada:

el 29 de Sept. de 2022

Editada:

el 4 de Dic. de 2024

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by