Popularity
2.7
Growing
Activity
8.6
Declining
77
18
31

Programming language: C++
Tags: Concurrency    
Latest version: v0.3.5

alpaka alternatives and similar libraries

Based on the "Concurrency" category

Do you think we are missing an alternative of alpaka or a related project?

Add another 'Concurrency' Library

README

alpaka - Abstraction Library for Parallel Kernel Acceleration

Travis CI Build Status Language Platforms License

[Alpaka](doc/images/alpaka_401x135.png)

The alpaka library is a header-only C++11 abstraction library for accelerator development.

Its aim is to provide performance portability across accelerators through the abstraction (not hiding!) of the underlying levels of parallelism.

It is platform independent and supports the concurrent and cooperative use of multiple devices such as the hosts CPU as well as attached accelerators as for instance CUDA GPUs and Xeon Phis (currently native execution only). A multitude of accelerator back-end variants using CUDA, OpenMP (2.0/4.0), Boost.Fiber, std::thread and also serial execution is provided and can be selected depending on the device. Only one implementation of the user kernel is required by representing them as function objects with a special interface. There is no need to write special CUDA, OpenMP or custom threading code. Accelerator back-ends can be mixed within a device queue. The decision which accelerator back-end executes which kernel can be made at runtime.

The alpaka API is currently unstable (beta state).

The abstraction used is very similar to the CUDA grid-blocks-threads division strategy. Algorithms that should be parallelized have to be divided into a multi-dimensional grid consisting of small uniform work items. These functions are called kernels and are executed in parallel threads. The threads in the grid are organized in blocks. All threads in a block are executed in parallel and can interact via fast shared memory. Blocks are executed independently and can not interact in any way. The block execution order is unspecified and depends on the accelerator in use. By using this abstraction the execution can be optimally adapted to the available hardware.

Software License

alpaka is licensed under MPL-2.0.

Documentation

The [general documentation](doc/markdown/Index.md) is located within the doc/markdown subfolder of the repository. The source code documentation is generated with doxygen.

Accelerator Back-ends

Accelerator Back-end Lib/API Devices Execution strategy grid-blocks Execution strategy block-threads
Serial n/a Host CPU (single core) sequential sequential (only 1 thread per block)
OpenMP 2.0+ blocks OpenMP 2.0+ Host CPU (multi core) parallel (preemptive multitasking) sequential (only 1 thread per block)
OpenMP 2.0+ threads OpenMP 2.0+ Host CPU (multi core) sequential parallel (preemptive multitasking)
OpenMP 4.0+ (CPU) OpenMP 4.0+ Host CPU (multi core) parallel (undefined) parallel (preemptive multitasking)
std::thread std::thread Host CPU (multi core) sequential parallel (preemptive multitasking)
Boost.Fiber boost::fibers::fiber Host CPU (single core) sequential parallel (cooperative multitasking)
TBB TBB 2.2+ Host CPU (multi core) parallel (preemptive multitasking) sequential (only 1 thread per block)
CUDA CUDA 8.0-10.0 NVIDIA GPUs parallel (undefined) parallel (lock-step within warps)
HIP(nvcc) HIP 1.5+ NVIDIA GPUs SM 2.0+ parallel (undefined) parallel (lock-step within warps)

Supported Compilers

This library uses C++11 (or newer when available).

Accelerator Back-end gcc 4.9.4 (Linux) gcc 5.5 (Linux) gcc 6.4/7.3 (Linux) gcc 8.1/9.1 (Linux) clang 4 (Linux) clang 5 (Linux) clang 6 (Linux) clang 7 (Linux) clang 8 (Linux) Apple LLVM 10.0.0 (macOS) MSVC 2017.9 (Windows)
Serial :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark:
OpenMP 2.0+ blocks :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :x: :white_check_mark:
OpenMP 2.0+ threads :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :x: :white_check_mark:
OpenMP 4.0+ (CPU) :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :x: :x:
std::thread :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark:
Boost.Fiber :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :x: :white_check_mark:
TBB :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark:
CUDA (nvcc) :white_check_mark: (CUDA 8.0-10.1) :white_check_mark: (CUDA 9.0-10.1) :white_check_mark: (CUDA 9.2-10.1) :x: :white_check_mark: (CUDA 9.1-10.1) :white_check_mark: (CUDA 10.1) :white_check_mark: (CUDA 10.1) :white_check_mark: (CUDA 10.1) :white_check_mark: (CUDA 10.1) :x: :white_check_mark: (CUDA 10.0-10.1)
CUDA (clang) - - - - :white_check_mark: (CUDA 8.0) :white_check_mark: (CUDA 8.0) :white_check_mark: (CUDA 8.0-9.0) :white_check_mark: (CUDA 8.0-9.2) :white_check_mark: (CUDA 8.0-10.0) - -
[HIP](doc/markdown/user/implementation/mapping/HIP.md) (nvcc) :white_check_mark: (nvcc 9.0+) :x: :x: :x: :x: :x: :x: :x: :x: :x: :x:

Other compilers or combinations marked with :x: in the table above may work but are not tested in CI and are therefore not explicitly supported.

Dependencies

