Ejemplo n.º 1
0
void pipeline_base::order_before(pipeline_base & other) {
	if (get_node_map()->find_authority()
		== other.get_node_map()->find_authority()) {

		tpie::log_debug()
			<< "Ignoring pipeline ordering hint since node maps are already shared"
			<< std::endl;
		return;
	}
	runtime rt1(get_node_map()->find_authority());
	runtime rt2(other.get_node_map()->find_authority());

	std::vector<node *> mySinks;
	std::vector<node *> otherSources;

	rt1.get_item_sinks(mySinks);
	rt2.get_item_sources(otherSources);

	if (mySinks.size() == 0) {
		throw tpie::exception("pipeline::order_before: mySinks is empty");
	}
	if (otherSources.size() == 0) {
		throw tpie::exception("pipeline::order_before: otherSources is empty");
	}

	for (size_t i = 0; i < otherSources.size(); ++i) {
		for (size_t j = 0; j < mySinks.size(); ++j) {
			otherSources[i]->add_dependency(*mySinks[j]);
		}
	}
}
Ejemplo n.º 2
0
void node::forward_any(std::string key, boost::any value) {
	switch (get_state()) {
		case STATE_FRESH:
		case STATE_IN_PREPARE:
		case STATE_AFTER_PREPARE:
			// Allowed since forward() is allowed in prepare()
			break;
		case STATE_IN_PROPAGATE:
		case STATE_AFTER_PROPAGATE:
			// Allowed since forward() is allowed in propagate()
			break;
		case STATE_IN_BEGIN:
			throw call_order_exception("forward");
		case STATE_AFTER_BEGIN:
		case STATE_IN_END:
		case STATE_AFTER_END:
			// Allowed since forward() is allowed in end()
			break;
		default:
			log_debug() << "forward in unknown state " << get_state() << std::endl;
			break;
	}

	add_forwarded_data(key, value, true);

	bits::node_map::ptr nodeMap = get_node_map()->find_authority();

	typedef node_token::id_t id_t;
	std::vector<id_t> successors;
	nodeMap->get_successors(get_id(), successors, true);
	for (size_t i = 0; i < successors.size(); ++i) {
		nodeMap->get(successors[i])->add_forwarded_data(key, value, false);
	}
}
Ejemplo n.º 3
0
void pipeline_base_base::output_memory(std::ostream & o) const {
	bits::node_map::ptr nodeMap = get_node_map()->find_authority();
	for (bits::node_map::mapit i = nodeMap->begin(); i != nodeMap->end(); ++i) {
		bits::node_map::val_t p = nodeMap->get(i->first);
		o << p->get_name() << ": min=" << p->get_minimum_memory() << "; max=" << p->get_available_memory() << "; prio=" << p->get_memory_fraction() << ";" << std::endl;

	}
}
Ejemplo n.º 4
0
memory_size_type node::get_datastructure_memory(const std::string & name) {
	const bits::node_map::datastructuremap_t & structures = get_node_map()->get_datastructures();
	bits::node_map::datastructuremap_t::const_iterator i = structures.find(name);

	if(i == structures.end())
		throw tpie::exception("attempted to get memory of non-registered datastructure");

	return i->second.first;
}
Ejemplo n.º 5
0
void pipeline_base_base::forward_any(std::string key, any_noncopyable value) {
	get_node_map()->find_authority()->forward(key, std::move(value));
}