cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

shingoxlf
Journeyman III

question about non_block writing

Hi, I was trying to text the non_blocking writing in function clEnqueueWriteBuffer. However the time I got is the same for CL_TRUE and CL_FALSE.

I thought CL_FALSE is for non_block writing, and should return immediately. The mem_init_time I got is about 9 seconds in my test for both CL_TRUE and CL_FALSE. Can someone tell me how to do the non_block writing? Thanks!

  t_start = rtclock();

  errcode |= clEnqueueWriteBuffer(clCommandQue, cl_k_matrix, CL_TRUE, 0, sizeof(double)*n_node1*n_node1, temp, 0, NULL, NULL);

  errcode |= clEnqueueWriteBuffer(clCommandQue, cl_vertex, CL_TRUE, 0, sizeof(double)*n_node1*n_node2, temp1, 0, NULL, NULL);

  errcode |= clEnqueueWriteBuffer(clCommandQue, cl_edge, CL_TRUE, 0, sizeof(double)*n_edge1*n_edge2, temp2, 0, NULL, NULL);

 

          if(errcode != CL_SUCCESS){printf("Error in initializing buffers %d\n",errcode); exit(-1);}

  t_end = rtclock();

          mem_init_time=t_end-t_start;

0 Likes
3 Replies
nou
Exemplar

how big are that buffers that you copy? because 9 seconds is just too much.

0 Likes

This code is part of a big program, the buff is really large and this copy happened many times.

the really timing is :

mem_init_time += t_end-t_start;

And it takes 9 second in total.

Anyway, my point is how to do the non_block writing, can you help?

0 Likes

well if you pass CL_FALSE as third parameter then clEnqueueRead/Write should return immediately and doesn't block. try put clFinish() before time start of timing. also consider using of profiler.

0 Likes