Defining Macros in NVCC CUDA 9 yields error but same thing works for NVCC CUDA 8

I am on Windows 10, Visual Studio 2017, CUDA 9 (nvcc V9.0.176). Here is the bare minimum code to reproduce the issue


nvcc -c “-DMYMACRO=__pragma(warning(push,0))” fatal error C1001: An internal error has occurred in the compiler.

However, if I simply rename to test.cpp and compile with cl it works without a problem,

type test.cpp

cl -c “-DMYMACRO=__pragma(warning(push,0))” test.cpp

If I downgrade my CUDA 9 back to CUDA 8 it also works. Why is it not working on CUDA 9?

Internal compiler errors are caused by either of the following:

  1. A corrupted CUDA installation
  2. An error internal to the CUDA compiler that a programmer can do nothing about, other than filing a bug report with NVIDIA

I would suggest checking these possibilities in the order indicated. A corrupted CUDA installation could also involve mixing files from multiple different versions of CUDA. If you believe this to be a compiler bug after performing due-diligence checks, consider filing a bug using the form linked from the registered developer website. You would want to attach the smallest buildable self-contained code that reproduces the issue.