In “cudaMemcpy”, can we assign the addresses of the src and dst to the parameters or we can only use the type pointer? Because I think it just the memory address copy, just use the address…
for example “cudaMemcpy(&h_sum,&sum,sizeof(int),cudaMemcpyDeviceToHost)”, can we use this syntax?
Should work. &src should be a pointer. In Memcpy you pass the addresses of src and dst, as usually done in C. E.g. I allocate arrays in Python and pass the address to the data area of the array as src/dst parameter - usually as an int (not size_t, which would be 64-bit using 64-bit OS).
Yeah. But it’s strange that when I use “cudaMemcpy(&dst,&src,count_bytes, cudaMemDeviceToHost)”, it doesn’t work and I replace &dst and &src by dst,src, it works well