[CUDA] Calling a host function from within the device

Started by
3 comments, last by maxest 12 years, 5 months ago
Exactly one year ago I used the current at the time CUDA version (don't remember which one) and I wrote some CUDA kernels that made use of my vector class. This class has some functions, mostly overloaded operators. And they all worked fine. But today I downloaded that newest CUDA toolkit, try to compile my old project and...

error: calling a host function("vec3::operator +") from a __device__/__global__ function("rasterizePixel") is not allowed

Is there a way to fix that? And I would prefer a way that avoids any modifications to vec3 class.
Advertisement
Is the function marked as __host__ __device__?
It's not marked at all. It's a regular C++ class.
Then I don't know how it ever worked. The model is that the host sends work to the device, but not the other way around. The device can only call functions that can run on the device.
I'm aware of that, but why CUDA compiler isn't smart enough to convert those functions to CUDA version? I thought the previous compiler did that

This topic is closed to new replies.

Advertisement