Toggle table of contents sidebar
ExecutionPolicy
¶
The concept of an ExecutionPolicy
is the fundamental abstraction to represent “how” the execution of a Kokkos parallel pattern takes place. This page talks practically about how to use the common features of execution policies in Kokkos; for a more formal and theoretical treatment, see this document.
What is anDisclaimer: There is nothing new about the term “concept” in C++; anyone who has ever used templates in C++ has used concepts whether they knew it or not. Please do not be confused by the word “concept” itself, which is now more often associated with a shiny new C++20 language feature. Here, “concept” just means “what you’re allowed to do with a type that is a template parameter in certain places”.
ExecutionPolicy
?¶
The dominant parallel dispatch mechanism in Kokkos, described elsewhere in the programming guide, involves a parallel_pattern
(e.g., something like Kokkos::parallel_for or Kokkos::parallel_reduce), an ExecutionPolicy
, and a Functor
. In a hand-wavy sense:
parallel_pattern( ExecutionPolicy(), Functor() );
The most basic (“beginner”) case is actually a shortcut:
Kokkos::parallel_for( 42, KOKKOS_LAMBDA (int n) { /* ... */ } );
is a “shortcut” for
Kokkos::parallel_for( Kokkos::RangePolicy<Kokkos::DefaultExecutionSpace>( Kokkos::DefaultExecutionSpace(), 0, 42 ), KOKKOS_LAMBDA(int n) { /* ... */ } );
In this example, Kokkos::RangePolicy<Kokkos::DefaultExecutionSpace>
is the ExecutionPolicy
type.
All ExecutionPolicy
types provide a nested type named index_type
.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4