Why does nvcc fails to compile a CUDA file with boost::spirit?

nvcc sometimes has trouble compiling complex template code such as is found in Boost, even if the code is only used in __host__ functions.

When a file’s extension is .cpp, nvcc performs no parsing itself and instead forwards the code to the host compiler, which is why you observe different behavior depending on the file extension.

If possible, try to quarantine code which depends on Boost into .cpp files which needn’t be parsed by nvcc.

I’d also make sure to try the nvcc which ships with the recent CUDA 4.1. nvcc‘s template support improves with each release.

Leave a Comment