|
PaCO++
0.05
|
#include <paco_libgraph_comScheduling.h>


Public Member Functions | |
| virtual void | clearAllSchedules () |
| virtual void | clearScheduleId (long id) throw (InvalidArgument) |
| paco_comSchedule * | computeScheduling (unsigned rank, PaCO::PacoTopology_t *srctopo, PaCO::PacoTopology_t *dsttopo, unsigned **com_matrix, void **info_vector[]) |
| virtual void | displayStatus () |
| unsigned int | get_beta () |
| unsigned int | get_k () |
| paco_comSchedule * | getSchedule (long id) |
| paco_comScheduling_libgraph () | |
| virtual void | propageComMatrix (PaCO_operation *op, unsigned **comMatrix) |
| void | set_beta (unsigned int beta) |
| void | set_k (unsigned int k) |
| virtual void | setSchedule (long id, paco_comSchedule *cs) |
| virtual | ~paco_comScheduling_libgraph () |
Protected Types | |
| typedef map< long, paco_comSchedule * > | _schedule_info_map_t |
Protected Member Functions | |
| virtual void | initializeBigraph (PaCO::PacoTopology_t *srctopo, PaCO::PacoTopology_t *dsttopo) |
Protected Attributes | |
| unsigned int | _beta |
| node ** | _client_nodes |
| PaCO::PacoTopology_t * | _client_topo |
| bigraph * | _g |
| unsigned int | _k |
| _schedule_info_map_t | _schedule_info_map |
| node ** | _server_nodes |
| PaCO::PacoTopology_t * | _server_topo |
Definition at line 62 of file paco_libgraph_comScheduling.h.
typedef map<long, paco_comSchedule*> paco_comScheduling::_schedule_info_map_t [protected, inherited] |
Definition at line 56 of file CommunicationScheduling.h.
Definition at line 5 of file paco_libgraph_comScheduling.cc.
References _beta, _client_nodes, _g, _k, and _server_nodes.
{
_beta=0;
_k=0;
_g = NULL;
_client_nodes = NULL;
_server_nodes = NULL;
}
Definition at line 15 of file paco_libgraph_comScheduling.cc.
References _client_nodes, _g, and _server_nodes.
{
if (_g) delete _g;
if (_client_nodes) delete[] _client_nodes;
if (_server_nodes) delete[] _server_nodes;
}
| void paco_comScheduling::clearAllSchedules | ( | ) | [virtual, inherited] |
Definition at line 44 of file CommunicationScheduling.cc.
References paco_comScheduling::_schedule_info_map.
Referenced by PaCO_operation::clearAllScheduleMemory(), set_beta(), and set_k().
{
#ifdef DEBUG_INTERNAL
std::cerr <<"[INFO] clearing all schedule memories\n";
#endif
for(_schedule_info_map_t::iterator it = _schedule_info_map.begin(); it!= _schedule_info_map.end(); it++)
{
delete it->second;
}
_schedule_info_map.clear();
}
| void paco_comScheduling::clearScheduleId | ( | long | id | ) | throw (InvalidArgument) [virtual, inherited] |
Definition at line 26 of file CommunicationScheduling.cc.
{
if (id<0)
throw new InvalidArgument("clearScheduleMemeoryId expects an id >0");
#ifdef DEBUG_INTERNAL
std::cerr <<"[INFO] clearing schedule memory Id "<<id<<endl;
#endif
_schedule_info_map_t::iterator it = _schedule_info_map.find(id);
if (it != _schedule_info_map.end())
{
delete _schedule_info_map[id];
_schedule_info_map.erase(it);
}
}
| paco_comSchedule * paco_comScheduling_libgraph::computeScheduling | ( | unsigned | rank, |
| PaCO::PacoTopology_t * | srctopo, | ||
| PaCO::PacoTopology_t * | dsttopo, | ||
| unsigned ** | com_matrix, | ||
| void ** | info_vector[] | ||
| ) | [virtual] |
Implements paco_comScheduling.
Definition at line 92 of file paco_libgraph_comScheduling.cc.
References _client_nodes, _g, _server_nodes, paco_comSchedule_libgraph::build_idx(), paco_comSchedule_libgraph::get_kbps(), initializeBigraph(), and PaCO::PacoTopology_s::total.
{
// 1. setup a new bigraph
initializeBigraph(srctopo, dsttopo);
// 2. fill the bigraph
for (unsigned i = 0; i < srctopo->total; i++)
{
if (i!= rank)
for (unsigned j = 0; j < dsttopo->total; j++)
{
_g->add_edge(_client_nodes[i], _server_nodes[j], com_matrix[i][j]);
#ifdef INFO_INTERNAL
std::cerr << "edge: "<<_client_nodes[i] << " -> "<<_server_nodes[j] << " : "<< com_matrix[i][j]<<endl;
#endif
}
else
for (unsigned j = 0; j < dsttopo->total; j++)
{
_g->add_edge(_client_nodes[i],_server_nodes[j], com_matrix[i][j], info_vector[j]);
#ifdef INFO_INTERNAL
std::cerr << "edge: "<<_client_nodes[i] << " -> "<<_server_nodes[j] << " : "<< com_matrix[i][j]<<" ("<<info_vector[j]<<")\n";
#endif
}
}
_g->remove_empty_nodes();
paco_comSchedule_libgraph* schedule_info = new paco_comSchedule_libgraph(new kbps_approximation(_g));
schedule_info->get_kbps()->compute_poly2();
schedule_info->get_kbps()->serialize();
schedule_info->build_idx();
return schedule_info;
}

