Hi,
is it somehow possible to define different code for the host and the device in a host device function?
Here’s an example:
__host__ __device__ int test()
{
#ifdef HOST
return 0;
#else
return 1;
#endif
}
I know, this function is somewhat stupid. It is only used to explain, what I would like to do.
As far as I know, there are no such macros defined by the nvcc compiler.
The following version will also not work:
__host__ int test() { return 0; }
__device__ int test() { return 1; }
The compiler will say, that this is a redefinition of the function.
Any ideas?
Regards,
porst17