Greetings. I’m a newcomer to the CUDA world, so I’d be grateful for some help with a simple question.
I’m trying to use the new operator in CUDA 4.0, inside a device function, but the compiler is scolding me that this is a host function. The exact code is:
device ANNpoint annAllocPt(int dim, ANNcoord c) // allocate 1 point
{
ANNpoint p = new ANNcoord[dim];
for (int i = 0; i < dim; i++) p[i] = c;
return p;
}
and the error message is:
1>e:/Fermi/ANN.cu(113) (col. 11): error: calling a host function("operator new ") from a device/global function(“annAllocPt”) is not allowed
1