My application needs to perform bit-vector operations like OR and XOR on bit-vectors.
e.g suppose array A = 000100101 (a.k.a bit vector)
B = 100101010
A . B = 100101111
Does CUDA support boolean variables? e.g. bool as in C. If yes, how is it stored and operated on? Does it also support bit-vector operations?. I couldn’t find the answer in the CUDA Programming Guide.
CUDA supports the standard C++
bool, but in C++ it is only a type guaranteed to support two states, so bit operations shouldn’t be used on it. In CUDA, as in C++, you get the standard complement of bitwise operators for integral types (and, or, xor, complement and left and right shift). Ideally you should aim to use a 32 bit type (or a packed 32 bit CUDA vector type) for memory throughput reasons.