ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches

The executor [see Executor.h] on an execution space of the host of Kokkos, beyond the book: KokkosExecutor< Space > runs bulk( n , f ) as a Kokkos::parallel_for of a RangePolicy of the space on the \( n \) indices with chunks of 1, followed by the fence() of the space, so that the parallel algorithms of ADS run on the threads that a program of Kokkos already has (those of its backend of OpenMP, of std::thread or of HPX), and concurrency() is that of the space. More...

#include "ADS/Contract.h"
#include "ADS/parallel/Executor.h"
#include <Kokkos_Core.hpp>
#include <cstddef>
#include <type_traits>
#include <utility>

Go to the source code of this file.

Classes

class  ADS::KokkosExecutor< Space >
 the executor on an execution space of the host of Kokkos More...

Namespaces

namespace  ADS

Detailed description

The executor [see Executor.h] on an execution space of the host of Kokkos, beyond the book: KokkosExecutor< Space > runs bulk( n , f ) as a Kokkos::parallel_for of a RangePolicy of the space on the \( n \) indices with chunks of 1, followed by the fence() of the space, so that the parallel algorithms of ADS run on the threads that a program of Kokkos already has (those of its backend of OpenMP, of std::thread or of HPX), and concurrency() is that of the space.

The space is Kokkos::DefaultHostExecutionSpace by default; the spaces of the devices do not fit, since the calls of ADS run code of the host on memory of the host. Kokkos must be initialized (Kokkos::initialize() or a Kokkos::ScopeGuard) while the executor is used.

A dispatch of Kokkos does not nest: on its backend of OpenMP it takes a lock of the instance for the whole kernel and aborts beyond the levels that it supports, and a dispatch from inside a kernel of the space is not allowed. A call of bulk() made inside a call of the executor, or inside a kernel of the program on the space (on OpenMP, inside a parallel region), therefore runs its calls in order on that thread [see detail::InsideCall], as for the senders [see SenderExecutor.h]: the parallelism of the nested calls is lost, that of the loops, the reductions, the prefix sums and the top level of the sorts is kept. There is no run().

The header is compiled where the headers of Kokkos are found (<Kokkos_Core.hpp>, or ADS_WITH_KOKKOS, which the CMake target ADS::Kokkos defines, with the flags that Kokkos asks of the compiler).

The contracts [see Contract.h]: an exception thrown by \( f \) stops the claims and is thrown again by bulk(), since an exception may not leave a kernel of Kokkos.

See also
C. R. Trott, D. Lebrun-Grandié, D. Arndt, J. Ciesko, V. Dang, N. Ellingwood, R. Gayatri, E. Harvey, D. S. Hollman, D. Ibanez, N. Liber, J. Madsen, J. Miles, D. Poliakoff, A. Powell, S. Rajamanickam, M. Simberg, D. Sunderland, B. Turcksin, J. Wilke, Kokkos 3: programming model extensions for the exascale era, IEEE Transactions on Parallel and Distributed Systems 33(4), 805-817, 2022, doi:10.1109/TPDS.2021.3097283
Author
Donato Meoli
Dipartimento di Informatica
Università di Pisa