SkelCL
SkelCL is a high level multi GPU skeleton library developed at the university of Münster, Germany.
 All Classes Namespaces Files Functions Variables Typedefs Groups
SkelCL Documentation

Introduction

This document describes SkelCL a multi-GPU skeleton library based on OpenCL. It is actively developed at the University of Münster, Germany, by Michel Steuwer and others. For comments or questions feel free to contact the author: miche.nosp@m.l.st.nosp@m.euwer.nosp@m.@uni.nosp@m.-muen.nosp@m.ster.nosp@m..de

Most of the functionality is explained in multiple peer-reviewed publications and in detail in a diploma thesis with the title: "Developing a Portable Multi-GPU Skeleton Library".

Two key abstractions are made in this library: algorithmic skeletons and a unified memory abstraction. This also reflects in the classes described here. The Skeleton class and subclasses describe calculations performed on a GPU. The Container classes, like Vector provides a unified memory management for CPU and GPU memory.

Example

The following example shows a full functional SkelCL program. The dot product of two vectors is calculated. The Zip skeleton combines two vectors element-wise. The Reduce skeleton reduces all elements of a vector to a single value.

#include <SkelCL/SkelCL.h>
#include <SkelCL/Zip.h>
#include <SkelCL/Reduce.h>
#include <SkelCL/Vector.h>
#include <iostream>
using namespace skelcl;
int main () {
skelcl::init(); // Initialize SkelCL
// Create zip skeleton with the multiplication as operation
Zip<float(float)> mult("(float x, float y){ return x*y; }");
// Reduce skeleton requires the identity of the given operation as
// second argument. For the addition this is 0.
Reduce<float(float)> sum("(float x, float y){ return x+y; }", "0");
// Create vectors A and B
Vector<float> A(1024); init(A.begin(), A.end());
Vector<float> B(1024); init(B.begin(), B.end());
// Execute the skeletons
Vector<float> C = sum( mult(A, B) );
// Access the calculated value.
std::cout << "Dot product: " C.front() << std::endl;
}