CUDA suppress or otherwise get rid of "Calling host funciton from a host device functions is not allowed" warning

I have code that looks something like this:

__host__ __device__ void Bar() {}

__host__ void Foo() {
    Bar();
}

This code produces the following warnings: #20014-D and #20011-D - how can I get around the compiler throwing these warnings at me? I’ve read that NVCC has its own pragma suppress, but when I tried it it didn’t work. I think separating the Bar function into a __host__ and __device__ implementation would probably work, but it doesn’t feel very clean. Any advice is very much appreciated.

FWIW your example is not what would trigger the warning you indicate. (You are calling a host/device function from a host function which is entirely ok and would not trigger a warning. The warning, as indicated, comes from calling a host function from a host/device function.)

Otherwise this or this may be of interest.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.