coder.checkGpuInstall: Basic Code Generation : FAILED (GPU code generation failed with an error

24 visualizzazioni (ultimi 30 giorni)
Hi,
I am trying to use the GPU coder to compile a MATLAB function of gpuArrays into a .mex file, but I keep getting the error "Basic Code Generation : FAILED (GPU code generation failed with an error" when i test the coder.checkGpuInstall. Here is my setup:
  • MATLAB R2024b - academic use;
  • Visual Studio 2022 17.8 (Enterprise) as C/C++ compiler;
  • CUDA toolkit 12.2
Some related test commands and results are as follows
gpuDevice
CUDADevice - :
Name: 'Tesla V100-SXM2-32GB'
Index: 1/8
ComputeCapability: '7.0'
DriverModel: 'TCC'
TotalMemory: 34218311680 (34.22 GB)
AvailableMemory: 33668726784 (33.67 GB)
DeviceAvailable: true
DeviceSelected: true
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 : FAILED (GPU code generation failed with an error. View report for further information: View report)
ans =
struct:
gpu: 1
cuda: 1
cudnn: 1
tensorrt: 0
hostcompiler: 1
basiccodegen: 0
basiccodeexec: 0
deepcodegen: 0
tensorrtdatatype: 0
deepcodeexec: 0
mex -setup
MEX is configured to use 'Microsoft Visual C++ 2022 (C)' for C compilation.
mex -setup C++
MEX is configured to use 'Microsoft Visual C++ 2022' for C++ language compilation.
when I click the View report, it seems a C++ compiler error happens when compiling the gpuSimpleTest fcn, I cannot figure out what is the issue (see below for the build log)
[1/10] cl /c /Zc:__cplusplus /Zp8 /GR /W3 /EHs /nologo /MD /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE /DMATLAB_MEX_FILE /O2 /Oy- /DNDEBUG /fp:strict /utf-8 /I "." /I "C:\Users\admin\AppData\Local\Temp\tp23b343d4_825a_4aa8_ad85_d5999890735a" /I "D:\Program Files\Matlab\toolbox\gpucoder\src\gpucoderrt\export\include\gpucoderrt" /I "D:\Program Files\Matlab\sys\cuda\win64\cuda\include" /I ".\interface" /I "D:\Program Files\Matlab\extern\include" /I "." -DMW_CUDA_ARCH=700 -DMW_GPU_MEMORY_DEBUG -DMW_GPU_MEMORY_MANAGER -DMODEL=gpuSimpleTest_mex -DMW_NEEDS_VERSION_H interface\_coder_gpuSimpleTest_info.cpp /Fobuild\win64\_coder_gpuSimpleTest_info.obj
FAILED: build/win64/_coder_gpuSimpleTest_info.obj
cl /c /Zc:__cplusplus /Zp8 /GR /W3 /EHs /nologo /MD /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE /DMATLAB_MEX_FILE /O2 /Oy- /DNDEBUG /fp:strict /utf-8 /I "." /I "C:\Users\admin\AppData\Local\Temp\tp23b343d4_825a_4aa8_ad85_d5999890735a" /I "D:\Program Files\Matlab\toolbox\gpucoder\src\gpucoderrt\export\include\gpucoderrt" /I "D:\Program Files\Matlab\sys\cuda\win64\cuda\include" /I ".\interface" /I "D:\Program Files\Matlab\extern\include" /I "." -DMW_CUDA_ARCH=700 -DMW_GPU_MEMORY_DEBUG -DMW_GPU_MEMORY_MANAGER -DMODEL=gpuSimpleTest_mex -DMW_NEEDS_VERSION_H interface\_coder_gpuSimpleTest_info.cpp /Fobuild\win64\_coder_gpuSimpleTest_info.obj
CreateProcess failed: The system cannot find the file specified.
Thanks for any suggestion!
  3 Commenti
Justin Hontz
Justin Hontz il 4 Apr 2025
Hi Shi,
Based on the diagnostic, it appears that the ninja build system is unable to locate the MSVC compiler. Do you run into the same issue if you try generating a MEX with MATLAB Coder (without using GPU Coder)?
It is possible that the issue may be caused by an out-of-date MEX configuration. One thing you can try is locate your preferences directory (by running prefdir in MATLAB) and find files mex_C++_win64.xml and mex_C_win64.xml within. Then delete these files, re-run the MEX setup commands, and try code generation again.
Shi
Shi il 5 Apr 2025
The problem was solved! Thanks for all your answers!!!
By running the code provided by Chao Luo, I found that the path in SetEnv.bat pointed to the VS version I had uninstalled. However, the problem was not solved after I reset the environment variables and restarted MATLAB. Then I used the method provided by Justin Hontz, deleted the corresponding files and re-run the mex setup command, and then coder.checkGpuInstall passed! I guess that the C/C++ compiler path recognized by Matlab should be updated by regenerating the files mex_C++_win64.xml and mex_C_win64.xml.

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Get Started with GPU Coder in Help Center e File Exchange

Prodotti


Release

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by