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


Public Member Functions | |
| virtual void | clientFree () |
| virtual PieceToSend * | computePiecesToSend (unsigned &size) |
| virtual bool | freeComId (long id) |
| virtual void * | getClientData (void *pid, int server_node, long &size, long &length, bool &end) |
| virtual void * | getDescr () |
| virtual PaCO::PacoTopology_t | getDestTopology () |
| virtual long | getNodeRank () |
| virtual void * | getServerData (long &length) |
| virtual PaCO::PacoTopology_t | getSourceTopology () |
| Identity () | |
| virtual bool | insertData (void *rcptBuf, unsigned long element_nb) |
| 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 (unsigned long size) |
| void | setLocalNbElt (unsigned long elt_nb) |
| virtual void | setNodeRank (long Rank) |
| virtual void | setSourceTopology (PaCO::PacoTopology_t topo) |
| virtual | ~Identity () |
Private Attributes | |
| char * | _clientBuffer |
| IdentityLib::IdentityDescr | _clientDescr |
| unsigned | _config |
| PaCO::PacoTopology_t | _dTopo |
| unsigned | _llen |
| unsigned | _nodeRank |
| char * | _serverBuffer |
| IdentityLib::IdentityDescr * | _serverDescr |
| unsigned long | _serverToReceived |
| PaCO::PacoTopology_t | _sTopo |
| unsigned | _unitsize |
Definition at line 13 of file Identity.h.
Definition at line 18 of file Identity.cc.
References _clientBuffer, _config, _dTopo, _nodeRank, _serverBuffer, _serverDescr, _sTopo, and PaCO::PacoTopology_s::total.
{
// Common
_config = 0;
// By default 1->1 :)
_sTopo.total=1;
_dTopo.total=1;
_nodeRank=0;
// Client side
_clientBuffer=NULL;
// Server side
_serverDescr=NULL;
_serverBuffer=NULL;
}
| Identity::~Identity | ( | ) | [virtual] |
Definition at line 36 of file Identity.cc.
{
}
| void Identity::clientFree | ( | ) | [virtual] |
Implements DistributionLibrary.
Definition at line 174 of file Identity.cc.
{
#ifdef DEBUG_INTERNAL
std::cerr << "-- clientFree\n";
#endif
}
| PieceToSend * Identity::computePiecesToSend | ( | unsigned & | size | ) | [virtual] |
Implements DistributionLibrary.
Definition at line 114 of file Identity.cc.
References _config, _llen, _nodeRank, CORRECT_CONFIG, PieceToSend::destNode, PieceToSend::id, PieceToSend::size, and PieceToSend::sourceNode.
{
PieceToSend * sched;
#ifdef DEBUG_INTERNAL
std::cerr << "computePiecesToSend-------------------- in\n";
std::cerr << __FUNCTION__ << ": config = "<<_config<<endl;
#endif
if (_config != CORRECT_CONFIG) {
std::cerr << "Identity: incorrect configuration state "<< _config<<"/"<<CORRECT_CONFIG<<endl;
abort();
}
sched = new PieceToSend[1];
size_out = 1;
sched[0].sourceNode = _nodeRank; // my self :)
sched[0].destNode = _nodeRank; // the corresponding node
sched[0].size = _llen; // msg size
sched[0].id = (void*) -1; /* not used */
#ifdef DEBUG_INTERNAL
std::cerr << "computePiecesToSend-------------------- done\n";
#endif
return sched;
}
| 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 * Identity::getClientData | ( | void * | pid, |
| int | server_node, | ||
| long & | size, | ||
| long & | length, | ||
| bool & | end | ||
| ) | [virtual] |
Implements DistributionLibrary.
Definition at line 155 of file Identity.cc.
References _clientBuffer, and _llen.
{
if (remaining_size_octet < _llen) {
std::cerr << "Identity: not yet implemented !\n";
abort();
}
#ifdef DEBUG_INTERNAL
std::cerr << __FUNCTION__ << ": getClientData returns #elt: "<<_llen<<endl;
#endif
remaining_size_octet-= _llen;
returned_length_element= _llen;
end=true;
return _clientBuffer;
}
| void * Identity::getDescr | ( | ) | [virtual] |
Implements DistributionLibrary.
Definition at line 183 of file Identity.cc.
References _clientDescr, and IdentityLib::IdentityDescr::llen.
{
#ifdef DEBUG_INTERNAL
std::cerr << "-- descr:llen: "<<_clientDescr.llen<<std::endl;
#endif
return &_clientDescr;
}
| PaCO::PacoTopology_t Identity::getDestTopology | ( | ) | [virtual] |
Implements DistributionLibrary.
Definition at line 70 of file Identity.cc.
References _dTopo.
{
std::cerr << "****** Why is the method " << __FUNCTION__ << "called?\n";
abort();
return _dTopo;
}
| long Identity::getNodeRank | ( | ) | [virtual] |
Implements DistributionLibrary.
Definition at line 87 of file Identity.cc.
References _nodeRank.
{
return _nodeRank;
}
| void * Identity::getServerData | ( | long & | length | ) | [virtual] |
Implements DistributionLibrary.
Definition at line 211 of file Identity.cc.
References _llen, and _serverBuffer.
{
length= _llen;
#ifdef DEBUG_INTERNAL
std::cerr << "-- getServerData: ptr : "<<(void*)_serverBuffer<<" #element:"<<length<<std::endl;
#endif
return (void*) _serverBuffer;
}
| PaCO::PacoTopology_t Identity::getSourceTopology | ( | ) | [virtual] |
Implements DistributionLibrary.
Definition at line 51 of file Identity.cc.
References _sTopo.
{
std::cerr << "****** Why is the method " << __FUNCTION__ << "called?\n";
abort();
return _sTopo;
}
| bool Identity::insertData | ( | void * | rcptBuf, |
| unsigned long | element_nb | ||
| ) | [virtual] |
Implements DistributionLibrary.
Definition at line 192 of file Identity.cc.
References _llen, _serverBuffer, and _unitsize.
{
// cp from recpBuf to _serverBuffer
#ifdef DEBUG_INTERNAL
std::cerr << "-- insertData "<<endl;
#endif
if (element_nb != _llen) {
std::cerr << "Identity: not yet implemented !\n";
abort();
}
unsigned long llen = element_nb*_unitsize;
memcpy(_serverBuffer, rcptBuf, llen);
return true;
}
| void Identity::serverFree | ( | ) | [virtual] |
Implements DistributionLibrary.
Definition at line 249 of file Identity.cc.
References _serverBuffer.
{
#ifdef DEBUG_INTERNAL
std::cerr << "-- serverFree: "<<(void*)_serverBuffer<<endl;
#endif
free(_serverBuffer);
_serverBuffer=NULL; // the orb (or the user) need to free the memory!
}
| 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 Identity::setCommunicator | ( | void * | group | ) | [inline, virtual] |
| void Identity::setDataPtr | ( | void * | dataPtr | ) | [virtual] |
Implements DistributionLibrary.
Definition at line 146 of file Identity.cc.
References _clientBuffer.
{
_clientBuffer = (char *) dataPtr;
#ifdef DEBUG_INTERNAL
cerr << "-- _clientBuffer set to "<<dataPtr<<endl;
#endif
}
| void Identity::setDescr | ( | void * | descr | ) | [virtual] |
Implements DistributionLibrary.
Definition at line 221 of file Identity.cc.
References _dTopo, _llen, _serverBuffer, _serverDescr, _serverToReceived, _sTopo, _unitsize, IdentityLib::IdentityDescr::llen, setLocalNbElt(), and PaCO::PacoTopology_s::total.
{
std::cerr << "-- insertData "<<endl;
_serverDescr = (IdentityLib::IdentityDescr*) descr;
// Descr already received
if ( _serverBuffer == NULL)
{
// 1st time -> allocate memory & init
//this->setEltSize(_descr->usz); BUG: usz can be different in client and server (32bit vs 64bit)
unsigned long len = _serverDescr->llen*_unitsize;
this->setLocalNbElt(_serverDescr->llen);
#ifdef DEBUG_INTERNAL
fprintf(stderr, "-- setDescr: stopo: %ld\tdtopo: %ld\n",_sTopo.total, _dTopo.total);
fprintf(stderr, " setDescr: local len: %ld", _serverDescr->llen);
#endif
_serverBuffer = (char*) malloc(len);
#ifdef DEBUG_INTERNAL
std::cerr << "-- serverMalloc: "<<(void*)_serverBuffer<<" - "<<_llen<<endl;
#endif
_serverToReceived = len;
}
}

