Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Cuda data structures in .cpp files

Is it possible to use the Cuda-defined data structures, such as float3, float4, dim3 etc. in a .cpp file?

How would you go about achieving this if it is possible?

Thanks

like image 913
3Pi Avatar asked Oct 24 '25 17:10

3Pi


1 Answers

Yes you can. Just #include "vector_types.h" (make sure the CUDA include directory is in your -I path). I think this code sample demonstrates it (not that you really need an example for something this simple).

Also, some of the CUDA SDK code samples include a header called "vector_math.h", which defines a number of operators (+, *, dot, etc.) for the vector types. That would be in the SDK common/include directory, I believe (note that this is not a standard, supported part of CUDA -- it's an example of code you could write yourself).

like image 95
harrism Avatar answered Oct 26 '25 07:10

harrism



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!