I use OpenCL on AMD Radeon Vega 64. In the task manager i see that GPU using at 7% max. How to maximize use the GPU?
NDRange global(100000);
queue.enqueueNDRangeKernel(kernel, NULL, global));
2 Answers 2
Mostly through trial and error. Depending on your kernel, the easiest way is to simply increase the global work size. You can also attempt to use available info like CL_DEVICE_MAX_COMPUTE_UNITS or CL_DEVICE_MAX_WORK_ITEM_SIZES to programmatically determine the work size, but it's not totally reliable.
1 Comment
You can try to manually set the work group size to a value that will increase performance. Typically the defaults are good enough, but sometimes you may want to use clGetKernelWorkGroupInfo to obtain kernel-specific values, such as CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE. The latter can be used as an indication of what a good custom work group size can be for a given OpenCL kernel.