Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
With the C++ Wrapper API, you can build applications that combine the high performance of OpenCL and the high-level object-oriented features of C++. C++ programming is usually considered to be more complicated than C programming, but if you compare the code listings in this chapter with those of previous chapters, I’m sure you’ll agree that you can obtain the same results with much less code by using C++.
This chapter has discussed the C++ API for OpenCL, and we started with the process of creating kernels. Instead of data structures like cl_platform_id and cl_context, we rely on objects instantiated from classes such as cl::Platform and cl::Context. Not only does this provide greater organization, but it also makes the code simpler. For example, if you want information about an object, you can simply call getInfo with a template instead of calling functions like clGetPlatformInfo and clGetDeviceInfo with their many parameters.