FleCSI Core API Version: 2.4.0
 
Loading...
Searching...
No Matches
Execution Model

Launching tasks and kernels. More...

Topics

 Reduction Operations
 Types to use with reduce, reduceall, and reduction_accessor.
 
 Kernels
 Local concurrent operations.
 
 Legion Execution
 Potentially remote task execution.
 
 MPI Execution
 Direct task execution.
 

Classes

struct  agent< S >
 A node-local context for potentially parallel operations. More...
 
struct  bind_accessors< Proc >
 Handling for low-level special task parameters/arguments. More...
 
struct  blocks< S, T, B >
 Parallel operations with thread configuration. More...
 
struct  cpu
 Single-core execution space. More...
 
struct  executor< S, T, B >
 Parallel operations given a name for debugging or profiling. More...
 
struct  executor_base< D >
 Executor derivation. More...
 
struct  future< Return, Launch >
 Single or multiple future. More...
 
struct  future< Return >
 Single-valued future. More...
 
struct  future< Return, exec::launch_type_t::index >
 Multi-valued future from an index launch. More...
 
struct  gpu
 GPU execution space. More...
 
struct  trace::guard
 RAII guard for executing a trace. More...
 
struct  launch_domain
 An explicit launch domain size. More...
 
struct  multi< class >
 A sequence of accessors obtained from a launch::mapping. More...
 
struct  omp
 OpenMP execution space. More...
 
struct  partial< F, AA >
 A simple version of C++20's bind_front. More...
 
struct  prolog< Proc >
 Analyzes task arguments and updates data objects before launching a task. More...
 
struct  scheduler
 Launches tasks according to their execution-space (template) parameters. More...
 
struct  space< S >
 Execution space operations. More...
 
struct  space_base
 An execution space. More...
 
struct  task_local< T >
 A global variable with a task-specific value. More...
 
struct  task_prologue< Proc >
 Handling for low-level special task parameters/arguments. More...
 
struct  trace
 Records execution of a loop whose iterations all execute the same sequence of tasks. More...
 

Typedefs

using accelerator
 The available accelerated execution space.
 

Enumerations

enum class  processor : size_t
 Enumeration of processor types. More...
 
enum  task_attributes_mask_t : TaskAttributes {
}
 Task attribute flags. More...
 

Functions

template<class T , class... AA>
auto & allocate (std::unique_ptr< topology< T > > &p, const typename T::coloring &c, AA &&... aa)
 Create a topology instance with specialization support.
 
template<auto & TASK, TaskAttributes ATTRIBUTES = flecsi::loc | flecsi::leaf, typename... ARGS>
auto execute (ARGS &&... args)
 Execute a task.
 
template<class Return >
future< std::decay_t< Return > > make_future (Return &&)
 Generate a new future from a value.
 
template<auto & F, class... AA>
constexpr exec::partial< F, std::decay_t< AA >... > make_partial (AA &&... aa)
 Partially apply a function.
 
template<auto & Task, class Reduction , TaskAttributes Attributes = flecsi::loc | flecsi::leaf, typename... Args>
auto reduce (Args &&...)
 Execute a reduction task.
 
template<class V , class... AA>
int test (AA &&... aa)
 Execute a variant of a test task.
 
template<auto & TASK, TaskAttributes ATTRIBUTES = flecsi::loc | flecsi::leaf, typename... ARGS>
int test (ARGS &&... args)
 Execute a test task.
 

Variables

constexpr auto default_accelerator
 The task attribute to use for tasks that use the on-node parallelism interface.
 
constexpr on_t on
 Placeholder argument that corresponds to an execution-space task parameter.
 

Detailed Description

Launching tasks and kernels.

Tasks are coarse-grained and use distributed-memory with restricted side effects; kernels are fine-grained and data-parallel, possibly using an accelerator.

Contents are in flecsi::exec unless otherwise specified.

#include "flecsi/execution.hh"

Typedef Documentation

◆ accelerator

using accelerator

The available accelerated execution space.

Defined as gpu or omp if support for one of those is available, otherwise cpu.

Enumeration Type Documentation

◆ task_attributes_mask_t

enum task_attributes_mask_t : TaskAttributes

Task attribute flags.

Appears directly in flecsi.

Enumerator
idempotent 

Ignored.

Deprecated
No effect.
loc 