| void Identity::setDestTopology | ( | PaCO::PacoTopology_t | topo | ) | [virtual] |
Implements DistributionLibrary.
Definition at line 59 of file Identity.cc.
References _config, _dTopo, DST_TOPOLOGY, and PaCO::PacoTopology_s::total.
{
#ifdef DEBUG_INTERNAL
std::cerr << "-- setDestTopology: " << topo.total << std::endl;
#endif
_config |= DST_TOPOLOGY;
_dTopo = topo;
}
| void Identity::setEltSize | ( | unsigned long | size | ) |
Definition at line 93 of file Identity.cc.
References _config, _unitsize, and ELEMENT_SIZE.
{
#ifdef DEBUG_INTERNAL
std::cerr << "-- setEltSize: " << size << std::endl;
#endif
_config |= ELEMENT_SIZE;
_unitsize = size;
}
| void Identity::setLocalNbElt | ( | unsigned long | elt_nb | ) |
Definition at line 103 of file Identity.cc.
References _clientDescr, _config, _llen, IdentityLib::IdentityDescr::llen, and LOCAL_SIZE.
Referenced by setDescr().
{
#ifdef DEBUG_INTERNAL
std::cerr << "-- setLocalNbElt: " << elt_nb << std::endl;
#endif
_config |= LOCAL_SIZE;
_clientDescr.llen = _llen = elt_nb;
}
| void Identity::setNodeRank | ( | long | Rank | ) | [virtual] |
Implements DistributionLibrary.
Definition at line 78 of file Identity.cc.
References _nodeRank.
{
#ifdef DEBUG_INTERNAL
std::cerr << "-- setNodeRank: " << Rank << std::endl;
#endif
_nodeRank = Rank;
}
| void Identity::setSourceTopology | ( | PaCO::PacoTopology_t | topo | ) | [virtual] |
Implements DistributionLibrary.
Definition at line 41 of file Identity.cc.
References _config, _sTopo, SRC_TOPOLOGY, and PaCO::PacoTopology_s::total.
{
#ifdef DEBUG_INTERNAL
std::cerr << "-- setSourceTopology: " << topo.total << std::endl;
#endif
_config |= SRC_TOPOLOGY;
_sTopo = topo;
}
char* Identity::_clientBuffer [private] |
Definition at line 30 of file Identity.h.
Referenced by getClientData(), Identity(), and setDataPtr().
Definition at line 31 of file Identity.h.
Referenced by getDescr(), and setLocalNbElt().
unsigned Identity::_config [private] |
Definition at line 19 of file Identity.h.
Referenced by computePiecesToSend(), Identity(), setDestTopology(), setEltSize(), setLocalNbElt(), and setSourceTopology().
PaCO::PacoTopology_t Identity::_dTopo [private] |
Definition at line 22 of file Identity.h.
Referenced by getDestTopology(), Identity(), setDescr(), and setDestTopology().
unsigned Identity::_llen [private] |
Definition at line 25 of file Identity.h.
Referenced by computePiecesToSend(), getClientData(), getServerData(), insertData(), setDescr(), and setLocalNbElt().
unsigned Identity::_nodeRank [private] |
Definition at line 24 of file Identity.h.
Referenced by computePiecesToSend(), getNodeRank(), Identity(), and setNodeRank().
char* Identity::_serverBuffer [private] |
Definition at line 36 of file Identity.h.
Referenced by getServerData(), Identity(), insertData(), serverFree(), and setDescr().
IdentityLib::IdentityDescr* Identity::_serverDescr [private] |
Definition at line 38 of file Identity.h.
Referenced by Identity(), and setDescr().
unsigned long Identity::_serverToReceived [private] |
Definition at line 35 of file Identity.h.
Referenced by setDescr().
PaCO::PacoTopology_t Identity::_sTopo [private] |
Definition at line 21 of file Identity.h.
Referenced by getSourceTopology(), Identity(), setDescr(), and setSourceTopology().
unsigned Identity::_unitsize [private] |
Definition at line 26 of file Identity.h.
Referenced by insertData(), setDescr(), and setEltSize().