Invalid Argument error when copying data from device to host

后端 未结 4 1312
[愿得一人]
[愿得一人] 2021-01-14 16:57

I am having problems copying data from my device back to the host. My data are arranged in a struct:

typedef struct Array2D {
    double* arr;        
    in         


        
4条回答
  •  暖寄归人
    2021-01-14 17:49

    It looks like h_output is allocated with a call to malloc(). In the first call to cudaMemcpy() (line 2), h_output is being used as as a host pointer (which seems right). In the second call to cudaMemcpy() (line 4), h_output->arr is being used as a device pointer (which does not seem right). In that 4th line, it looks like you are copying from host memory to host memory. So, you will probably want to use just a straight memcpy() instead of cudaMemcpy().

    At least that is what it looks like from the code you have provided.

提交回复
热议问题