Reputation: 21082
I have bunch of common functions like swap
, min
, max
etc. How to mark them so I could call them both from the host and from the device?
Upvotes: 1
Views: 375
Reputation: 152249
You use __host__
__device__
before the function declaration, like:
__host__ __device__ int min(int A, int B) {return (A<B)?A:B;}
This is documented in the C programming guide here.
Upvotes: 5