-
-
Save zoq/11101e2022d11527854a263061a3939b to your computer and use it in GitHub Desktop.
copy-test.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mat src(4, 1); | |
src.randn(); | |
mat dst(4, 1); | |
dst.randu(); | |
src.print(); | |
dst.print(); | |
// Copy the first three elements from src to dst. | |
cudaMemcpy((double*)dst.get_dev_mem().cuda_mem_ptr, src.get_dev_mem().cuda_mem_ptr, sizeof(double) * 3, cudaMemcpyDeviceToDevice); | |
// Copy first element from src to last element in dst. | |
cudaMemcpy((double*)dst.get_dev_mem().cuda_mem_ptr + 3, src.get_dev_mem().cuda_mem_ptr, sizeof(double) * 1, cudaMemcpyDeviceToDevice); | |
src.print(); | |
dst.print(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
that is right