Clear Filters
Clear Filters

Unable to compile mexGPUExample.cu in Matlab R2023a

26 views (last 30 days)
Dear Matlab community, I installed CUDA 11.8 and VS Community 2019, and the C++ and CUDA environments are identified by MATLAB.
Run the command:
mex -setup C++
And it shows:
MEX 配置为使用 'Microsoft Visual C++ 2019' 以进行 C++ 语言编译。
However, it was unable to pass the Basic Code Generation. When I run coder.checkGpuInstall command, it shows:
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.)
Host Compiler : PASSED
Basic Code Generation : FAILED (GPU code generation failed with the error 'emlc:compilationError'. View report for further information: View report)
I don't use neural networks, so I didn't install cuDNN.
The report said:
ninja: build stopped: subcommand failed.
At last, I run the command:
mexcuda -V mexGPUExample.cu
And this is what came out:
详细模式已开。
... 正在查找编译器 'NVIDIA CUDA Compiler'...
... 正在查找环境变量 'ProgramFiles(x86)'...是('C:\Program Files (x86)')。
... 正在查找文件 'C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe'...是。
... 正在执行命令 '"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -version "[16.0,17.0)" -products Microsoft.VisualStudio.Product.Enterprise -property installationPath -format value'...否。
... 正在查找环境变量 'ProgramFiles(x86)'...是('C:\Program Files (x86)')。
... 正在查找文件 'C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe'...是。
... 正在执行命令 '"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -version "[16.0,17.0)" -products Microsoft.VisualStudio.Product.Professional -property installationPath -format value'...否。
... 正在查找环境变量 'ProgramFiles(x86)'...是('C:\Program Files (x86)')。
... 正在查找文件 'C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe'...是。
... 正在执行命令 '"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -version "[16.0,17.0)" -products Microsoft.VisualStudio.Product.Community -property installationPath -format value'...是('C:\Program Files (x86)\Microsoft Visual Studio\2019\Community')。
... 正在执行命令 'set "vcroot=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community"&for /f "delims= " %a in ('type "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt"') do @if exist "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\%a\bin\HostX64\x64\cl.exe" call echo %vcroot%'...是('C:\Program Files (x86)\Microsoft Visual Studio\2019\Community')。
... 正在查找注册表设置 'HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0' InstallationFolder...否。
... 正在查找注册表设置 'HKCU\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0' InstallationFolder...否。
... 正在查找注册表设置 'HKLM\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0' InstallationFolder...是('C:\Program Files (x86)\Windows Kits\10\')。
... 正在查找环境变量 'ProgramFiles(x86)'...是('C:\Program Files (x86)')。
... 正在查找文件 'C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe'...是。
... 正在执行命令 '"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -version "[16.0,17.0)" -products Microsoft.VisualStudio.Product.Enterprise -property installationPath -format value'...否。
... 正在查找环境变量 'ProgramFiles(x86)'...是('C:\Program Files (x86)')。
... 正在查找文件 'C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe'...是。
... 正在执行命令 '"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -version "[16.0,17.0)" -products Microsoft.VisualStudio.Product.Professional -property installationPath -format value'...否。
... 正在查找环境变量 'ProgramFiles(x86)'...是('C:\Program Files (x86)')。
... 正在查找文件 'C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe'...是。
... 正在执行命令 '"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -version "[16.0,17.0)" -products Microsoft.VisualStudio.Product.Community -property installationPath -format value'...是('C:\Program Files (x86)\Microsoft Visual Studio\2019\Community')。
... 正在查找环境变量 'ProgramFiles(x86)'...是('C:\Program Files (x86)')。
... 正在查找文件 'C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe'...是。
... 正在执行命令 '"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -version "[16.0,17.0)" -products Microsoft.VisualStudio.Product.Enterprise -property installationPath -format value'...否。
... 正在查找环境变量 'ProgramFiles(x86)'...是('C:\Program Files (x86)')。
... 正在查找文件 'C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe'...是。
... 正在执行命令 '"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -version "[16.0,17.0)" -products Microsoft.VisualStudio.Product.Professional -property installationPath -format value'...否。
... 正在查找环境变量 'ProgramFiles(x86)'...是('C:\Program Files (x86)')。
... 正在查找文件 'C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe'...是。
... 正在执行命令 '"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -version "[16.0,17.0)" -products Microsoft.VisualStudio.Product.Community -property installationPath -format value'...是('C:\Program Files (x86)\Microsoft Visual Studio\2019\Community')。
... 正在执行命令 'set "vcroot=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community"&for /f "delims= " %a in ('type "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt"') do @if exist "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\%a\bin\HostX64\x64\cl.exe" call echo %vcroot%\VC\Tools\MSVC\%a'...是('C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133')。
... 正在查找环境变量 'ProgramFiles(x86)'...是('C:\Program Files (x86)')。
... 正在查找文件 'C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe'...是。
... 正在执行命令 '"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -version "[16.0,17.0)" -products Microsoft.VisualStudio.Product.Enterprise -property installationPath -format value'...否。
... 正在查找环境变量 'ProgramFiles(x86)'...是('C:\Program Files (x86)')。
... 正在查找文件 'C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe'...是。
... 正在执行命令 '"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -version "[16.0,17.0)" -products Microsoft.VisualStudio.Product.Professional -property installationPath -format value'...否。
... 正在查找环境变量 'ProgramFiles(x86)'...是('C:\Program Files (x86)')。
... 正在查找文件 'C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe'...是。
... 正在执行命令 '"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -version "[16.0,17.0)" -products Microsoft.VisualStudio.Product.Community -property installationPath -format value'...是('C:\Program Files (x86)\Microsoft Visual Studio\2019\Community')。
... 正在查找文件 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat'...是。
... 正在查找文件夹 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build'...是。
... 正在查找注册表设置 'HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows Kits\Installed Roots' KitsRoot10...是('C:\Program Files (x86)\Windows Kits\10\')。
... 正在查找注册表设置 'HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows Kits\Installed Roots' KitsRoot10...是('C:\Program Files (x86)\Windows Kits\10\')。
... 正在执行命令 'echo off&set "sdkversion="&(for /f %a IN ('dir "C:\Program Files (x86)\Windows Kits\10\include\" /b /ad-h /on') do ( @if exist "C:\Program Files (x86)\Windows Kits\10\include\%a\ucrt\" set "sdkversion=%a" ))&call echo %sdkversion%'...是('10.0.19041.0')。
... 正在查找环境变量 'MW_NVCC_PATH'...否。
... 正在查找环境变量 'CUDA_LIB_PATH'...否。
... 正在查找环境变量 'CUDA_PATH'...是('C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8')。
... 正在查找文件 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\lib\x64\cudart.lib'...是。
... 正在查找文件夹 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\lib\x64'...是。
... 正在执行命令 '(IF DEFINED MW_ALLOW_ANY_CUDA ( true ) ELSE ( false )) > NUL && echo C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\lib\x64'...否。
... 正在执行命令 '$$\bin\nvcc --version | findstr /c:"release " > NUL && echo $$'...否。
... 正在查找环境变量 'MW_NVCC_PATH'...否。
... 正在查找环境变量 'CUDA_LIB_PATH'...否。
... 正在查找环境变量 'CUDA_PATH'...是('C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8')。
... 正在查找文件 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\lib\x64\cudart.lib'...是。
... 正在查找文件夹 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\lib\x64'...是。
... 正在执行命令 '(IF DEFINED MW_ALLOW_ANY_CUDA ( true ) ELSE ( false )) > NUL && echo C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\lib\x64'...否。
... 正在执行命令 '"$$\bin\nvcc" --version | findstr /c:"release " > NUL && echo $$'...否。
... 正在查找文件 'D:\MATLAB\sys\cuda\win64\cuda\lib\x64\cudart.lib'...是。
... 正在查找文件夹 'D:\MATLAB\sys\cuda\win64\cuda\lib\x64'...是。
... 正在查找环境变量 'MW_NVCC_PATH'...否。
... 正在查找环境变量 'CUDA_BIN_PATH'...否。
... 正在查找环境变量 'CUDA_PATH'...是('C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8')。
... 正在查找文件 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\bin\nvcc.exe'...是。
... 正在查找文件夹 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8'...是。
... 正在执行命令 '(IF DEFINED MW_ALLOW_ANY_CUDA ( true ) ELSE ( false )) > NUL && echo C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8'...否。
... 正在执行命令 '$$\bin\nvcc --version | findstr /c:"release " > NUL && echo $$'...否。
... 正在查找环境变量 'MW_NVCC_PATH'...否。
... 正在查找环境变量 'CUDA_BIN_PATH'...否。
... 正在查找环境变量 'CUDA_PATH'...是('C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8')。
... 正在查找文件 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\bin\nvcc.exe'...是。
... 正在查找文件夹 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8'...是。
... 正在执行命令 '(IF DEFINED MW_ALLOW_ANY_CUDA ( true ) ELSE ( false )) > NUL && echo C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8'...否。
... 正在执行命令 '"$$\bin\nvcc" --version | findstr /c:"release " > NUL && echo $$'...否。
... 正在查找文件 'D:\MATLAB\sys\cuda\win64\cuda\bin\nvcc.exe'...是。
... 正在查找文件夹 'D:\MATLAB\sys\cuda\win64\cuda'...是。
... 正在查找文件夹 'D:\MATLAB\sys\cuda\win64\cuda'...是。
... 正在查找环境变量 'MW_NVCC_PATH'...否。
... 正在查找环境变量 'CUDA_BIN_PATH'...否。
... 正在查找环境变量 'CUDA_PATH'...是('C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8')。
... 正在查找文件 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\bin\nvcc.exe'...是。
... 正在查找文件夹 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\nvvm\libdevice'...是。
... 正在执行命令 '(IF DEFINED MW_ALLOW_ANY_CUDA ( true ) ELSE ( false )) > NUL && echo C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\nvvm\libdevice'...否。
... 正在执行命令 '$$\bin\nvcc --version | findstr /c:"release " > NUL && echo $$'...否。
... 正在查找环境变量 'MW_NVCC_PATH'...否。
... 正在查找环境变量 'CUDA_BIN_PATH'...否。
... 正在查找环境变量 'CUDA_PATH'...是('C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8')。
... 正在查找文件 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\bin\nvcc.exe'...是。
... 正在查找文件夹 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\nvvm\libdevice'...是。
... 正在执行命令 '(IF DEFINED MW_ALLOW_ANY_CUDA ( true ) ELSE ( false )) > NUL && echo C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\nvvm\libdevice'...否。
... 正在执行命令 '"$$\bin\nvcc" --version | findstr /c:"release " > NUL && echo $$'...否。
... 正在查找文件 'D:\MATLAB\sys\cuda\win64\cuda\bin\nvcc.exe'...是。
... 正在查找文件夹 'D:\MATLAB\bin\win64'...是。
... 正在查找文件夹 'D:\MATLAB\bin\win64'...是。
找到已安装的编译器 'NVIDIA CUDA Compiler'
设置 PATH = D:\MATLAB\sys\cuda\win64\cuda\nvvm\bin;D:\MATLAB\sys\cuda\win64\cuda\bin;D:\MATLAB\sys\cuda\win64\cuda\lib\x64\..;D:\MATLAB\sys\cuda\win64\cuda;D:\MATLAB\bin\win64;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64\;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\VC\vcpackages;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools;C:\Program Files (x86)\Windows Kits\10\\Bin\10.0.19041.0\x64;C:\Program Files (x86)\Windows Kits\10\\Bin\10.0.19041.0\x86;C:\Program Files (x86)\Windows Kits\10\\Bin\x64;C:\Program Files (x86)\Windows Kits\10\\Bin\x86;;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\libnvvp;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;D:\bandizip\;C:\Program Files\Wolfram Research\WolframScript\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\150\Tools\Binn\;C:\Program Files\Microsoft SQL Server\150\Tools\Binn\;C:\Program Files\Microsoft SQL Server\150\DTS\Binn\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\Hostx64\x64;C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.19041.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;D:\MATLAB\extern\lib\win64\microsoft;D:\MATLAB\lib\win64;D:\MATLAB\bin\win64;C:\Program Files\NVIDIA Corporation\Nsight Compute 2022.3.0\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files\NVIDIA Corporation\Nsight Systems 2022.4.2\target-windows-x64;D:\MATLAB\runtime\win64;C:\Users\王伟\AppData\Local\Microsoft\WindowsApps;
设置 INCLUDE = D:\MATLAB\sys\cuda\win64\cuda\include;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\atlmfc\include;C:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\ucrt;C:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\shared;C:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\um;C:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\winrt;D:\MATLAB\extern\include;D:\MATLAB\toolbox\parallel\gpu\extern\include;
设置 LIB = C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\lib\x64;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\atlmfc\lib\x64;C:\Program Files (x86)\Windows Kits\10\\Lib\10.0.19041.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\\lib\10.0.19041.0\um\x64;D:\MATLAB\lib\win64;D:\MATLAB\sys\cuda\win64\cuda\lib\x64\..;D:\MATLAB\sys\cuda\win64\cuda\lib\x64;
设置 LIBPATH = C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\lib\x64;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\atlmfc\lib\x64;
Options file details
-------------------------------------------------------------------
Compiler location: D:\MATLAB\sys\cuda\win64\cuda\bin\nvcc.exe
Options file: D:\MATLAB\toolbox\parallel\gpu\extern\src\mex\win64\nvcc_msvcpp2019.xml
CMDLINE200 : link /nologo /manifest /DLL /EXPORT:mexFunction /EXPORT:mexfilerequiredapiversion C:\Users\王伟\AppData\Local\Temp\mex_28064137006337_21244\mexGPUExample.obj C:\Users\王伟\AppData\Local\Temp\mex_28064137006337_21244\c_mexapi_version.obj /LIBPATH:"D:\MATLAB\extern\lib\win64\microsoft" libmx.lib libmex.lib libmat.lib gpumexbinder.lib cudart.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libMatlabDataArray.lib libMatlabEngine.lib /out:mexGPUExample.mexw64
CMDLINE250 : mt -outputresource:mexGPUExample.mexw64;2 -manifest "mexGPUExample.mexw64.manifest"
CMDLINE300 : del "mexGPUExample.exp" "mexGPUExample.lib" "mexGPUExample.mexw64.manifest" "mexGPUExample.ilk"
COMPILER : nvcc
COMPFLAGS : --compiler-options=/Zp8,/GR,/W3,/EHs,/nologo,/MD -gencode=arch=compute_35,code=sm_35 -gencode=arch=compute_50,code=sm_50 -gencode=arch=compute_60,code=sm_60 -gencode=arch=compute_70,code=sm_70 -gencode=arch=compute_80,code=sm_80 -gencode=arch=compute_90,code=\"sm_90,compute_90\" --dont-use-profile -ldir "D:\MATLAB\bin\win64"
NVCCFLAGS : -gencode=arch=compute_35,code=sm_35 -gencode=arch=compute_50,code=sm_50 -gencode=arch=compute_60,code=sm_60 -gencode=arch=compute_70,code=sm_70 -gencode=arch=compute_80,code=sm_80 -gencode=arch=compute_90,code=\"sm_90,compute_90\"
COMPDEFINES : --compiler-options=/DMX_COMPAT_64 --compiler-options=/DMATLAB_DEFAULT_RELEASE=R2017b --compiler-options=/DUSE_MEX_CMD --compiler-options=/D_CRT_SECURE_NO_DEPRECATE,/D_SCL_SECURE_NO_DEPRECATE,/D_SECURE_SCL=0,/DMATLAB_MEX_FILE
MATLABMEX : /DMATLAB_MEX_FILE
OPTIMFLAGS : --compiler-options=/O2,/Oy-,/DNDEBUG
INCLUDE : -I"D:\MATLAB\extern\include" -I"D:\MATLAB\simulink\include" -I"D:\MATLAB\sys\cuda\win64\cuda\include"
DEBUGFLAGS : --compiler-options=/Z7
LINKER : link
LINKFLAGS : /nologo /manifest
LINKTYPE : /DLL
LINKEXPORT : /EXPORT:mexFunction
LINKEXPORTVER : /EXPORT:mexFunction /EXPORT:mexfilerequiredapiversion
LINKLIBS : /LIBPATH:"D:\MATLAB\extern\lib\win64\microsoft" libmx.lib libmex.lib libmat.lib gpumexbinder.lib cudart.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libMatlabDataArray.lib libMatlabEngine.lib
NVVMIR_LIBRARY : --dont-use-profile -ldir "D:\MATLAB\bin\win64"
LINKDEBUGFLAGS : /debug /PDB:"mexGPUExample.mexw64.pdb"
LINKOPTIMFLAGS :
OBJEXT : .obj
LDEXT : .mexw64
SETENV : set COMPILER=nvcc
set COMPFLAGS=/c --compiler-options=/Zp8,/GR,/W3,/EHs,/nologo,/MD -gencode=arch=compute_35,code=sm_35 -gencode=arch=compute_50,code=sm_50 -gencode=arch=compute_60,code=sm_60 -gencode=arch=compute_70,code=sm_70 -gencode=arch=compute_80,code=sm_80 -gencode=arch=compute_90,code=\"sm_90,compute_90\" --dont-use-profile -ldir "D:\MATLAB\bin\win64" --compiler-options=/DMX_COMPAT_64 --compiler-options=/DMATLAB_DEFAULT_RELEASE=R2017b --compiler-options=/DUSE_MEX_CMD --compiler-options=/D_CRT_SECURE_NO_DEPRECATE,/D_SCL_SECURE_NO_DEPRECATE,/D_SECURE_SCL=0,/DMATLAB_MEX_FILE /DMATLAB_MEX_FILE
set OPTIMFLAGS=--compiler-options=/O2,/Oy-,/DNDEBUG
set DEBUGFLAGS=--compiler-options=/Z7
set LINKER=link
set LINKFLAGS=/nologo /manifest /export:%ENTRYPOINT% /DLL /LIBPATH:"D:\MATLAB\extern\lib\win64\microsoft" libmx.lib libmex.lib libmat.lib gpumexbinder.lib cudart.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libMatlabDataArray.lib libMatlabEngine.lib /EXPORT:mexFunction
set LINKDEBUGFLAGS=/debug /PDB:"%OUTDIR%%MEX_NAME%.mexw64.pdb"
set NAME_OUTPUT=/out:"%OUTDIR%%MEX_NAME%%MEX_EXT%"
VCROOT : C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
SDKROOT : C:\Program Files (x86)\Windows Kits\10\
VSINSTALLDIR : C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
VCINSTALLDIR : C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133
VCVARSALLDIR : C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build
KITSROOT : C:\Program Files (x86)\Windows Kits\10\
SDKVERSION : 10.0.19041.0
CUDA_LIB_PATH : D:\MATLAB\sys\cuda\win64\cuda\lib\x64
CUDA_ROOT : D:\MATLAB\sys\cuda\win64\cuda
LIBDEVICE : D:\MATLAB\bin\win64
MATLABROOT : D:\MATLAB
ARCH : win64
SRC : "D:\MATLAB\toolbox\parallel\gpu\extern\src\mex\mexGPUExample.cu";"D:\MATLAB\extern\version\c_mexapi_version.c"
OBJ : C:\Users\王伟\AppData\Local\Temp\mex_28064137006337_21244\mexGPUExample.obj;C:\Users\王伟\AppData\Local\Temp\mex_28064137006337_21244\c_mexapi_version.obj
OBJS : C:\Users\王伟\AppData\Local\Temp\mex_28064137006337_21244\mexGPUExample.obj C:\Users\王伟\AppData\Local\Temp\mex_28064137006337_21244\c_mexapi_version.obj
SRCROOT : D:\MATLAB\toolbox\parallel\gpu\extern\src\mex\mexGPUExample
DEF : C:\Users\王伟\AppData\Local\Temp\mex_28064137006337_21244\mexGPUExample.def
EXP : "mexGPUExample.exp"
LIB : "mexGPUExample.lib"
EXE : mexGPUExample.mexw64
ILK : "mexGPUExample.ilk"
MANIFEST : "mexGPUExample.mexw64.manifest"
TEMPNAME : mexGPUExample
EXEDIR :
EXENAME : mexGPUExample
NVCC_FLAGS :
OPTIM : --compiler-options=/O2,/Oy-,/DNDEBUG
LINKOPTIM :
CMDLINE100_0 : nvcc -c --compiler-options=/Zp8,/GR,/W3,/EHs,/nologo,/MD -gencode=arch=compute_35,code=sm_35 -gencode=arch=compute_50,code=sm_50 -gencode=arch=compute_60,code=sm_60 -gencode=arch=compute_70,code=sm_70 -gencode=arch=compute_80,code=sm_80 -gencode=arch=compute_90,code=\"sm_90,compute_90\" --dont-use-profile -ldir "D:\MATLAB\bin\win64" --compiler-options=/O2,/Oy-,/DNDEBUG --compiler-options=/DMX_COMPAT_64 --compiler-options=/DMATLAB_DEFAULT_RELEASE=R2017b --compiler-options=/DUSE_MEX_CMD --compiler-options=/D_CRT_SECURE_NO_DEPRECATE,/D_SCL_SECURE_NO_DEPRECATE,/D_SECURE_SCL=0,/DMATLAB_MEX_FILE -I"D:\MATLAB\extern\include" -I"D:\MATLAB\simulink\include" -I"D:\MATLAB\sys\cuda\win64\cuda\include" "D:\MATLAB\toolbox\parallel\gpu\extern\src\mex\mexGPUExample.cu" -o C:\Users\王伟\AppData\Local\Temp\mex_28064137006337_21244\mexGPUExample.obj && echo /Fo > NUL
CMDLINE100_1 : nvcc -c --compiler-options=/Zp8,/GR,/W3,/EHs,/nologo,/MD -gencode=arch=compute_35,code=sm_35 -gencode=arch=compute_50,code=sm_50 -gencode=arch=compute_60,code=sm_60 -gencode=arch=compute_70,code=sm_70 -gencode=arch=compute_80,code=sm_80 -gencode=arch=compute_90,code=\"sm_90,compute_90\" --dont-use-profile -ldir "D:\MATLAB\bin\win64" --compiler-options=/O2,/Oy-,/DNDEBUG --compiler-options=/DMX_COMPAT_64 --compiler-options=/DMATLAB_DEFAULT_RELEASE=R2017b --compiler-options=/DUSE_MEX_CMD --compiler-options=/D_CRT_SECURE_NO_DEPRECATE,/D_SCL_SECURE_NO_DEPRECATE,/D_SECURE_SCL=0,/DMATLAB_MEX_FILE -I"D:\MATLAB\extern\include" -I"D:\MATLAB\simulink\include" -I"D:\MATLAB\sys\cuda\win64\cuda\include" "D:\MATLAB\extern\version\c_mexapi_version.c" -o C:\Users\王伟\AppData\Local\Temp\mex_28064137006337_21244\c_mexapi_version.obj && echo /Fo > NUL
-------------------------------------------------------------------
使用 'NVIDIA CUDA Compiler' 编译。
nvcc -c --compiler-options=/Zp8,/GR,/W3,/EHs,/nologo,/MD -gencode=arch=compute_35,code=sm_35 -gencode=arch=compute_50,code=sm_50 -gencode=arch=compute_60,code=sm_60 -gencode=arch=compute_70,code=sm_70 -gencode=arch=compute_80,code=sm_80 -gencode=arch=compute_90,code=\"sm_90,compute_90\" --dont-use-profile -ldir "D:\MATLAB\bin\win64" --compiler-options=/O2,/Oy-,/DNDEBUG --compiler-options=/DMX_COMPAT_64 --compiler-options=/DMATLAB_DEFAULT_RELEASE=R2017b --compiler-options=/DUSE_MEX_CMD --compiler-options=/D_CRT_SECURE_NO_DEPRECATE,/D_SCL_SECURE_NO_DEPRECATE,/D_SECURE_SCL=0,/DMATLAB_MEX_FILE -I"D:\MATLAB\extern\include" -I"D:\MATLAB\simulink\include" -I"D:\MATLAB\sys\cuda\win64\cuda\include" "D:\MATLAB\toolbox\parallel\gpu\extern\src\mex\mexGPUExample.cu" -o C:\Users\王伟\AppData\Local\Temp\mex_28064137006337_21244\mexGPUExample.obj && echo /Fo > NUL
无法删除临时文件 'C:\Users\王伟\AppData\Local\Temp\mex_28069243218250_21244'
无法删除临时文件 'C:\Users\王伟\AppData\Local\Temp\mex_28069242896200_21244'
错误使用 mex
nvcc warning : The 'compute_35', 'compute_37', 'sm_35', and 'sm_37' architectures are deprecated, and may be
removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
出错 mexcuda (185 )
[varargout{1:nargout}] = mex(mexArguments{:});
I tried
setenv("MW_NVCC_PATH","C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\bin")
to set the environment variables right, and it seems that MATLAB could recognize CUDA_PATH but still used its pre-installed nvcc compiler, which is located at "D:\MATLAB\sys\cuda\win64\cuda\bin\nvcc.exe". The compiling failed again.
Thank you for any help and suggestion.
  9 Comments
伟
on 16 Jul 2023
Thank you for your time. The reason why I failed compling mexGPUExample.cu may be that the user's name is in Chinese, MATLAB or cuda may not support path name in Chinese. I will try to change the user's name to English and avoid any Chinese in the path name.
Thank you for your help again.
Joss Knight
Joss Knight on 18 Jul 2023

I'd be disturbed if that was the reason since both NVIDIA and Microsoft have a significant Chinese customer base! I wonder, can you successfully call nvcc commands with your user directory on the path outside MATLAB? You could try copying the commands from the verbose output and pasting them into a system call.

Sign in to comment.

Accepted Answer

伟
on 22 Jul 2023
@Joss Knight, the problem is solved. I reset my computer system, and changed the user's name to English.The mexGPUExample.cu can now be compiled successfully.
mexcuda mexGPUExample.cu
使用 'NVIDIA CUDA Compiler' 编译。
MEX 已成功完成。
So I guess that was just the reason.
When compilng, some files are written in "C:\Users\xxxx\AppData\Local\Temp" where xxxx is the user's name. If xxxx is not in English, the compiling process will fail and no error will be reported.It looks like a unicode encoding problem.
  1 Comment
Joss Knight
Joss Knight on 22 Jul 2023
Hi . Good to know. This does surprise me. I don't know whether this is a limitation of Visual Studio or of nvcc, but it almost certainly isn't a limitation of MEX. I'll follow up with the MEX team to find out.

Sign in to comment.

More Answers (0)

Categories

Find more on Get Started with GPU Coder in Help Center and File Exchange

Products


Release

R2023a

Community Treasure Hunt

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

Start Hunting!