cudaHostAlloc and memcpy


If I use cudaHostAlloc to allocate some pinned memory, is it valid to use memcpy to copy the data between two pinned memory pointers? For example if float *x; float *y; both point to pinned memory allocated with cudaHostAlloc can I use memcpy to copy the data from x to y? Or do I need to use cudaMemcpy?


You can use memcpy. You can also use cudaMemcpy with the cudaMemcpyHostToHost direction.