| void paco_comScheduling::displayStatus | ( | ) | [virtual, inherited] |
Definition at line 70 of file CommunicationScheduling.cc.
References paco_comScheduling::_client_topo, paco_comScheduling::_schedule_info_map, paco_comScheduling::_server_topo, and PaCO::PacoTopology_s::total.
{
cerr << this << " ctopo: "<<_client_topo<<" - "<<_client_topo->total<< " stopo: "<<_server_topo<<" - "<<_server_topo->total << " map: "<< _schedule_info_map.size() << endl;
}
| unsigned int paco_comScheduling_libgraph::get_beta | ( | ) |
| unsigned int paco_comScheduling_libgraph::get_k | ( | ) |
| paco_comSchedule * paco_comScheduling::getSchedule | ( | long | id | ) | [inherited] |
return NULL if schedule id is unknown
Definition at line 8 of file CommunicationScheduling.cc.
References paco_comScheduling::_schedule_info_map.
{
_schedule_info_map_t::iterator it = _schedule_info_map.find(id);
if (it != _schedule_info_map.end())
{
return it->second;
}
else
return NULL;
}
| void paco_comScheduling_libgraph::initializeBigraph | ( | PaCO::PacoTopology_t * | srctopo, |
| PaCO::PacoTopology_t * | dsttopo | ||
| ) | [protected, virtual] |
create and initialize a graph
Definition at line 56 of file paco_libgraph_comScheduling.cc.
References _beta, _client_nodes, _g, _k, _server_nodes, and PaCO::PacoTopology_s::total.
Referenced by computeScheduling().
{
#ifdef INFO_INTERNAL
std::cerr<<__FUNCTION__<<" with beta:"<<_libgraph_beta<<" k:"<<_libgraph_k<<endl;
#endif
// Removing old instances
if (_g) delete _g;
if (_client_nodes) delete[] _client_nodes;
if (_server_nodes) delete[] _server_nodes;
// Creating new instances
_g = new bigraph();
// Setting up the parametter of the graph
if ((_beta==0)||(_k==0)) {
std::cerr<< "ERROR: libgraph not initialized -- Specifiy k & beta !!"<<endl;
}
_g->set_beta(_beta);
_g->set_k(_k);
_client_nodes = new node*[srctopo->total];
_server_nodes = new node*[dsttopo->total];
for (unsigned i = 0; i < srctopo->total; i++)
{
_client_nodes[i] = _g->add_node(true);
}
for (unsigned i = 0; i < dsttopo->total; i++)
{
_server_nodes[i] = _g->add_node(false);
}
}
| void paco_comScheduling::propageComMatrix | ( | PaCO_operation * | op, |
| unsigned ** | comMatrix | ||
| ) | [virtual, inherited] |
Reimplemented in paco_comScheduling_direct.
Definition at line 58 of file CommunicationScheduling.cc.
References PaCO_operation::my_com, PaCO_operation::mytopo, paco_com::paco_bcast(), PaCO_operation::serveur_topo_aller, and PaCO::PacoTopology_s::total.
{
std::cerr << "[Debug] doing all-2-all communication, #phases: " << op->mytopo.total << endl;
int size_temp_vector = sizeof(unsigned) * op->serveur_topo_aller.total;;
for (unsigned i = 0; i < op->mytopo.total; i++)
{
std::cerr << "[Debug] all-2-all phase: "<<i<<" sz:"<<size_temp_vector<< endl;
op->my_com->paco_bcast((void*) comMatrix[i], size_temp_vector, i);
}
}

