# CUDA host/device flags

**URL:** <https://forums.developer.nvidia.com/t/cuda-host-device-flags/19460>\
**Category:** CUDA Programming and Performance\
**Created:** [October 28, 2010, 2:42pm UTC](https://forums.developer.nvidia.com/t/cuda-host-device-flags/19460 "2010-10-28T14:42:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![papaboo](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/papaboo/32/37422_2.png) [@papaboo](https://forums.developer.nvidia.com/u/papaboo)\
**Post date:** [October 28, 2010, 2:42pm UTC](https://forums.developer.nvidia.com/t/cuda-host-device-flags/19460/1 "2010-10-28T14:42:52Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![papaboo](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/papaboo/32/37422_2.png) [@papaboo](https://forums.developer.nvidia.com/u/papaboo)\
**Post date:** [October 28, 2010, 2:42pm UTC](https://forums.developer.nvidia.com/t/cuda-host-device-flags/19460/2 "2010-10-28T14:42:52Z")

</div>

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
