Memory allocation with driver API


having a little bit of trouble with my C# implementations I need to ask a few questions.

Assume I have following code

__device__ float *ResultImageMatrix=NULL;

extern "C" void __global__ backprojectorCUDA()






From my C# environment I need to allocate the ResultImageMatrix since I don’t now in advance the size of the matrix.

Through the driver API I obtain the symbol by using cuModuleGetGlobal and there I get a CUdeviceptr which is OK.

I now need to allocate the data on the device, which I do with cuMemAlloc. But with this method I get a new CUdeviceptr which I cannot assign to the ResultImageMatrix.

How can I achieve to allocate memory for the ResultImageMatrix? I somehow need a way to set the new CUdeviceptr to the symbol.

Another question is if I had a ResultImageMatrix defined like this:

float ResultImageMatrix[1000];

is it possible to reallocate such a matrix?

I hope everything is clear for the reader, otherwise just write to me so that I can make things clearer.