Launching tasks and kernels.
More...
|
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.
|
|
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"
◆ task_attributes_mask_t
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.
|
◆ execute()
template<auto & TASK, TaskAttributes ATTRIBUTES = flecsi::loc | flecsi::leaf, typename... ARGS>
auto execute |
( |
ARGS && |
... | ) |
|
Execute a task.
- Template Parameters
-
TASK | The user task. Its parameters must support Serialization. If ATTRIBUTES specifies an MPI task, parameters need merely be movable. |
ATTRIBUTES | The task attributes mask. |
ARGS | The 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
-
F | function to call |
AA | serializable 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>();
}
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
-
Task | The user task. |
Reduction | The reduction operation type. |
Attributes | The task attributes mask. |
Args | The 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
-
TASK | The 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. |
ATTRIBUTES | The task attributes mask. |
ARGS | The user-specified task arguments, implicitly converted to the parameter types for TASK. |
- Returns
- zero on success, non-zero on failure.
◆ 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.