Declare a function for both device and host?

Hello,

I have several functions that I use both on the host and the device. Currently I have to write every function twice because I need to precede the device functions with device and accordingly the host functions with host. Is there a way to avoid this?

Kind Regards

You can declare functions as

__device__ __host__ function(..)

and it will be available for both device and host code.

Thank you, I guess this should have been obvious to me :smile:

Thank you, I guess this should have been obvious to me :smile: