Pregunta

There is some C++ code in a CUDA file that uses this pragma:

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-result"
    void foobar()
    {
        // some code
    }
#pragma GCC diagnostic pop

When this CUDA file is compiled using CUDA 5.5 nvcc compiler, the host compiler stage is fine, but the device compiler stage produces this warning:

foobar.cu(420): warning: unrecognized GCC pragma

It looks like the CUDA compiler understands that this is a GCC pragma. I have no idea why it is trying to understand all GCC pragmas. Is there any method to fix this warning or make this warning go away?

Update: Please note that passing the -Xcudafe "--diag_suppress=unrecognized_pragma" option to the nvcc compiler does not seem to have any effect.

¿Fue útil?

Solución

Try this one:

-Xcudafe "--diag_suppress=unrecognized_gcc_pragma"

Otros consejos

As shown in the duplicate question, you need to pass the following flag to nvcc:

-Xcudafe "--diag_suppress=unrecognized_pragma"
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top