GPU coder configured for MinGW-w64 C/C++/Fortran compiler passes invalid options to nvcc. How to remove?
8 次查看(过去 30 天)
显示 更早的评论
Passing MATLAB code to GPU coder (v24.02) fails while building MEX as the build script invokes nvcc with bare options like "-Wno-stringop-overflow", which I'm guessing should be "-Xcompiler -Wno-stringop-overflow" as nvcc (v12.8) does not accept the warning disabling options but g++ does. From settings or coder.gpuConfig, I can only add compiler flags, but how do I remove or change the build script to correct the options/flags sent to nvcc?
0 个评论
回答(1 个)
Nathaniel
2025-2-6
编辑:Nathaniel
2025-2-6
Hey Jeffrey,
I see you're using GPU Coder with MinGW to build MEX, and the compiler is receiving some invalid options. Please note that GPU Coder does not support MinGW. It only supports using the Microsoft Visual C/C++ compiler. See the supported compilers for GPU Coder in R2024b here:
GPU Coder uses CUDA version 12.2 to build MEX in R2024b, so the compiler should be compatible with CUDA 12.2. This version of CUDA supports both Visual Studio 2017 or 2019. See Visual Studio Older Downloads to get Visual Studio 2017 or 2019.
You can also use Microsoft Visual Studio 2022, but CUDA 12.2 only supports Visual Studio 2022 version 17.0.
Is Visual C/C++ available to you? If you have it installed, you can enter mex -setup C++ in the MATLAB command line to select the Visual C/C++ compiler.
Thanks,
Nathaniel
2 个评论
Chao Luo
2025-2-7
Hi Jeffrey,
Many flags are hardcoded and cannot be removed using config files. You can modify the genearted build.ninja to remove the flags in the codegen folder. You can run !YouFcn_mex.bat to recompile the generated code.
However, even if you removed the unsupported flags, the compilation would still fail since NVCC would error out complaining cl.exe not found.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Get Started with GPU Coder 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!