memcopy a single value back to the host


Let’s say that we memcpy a large array of floats from the host to the device. The device manipulates the values in this large array. Then, I would like to bring only one value of this large array to the Host.

I would appreciate if anybody could tell me which is the most efficient way to do this. I would like to avoid copying the entire array back to the host and extracting it from there.


Then copy the amount you want!

size_t  count = 1*sizeof(...);

cudaMemcpy(..., count, cudaMemcpyDevicToHost);