Run on a Latency-Optimized Core (a CPU).

toc 

Run on a Throughput-Optimized Core (a GPU).

The task function itself still runs on the host, but a GPU is reserved for its use and field data is made available there.

Warning
MPI backend: Running one process per node likely leads to poor performance.
omp 

Run as an OpenMP task.

Note
Legion backend: Can improve OpenMP task execution, since Legion knows to assign an entire node to such a task
Warning
MPI backend: Running one process per core likely leads to poor performance.
mpi 

Run simultaneously on all processes with the obvious color mapping; allow MPI communication among point tasks, at the cost of significant startup overhead.

◆ processor

enum class processor : size_t
strong

Enumeration of processor types.

Function Documentation

◆ make_future()

template<class Return >
future< std::decay_t< Return > > make_future ( Return && val)

Generate a new future from a value.

Appears directly in flecsi.

◆ reduce()

template<auto & Task, class Reduction , TaskAttributes Attributes = flecsi::loc | flecsi::leaf, typename... Args>
auto reduce ( Args && ...)
nodiscard

Execute a reduction task.

Template Parameters
ReductionThe reduction operation type.
Returns
a future providing the reduced return value
See also
execute about parameter and argument types.

Appears directly in flecsi.

◆ execute()

template<auto & TASK, TaskAttributes ATTRIBUTES = flecsi::loc | flecsi::leaf, typename... ARGS>
auto execute ( ARGS &&... args)

Execute a task.

Template Parameters
TASKThe user task. Its parameters must be copyable or a reference to a const, movable type. Any that is a pointer must be to a const type or to a function. If ATTRIBUTES specifies an MPI task, parameters need merely be movable.
ATTRIBUTESThe task attributes mask.
ARGSThe user-specified task arguments, implicitly converted to the parameter types for TASK. Certain FleCSI-defined parameter types accept particular, different argument types that serve as selectors for information stored by the backend; each type involved documents the correspondence. Additionally, a parameter may be a std::vector of such a type or a std::tuple that includes such a type; it accepts a std::vector of or a std::tuple including the corresponding argument type.
Returns
a future providing the value(s) returned from the task

Appears directly in flecsi.

◆ make_partial()

template<auto & F, class... AA>
exec::partial< F, std::decay_t< AA >... > make_partial ( AA &&... aa)
constexpr

Partially apply a function.

Template Parameters
Ffunction to call
AAleading arguments
Returns
a function object
Note
A task that accepts the result will usually be a function template:
void func(/*...*/);
template<class F>
void task(F f) {f(/* ... */);}
void client(scheduler &s) {
auto p = make_partial<func>(/*...*/);
s.execute<task<decltype(p)>>(p); // note explicit template argument
}
constexpr exec::partial< F, std::decay_t< AA >... > make_partial(AA &&... aa)
Partially apply a function.
Definition launch.hh:619

Appears directly in flecsi.

Deprecated
Use a lambda or std::bind.

◆ test() [1/2]

template<auto & TASK, TaskAttributes ATTRIBUTES = flecsi::loc | flecsi::leaf, typename... ARGS>
int test ( ARGS &&... args)
nodiscard

Execute a test task.

This interface is provided for FleCSI's unit testing framework. Test tasks must return an integer that is non-zero on failure, and zero otherwise.

See also
execute about parameter and argument types.
Returns
zero on success, non-zero on failure.

Appears directly in flecsi.

◆ test() [2/2]

template<class V , class... AA>
int test ( AA &&... aa)
nodiscard

Execute a variant of a test task.

◆ allocate()

template<class T , class... AA>
auto & allocate ( std::unique_ptr< topology< T > > & p,
const typename T::coloring & c,
AA &&... aa )

Create a topology instance with specialization support.

Calls the specialization's initialize on the topology instance.

Parameters
pwhere to store the topology
ccoloring (perhaps from an mpi_coloring)
aafurther specialization-specific parameters
Returns
the new instance

Variable Documentation

◆ on

on_t on
constexpr

Placeholder argument that corresponds to an execution-space task parameter.

◆ default_accelerator

auto default_accelerator
constexpr

The task attribute to use for tasks that use the on-node parallelism interface.

Warning
Using toc causes field data to be placed on the device, so that it is accessible only via the parallelism interface.

Appears directly in flecsi.

Deprecated
Use accelerator.