If I do this in a header file:
#if (defined(CUDA_ARCH) && (CUDA_ARCH > 0))
#define ON_CUDA_DEVICE
#else
#define ON_CUDA_HOST
#endif
Then try and use ON_CUDA_DEVICE in a .cu file that includes that header to conditionally compile code for host/device it doesn’t work? I guess because something funky is going on with the two pass compilation?
Is there anyway to get this to work as it’s a little bit more complicated as I have other #define’s in headers triggered off these - where headers are shared with .CPP files etc.
This is with CUDA 7.5 and MSVC2013. I don’t use precompiled headers.