瀏覽代碼

examples/incrementer: the local size depends on the kernel and not on the input data size

Nathalie Furmento 14 年之前
父節點
當前提交
33ec408d01
共有 1 個文件被更改,包括 8 次插入1 次删除
  1. 8 1
      examples/incrementer/incrementer_kernels_opencl.c

+ 8 - 1
examples/incrementer/incrementer_kernels_opencl.c

@@ -38,7 +38,14 @@ void opencl_codelet(void *descr[], void *_args)
 
 	{
 		size_t global=4;
-		size_t local=4;
+		size_t local, s;
+                cl_device_id device;
+
+                starpu_opencl_get_device(devid, &device);
+                err = clGetKernelWorkGroupInfo (kernel, device, CL_KERNEL_WORK_GROUP_SIZE, sizeof(local), &local, &s);
+                if (err != CL_SUCCESS) STARPU_OPENCL_REPORT_ERROR(err);
+                if (local > global) local=global;
+
 		err = clEnqueueNDRangeKernel(queue, kernel, 1, NULL, &global, &local, 0, NULL, NULL);
 		if (err != CL_SUCCESS) STARPU_OPENCL_REPORT_ERROR(err);
 	}