I’m clueless, I don’t know why I am getting this error. Basically this is what I’m doing:
[codebox]
if(cudaMalloc((void **)&weights_d,2nEsizeof(struct smax)) != cudaSuccess) die(“Error allocating GPU memory”);
if(cudaMalloc((void **)&edges_d[0],nE*sizeof(int)) != cudaSuccess) die(“Error allocating GPU memory”);
if(cudaMalloc((void **)&edges_d[1],nE*sizeof(int)) != cudaSuccess) die(“Error allocating GPU memory”);
(…)
// somekernelthat search for the max of weights.value
// Check for kernel errors
cudaError_t error = cudaGetLastError();
// no error
(…)
// Update values
if(cudaMemcpy(&edges_d[0][m],&mOne,sizeof(int),cudaMemcpyHostToDevice)!= cudaSuccess) die(“edges0: Error Copying From Device”);
if(cudaMemcpy(&edges_d[1][m],&mOne,sizeof(int),cudaMemcpyHostToDevice)!= cudaSuccess) die(“edges1: Error Copying From Device”);
if(cudaMemcpy(&weights_d[m].value,&mInf,sizeof(float),cudaMemcpyHostToDevice)!= cudaSuccess){
sprintf(szError,"weights_d: Error copying to device. Error: %d", cudaGetLastError());
die(szError);
}
[/codebox]
Output:
weights_d: Error copying to device. Error: 17
My pointers are preserved trough the code:
weights_d: 0x2a20000
edges_d0: 0x34f0000
edges_d1: 0x37b0000
And &weights_d[m].value is: 0x2c2abb0 wich is 0x2a20000 + m*sizeof(struct smax). Of course m < nE so I should be within the video memory range.
Any suggestion or comments will be appreciated.
Regards,