copy only a few values from a device array to a host array how to write the code

I want to copy one or a few values from a device array to a host variable or host array, instead of copying the whole device array. Is this possible? How to write the code?

That is, instead of
cutilSafeCall( cudaMemcpy( h_odata, d_odata, memSize, cudaMemcpyDeviceToHost) );
Can I do:
cutilSafeCall( cudaMemcpy( h_odata, d_odata + skip_n, sizeof(float) * n_wanted, cudaMemcpyDeviceToHost) );

Thank you,

I want to copy one or a few values from a device array to a host variable or host array, instead of copying the whole device array. Is this possible? How to write the code?

That is, instead of
cutilSafeCall( cudaMemcpy( h_odata, d_odata, memSize, cudaMemcpyDeviceToHost) );
Can I do:
cutilSafeCall( cudaMemcpy( h_odata, d_odata + skip_n, sizeof(float) * n_wanted, cudaMemcpyDeviceToHost) );

Thank you,

Yes !

I remember someone asking this question before and the answer was yes cudaMemcoy allows you to specify a chunk smaller than the full array.
Looks like cutilSafeCall( cudaMemcpy( h_odata, d_odata + skip_n, sizeof(float) * n_wanted, cudaMemcpyDeviceToHost) ); is about correct as well.

Yes !

I remember someone asking this question before and the answer was yes cudaMemcoy allows you to specify a chunk smaller than the full array.
Looks like cutilSafeCall( cudaMemcpy( h_odata, d_odata + skip_n, sizeof(float) * n_wanted, cudaMemcpyDeviceToHost) ); is about correct as well.