PaCO++
0.05
|
#include <ParisBasicExample.h>
Public Member Functions | |
virtual void | clientFree () |
virtual void | clientFree (int server_node) |
virtual PieceToSend * | computePiecesToSend () |
virtual PieceToSend * | computePiecesToSend (unsigned &size)=0 |
virtual bool | freeComId (long id) |
virtual void * | getClientData (int server_node, long &size, long &length, bool &end) |
virtual void * | getClientData (void *pid, int server_node, long &size, long &length, bool &end)=0 |
virtual void * | getDescr () |
virtual PaCO::PacoTopology_t | getDestTopology () |
virtual long | getNodeRank () |
virtual void * | getServerData (long &length) |
virtual PaCO::PacoTopology_t | getSourceTopology () |
virtual bool | insertData (void *rcptBuf) |
virtual bool | insertData (void *rcptBuf, unsigned long element_nb)=0 |
ParisBasicExample () | |
virtual void | serverFree () |
virtual bool | setComId (long id) |
virtual void | setCommunicator (void *group) |
virtual void | setDataPtr (void *dataPtr) |
virtual void | setDescr (void *descr) |
virtual void | setDestTopology (PaCO::PacoTopology_t topo) |
void | setEltSize (long size) |
void | setNbElt (long elt_nb) |
virtual void | setNodeRank (long Rank) |
virtual void | setSourceTopology (PaCO::PacoTopology_t topo) |
virtual | ~ParisBasicExample () |
Private Attributes | |
long | _data_elt_nb |
long * | _data_rst |
long | _data_size |
PaCO::PacoTopology_t | _destTopo |
CORBA::Short | _length |
long | _my_rank |
long | _server_nb_nodes |
PaCO::PacoTopology_t | _srcTopo |
char * | _user_data |
long * | position |
char * | temp_buffer |
Definition at line 8 of file ParisBasicExample.h.
Definition at line 6 of file ParisBasicExample.cc.
References _length, _user_data, and temp_buffer.
: _data_size(0), _data_elt_nb(0), _my_rank(-1), _server_nb_nodes(-1) { _user_data = 0; temp_buffer = 0; _length = 0; }
ParisBasicExample::~ParisBasicExample | ( | ) | [virtual] |
void ParisBasicExample::clientFree | ( | ) | [virtual] |
Implements DistributionLibrary.
Definition at line 177 of file ParisBasicExample.cc.
References temp_buffer.
Referenced by getClientData().
{ free(temp_buffer); }
void ParisBasicExample::clientFree | ( | int | server_node | ) | [virtual] |
PieceToSend * ParisBasicExample::computePiecesToSend | ( | ) | [virtual] |
Definition at line 98 of file ParisBasicExample.cc.
References _data_elt_nb, _data_size, _my_rank, _server_nb_nodes, PieceToSend::destNode, PieceToSend::size, and PieceToSend::sourceNode.
{ // Compute total data length long total_length = _data_size * _data_elt_nb; // We send at each server node the // same data PieceToSend * comm_vector = new PieceToSend[_server_nb_nodes]; for (int i = 0; i < _server_nb_nodes; i++) { comm_vector[i].sourceNode = _my_rank; comm_vector[i].destNode = i; if (i == _my_rank) { comm_vector[i].size = total_length; } else { comm_vector[i].size = 0; } } return comm_vector; }
virtual PieceToSend* DistributionLibrary::computePiecesToSend | ( | unsigned & | size | ) | [pure virtual, inherited] |
Implemented in BasicBC, Controlled, Identity, and GaBro.
virtual bool DistributionLibrary::freeComId | ( | long | id | ) | [inline, virtual, inherited] |
Reimplemented in BasicBC, and GaBro.
Definition at line 41 of file DistributionLibrairie.h.
{ return false;}
void * ParisBasicExample::getClientData | ( | int | server_node, |
long & | size, | ||
long & | length, | ||
bool & | end | ||
) | [virtual] |
Definition at line 134 of file ParisBasicExample.cc.
References _data_elt_nb, _data_rst, _data_size, _length, _user_data, clientFree(), position, and temp_buffer.
{ if (size > 0) { if (temp_buffer) clientFree(server_node); // First get position long actual_pos = position[server_node]; // Test if size > _data_rst long real_size = 0; if (size > _data_rst[server_node]) { real_size = _data_rst[server_node]; size = size - _data_rst[server_node]; _data_rst[server_node] = 0; } else { real_size = size; _data_rst[server_node] = _data_rst[server_node] - size; size = 0; } length = real_size / _data_size; _length = length; end = true; position[server_node] = actual_pos + real_size; if (_data_rst[server_node] == 0) { _data_rst[server_node] = _data_size * _data_elt_nb; position[server_node] = 0; } return &_user_data[actual_pos]; } else { length = 0; _length = length; end = true; return NULL; } return NULL; }
virtual void* DistributionLibrary::getClientData | ( | void * | pid, |
int | server_node, | ||
long & | size, | ||
long & | length, | ||
bool & | end | ||
) | [pure virtual, inherited] |
Implemented in BasicBC, Controlled, Identity, and GaBro.
void * ParisBasicExample::getDescr | ( | ) | [virtual] |
Implements DistributionLibrary.
Definition at line 210 of file ParisBasicExample.cc.
References _length.
{ return &_length; }
PaCO::PacoTopology_t ParisBasicExample::getDestTopology | ( | ) | [virtual] |
Implements DistributionLibrary.
Definition at line 80 of file ParisBasicExample.cc.
References _destTopo.
{ return _destTopo; }
long ParisBasicExample::getNodeRank | ( | ) | [virtual] |
Implements DistributionLibrary.
Definition at line 92 of file ParisBasicExample.cc.
References _my_rank.
{ return _my_rank; }
void * ParisBasicExample::getServerData | ( | long & | length | ) | [virtual] |
Implements DistributionLibrary.
Definition at line 196 of file ParisBasicExample.cc.
References _length, and _user_data.
{ length = _length; return _user_data; }
PaCO::PacoTopology_t ParisBasicExample::getSourceTopology | ( | ) | [virtual] |
Implements DistributionLibrary.
Definition at line 53 of file ParisBasicExample.cc.
References _srcTopo.
{ return _srcTopo; }
bool ParisBasicExample::insertData | ( | void * | rcptBuf | ) | [virtual] |
Definition at line 189 of file ParisBasicExample.cc.
References _user_data.
{ _user_data = (char *) rcptBuf; return true; }
virtual bool DistributionLibrary::insertData | ( | void * | rcptBuf, |
unsigned long | element_nb | ||
) | [pure virtual, inherited] |
Implemented in BasicBC, Controlled, Identity, and GaBro.
virtual void ParisBasicExample::serverFree | ( | ) | [inline, virtual] |
virtual bool DistributionLibrary::setComId | ( | long | id | ) | [inline, virtual, inherited] |
Reimplemented in BasicBC, and GaBro.
Definition at line 40 of file DistributionLibrairie.h.
{ return false;}
virtual void ParisBasicExample::setCommunicator | ( | void * | group | ) | [inline, virtual] |
void ParisBasicExample::setDataPtr | ( | void * | dataPtr | ) | [virtual] |
Implements DistributionLibrary.
Definition at line 122 of file ParisBasicExample.cc.
References _data_elt_nb, _data_rst, _data_size, _my_rank, _server_nb_nodes, _user_data, and position.
{ _user_data = (char*) dataPtr; cerr << "_data_size " <<_data_size << endl; cerr << "_data_elt_nb " <<_data_elt_nb << endl; cerr << "_my_rank " <<_my_rank << endl; cerr << "_server_nb_nodes " <<_server_nb_nodes << endl; cerr << "_data_rst " <<_data_rst << endl; cerr << " position" << position << endl; }
void ParisBasicExample::setDescr | ( | void * | descr | ) | [virtual] |
Implements DistributionLibrary.
Definition at line 203 of file ParisBasicExample.cc.
References _length.
void ParisBasicExample::setDestTopology | ( | PaCO::PacoTopology_t | topo | ) | [virtual] |
Implements DistributionLibrary.
Definition at line 59 of file ParisBasicExample.cc.
References _data_elt_nb, _data_rst, _data_size, _destTopo, _server_nb_nodes, position, and PaCO::PacoTopology_s::total.
{ _destTopo = topo; _server_nb_nodes = _destTopo.total; position = new long[_server_nb_nodes]; _data_rst = new long[_server_nb_nodes]; for (int i = 0; i < _server_nb_nodes; i++) { position[i] = 0; _data_rst[i] = 0; } if (_data_size && _data_elt_nb) { for (int i = 0; i < _server_nb_nodes; i++) { _data_rst[i] = _data_size * _data_elt_nb; } } }
void ParisBasicExample::setEltSize | ( | long | size | ) |
Definition at line 21 of file ParisBasicExample.cc.
References _data_elt_nb, _data_rst, _data_size, and _server_nb_nodes.
{ _data_size = size; if (_data_elt_nb && _server_nb_nodes) { for (int i = 0; i < _server_nb_nodes; i++) { _data_rst[i] = _data_size * _data_elt_nb; } } }
void ParisBasicExample::setNbElt | ( | long | elt_nb | ) |
Definition at line 34 of file ParisBasicExample.cc.
References _data_elt_nb, _data_rst, _data_size, and _server_nb_nodes.
{ _data_elt_nb = elt_nb; if (_data_size && _server_nb_nodes) { for (int i = 0; i < _server_nb_nodes; i++) { _data_rst[i] = _data_size * _data_elt_nb; } } }
void ParisBasicExample::setNodeRank | ( | long | Rank | ) | [virtual] |
Implements DistributionLibrary.
Definition at line 86 of file ParisBasicExample.cc.
References _my_rank.
{ _my_rank = Rank; }
void ParisBasicExample::setSourceTopology | ( | PaCO::PacoTopology_t | topo | ) | [virtual] |
Implements DistributionLibrary.
Definition at line 47 of file ParisBasicExample.cc.
References _srcTopo.
{ _srcTopo = topo; }
long ParisBasicExample::_data_elt_nb [private] |
Definition at line 48 of file ParisBasicExample.h.
Referenced by computePiecesToSend(), getClientData(), setDataPtr(), setDestTopology(), setEltSize(), and setNbElt().
long* ParisBasicExample::_data_rst [private] |
Definition at line 52 of file ParisBasicExample.h.
Referenced by getClientData(), setDataPtr(), setDestTopology(), setEltSize(), setNbElt(), and ~ParisBasicExample().
long ParisBasicExample::_data_size [private] |
Definition at line 47 of file ParisBasicExample.h.
Referenced by computePiecesToSend(), getClientData(), setDataPtr(), setDestTopology(), setEltSize(), and setNbElt().
Definition at line 44 of file ParisBasicExample.h.
Referenced by getDestTopology(), and setDestTopology().
CORBA::Short ParisBasicExample::_length [private] |
Definition at line 46 of file ParisBasicExample.h.
Referenced by getClientData(), getDescr(), getServerData(), ParisBasicExample(), and setDescr().
long ParisBasicExample::_my_rank [private] |
Definition at line 49 of file ParisBasicExample.h.
Referenced by computePiecesToSend(), getNodeRank(), setDataPtr(), and setNodeRank().
long ParisBasicExample::_server_nb_nodes [private] |
Definition at line 50 of file ParisBasicExample.h.
Referenced by computePiecesToSend(), setDataPtr(), setDestTopology(), setEltSize(), and setNbElt().
Definition at line 43 of file ParisBasicExample.h.
Referenced by getSourceTopology(), and setSourceTopology().
char* ParisBasicExample::_user_data [private] |
Definition at line 54 of file ParisBasicExample.h.
Referenced by getClientData(), getServerData(), insertData(), ParisBasicExample(), and setDataPtr().
long* ParisBasicExample::position [private] |
Definition at line 53 of file ParisBasicExample.h.
Referenced by getClientData(), setDataPtr(), setDestTopology(), and ~ParisBasicExample().
char* ParisBasicExample::temp_buffer [private] |
Definition at line 55 of file ParisBasicExample.h.
Referenced by clientFree(), getClientData(), and ParisBasicExample().