Pointer into device array? Device Pointer Math

Can I get a pointer on the host into a device array which is already allocated?

Something like the CUDA equivalent of:

[codebox]float* myArray = new float[64];

float* secondHalf = myArray + 32;[/codebox]

would be:

[codebox]float* myDevArray;

cudaMalloc((void**)&myDevArray, 64*sizeof(float));

float* secondHalf;


Yes, you can: [font=“Courier New”]float* secondHalf = myArray + 32;[/font]

However remember that this pointer is of little use other than in a cudaMemcpy() call.