gtensor icon indicating copy to clipboard operation
gtensor copied to clipboard

CUDA host/device warnings (shape ctor not device)

Open bd4 opened this issue 2 years ago • 2 comments

Building codes that use gt::adapt_device can result in a lot of spurious warnings:

include/gtensor/gtensor_span.h(263): warning #20011-D: calling a __host__ function("gt::sarray<int, (unsigned long)5ul> ::sarray(const int *, unsigned long)") from a __host__ __device__ function("gt::adapt_device<(unsigned long)5ul, const double> ") is not allowed 

It's not clear how to make the sarray ctor device, the simplest change would be to make adapt_device host only, but I think PSC may be using it. @germasch what do you think?

bd4 avatar Aug 07 '23 14:08 bd4

I think this was fixed in 54251ecdd591e6f3204a0b86d52c0944c7502958, and re-introduced in 5ef9f0b5de4adeca648b86e92813c52bd80865fa

bd4 avatar Aug 07 '23 14:08 bd4

Note that it's the version that takes an int array that is unsafe for device. The shape version is fine. The think the right solution is to re-apply fix from 54251ec, making only the shape version GT_INLINE.

bd4 avatar Aug 07 '23 14:08 bd4