View on GitHub

SuperGlue

A C++ Library for Data-Dependent Task Parallelism

Download this project as a .zip file Download this project as a tar.gz file

WHAT IS THIS?

SuperGlue is a C++ header-only template library for task-parallelism, with data-dependent tasks.

The programmer specifies tasks, and which data each task reads and writes, and SuperGlue uses this information to deduce dependencies.

SHOW ME THE CODE!

#include "sg/superglue.hpp"
#include <iostream>

// Settings for SuperGlue. Here we use the defaults.
struct Options : public DefaultOptions<Options> {};

// Define a task, with no dependencies.
struct MyTask : public Task<Options> {
    void run() {
        std::cout << "Hello world!" << std::endl;
    }
};

int main() {
    // The SuperGlue object starts the run-time system and starts
    // as many worker threads as there are cores.
    SuperGlue<Options> sg;

    // Create a task and submit it to SuperGlue
    sg.submit(new MyTask());

    return 0;
}

Check the "examples/" directory for more examples. The above example is found in "examples/src/helloworld.cpp". For an example with task dependencies, look at "examples/src/dependencies.cpp".

COMPILING AND INSTALLING

SuperGlue is a header-only template library. As such, it is not compiled as its own unit, but included into and compiled together with other code. The only setup that is needed is to add the "superglue/" directory to the include paths of the compiler, and enable pthreads support (compile with the -pthread flag).

To check out SuperGlue from github and build the example above:

git clone https://github.com/tillenius/superglue.git
cd superglue/
g++ examples/src/helloworld.cpp -I include/ -pthread

GETTING STARTED

Running "make" will compile and run a few unit tests. Running "make examples" will compile all examples in the "examples/" directory. The "examples_dep/" directory contains examples with external dependencies.

TUTORIALS