CudaMemCpy Pointer of Pointer How do???

printf(“Hello Cuda World”);

I have a problem…i post my code, it is more explicative

[codebox]

int *genome_cuda;

error_cuda = cudaMemcpy2D(genome_cuda, altezza_tabella_genome * sizeof(int), &genome, pitch_genome_cuda, altezza_tabella_genome * sizeof(int), larghezza_tabella_genome * sizeof(int), cudaMemcpyHostToDevice);[/codebox]

int **genome;

genome is a point to point

this code line give me this Error (primitive translate from italian to english, sorry):

“Unmanaged Exception a 0x00841d00 in evorobotCUDA.exe: 0xC0000005: Access violation of the path reading 0x00371ae0.”

Why???

Thanks to all…

I understand because this code give me this one error. I post all code:

[codebox]void set_cuda_parameter()

{

cudaError_t error_cuda;





/*int larghezza_tabella_genome = (nindividuals + additional_ind) * npopulations;

int altezza_tabella_genome = ind->numchars;*/



//Il massimo che posso allocare è 14000 spazi di sizeof(int)

int larghezza_tabella_genome = 500;

int altezza_tabella_genome = 28;

error_cuda = cudaMalloc((void**) &neurondelta_cuda, 40 * sizeof(int));

error_cuda = cudaMalloc((void**) &neuronbias_cuda, 40 * sizeof(int));

error_cuda = cudaMalloc((void**) &neurondisplay_cuda, 40 * sizeof(int));

error_cuda = cudaMalloc((void**) &neuronlesion_cuda, 40 * sizeof(int));

error_cuda = cudaMallocPitch((void**) &net_block_cuda, &pitch_net_block_cuda, 5 * sizeof(int), 40);

error_cuda = cudaMallocPitch((void**) &neuronxy_cuda, &pitch_neuronxy_cuda, 2 * sizeof(int), 40);

//error_cuda = cudaMallocPitch((void**) &genome_cuda, &pitch_genome_cuda, larghezza_tabella_genome * sizeof(int), altezza_tabella_genome * sizeof(int));

error_cuda = cudaMallocPitch((void**) &activation_cuda, &pitch_activation_cuda, nteam * sizeof(int), 50 * sizeof(int));



error_cuda = cudaMemcpy(neurondelta_cuda,neurondelta,40 * sizeof(int), cudaMemcpyHostToDevice);

error_cuda = cudaMemcpy(neuronbias_cuda,neuronbias,40 * sizeof(int), cudaMemcpyHostToDevice);

error_cuda = cudaMemcpy(neurondisplay_cuda,neurondisplay,40 * sizeof(int), cudaMemcpyHostToDevice);

error_cuda = cudaMemcpy(neuronlesion_cuda,neuronlesion,40 * sizeof(int), cudaMemcpyHostToDevice);

error_cuda = cudaMemcpy2D(net_block_cuda, 5 * sizeof(int), &net_block,pitch_net_block_cuda, 5 * sizeof(int), 40, cudaMemcpyHostToDevice);

error_cuda = cudaMemcpy2D(neuronxy_cuda, 2 * sizeof(int), &neuronxy,pitch_neuronxy_cuda, 2 * sizeof(int), 40, cudaMemcpyHostToDevice);

//error_cuda = cudaMemcpy2D(genome_cuda, altezza_tabella_genome * sizeof(int), &genome, pitch_genome_cuda, altezza_tabella_genome * sizeof(int), larghezza_tabella_genome * sizeof(int), cudaMemcpyHostToDevice);



error_cuda = cudaMalloc((void**) &genome_cuda, altezza_tabella_genome * larghezza_tabella_genome * sizeof(int));

error_cuda = cudaMemcpy(genome_cuda, *genome, altezza_tabella_genome * larghezza_tabella_genome * sizeof(int), cudaMemcpyHostToDevice);



printf(" My CUDA Error :%s\n",cudaGetErrorString(cudaGetLastError()));

}[/codebox]

Now. After varied prove, i understand that the error is MOST memory copy.

ALTEZZA_TABELLA_GENOME is 128 and

LARGHEZZA_TABELLA_GENOME is 1000

if ALTEZZA_TABELLA_GENOME is 28 and

LARGHEZZA_TABELLA_GENOME is 500

this code don’t give me error when I copy memory HOST in memory DEVICE.

Why???

Sorry for my bad english…