2

For now I know that such types exist, I know what fields they have, but I couldn't find a definitions for them. I.e. I found:

typedef __device_builtin__ struct uint2 uint2;

But this leaves all the questions I have intact -- what about their constructors? What about operators? And so on.

So, are the definitions (real ones) for those types published somewhere? I wouldn't like to reinvent the wheel especially not optimized (starting how to init such structure).

4

1 回答 1

8

The definitions for most of these vector types are included in:

/usr/local/cuda/include/vector_types.h

(assuming standard cuda install path). Most of them are structs, and don't require specific operator definitions for operating on struct members, nor do they have official c++ style constructors.

The "constructors" that you refer to e.g. make_int2 are inline functions defined in:

/usr/local/cuda/include/vector_functions.h

Again, they are ordinary c style functions operating on structure members, not c++ style class/struct methods.

于 2013-03-14T14:49:59.983 回答