Determine global_work_size


i have a question regarding the “clEnqueueNDRangeKernel” function parameter “const size_t *global_work_size”:

Is there a way to determine the max global_work_size before the display driver stops working? Of course i mean for GPU devices that are connected to a monitor.

On my desktop(Radeon HD 7570) and on my laptop(GeForce 9600M), those devices are connected to monitors and i noticed the global_work_size limit is somewhere between 250,000 and 360,000 before the display driver stops working. I am aware that some registry settings can be modified, like display driver timeout…etc but that is not an option for me. Is it possible to compute the max global_work_size before the driver gets restarted? Thanks in advance.

I think the only way to make shure your driver will not crash is to determine the approximate flops you can achieve and split your problem in dimensions that fit these values plus an extra backup time.

The number will change depending on the complexity and performance of the kernel you are running.

You can disable the driver timeout but your system will be unresponsive, which is not great.

You could queue up smaller global work sizes, but more of them. OpenCL 1.1 supports an offset parameter, so your kernel wouldn’t have to change (e.g, queue up 0-9999, 10000-19999, 20000-29999, etc.). This will allow the regular graphics updates a change to sneak in-between your kernel executions.