Azzera filtri
Azzera filtri

C++ Compiler errors when using GPU Coder

11 visualizzazioni (ultimi 30 giorni)
I am trying to use the GPU Coder app to generate GPU codes for various functions I have in matlab. I have gotten this to work succesfully a handful of times but for most attempts I cannot get past the code verification stage and it fails while building MEX. The error I get is "Build error: C++ compiler produced errors. See the Build Log for further details." I will paste the build log below as it is quite long. From what I can tell it is not regocnizing that I have a compiler that can be used but I have both microsoft visual studio 11.8 and WinGw 8.1. when I use mex -setup matlab sees that I have both of these installed so I am not sure what the issue is here. For some of my codes this happen and I keep playing with it and randomly it will work and then go back to the same error if I try again. I am using matlab 2023a with Cuda 11.8 on an RTX 3060 ti. Any help would be greatly appreciated.
Here is the build log:
[1/11] 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\Bakir\OneDrive - University of Nebraska-Lincoln\Doccuments\Nanoscale Labratory\MATLAB Code\Near-Field Replication\Francoeur Role of Fluctuational Electrodynamics 2008\GPU Code (Not Working)\Sina GPU" /I ".\interface" /I "D:\MATLAB\extern\include" /I "." -DMW_CUDA_ARCH=350 -DMW_GPU_MEMORY_DEBUG -DMODEL=heatflux_evan_mex -DMW_NEEDS_VERSION_H interface\_coder_heatflux_evan_info.cpp /Fobuild\win64\_coder_heatflux_evan_info.obj
FAILED: build/win64/_coder_heatflux_evan_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\Bakir\OneDrive - University of Nebraska-Lincoln\Doccuments\Nanoscale Labratory\MATLAB Code\Near-Field Replication\Francoeur Role of Fluctuational Electrodynamics 2008\GPU Code (Not Working)\Sina GPU" /I ".\interface" /I "D:\MATLAB\extern\include" /I "." -DMW_CUDA_ARCH=350 -DMW_GPU_MEMORY_DEBUG -DMODEL=heatflux_evan_mex -DMW_NEEDS_VERSION_H interface\_coder_heatflux_evan_info.cpp /Fobuild\win64\_coder_heatflux_evan_info.obj
_coder_heatflux_evan_info.cpp
c1xx: fatal error C1083: Cannot open source file: 'interface\_coder_heatflux_evan_info.cpp': No such file or directory
[2/11] nvcc -c -rdc=true -Wno-deprecated-gpu-targets -Xcompiler "/wd 4819" -Xcompiler "/MD" -Xcudafe "--display_error_number --diag_suppress=2381 --diag_suppress=unsigned_compare_with_zero --diag_suppress=useless_type_qualifier_on_return_type" -D_GNU_SOURCE -DMATLAB_MEX_FILE --no-exceptions -Xcompiler "/EHa" -Xcompiler "/utf-8" -I "." -I "C:\Users\Bakir\OneDrive - University of Nebraska-Lincoln\Doccuments\Nanoscale Labratory\MATLAB Code\Near-Field Replication\Francoeur Role of Fluctuational Electrodynamics 2008\GPU Code (Not Working)\Sina GPU" -I ".\interface" -I "D:\MATLAB\extern\include" -I "." -DMW_CUDA_ARCH=350 -DMW_GPU_MEMORY_DEBUG -DMODEL=heatflux_evan_mex -DMW_NEEDS_VERSION_H -arch sm_35 -I "D:\MATLAB/simulink/include" -I "D:\MATLAB/toolbox/shared/simtargets" interface\_coder_heatflux_evan_api.cu -o build\win64\_coder_heatflux_evan_api.obj
FAILED: build/win64/_coder_heatflux_evan_api.obj
nvcc -c -rdc=true -Wno-deprecated-gpu-targets -Xcompiler "/wd 4819" -Xcompiler "/MD" -Xcudafe "--display_error_number --diag_suppress=2381 --diag_suppress=unsigned_compare_with_zero --diag_suppress=useless_type_qualifier_on_return_type" -D_GNU_SOURCE -DMATLAB_MEX_FILE --no-exceptions -Xcompiler "/EHa" -Xcompiler "/utf-8" -I "." -I "C:\Users\Bakir\OneDrive - University of Nebraska-Lincoln\Doccuments\Nanoscale Labratory\MATLAB Code\Near-Field Replication\Francoeur Role of Fluctuational Electrodynamics 2008\GPU Code (Not Working)\Sina GPU" -I ".\interface" -I "D:\MATLAB\extern\include" -I "." -DMW_CUDA_ARCH=350 -DMW_GPU_MEMORY_DEBUG -DMODEL=heatflux_evan_mex -DMW_NEEDS_VERSION_H -arch sm_35 -I "D:\MATLAB/simulink/include" -I "D:\MATLAB/toolbox/shared/simtargets" interface\_coder_heatflux_evan_api.cu -o build\win64\_coder_heatflux_evan_api.obj

Risposta accettata

Justin Hontz
Justin Hontz il 12 Apr 2024
Hi Bakir. Based on the syndrome you are seeing, I believe the issue is that the path you are generating code under ("C:\Users\Bakir\OneDrive - University of Nebraska-Lincoln\Doccuments\Nanoscale Labratory\MATLAB Code\Near-Field Replication\Francoeur Role of Fluctuational Electrodynamics 2008\GPU Code (Not Working)\Sina GPU") is too long for the toolchain compiler to handle. I was able to reproduce a very similar error on my end when generating code in a directory of similar length.
Windows has file path length limit that can cause certain applications to fail when working with paths of length > 200 characters. More information can be found here: https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry. The easiest fix would be to generate code under a file path of shorter length.
  1 Commento
Bakir Al-Ameri
Bakir Al-Ameri il 12 Apr 2024
Hi Justin,
This was exactly the issue! I moved my folder to the desktop and I havent had an issue with building mex since. Thank you very much!

Accedi per commentare.

Più risposte (0)

Categorie

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

Prodotti


Release

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by