cuda-api-wrappers icon indicating copy to clipboard operation
cuda-api-wrappers copied to clipboard

Should cuda::device::count() return an std::size or a device::id_t?

Open eyalroz opened this issue 5 years ago • 0 comments

Should cuda::device::count() return an std::size or a device::id_t?

std::size_t is semantically more accurate, i.e. it's the size of a set of devices. It's non-negative. And in C++ we use this types for this purpose a lot.

cuda::device::id_t is what the underlying API returns, so it has the appropriate range; it's smaller-sized; and it won't give you warnings when you compare device::id_t's to it (although it will give you warnings if you cmpare unsigned indices to it...)

Which should it be?

eyalroz avatar Apr 01 '20 14:04 eyalroz