View on GitHub

Habanero-C++

A Compiler-free Work-Stealing Library

Habanero-C++ Overview

The different types of supported intra-node asynchronous tasks are as following:


(1) Asynchronous parallel task

async([capture_list]() {
  S1;
});

(2) Asynchronous parallel task depending on data driven futures (DDFs)

asyncAwait(ddf_1, ddf_2, ...., [capture_list]() {
  S2;
});

(3) Asynchronous parallel for-loop iterations

// parallel for loop
// loop properties
loop_domain_t loop0 = {loopLowBound, loopHighBound, loopStride, tileSize};

// Loop iterations are recursively partitioned until the size of a block 
// size specified by the "tile_size" is reached. 
// This is similar to the TBB style.
int schedule_type = FORASYNC_MODE_RECURSIVE; 

// Loop iterations are chunked into blocks of lengths 
// specified by the "tile_size".
schedule_type = FORASYNC_MODE_FLAT;

// 1-Dimension for-loop
forasync1D(&loop0, [capture_list]() {
  S3;
}, schedule_type);

// 2-Dimension for-loop
loop_domain_t loop[2] = {loop0, loop1};
forasync2D(loop, [capture_list]() {
  S3;
}, schedule_type);

// 3-Dimension for-loop
loop_domain_t loop[3] = {loop0, loop1, loop2};
forasync3D(loop, [capture_list]() {
  S3;
}, schedule_type); 

These asynchronous tasks can be joined by using a finish:

finish([capture_list]() {
  async(....);
  asyncAwait(...);
  forasync1D(...);
  forasync2D(...);
  forasync3D(...);
});

Light-weight standalone runtime of Habanero-C++ also supports three extra runtime features:

(1) Hierarchical Place Trees (HPTs).
(2) Memory management tool from Habanero-C.
(3) Binding worker threads to cores (Linux only).