The Heterogeneous Programming Library (HPL) is a C++ framework that provides an easy and portable way to exploit heterogeneous computing systems on top of the OpenCL standard. HPL can be used in two ways that can be mixed:
  • on top of existing OpenCL kernels, largely simplifying their usage, or
  • developing the heterogeneous kernels in the embedded language it provides, which is naturally integrated in C++

As an example, the code below computes the SAXPY function Y = alpha * X + Y, which is described in the C++ function saxpy using the HPL embedded language.

If an OpenCL C kernel is already available, it can be associated to a C++ function that is used to invoke it in HPL. The function parameter list specifies whether each non scalar arguments is an input, an output or both. HPL can get the kernel from a file or a string in the program. The following example illustrates this second possibility.