function inside the cuda kernel

small_potato picture small_potato · Oct 15, 2010 · Viewed 16.8k times · Source

Is there any ways i can have a function inside cuda kernel. I mean my cuda kernel gets pretty long and hard to debug at one point. Thanks.

Answer

Andrey picture Andrey · Oct 15, 2010

yes, just mark function with __device__ and it will be callable only from GPU. Check CUDA Programming guide, section B.1 Here is the direct link