Basic structure of an ALF application

The basic structure of an ALF application is shown in Figure 1. The process on the host is as follows:
  1. Initialize the ALF runtime.
  2. Create a compute task.
  3. After the task is created, you start to add work blocks to the work queue of the task.
  4. Wait for the task to complete and shut down the ALF runtime to release the allocated resources.
The process on the accelerator is as follows:
  1. After an instance of the task is spawned, it waits for pending work blocks to be added to the work queue.
  2. The alf_accel_comp_kernel function is called for each work block.
  3. If the task has been created with a task descriptor with ALF_TASK_DESC_PARTITION_ON_ACCEL set to 1, then the alf_accel_input_dtl_prepare function is called before the invocation of the compute kernel and the alf_accel_output_dtl_prepare function is called after the compute kernel exits.

For examples of ALF applications including some source code samples, see Examples.

Figure 1. ALF application structure and process flowALF application structure and process flow.