I am facing the following issue when trying to pass a structure from Host to Device.
Code Snippet:
struct c0
{
double R0[3][10000],R1[3][10000],R2[3][10000],R3[3][10000],SC1,SC2;
}c0_;
struct kxis3 {
int kb, lchk, nchk[100000], kchk, ktype[100000], kt[100], kt2[100];
} kxis3_;
__global__ void zero_kernel(c0 *c1, kxis3 *k1)
{
int i,j;
double s1,s2,SCB,rr,SC;
/*
..........................
Rest of Kernel code
*/
}
int main()
{
c0 *d_c1;
cudaMalloc((void **)&d_c1, sizeof(c0));
/* Line 92 */ cudaMemcpy(d_c1,c0_,sizeof(c0),cudaMemcpyHostToDevice);
cudaMalloc((void **)&d_k1, sizeof(struct kxis3));
/* Line 94 */ cudaMemcpy(d_k1,kxis3_,sizeof(struct kxis3),cudaMemcpyHostToDevice);
zero_kernel<<<2,512 >>>(d_c1,d_k1);
/* Line 96 */ cudaMemcpy(c0_,d_c1,sizeof(struct c0),cudaMemcpyDeviceToHost);
/* Line 97 */ cudaMemcpy(kxis3_,d_k1,sizeof(struct kxis3),cudaMemcpyDeviceToHost);
}
On compilation I get the following errors
The line numbers refer to the cudaMemcpy statements