cudaErrorInvalidValue returned by cudaMemcpy
<p>I have a problem in my code, more precisely both cudaMemcpy calls return cudaErrorInvalidValue  in the following code:.  </p>

<pre><code>const int N = 3 ;
double d_doc[N][4][2500];
double d_vec_res[N][2];
double d_req[4][100];.
.
.
.    
void similarity (double doc[][4][2500], double req[4][100], double vec_res[][2]) 
    {         
        int r =  cudaMalloc((void **)&amp;d_req , 4*100*sizeof(double) ); // r = cudaSuccess
        cudaMalloc((void **)&amp;d_doc , N*2500*4*sizeof(double) );
        cudaMalloc((void **)&amp;d_vec_res , N*2*sizeof(double) );         
        int err =  cudaMemcpy(d_req, req, 4*100*sizeof(double), cudaMemcpyHostToDevice); // err = cudaErrorInvalidValue
        int err2 = cudaMemcpy(d_doc, doc, N*4*2500*sizeof(double), cudaMemcpyHostToDevice); // err = cudaErrorInvalidValue               
        sim&lt;&lt;&lt;1, N&gt;&gt;&gt;(d_doc,d_req,d_vec_res);        
        cudaMemcpy(vec_res, d_vec_res, 2*N*sizeof(double),cudaMemcpyDeviceToHost); 
         cudaFree(d_req);
         cudaFree(d_doc);
         cudaFree(d_vec_res);
     }
</code></pre>

<p>Could you help me please?.</p>