I would like to write some functions that are both host and device compatible, and change the execution depending on whether the code is being executed on the device or the host. I am trying to write a class that will be used both on the device and host, and hide the distinction from the user.
If there is no way to do this, does anybody have suggestions on how to accomplish this goal?
i.e.
__host__ __device__ void foo(){
bool executingOnHost = // how do I figure this out?
if( executingOnHost)
// do stuff using host pointers
else
// do stuff with device pointers
}