I have a memory allocated on device using malloc() function. I want to copy it to host. What I am doing right now is cudaMemcpy( dst, src, size, cudaMemcpyDeviceToHost) where dst is destination on host and src is pointer to memory allocated in kernel with malloc. This does not work, and cudaMemcpy return 0xb which translates to: "invalid argument".
Asked
Active
Viewed 38 times
0
-
Can you show some code that reproduces that error? http://stackoverflow.com/help/mcve – kangshiyin Jun 22 '16 at 12:06
-
This isn't supported. You cannot copy from allocations on the runtime heap using the host API. You will need to use a copy on the device instead – talonmies Jun 22 '16 at 12:19
-
@talonmies memcpy on the device side to the host is not supported – Grzegorz Jun 22 '16 at 13:03
-
@talonmies Is the answer from the linkt you provided still update? It concerns cuda 4 or 5 and last reply was in 2012? I am using cuda 7.5 – Grzegorz Jun 22 '16 at 13:05
-
1A pointer returned by in-kernel `malloc` (or `new`, or in-kernel `cudaMalloc`, for that matter) cannot participate in a host API `cudaMemcpy` call. The `invalid argument` error is your direct indication of this. – Robert Crovella Jun 22 '16 at 13:36
-
1Yes it is. Nothing has changed – talonmies Jun 22 '16 at 13:37