FleCSI User API Version: 2.3.0
 
Loading...
Searching...
No Matches
control< P > Struct Template Reference

The control type provides a control model for specifying a set of control points as a coarse-grained control flow graph, with each node of the graph specifying a set of actions as a directed acyclic graph (DAG). More...

Classes

struct  action
 The action type provides a mechanism to add execution elements to the FleCSI control model. More...
 

Public Types

template<target_type T, control_points_enum CP>
using meta = action< T, CP, true >
 An action registration on a meta_point for a specialization.
 

Static Public Member Functions

static int check_status (int s)
 Process control model command-line options.
 
static int execute ()
 Perform the same operation as invoke with no arguments.
 
template<class... AA>
static int invoke (AA &&... aa)
 Execute the control model.
 
static P & state ()
 Return the control policy object.
 
static void write_actions (std::string_view p, const char *f)
 Write a Dot graph of the sorted sequence of actions.
 
static void write_graph (std::string_view p, const char *f)
 Write a Dot graph of control points and actions.
 

Detailed Description

template<typename P>
struct flecsi::run::control< P >

The control type provides a control model for specifying a set of control points as a coarse-grained control flow graph, with each node of the graph specifying a set of actions as a directed acyclic graph (DAG).

The actions under a control point DAG are topologically sorted to respect dependency edges, which can be specified through the dag interface.

If Graphviz support is enabled, the control flow graph and its DAG nodes can be written to a graphviz file that can be compiled and viewed using the dot program.

Template Parameters
Ppolicy type like control_policy

Member Typedef Documentation

◆ meta

template<typename P >
template<target_type T, control_points_enum CP>
using meta = action<T, CP, true>

An action registration on a meta_point for a specialization.

Template Parameters
Tfunction
CPcontrol point enumerator

Member Function Documentation

◆ state()

template<typename P >
static P & state ( )
static

Return the control policy object.

It is default-initialized when the control model is first used (typically to register an action) and destroyed at the end of the program. This function cannot be used if P inherits from control_base.

Deprecated:
derive P from control_base and use the parameter passed to each action

◆ invoke()

template<typename P >
template<class... AA>
static int invoke ( AA &&...  aa)
static

Execute the control model.

This method does a topological sort of the actions under each of the control points to determine a non-unique, but valid ordering, and executes the actions. An object of type P is initialized from aa and passed to each action; it is destroyed before this function returns. control_base::exception can be thrown for early termination. The control policy must inherit from control_base and must not define a node_policy, or the code will fail to compile.

Returns
code from a thrown control_base::exception or 0

◆ execute()

template<typename P >
static int execute ( )
static

Perform the same operation as invoke with no arguments.

P need not inherit from control_base, if it does not, no object of it is created and actions are called with no arguments. P may define node_policy.

Returns
invoke() if P inherits from control_base, otherwise the bitwise or of return values of executed actions
Deprecated:
Call invoke directly or use runtime::control.

◆ check_status()

template<typename P >
static int check_status ( int  s)
static

Process control model command-line options.

Parameters
sinitialization status from initialize
Returns
status of control model output if requested, else s
Deprecated:
Call write_graph or write_actions as needed.
See also
status

◆ write_graph()

template<typename P >
static void write_graph ( std::string_view  p,
const char *  f 
)
static

Write a Dot graph of control points and actions.

Parameters
pprogram name for graph title
foutput file

◆ write_actions()

template<typename P >
static void write_actions ( std::string_view  p,
const char *  f 
)
static

Write a Dot graph of the sorted sequence of actions.

Parameters
pprogram name for graph title
foutput file