Boost 1.62+ is the only mandatory external dependency (for CUDA 9+ Boost >=1.65.1 is required). The alpaka library itself just requires header-only libraries. However some of the accelerator back-end implementations require different boost libraries to be built.

When an accelerator back-end using Boost.Fiber is enabled, boost-fiber and all of its dependencies are required to be built in C++11 mode ./b2 cxxflags="-std=c++11". When Boost.Fiber is enabled and alpaka is built in C++17 mode with clang and libstc++, Boost >= 1.67.0 is required.

When an accelerator back-end using CUDA is enabled, version 8.0 of the CUDA SDK is the minimum requirement. NOTE: When using nvcc as CUDA compiler, the CUDA accelerator back-end can not be enabled together with the Boost.Fiber accelerator back-end due to bugs in the nvcc compiler. NOTE: When using clang as a native CUDA compiler, the CUDA accelerator back-end can not be enabled together with any OpenMP accelerator back-end because this combination is currently unsupported. NOTE: Separable compilation is only supported when using nvcc, not with clang as native CUDA compiler. It is disabled by default and can be enabled via the CMake flag ALPAKA_CUDA_NVCC_SEPARABLE_COMPILATION.

When an accelerator back-end using OpenMP is enabled, the compiler and the platform have to support the corresponding minimum OpenMP version.

When an accelerator back-end using TBB is enabled, the compiler and the platform have to support the corresponding minimum TBB version.

Usage

The library is header only so nothing has to be built. CMake 3.11.4+ is required to provide the correct defines and include paths. Just call ALPAKA_ADD_EXECUTABLE instead of CUDA_ADD_EXECUTABLE or ADD_EXECUTABLE and the difficulties of the CUDA nvcc compiler in handling .cu and .cpp files are automatically taken care of. Source files do not need any special file ending. Examples of how to utilize alpaka within CMake can be found in the example folder.

The whole alpaka library can be included with: #include <alpaka/alpaka.hpp> Code that is not intended to be utilized by the user is hidden in the detail namespace.

Introduction

For a quick introduction, feel free to playback the recording of our presentation at GTC 2016:

  • E. Zenker, R. Widera, G. Juckeland et al., Porting the Plasma Simulation PIConGPU to Heterogeneous Architectures with Alpaka, video link (39 min)

Citing alpaka

Currently all authors of alpaka are scientists or connected with research. For us to justify the importance and impact of our work, please consider citing us accordingly in your derived work and publications:

% Peer-Reviewed Publication %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Peer reviewed and accepted publication in
%   "2nd International Workshop on Performance Portable
%    Programming Models for Accelerators (P^3MA)"
% colocated with the
%   "2017 ISC High Performance Conference"
%   in Frankfurt, Germany
@inproceedings{MathesP3MA2017,
  author    = {{Matthes}, A. and {Widera}, R. and {Zenker}, E. and {Worpitz}, B. and
               {Huebl}, A. and {Bussmann}, M.},
  title     = {Tuning and optimization for a variety of many-core architectures without changing a single line of implementation code
               using the Alpaka library},
  archivePrefix = "arXiv",
  eprint    = {1706.10086},
  keywords  = {Computer Science - Distributed, Parallel, and Cluster Computing},
  day       = {30},
  month     = {Jun},
  year      = {2017},
  url       = {https://arxiv.org/abs/1706.10086},
}

% Peer-Reviewed Publication %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Peer reviewed and accepted publication in
%   "The Sixth International Workshop on
%    Accelerators and Hybrid Exascale Systems (AsHES)"
% at the
%   "30th IEEE International Parallel and Distributed
%    Processing Symposium" in Chicago, IL, USA
@inproceedings{ZenkerAsHES2016,
  author    = {Erik Zenker and Benjamin Worpitz and Ren{\'{e}} Widera
               and Axel Huebl and Guido Juckeland and
               Andreas Kn{\"{u}}pfer and Wolfgang E. Nagel and Michael Bussmann},
  title     = {Alpaka - An Abstraction Library for Parallel Kernel Acceleration},
  archivePrefix = "arXiv",
  eprint    = {1602.08477},
  keywords  = {Computer science;CUDA;Mathematical Software;nVidia;OpenMP;Package;
               performance portability;Portability;Tesla K20;Tesla K80},
  day       = {23},
  month     = {May},
  year      = {2016},
  publisher = {IEEE Computer Society},
  url       = {http://arxiv.org/abs/1602.08477},
}


% Original Work: Benjamin Worpitz' Master Thesis %%%%%%%%%%
%
@MasterThesis{Worpitz2015,
  author = {Benjamin Worpitz},
  title  = {Investigating performance portability of a highly scalable
            particle-in-cell simulation code on various multi-core
            architectures},
  school = {{Technische Universit{\"{a}}t Dresden}},
  month  = {Sep},
  year   = {2015},
  type   = {Master Thesis},
  doi    = {10.5281/zenodo.49768},
  url    = {http://dx.doi.org/10.5281/zenodo.49768}
}

Authors

Maintainers and Core Developers

  • Benjamin Worpitz (original author)
  • Rene Widera

Former Members, Contributions and Thanks

  • Dr. Michael Bussmann
  • Axel Huebl
  • Erik Zenker


*Note that all licence references and agreements mentioned in the alpaka README section above are relevant to that project's source code only.