Forráskód Böngészése

src/drivers/opencl/driver_opencl.c: really implement a synchronous copy

	If blocking_write is CL_TRUE, the OpenCL implementation copies the data referred to by ptr
	and enqueues the write operation in the command-queue. The memory pointed to by ptr can be
	reused by the application after the clEnqueueWriteBuffer call returns.

we use CL_FALSE to avoid the use of a temporary buffer, and call clFinish to synchronise the
queue
Nathalie Furmento 13 éve
szülő
commit
3d50759006
1 módosított fájl, 4 hozzáadás és 3 törlés
  1. 4 3
      src/drivers/opencl/driver_opencl.c

+ 4 - 3
src/drivers/opencl/driver_opencl.c

@@ -201,9 +201,10 @@ cl_int starpu_opencl_allocate_memory(cl_mem *mem, size_t size, cl_mem_flags flag
 	 * want to know this __now__, so we just perform a dummy copy.
 	 */
 	char dummy = 0;
-	err = clEnqueueWriteBuffer(queues[worker->devid], memory, CL_TRUE,
-				0, sizeof(dummy), &dummy,
-				0, NULL, NULL);
+	err = clEnqueueWriteBuffer(queues[worker->devid], memory, CL_FALSE,
+				   0, sizeof(dummy), &dummy,
+				   0, NULL, NULL);
+	clFinish(queues[worker->devid]);
 	if (err == CL_MEM_OBJECT_ALLOCATION_FAILURE)
 		return err;
 	if (err != CL_SUCCESS)