Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to ignore unrecognized GCC pragma warning of CUDA

📅 2014-Apr-09 ⬩ ✍️ Ashwin Nanjappa ⬩ 📚 Archive

Problem

You have a GCC pragma in your CUDA code to ignore a specific warning produced by your code. While the GCC compiler uses this for the C++ section of the code, the CUDA compiler frontend complains about it with a warning:

foo.cu(44): warning: unrecognized GCC pragma

Solution

To request the frontend of the CUDA compiler to ignore or hide this warning, pass this option during compilation:

-Xcudafe "--diag_suppress=unrecognized_gcc_pragma"

The GCC pragma warning should be hidden now.

Tried with: CUDA 5.5, GCC 4.8 and Ubuntu 12.04