Hi,
Anyone knows how can I just copy the last element of an array from GPU to CPU?
Thanks,
Shadi
Hi,
Anyone knows how can I just copy the last element of an array from GPU to CPU?
Thanks,
Shadi
You can do pointer arithmetic on device pointers from the host (just don’t dereference them!), so this is totally valid:
cudaMemcpy(h_array, d_array + n - 1, sizeof(float), cudaMemcpyDeviceToHost)
where n is the number of entries in your array, and I’ve assumed it is an array of floats.
Thanks a lot