__host__ and __device__


If I use host and device at a function definition, how can I separate sections which should compile only on the host, or only on the device? CudaMath.h, BlackScholes.cu and simpleCUFFT.cu have functions like this, but there they are all identical for both targets. Unlike float4, threadIDx etc. cannot be used in such a way, and I’d really prefer not to use two separately named functions. Are there #defines I could use?


Hi again,

I couldn’t find a way. For the moment I’ll use two function sets, with the device ones appended: _d. Until recently I’d been working in emulation mode, where threadIDx etc. are defined, and filled with zeros.