Browse Source

tests/datawizard/increment_redux_v2.c: force queue synchronisation when finishing codelet

Nathalie Furmento 13 years ago
parent
commit
4ab290b2b2
1 changed files with 3 additions and 1 deletions
  1. 3 1
      tests/datawizard/increment_redux_v2.c

+ 3 - 1
tests/datawizard/increment_redux_v2.c

@@ -86,6 +86,7 @@ static void redux_opencl_kernel(void *descr[], void *arg)
 	h_dst += h_src;
 
 	clEnqueueWriteBuffer(queue, d_dst, CL_TRUE, 0, sizeof(unsigned), (void *)&h_dst, 0, NULL, NULL);
+	clFinish(queue);
 }
 
 static void neutral_opencl_kernel(void *descr[], void *arg)
@@ -99,6 +100,7 @@ static void neutral_opencl_kernel(void *descr[], void *arg)
 	starpu_opencl_get_current_queue(&queue);
 
 	clEnqueueWriteBuffer(queue, d_dst, CL_TRUE, 0, sizeof(unsigned), (void *)&h_dst, 0, NULL, NULL);
+	clFinish(queue);
 }
 #endif
 
@@ -166,6 +168,7 @@ static void increment_opencl_kernel(void *descr[], void *cl_arg __attribute__((u
 	clEnqueueReadBuffer(queue, d_token, CL_TRUE, 0, sizeof(unsigned), (void *)&h_token, 0, NULL, NULL);
 	h_token++;
 	clEnqueueWriteBuffer(queue, d_token, CL_TRUE, 0, sizeof(unsigned), (void *)&h_token, 0, NULL, NULL);
+	clFinish(queue);
 }
 #endif
 
@@ -282,7 +285,6 @@ int main(int argc, char **argv)
 		_STARPU_DEBUG("%d != %d\n", var, ntasks*nloops);
 		goto err;
 	}
-	
 
 	starpu_shutdown();