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).

greenoldman
  • 16,895
  • 26
  • 119
  • 185
  • 1
    http://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#vector-types Have you read this? – KiaMorot Mar 14 '13 at 14:05
  • Thank you, in pdf, yes, but does it mean it is all? – greenoldman Mar 14 '13 at 14:46
  • Well I don't know if there's source available. So I'd say yes. In any case why would you need to know such information? Personally I don't like this CUDA black box as even NVIDIAs' engineers don't know what's happening in there so I don't use those built-in types. – KiaMorot Mar 14 '13 at 14:48
  • @KiaMorot, perfomance & reusability. – greenoldman Mar 14 '13 at 14:52

1 Answers1

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.

Robert Crovella
  • 143,785
  • 11
  • 213
  • 257