Pointer arithmetic?

I haven’t been able to find anything in the documentation or forum so far…

Does anyone know if pointer arithmetic is supported. For example:

cudaMemcpy( hostArray, deviceArray+offset, memcpySize, cudaMemcpyDeviceToHost );


Yes, it is. offsetting a device pointer works just the same as offsetting a host pointer, both in the runtime and driver APIs.

Edit: Keep in mind however, that some functions (eg: some memory copies, especially 2D/3D aligned copies) require the device pointer be aligned appropriately - and if you pass an offset pointer to these types of calls, you’ll get an error. (note: there are unaligned versions of the 2D/3D memory copies).

Excellent!! Thanks for the quick reply. =)