The logic of the example works as follows. Lines 8 and 9 create a buffer of 16
elements, which have no initial value. This buffer acts like an array. Line 11 constructs a
, which is a connection to an accelerator device. This simple example asks
to choose a default accelerator device, but a more robust application would probably examine the topology of the system and choose a particular accelerator. Once the queue is created, the example calls the
member function to submit work to the accelerator. The parameter to this
function is a lambda function, which executes immediately on the host. The lambda function does two things. First, it creates an
on line 12, which can writing elements in the buffer. Second, it calls the
function on line 13 to execute code on the accelerator.