| void paco_comScheduling_libgraph::set_beta | ( | unsigned int | beta | ) |
Definition at line 24 of file paco_libgraph_comScheduling.cc.
References _beta, and paco_comScheduling::clearAllSchedules().
{
if (_beta == beta) return;
_beta = beta;
// beta change -> clear all schedule memory
clearAllSchedules();
}

| void paco_comScheduling_libgraph::set_k | ( | unsigned int | k | ) |
Definition at line 34 of file paco_libgraph_comScheduling.cc.
References _k, and paco_comScheduling::clearAllSchedules().
{
if (_k == k) return;
_k = k;
// k change -> clear all schedule memory
clearAllSchedules();
}

| void paco_comScheduling::setSchedule | ( | long | id, |
| paco_comSchedule * | cs | ||
| ) | [virtual, inherited] |
Definition at line 20 of file CommunicationScheduling.cc.
{
// _schedule_info_map[id] = cs;
}
unsigned int paco_comScheduling_libgraph::_beta [protected] |
Definition at line 83 of file paco_libgraph_comScheduling.h.
Referenced by get_beta(), initializeBigraph(), paco_comScheduling_libgraph(), and set_beta().
node** paco_comScheduling_libgraph::_client_nodes [protected] |
Definition at line 87 of file paco_libgraph_comScheduling.h.
Referenced by computeScheduling(), initializeBigraph(), paco_comScheduling_libgraph(), and ~paco_comScheduling_libgraph().
PaCO::PacoTopology_t* paco_comScheduling::_client_topo [protected, inherited] |
Definition at line 52 of file CommunicationScheduling.h.
Referenced by paco_comScheduling::displayStatus().
bigraph* paco_comScheduling_libgraph::_g [protected] |
Definition at line 86 of file paco_libgraph_comScheduling.h.
Referenced by computeScheduling(), initializeBigraph(), paco_comScheduling_libgraph(), and ~paco_comScheduling_libgraph().
unsigned int paco_comScheduling_libgraph::_k [protected] |
Definition at line 84 of file paco_libgraph_comScheduling.h.
Referenced by get_k(), initializeBigraph(), paco_comScheduling_libgraph(), and set_k().
_schedule_info_map_t paco_comScheduling::_schedule_info_map [protected, inherited] |
Definition at line 57 of file CommunicationScheduling.h.
Referenced by paco_comScheduling::clearAllSchedules(), paco_comScheduling::displayStatus(), and paco_comScheduling::getSchedule().
node** paco_comScheduling_libgraph::_server_nodes [protected] |
Definition at line 88 of file paco_libgraph_comScheduling.h.
Referenced by computeScheduling(), initializeBigraph(), paco_comScheduling_libgraph(), and ~paco_comScheduling_libgraph().
PaCO::PacoTopology_t* paco_comScheduling::_server_topo [protected, inherited] |
Definition at line 53 of file CommunicationScheduling.h.
Referenced by paco_comScheduling::displayStatus().