FleCSI User API Version: 2.3.0
 
Loading...
Searching...
No Matches
Execution Model

Launching tasks and kernels. More...

Modules

 Reduction Operations
 Types to use with reduce, reduceall, and reduction_accessor.
 
 Kernels
 Local concurrent operations.
 

Classes

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  trace::guard
 RAII guard for executing a trace. More...
 
struct  launch_domain
 An explicit launch domain size. More...
 
struct  multi< A >
 A sequence of accessors obtained from a launch::mapping. More...
 
struct  task_local< T >
 A global variable with a task-specific value. More...
 
struct  trace
 Records execution of a loop whose iterations all execute the same sequence of tasks. More...
 

Enumerations

enum  task_attributes_mask_t : TaskAttributes {
}
 Task attribute flags. More...
 

Functions

template<auto & TASK, TaskAttributes ATTRIBUTES = flecsi::loc | flecsi::leaf, typename... ARGS>
auto execute (ARGS &&...)
 Execute a task.
 
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 &&... args)
 Execute a reduction 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.
 

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.

#include "flecsi/execution.hh"

Enumeration Type Documentation

◆ task_attributes_mask_t

enum task_attributes_mask_t : TaskAttributes

Task attribute flags.

Enumerator
idempotent 

Task may be replicated to reduce communication.

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.

Function Documentation

◆ execute()

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

Execute a task.

Template Parameters
TASKThe user task. Its parameters must support Serialization. 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.
Returns
a future providing the value(s) returned from the task
Note
Avoid passing large objects to tasks repeatedly; use global variables (and, perhaps, pass keys to select from them) or fields.

◆ make_partial()

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

Partially apply a function.

Lambdas and bind objects may not in general be passed to tasks.

Template Parameters
Ffunction to call
AAserializable types
Returns
a function object that can be an argument to a task
Note
The task will usually be a function template:
void func(/*...*/);
template<class F>
void task(F f) {f(/* ... */);}
void client() {
auto p = make_partial<func>(/*...*/);
execute<task<decltype(p)>>(p); // note explicit template argument
}
auto execute(ARGS &&...)
Execute a task.

◆ reduce()

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

Execute a reduction task.

Template Parameters
TaskThe user task.
ReductionThe reduction operation type.
AttributesThe task attributes mask.
ArgsThe user-specified task arguments.
Returns
a future providing the reduced return value
See also
execute about parameter and argument types.

◆ test()

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

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.

Template Parameters
TASKThe user task. Its parameters may be of any default-constructible, trivially-move-assignable, non-pointer type, any type that supports the Legion return-value serialization interface, or any of several standard containers of such types. 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.
Returns
zero on success, non-zero on failure.

Variable Documentation

◆ default_accelerator

constexpr auto default_accelerator
constexpr

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

Defined as toc or omp if support for one of those is available, otherwise loc.

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