CUDA host/device flags

Hey

While writing helper methods for my kernel I would like the possibility to test them on the CPU and possibly print temporary results. Unfortunately the methods use __ffs and __popc, so when I compile them with host, I of course get an error telling me I can’t call device function from a host function.

Does nvcc define compiler flags for when it’s compiling host code and different flags when compiling device functions? Then I could use that to ifdef my way out of the problem.

/papaboo

Hey

While writing helper methods for my kernel I would like the possibility to test them on the CPU and possibly print temporary results. Unfortunately the methods use __ffs and __popc, so when I compile them with host, I of course get an error telling me I can’t call device function from a host function.

Does nvcc define compiler flags for when it’s compiling host code and different flags when compiling device functions? Then I could use that to ifdef my way out of the problem.

/papaboo