C++ support?

I made a little templated CudaArray class to simplify allocation and transfers of arrays to and from the card, inside .cu files. This works fine as long as these array objects are stack allocated, and the code is a lot cleaner and more readable.

But when using dynamically allocated or statically initialized C++ objects in .cu files I get linking errors. I assume this is because the compiler doesn’t generate initializers that are compatible with the MSVC linker, or that for some reason they simply aren’t generated since it thinks it’s C, somehow.

Is better C++ support coming anytime soon?

Yes, better C++ support is in the pipeline.

Currently function templates do work quite well on global and device functions – I use them all the time to ensure decisions are made a compile time rather than runtime to improve performance.

However I have not made much use of classes or class templates in code compiled by nvcc due to the current linker limitations. YMMV.


Ah, good to see that it’s coming.

I assume there is no easy workaround for the linking problems at this time?

How do one invoke templatized functions?

I’ve played around a bit, but the templatized functions disappear from the .ptx-files…?