Hi,
I am currently working on my first CUDA project and ran into a problem with 2D arrays. Consider the following code snippet:
cudaStatus = cudaMallocPitch(&dev_traces, &pitch, N * sizeof(int), M);
cudaStatus = cudaMemcpy2D(dev_traces, pitch, traces, N * sizeof(int), N * sizeof(int), M, cudaMemcpyHostToDevice);
traces has the dimensions N and M, which should be both 10000. However, if I set N=M=480 it seems to work fine. But as soon as I use bigger values for N and M (,e.g., N=M=500) it crashes with an access violation while reading in cudaMemcpy2D().
Initialization of traces:
int **traces;
traces = new int *[POINTS_PER_TRACE];
for (int i = 0; i < POINTS_PER_TRACE; i++)
{
traces[i] = new int[NUMBER_OF_TRACES];
}
Do you have any idea what could be wrong here?