89591

Question:
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?
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 <a href="http://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#function-type-qualifiers" rel="nofollow">here</a>.