CUDA and C ++ for host and device code

I started integrating CUDA into my C ++ applications a few weeks ago. I did my own research on integrating CUDA and C ++. However, I still feel uncomfortable in this thread.

Can someone help me clarify some issues based on the latest versions of Toolkit 3.2 or 4.0 RC?

  • It says that Fermi fully supports C ++ in Fermi's white paper. Does this mean that it supports C ++ both in the host code, and in the device or just in the host code?

  • What C ++ functions can I use in kernel code? I know that templates are supported. What about classes or structures?

  • Can I pass a custom instance of a class (which contains some pointers to device memory) to the kernel and call its member function in the kernel code? Do classes and structures share any differences?

Any advice is appreciated! Thank!

+3
source share
1 answer
  • Your host already supports C ++, right? But now the GeForce 400 series (codename Fermi) supports C ++ code on the device.

  • Classes are also with some limitations. See Appendix D of the manual for more details .

  • You can pass a class reference. Check section D.6.2 of the programming guide.

In general, Appendix D shows the supported C ++ constructs and code snippets. It is worth reading it.

+6
source

All Articles