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

#1
Posted 10/28/2010 02:42 PM   
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

#2
Posted 10/28/2010 02:42 PM   
Scroll To Top

Add Reply