Difference between global and device functions

后端 未结 9 1718
渐次进展
渐次进展 2021-01-29 20:10

Can anyone describe the differences between __global__ and __device__ ?

When should I use __device__, and when to use __glob

9条回答
  •  星月不相逢
    2021-01-29 20:37

    I am recording some unfounded speculations here for the time being (I will substantiate these later when I come across some authoritative source)...

    1. __device__ functions can have a return type other than void but __global__ functions must always return void.

    2. __global__ functions can be called from within other kernels running on the GPU to launch additional GPU threads (as part of CUDA dynamic parallelism model (aka CNP)) while __device__ functions run on the same thread as the calling kernel.

提交回复
热议问题