Make CUDA annotated functions available in usual std namespace
krzikalla opened this issue · 4 comments
What are the chances that one day I will be able to write the following:
#include <complex>
#ifdef __NVCC__
#define FN_PREFIX __host__ __device__
#else
#define FN_PREFIX
#endif
FN_PREFIX void flexible_foo(std::complex<double> x)
{
std::complex<double> y = x+x;
}
In the current state the library is barely usable for me, since I still have to write my kernels and includes either with macros all over the place or without the STL at all.
We have a tentative goal to be compatible with source that is not compiled under NVCC. Is that something that's impacting you currently? If so I would be happy to attempt to fix it.
What you may be asking for however is not an immediate goal of ours. We aren't prepared to ship anything that would replace the standard library that comes with your toolchain.
Eventually you will be able to write the following with NVC++:
#include <complex>
void flexible_foo(std::complex<double> x)
{
std::complex<double> y = x+x;
}
and have it run on your CPU or GPU. __host__ __device__
isn't needed with NVC++.
Ah, that's even better. I always wondered, why the __host__ __device__
was necessary, since the compiler is already able to complain about missing those prefixes. When will NVC++ arrive?
Given that NVC++ is available with the HPC SDK I believe we can close this issue