Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
One of the primary advantages of using OpenCL is that you can execute applications using thousands and thousands of threads, called work-items. The upper limit on the number of work-items you can generate is the maximum value of size_t (see SIZE_MAX in stdint.h), so it’s usually a good idea to generate one for each data point you need to process. For example, if a kernel needs to sort 216 integers and you want to process them using int4 vectors, set the total number of work-items to 216/4, or 214. This total number of work-items is called the global size.
Another rule of thumb to follow when generating work-items is that the global size should be a multiple of the maximum work-group size. Chapters 3 and 4 discussed work-groups in detail, but for this chapter, there are five main points to keep in mind: