I need a 64bit unsigned integer data type atomicOr, especially size_t data type.
but CUDA supports only unsigned long long int data type.
I can’t Be compatible between size_t and unsigned long long type.
So I want to use like this code:
__device__ double atomicAdd(double* address, double val)
{
unsigned long long int* address_as_ull =
(unsigned long long int*)address;
unsigned long long int old = *address_as_ull, assumed;
do {
assumed = old;
old = atomicCAS(address_as_ull, assumed,
__double_as_longlong(val +
__longlong_as_double(assumed)));
} while (assumed != old);
return __longlong_as_double(old);
}
CUDA API hasn’t double data type atomicAdd.
Can use size_t atomicOr like that?
and How to use atomicOr unsigned long long int example?
unsigned int(32bit) and int(32bit) are compiled, but unsigned long long int(64bit) has occurred… I don’t know the reason.
What is this supposed to mean? On all platforms supported by CUDA, both ‘size_t’ and ‘unsigned long long int’ are unsigned 64-bit integer types, and the former might even just be a typedef of the latter. So casting in either direction should be perfectly fine.
but when I use the size_t in atomicOr, it occurred this error message
error: no instance of overloaded function “atomicOr” matches the argument list argument types are: (size_t *, size_t)
and when I use the unsigned long long in atomicOr, it occurred this error message
error: no instance of overloaded function “atomicOr” matches the argument list argument types are: (unsigned long long *, unsigned long long)
but, when I use the int or unsigned int in atomicOr, there was no any compile error.
That’s a different issue than the one I understood you were raising in your earlier post. Not all functions are necessarily overloaded for all data types. There may be limitations due to GPU architecture. From the CUDA Programming Guide:
You would want to specify the architecture of your GPU when building the code. The compiler likely defaults to a build target of compute capability 3.0.