kokkos-execution is a header-only library
that customizes std::execution for Kokkos.
It uses stdexec, the reference implementation of std::execution.
kokkos-execution lets you express your operations as sender pipelines,
and lower them transparently to either of these two Kokkos execution models:
A thorough comparison of these execution models can be found here.
The full documentation is available here.
kokkos-execution provides the following execution contexts:
Many standard algorithms (such as then, bulk, continues_on, when_all)
are customized for each of these contexts,
together with the custom algorithms
Kokkos::Execution::parallel_for
Kokkos::Execution::parallel_reduce.
The algorithms are customized to avoid unnecessary synchronization points.
All of the following Kokkos backends are supported and exercised in CI:
Kokkos backend |
Supported |
|---|---|
Serial |
✅ |
Threads |
❗ |
OpenMP |
✅ |
HPX |
✅ |
Cuda |
✅ |
HIP |
✅ |
SYCL |
✅ |
❗ The
Kokkos::Threadsbackend requires that parallel regions be launched from the thread that initializedKokkos. Many tests are thus disabled.
When using Kokkos::Execution::ExecutionSpaceContext, dependencies are expressed either
through execution space ordering or using events.
When using Kokkos::Execution::GraphContext, dependencies are expressed
through the underlying Kokkos graph edges.
Tests do not rely solely on value correctness.
Through the kokkos-tools hooks,
they also assert that the expected sequence of Kokkos actions (such as parallel region launch or fence)
actually took place.
Such trace-based assertions are made practical by kokkos-utils,
which provides the matcher machinery used to express and check the expected sequences.
Tests can be found in this directory.
The library is developed against the latest version of stdexec, bundled as a submodule.
The versions of Kokkos and other dependencies are recorded here.
Our CI relies on Docker images, ready to be used for testing kokkos-execution off the self:
docker pull ghcr.io/uliegecsm/kokkos-execution/kokkos-execution:gnu-15-OpenMP-ReleaseOnce the container is running, do:
git clone --recurse-submodules https://github.com/uliegecsm/kokkos-execution.git
cd kokkos-execution
cmake -S . --preset=gnu-OpenMP
cmake --build --preset=gnu-OpenMP
ctest --preset=gnu-OpenMPA sequence of operations can be written as a sender pipeline and easily lowered to either an execution space instance or a graph:
auto ops = Kokkos::Execution::parallel_for("label for A", 17, Functor_A{...})
| stdexec::bulk(stdexec::par, N_B, Functor_B{...})
| Kokkos::Execution::parallel_for("label for C", Kokkos::range_slice<size_t, size_t>{3, 42}, Functor_C{...});
// Lower onto an execution space instance.
const Kokkos::Execution::ExecutionSpaceContext<Exec> ectx{exec};
stdexec::sync_wait(stdexec::schedule(ectx.get_scheduler()) | ops);
// Lower onto a graph.
const Kokkos::Execution::GraphContext<Exec> gctx{exec};
stdexec::sync_wait(stdexec::schedule(gctx.get_scheduler()) | ops);More examples are available here.
See our contribution guidelines.