X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/snake_gpu.git/blobdiff_plain/c17ca25473465d5550bc7e3e27b87b3d33d28dc6..af4b787ce73a80f23e9e2b1ef9ac52660e8ab754:/src/lib_gpu.cu?ds=sidebyside diff --git a/src/lib_gpu.cu b/src/lib_gpu.cu index 73571f2..1bbd61d 100644 --- a/src/lib_gpu.cu +++ b/src/lib_gpu.cu @@ -235,19 +235,23 @@ void cuda_init_img_cumul(unsigned short ** img_in, int H, int L, int nb_nodes, 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 ); }