tic(&chrono, NULL);
int MAX_DIAGOS = 1024*65536 ;
- int ret, Q = 100 ;
+ int ret, Q = 120 ;
+ int * d_n_diagos, h_n_diagos;
uint4 * d_diagos_snake ;
uint4 * h_diagos_snake = new uint4[MAX_DIAGOS];
-
- ret = cudaMalloc( (void**) &d_diagos_snake, MAX_DIAGOS*sizeof(uint4)) ;
- genere_diagos_rectangle<<<1,1>>>(d_diagos_snake, H,L,Q);
-
+ cudaMalloc( (void**) &d_n_diagos, sizeof(int)) ;
+ cudaMalloc( (void**) &d_diagos_snake, MAX_DIAGOS*sizeof(uint4)) ;
+
+ genere_diagos_rectangle<<<1,1>>>(d_diagos_snake, H,L,Q, d_n_diagos);
+
+ cudaMemcpy( &h_n_diagos, d_n_diagos, sizeof(int), cudaMemcpyDeviceToHost) ;
ret = cudaMemcpy( h_diagos_snake, d_diagos_snake, MAX_DIAGOS*sizeof(uint4), cudaMemcpyDeviceToHost) ;
- //cudaSuccess, cudaErrorInvalidValue, cudaErrorInvalidDevicePointer, cudaErrorInvalidMemcpyDirection
-
- printf("COPY : %d, MAX_DIAGOS = %d\n", ret, MAX_DIAGOS);
+
+ toc(chrono, "\tCalcul diagos");
+
+ printf("COPY : %s, DIAGOS = %d / %d\n", (ret==0)?"OK":"ERREUR", h_n_diagos,MAX_DIAGOS);
for (int d=0; d<200;d++){
printf("| (%d,%d)-(%d,%d) ", h_diagos_snake[d].x, h_diagos_snake[d].y, h_diagos_snake[d].z, h_diagos_snake[d].w );
}