Borrar filtros
Borrar filtros

How to add an NVCC flag

53 visualizaciones (últimos 30 días)
Aidan Fishenden
Aidan Fishenden el 9 de Jul. de 2024 a las 14:26
Comentada: Aidan Fishenden el 15 de Jul. de 2024 a las 13:05
I am attempting to compile a program using CUDA, and am getting the following error in response
C:\Program Files\MATLAB\R2024a\sys\cuda\win64\cuda\include\crt/host_config.h(164): fatal error C1189:
#error: -- unsupported Microsoft Visual Studio version! Only the versions between 2017 and 2022
(inclusive) are supported! The nvcc flag '-allow-unsupported-compiler' can be used to override this
version check; however, using an unsupported host compiler may cause compilation failure or incorrect run
time execution. Use at your own risk.
I looked and it seems the problem is caused by a small glitch in a recent update of visual studio that shouldnt have any effect on the compiler. How do I add the flag to override the version check? My current code is as follows
mex -setup:'C:\Program Files\MATLAB\R2024a\bin\win64\mexopts\msvcpp2022.xml' C++
mexGPUall

Respuesta aceptada

Xiao Haonan
Xiao Haonan el 13 de Jul. de 2024 a las 3:06
Hi Aiden,
I encountered the same problem, and solved it by setting environmental variable "NVCC_APPEND_FLAGS".
To do this, you can try:
setenv("NVCC_APPEND_FLAGS", '-allow-unsupported-compiler')
mexcuda -v mexGPUExample.cu
Hope it helps!
  1 comentario
Aidan Fishenden
Aidan Fishenden el 15 de Jul. de 2024 a las 13:05
This worked perfectly, thank you!

Iniciar sesión para comentar.

Más respuestas (1)

Akash
Akash el 10 de Jul. de 2024 a las 9:20
Hi Aidan,
To address the issue, you can ensure that the compiler and its version are supported with the product. You can find the list of supported and compatible compilers at the following link:-
The tables on this page outline the compilers that are supported by various MathWorks products.
For configuring parameters for CUDA code generation, you can use "coder.gpuConfig". This allows setting additional flags for the GPU compiler, including the NVCC flag. You can find more information on how to set these properties in the below provided MATLAB documentation link:-
  1 comentario
Aidan Fishenden
Aidan Fishenden el 10 de Jul. de 2024 a las 17:18
Editada: Walter Roberson el 10 de Jul. de 2024 a las 21:13
Would it be possible for you to show example code? I've gone through the page you reccomended but am still getting the same error despite the changes. It still does not recognize the flag.
mex -setup:'C:\Program Files\MATLAB\R2024a\bin\win64\mexopts\msvcpp2022.xml' C++
cfg = coder.gpuConfig( "mex" );
cfg.TargetLang = "C++";
cfg.GpuConfig.CompilerFlags = "--allow-unsupported-compiler";
cfg.GpuConfig.SelectCudaDevice = 0;
mexGPUall

Iniciar sesión para comentar.

Categorías

Más información sobre MATLAB Compiler en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by