OpenCL Programming Guide - 10.1 C++ Wrapper API

C++ wrapper API overview

The C++ API is divided into multiple classes, each of which is mapped to an OpenCL C type. For example, the cl::Memory class is mapped to cl_mem in OpenCL C. However, the C++ API uses inheritance when possible to provide an additional layer of type abstraction; for example, class cl::Buffer is derived from the base class cl::Memory and represents the 1-dimensional memory subclass of all possible OpenCL memory objects. The class hierarchy architecture is shown in Figure 12-1.
Insert image description here
Generally, C++ class types have a direct mapping to the underlying OpenCL C type, in which case the underlying C type can be accessed via operator(). For example, the following code can get the first OpenCL platform, query the underlying OpenCL C type cl_platform, and assign it to the variable platform:

extern void someFunction(cl_program);

cl_platform platform;
{
   
    
    
    std

Guess you like

Origin blog.csdn.net/qq_36314864/article/details/132733773