kamping
KaMPIng: (Near) zero-overhead MPI wrapper for modern C++
Science Score: 67.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 6 DOI reference(s) in README -
✓Academic publication links
Links to: arxiv.org, zenodo.org -
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (14.3%) to scientific vocabulary
Keywords
Repository
KaMPIng: (Near) zero-overhead MPI wrapper for modern C++
Basic Info
- Host: GitHub
- Owner: kamping-site
- License: lgpl-3.0
- Language: C++
- Default Branch: main
- Homepage: https://kamping-site.github.io/kamping/
- Size: 30.1 MB
Statistics
- Stars: 54
- Watchers: 6
- Forks: 4
- Open Issues: 45
- Releases: 4
Topics
Metadata Files
README.md
KaMPIng: Karlsruhe MPI next generation :rocket:
This is KaMPIng [kampɪŋ], a (near) zero-overhead MPI wrapper for modern C++.
It covers the whole range of abstraction levels from low-level MPI calls to convenient STL-style bindings, where most parameters are inferred from a small subset of the full parameter set. This allows for both rapid prototyping and fine-tuning of distributed code with predictable runtime behavior and memory management.
Using template-metaprogramming, only code paths required for computing parameters not provided by the user are generated at compile time, which results in (near) zero-overhead bindings.
:running: Quick Start: KaMPIng is header-only, compatible with all major MPI implementations and requires a C++17-ready compiler. The easiest way to get started is to include KaMPIng using CMake's FetchContent module. ```cmake include(FetchContent) FetchContentDeclare( kamping GITREPOSITORY https://github.com/kamping-site/kamping.git GIT_TAG v0.1.1 )
FetchContentMakeAvailable(kamping) targetlink_libraries(myapp PRIVATE kamping::kamping) ``` It is fully compatible with your existing MPI code and you can start using it right away. Just include the headers for the main communicator class and the MPI call that you want to use.
``` c++
include
include
kamping::Communicator comm;
std::vector
We provide a wide range of usage and simple applications examples (start with allgatherv). Or checkout the documentation for a description of KaMPIng's core concepts and a full reference.
KaMPIng is developed at the Algorithm Engineering Group at Karlsruhe Institute of Technology.
If you use KaMPIng in the context of an academic publication, we kindly ask you to cite our SC'24 paper:
bibtex
@inproceedings{kamping2024,
author = {Uhl, Tim Niklas and Schimek, Matthias and Hübner,
Lukas and Hespe, Demian and Kurpicz, Florian and
Seemaier, Daniel and Stelz, Christoph and Sanders,
Peter},
booktitle = {SC24: International Conference for High Performance
Computing, Networking, Storage and Analysis},
title = {KaMPIng: Flexible and (Near) Zero-Overhead C++
Bindings for MPI},
year = {2024},
pages = {1-21},
doi = {10.1109/SC41406.2024.00050}
}
You can also find a freely accessibly post-print in the arXiv.
Features :sparkles:
Named Parameters :speech_balloon:
Using plain MPI, operations like MPI_Allgatherv often lead to verbose and error-prone boilerplate code:
``` c++
std::vector
```
In contrast, KaMPIng introduces a streamlined syntax inspired by Python's named parameters. For example, the allgatherv operation becomes more intuitive and concise:
c++
std::vector<T> v = ...; // Fill with data
std::vector<T> v_glob = comm.allgatherv(kamping::send_buf(v));
Empowered by named parameters, KaMPIng allows users to name and pass parameters in arbitrary order, computing default values only for the missing ones. This not only improves readability but also streamlines the code, providing a user-friendly and efficient way of writing MPI applications.
Controlling memory allocation :floppy_disk:
KaMPIng's resize policies allow for fine-grained control over when allocation happens:
| resize policy | |
|--------------------------|-------------------------------------------------------------------------|
| kamping::resize_to_fit | resize the container to exactly accommodate the data |
| kamping::no_resize | assume that the container has enough memory available to store the data |
| kamping::grow_only | only resize the container if it not large enough |
``` c++
// easy to use with sane defaults
std::vector
// flexible memory control
std::vector
STL support :books:
- KaMPIng works with everything that is a
std::contiguous_range, everywhere. - Builtin C++ types are automatically mapped to their corresponding MPI types.
- All internally used containers can be altered via template parameters. ### Expandability :jigsaw:
- Don't like the performance of your MPI implementation's reduce algorithm? Just override it using our plugin architecture.
- Add additional functionality to communicator objects, without altering any application code.
- Easy to integrate with existing MPI code.
- Flexible core library for a new toolbox :toolbox: of distributed datastructures and algorithms
And much more ... :arrowupperright:
- Safety guarantees for non-blocking communication and easy handling of multiple requests via request pools
- Compile time and runtime error checking (which can be completely deactivated).
- Collective hierarchical timers to speed up your evaluation workflow.
- ...
Dive into the documentation or tests to find out more ...
(Near) zero overhead - for development and performance :chartwithupwards_trend:
Using template-metaprogramming, KaMPIng only generates the code paths required for computing parameters not provided by the user. The following shows a complete implementation of distributed sample sort with KaMPIng.
c++
void sort(MPI_Comm comm_, std::vector<T>& data, size_t seed) {
Communicator<> comm(comm_);
size_t const oversampling_ratio = 16 * static_cast<size_t>(std::log2(comm.size())) + 1;
std::vector<T> local_samples(oversampling_ratio);
std::sample(data.begin(), data.end(), local_samples.begin(), oversampling_ratio, std::mt19937{seed});
auto global_samples = comm.allgather(kamping::send_buf(local_samples));
std::sort(global_samples.begin(), global_samples.end());
for (size_t i = 0; i < comm.size() - 1; i++) {
global_samples[i] = global_samples[oversampling_ratio * (i + 1)];
}
global_samples.resize(num_splitters);
std::vector<std::vector<T>> buckets(global_samples.size() + 1);
for (auto& element: data) {
auto const bound = std::upper_bound(global_samples.begin(), global_samples.end(), element);
buckets[static_cast<size_t>(bound - global_samples.begin())].push_back(element);
}
data.clear();
std::vector<int> scounts;
for (auto& bucket: buckets) {
data.insert(data.end(), bucket.begin(), bucket.end());
scounts.push_back(static_cast<int>(bucket.size()));
}
data = comm.alltoallv(kamping::send_buf(data), kamping::send_counts(scounts));
std::sort(data.begin(), data.end());
}
It is a lot more concise than the (verbose) plain MPI implementation, but also introduces no additional overhead to achieve this, as can be seen the following experiment. There we compare the sorting implementation in KaMPIng to other MPI bindings.
Platform :desktop_computer:
- intensively tested with GCC and Clang and OpenMPI
- requires a C++17 ready compiler
- easy integration into other projects using modern CMake
Other MPI bindings
| | MPI | Boost.MPI | RWTH MPI | MPL | |
|------------------------------------------------------|:---------------------------------:|:--------------------------------------------------------------------:|:----------------------------------------------:|:-------------------------------------:|:-----------------------------------------------:|
| STL support | :x: | :heavycheckmark:[^2] | :heavycheckmark:[^3] | :heavycheckmark:[^2] | :whitecheckmark: |
| computation of defaults via additional communication | :x: | :x: | :whitecheckmark: | :x: | :whitecheckmark: |
| custom reduce operations via lambdas | :x: | :whitecheckmark: | :x: | :heavycheckmark:[^4] | :whitecheckmark: |
| containers can be resized automatically | :x: | :heavycheckmark:^1 | :heavycheckmark:[^3] | :x: | :whitecheckmark: |
| error handling | :whitecheckmark: | :whitecheckmark: | :whitecheckmark: | :x: | :whitecheckmark: |
| actively maintained | :whitecheckmark: | :x: | :heavycheckmark: | :whitecheckmark: | :whitecheckmark: |
[^2]: only std::vector
[^3]: only for send and receive buffers
[^4]: not mapped to builtin operations
LICENSE
KaMPIng is released under the GNU Lesser General Public License. See COPYING and COPYING.LESSER for details
Owner
- Name: kamping-site
- Login: kamping-site
- Kind: organization
- Location: Germany
- Repositories: 1
- Profile: https://github.com/kamping-site
The home of KaMPI.ng - the post modern C++ interface for MPI - and its related projects.
Citation (CITATION.cff)
cff-version: 1.2.0
message: "If you use KaMPIng in an academic context, please cite our SC'24 paper."
authors:
- family-names: Hespe
given-names: Demian
- family-names: Hübner
given-names: Lukas
- family-names: Kurpicz
given-names: Florian
- family-names: Schimek
given-names: Matthias
- family-names: Seemaier
given-names: Daniel
- family-names: Uhl
given-names: Tim Niklas
title: "KaMPIng: (Near) zero-overhead MPI wrapper for modern C++"
version: 0.1.2
date-released: 2025-03-13
url: "https://github.com/kamping-site/kamping"
doi: 10.5281/zenodo.10949643
preferred-citation:
type: conference-paper
title: "KaMPIng: Flexible and (Near) Zero-Overhead C++ Bindings for MPI"
authors:
- family-names: Uhl
given-names: Tim Niklas
- family-names: Schimek
given-names: Matthias
- family-names: Hübner
given-names: Lukas
- family-names: Hespe
given-names: Demian
- family-names: Kurpicz
given-names: Florian
- family-names: Seemaier
given-names: Daniel
- family-names: Stelz
given-names: Christoph
- family-names: Sanders
given-names: Peter
collection-title: "SC24: International Conference for High Performance Computing, Networking, Storage and Analysis"
doi: "10.1109/SC41406.2024.00050"
start: 1
end: 21
pages: 21
year: 2024
GitHub Events
Total
- Create event: 7
- Release event: 1
- Issues event: 15
- Watch event: 23
- Delete event: 10
- Member event: 1
- Issue comment event: 8
- Push event: 47
- Pull request review comment event: 23
- Pull request review event: 13
- Pull request event: 20
- Fork event: 3
Last Year
- Create event: 7
- Release event: 1
- Issues event: 15
- Watch event: 23
- Delete event: 10
- Member event: 1
- Issue comment event: 8
- Push event: 47
- Pull request review comment event: 23
- Pull request review event: 13
- Pull request event: 20
- Fork event: 3
Issues and Pull Requests
Last synced: 4 months ago
All Time
- Total issues: 10
- Total pull requests: 8
- Average time to close issues: over 2 years
- Average time to close pull requests: 9 days
- Total issue authors: 6
- Total pull request authors: 3
- Average comments per issue: 0.9
- Average comments per pull request: 0.0
- Merged pull requests: 7
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 5
- Pull requests: 8
- Average time to close issues: 4 months
- Average time to close pull requests: 9 days
- Issue authors: 3
- Pull request authors: 3
- Average comments per issue: 0.0
- Average comments per pull request: 0.0
- Merged pull requests: 7
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- niklas-uhl (6)
- kurpicz (4)
- ByteHamster (3)
- lukashuebner (3)
- Hespian (1)
- mschimek (1)
Pull Request Authors
- niklas-uhl (20)
- mschimek (10)
- dependabot[bot] (8)
- kurpicz (3)
- stelzch (1)
- dabrommer (1)
Top Labels
Issue Labels
Pull Request Labels
Dependencies
- actions/checkout v3.0.2 composite
- actions/checkout v3.0.2 composite
- jidicula/clang-format-action v4.4.0 composite
- Hespian/cmake-format-action main composite
- actions/checkout v3.0.2 composite
- actions/checkout v3.0.2 composite
- actions/checkout v3.0.2 composite
- ubuntu jammy build