20 #ifndef TPIE_PIPELINING_RUNTIME_H
21 #define TPIE_PIPELINING_RUNTIME_H
25 #include <tpie/pipelining/node.h>
27 #include <unordered_set>
31 namespace pipelining {
39 class datastructure_runtime;
43 void operator()(
void *);
45 typedef std::unique_ptr<gocontext, gocontextdel> gocontext_ptr;
69 gocontext_ptr go_init(stream_size_type items,
71 memory_size_type files,
72 memory_size_type memory,
73 const char *
file,
const char *
function);
75 void go_until(gocontext * gc,
node *
node=
nullptr);
92 void go(stream_size_type items,
94 memory_size_type files,
95 memory_size_type memory,
96 const char * file,
const char *
function);
148 void get_phases(
const std::map<node *, size_t> & phaseMap,
150 std::unordered_set<node_map::id_t> & evacuateWhenDone,
151 std::vector<std::vector<node *> > & phases);
201 const std::unordered_set<node_map::id_t> & evacuateWhenDone);
229 static void assign_files(
const std::vector<std::vector<node *> > & phases,
230 memory_size_type files);
235 static void reassign_files(
const std::vector<std::vector<node *> > & phases,
236 memory_size_type phase,
237 memory_size_type files);
243 const file_runtime & frt);
248 static void assign_memory(
const std::vector<std::vector<node *> > & phases,
249 memory_size_type memory, datastructure_runtime & drt);
254 static void reassign_memory(
const std::vector<std::vector<node *> > & phases,
255 memory_size_type phase,
256 memory_size_type memory,
const datastructure_runtime & drt);
262 memory_size_type phase,
263 const memory_runtime & mrt,
264 const datastructure_runtime & drt,
265 bool datastructures_locked);
274 #endif // TPIE_PIPELINING_RUNTIME_H
void get_phase_map(std::map< node *, size_t > &phaseMap)
Partition nodes into phases (using union-find).
The base class for indicating the progress of some task.
void propagate_all(const graph< node * > &itemFlow)
Call propagate on all nodes in item source to sink order.
runtime(node_map::ptr nodeMap)
Construct a runtime object.
static void reassign_memory(const std::vector< std::vector< node * > > &phases, memory_size_type phase, memory_size_type memory, const datastructure_runtime &drt)
Internal method used by go().
void get_item_flow_graphs(std::vector< std::vector< node * > > &phases, std::vector< graph< node * > > &itemFlow)
Internal method used by go().
Central file abstraction.
void get_phase_graph(const std::map< node *, size_t > &phaseMap, graph< size_t > &phaseGraph)
Set up phase graph so we can find a topological order.
void go_initiators(const std::vector< node * > &phase)
Call go() on all initiators after setting the given progress indicator.
void get_phases(const std::map< node *, size_t > &phaseMap, const graph< size_t > &phaseGraph, std::unordered_set< node_map::id_t > &evacuateWhenDone, std::vector< std::vector< node * > > &phases)
Compute topological phase order.
static void set_resource_being_assigned(const std::vector< node * > &nodes, resource_type type)
Internal method used by go().
void prepare_all(const std::vector< graph< node * > > &itemFlow)
Call prepare on all nodes in item source to sink order.
static void reassign_files(const std::vector< std::vector< node * > > &phases, memory_size_type phase, memory_size_type files)
Internal method used by go().
void set_progress_indicators(const std::vector< node * > &phase, progress_indicator_base &pi)
Call set_progress_indicator on all nodes in the phase.
void get_actor_graphs(std::vector< std::vector< node * > > &phases, std::vector< graph< node * > > &actors)
Internal method used by go().
static void assign_files(const std::vector< std::vector< node * > > &phases, memory_size_type files)
Internal method used by go().
void get_item_sources(std::vector< node * > &itemSources)
Get all sources of the item flow graph.
size_t get_node_count()
Number of nodes contained in node map.
Fractional progress reporting.
void ensure_initiators(const std::vector< std::vector< node * > > &phases)
Ensure that all phases have at least one initiator.
static std::vector< size_t > inverse_permutation(const std::vector< size_t > &f)
Compute the inverse of a permutation.
void go(stream_size_type items, progress_indicator_base &progress, memory_size_type files, memory_size_type memory, const char *file, const char *function)
Execute the pipeline.
Execute the pipeline contained in a node_map.
static double get_files_factor(memory_size_type files, const file_runtime &frt)
Internal method used by assign_memory().
static void assign_memory(const std::vector< std::vector< node * > > &phases, memory_size_type memory, datastructure_runtime &drt)
Internal method used by go().
bool is_initiator(node *n)
Check if the node is a phase initiator.
void get_item_sinks(std::vector< node * > &itemSinks)
Get all sinks of the item flow graph.
static double get_memory_factor(memory_size_type memory, memory_size_type phase, const memory_runtime &mrt, const datastructure_runtime &drt, bool datastructures_locked)
Internal method used by assign_memory().
void evacuate_all(const std::vector< node * > &phase, const std::unordered_set< node_map::id_t > &evacuateWhenDone)
Call evacuate on all nodes in evacuateWhenDone for which can_evacuate() is true.
bool has_initiator(const std::vector< node * > &phase)
Equivalent to any_of(begin(phase), end(phase), is_initiator).
void get_graph(std::vector< node * > &phase, graph< node * > &result, bool itemFlow)
Internal method used by get_{actor,item_flow}_graphs().