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


Classes | |
| struct | info_t |
Public Member Functions | |
| BasicBC () | |
| 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 () |
| virtual bool | insertData (void *rcptBuf, unsigned long element_nb) |
| virtual void | serverFree () |
| void | setBlocSize (unsigned long bsz) |
| 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) |
| virtual void | setNodeRank (long Rank) |
| virtual void | setSourceTopology (PaCO::PacoTopology_t topo) |
| void | setTotalNbElt (unsigned long elt_nb) |
| virtual | ~BasicBC () |
Private Types | |
| typedef map< long, info_list_t ** > | info_list_map_t |
| typedef list< info_t * > | info_list_t |
Private Member Functions | |
| void | allocate_new_info_list () |
| void | clear_info_list () |
| void | internalFreeComId (info_list_map_t::iterator &it) |
| void | internalSetComId (long id) |
| void | reset_info_list () |
Private Attributes | |
| char * | _clientBuffer |
| BasicBCLib::BasicBCDescr | _clientDescr |
| unsigned | _config |
| long | _cur_id |
| unsigned | _dbsz |
| unsigned | _descr_ids_counter |
| bool | _descr_to_be_cleaned |
| PaCO::PacoTopology_t | _dTopo |
| unsigned | _glen |
| info_list_map_t | _info_list_map |
| info_list_t ** | _infolists |
| unsigned | _llen |
| unsigned | _lstart |
| unsigned | _nodeRank |
| BasicBC_param_t | _param |
| unsigned | _sbsz |
| char * | _serverBuffer |
| BasicBCLib::BasicBCDescr * | _serverDescr |
| unsigned long | _serverToReceived |
| PaCO::PacoTopology_t | _sTopo |
typedef map<long, info_list_t**> BasicBC::info_list_map_t [private] |
typedef list<info_t*> BasicBC::info_list_t [private] |
| BasicBC::BasicBC | ( | ) |
Definition at line 117 of file BasicBC.cc.
References _clientBuffer, _config, _descr_to_be_cleaned, _dTopo, _nodeRank, _param, _serverBuffer, _serverDescr, _sTopo, BASICBC_BLOC, internalSetComId(), PaCO::PacoTopology_s::total, and BasicBC_param_t::type.
{
// Common
_config = 0;
// By default 1->1 :)
_sTopo.total=1;
_dTopo.total=1;
_param.type = BASICBC_BLOC;
_nodeRank=0;
// Client side
_clientBuffer=NULL;
_descr_to_be_cleaned=true;
this->internalSetComId(-1); // set anonymous & init iterator, infolists & _cur_id
// Server side
_serverDescr=NULL;
_serverBuffer=NULL;
}

| BasicBC::~BasicBC | ( | ) | [virtual] |
Definition at line 139 of file BasicBC.cc.
References _info_list_map, and internalFreeComId().
{
for(info_list_map_t::iterator it=_info_list_map.begin(); it!=_info_list_map.end(); ++it)
this->internalFreeComId(it);
_info_list_map.clear();
}

| void BasicBC::allocate_new_info_list | ( | ) | [private] |
Definition at line 754 of file BasicBC.cc.
References _dTopo, _infolists, and PaCO::PacoTopology_s::total.
Referenced by internalSetComId().
{
_infolists = new info_list_t*[_dTopo.total];
for(unsigned i=0;i<_dTopo.total;i++)
_infolists[i]=new info_list_t();
}
| void BasicBC::clear_info_list | ( | ) | [private] |
Definition at line 777 of file BasicBC.cc.
References _dTopo, _infolists, and PaCO::PacoTopology_s::total.
Referenced by clientFree().
{
#ifdef DEBUG_INTERNAL
std::cerr << "-- clear info list\n";
#endif
// for each destNode
for(unsigned i=0; i< _dTopo.total; i++) {
// for each element of the list
info_list_t *ilp = _infolists[i];
for(info_list_t::const_iterator ci=ilp->begin(); ci!=ilp->end(); ++ci)
delete (*ci);
_infolists[i] -> clear();
}
}
| void BasicBC::clientFree | ( | ) | [virtual] |
Implements DistributionLibrary.
Definition at line 558 of file BasicBC.cc.
References _cur_id, clear_info_list(), and reset_info_list().
{
#ifdef DEBUG_INTERNAL
std::cerr << "-- clientFree\n";
#endif
if (_cur_id == -1) {
this->clear_info_list();
} else {
this->reset_info_list();
}
}

| PieceToSend * BasicBC::computePiecesToSend | ( | unsigned & | size | ) | [virtual] |
Implements DistributionLibrary.
Definition at line 265 of file BasicBC.cc.
References _dTopo, _glen, _infolists, _llen, _lstart, _nodeRank, _param, _sbsz, _sTopo, BASICBC_BLOC, BlocNumberOfElementProc(), blocSize(), computeBlocBounds(), PieceToSend::destNode, getProcRangeInf(), getProcRangeSup(), BasicBC::info_t::gstart, PieceToSend::id, BasicBC::info_t::lstart, BasicBC::info_t::msg_size, NumberOfBlocProc(), OwnerBloc(), BasicBC::info_t::sent_size, PieceToSend::size, PieceToSend::sourceNode, PaCO::PacoTopology_s::total, TotalNumberOfElementProc(), BasicBC_param_t::type, and BasicBC_param_t::unitsize.
{
/*
* store src/dst/sz/start
*
* where start is a local offset to apply to the vector
*
*/
PieceToSend * sched;
unsigned long golen = _glen*_param.unitsize;
// We need to compute _lstart and _llen
_sbsz = blocSize( golen, _sTopo.total, _param);
_lstart = _nodeRank*_sbsz;
_lstart = (_lstart < golen ? _lstart:golen);
_llen = TotalNumberOfElementProc(golen, _nodeRank, _sTopo.total, _sbsz);
#ifdef DEBUG_INTERNAL
// std::cerr << "In computePiecesToSend-------------------- all in octet !\n";
fprintf(stderr, "-- stopo: %ld\tdtopo: %ld\n", _sTopo.total, _dTopo.total);
fprintf(stderr, "-- golen: %ld\ttype: %d\tsd.start %d\tllen: %d\n", golen,
_param.type, _lstart, _llen);
#endif
if (_sTopo.total == _dTopo.total) {
#ifdef DEBUG_INTERNAL
fprintf(stderr, "-- easy: n<->n case !\n");
#endif
size_out = 1;
sched = new PieceToSend[1];
sched[0].sourceNode = _nodeRank; // my self :)
sched[0].destNode = _nodeRank; // the corresponding node
sched[0].size = _llen; // msg size
info_t* inf = new info_t();
inf->gstart = _lstart/_param.unitsize; // used start as id -> same at server side
inf->lstart = 0; // do not apply any offset to local ptr
inf->msg_size = _llen;
inf->sent_size = 0;
// add inf to the list
_infolists[_nodeRank]->push_back(inf);
// sched points to the list
sched[0].id = (void*) _infolists[_nodeRank];
#ifdef DEBUG_INTERNAL
fprintf(stderr, "-- %2d -> %2d : gstart:%2u lstart:%2u len:%2d\n",
sched[0].sourceNode, sched[0].destNode, inf->gstart, inf->lstart, inf->msg_size);
#endif
} else {
if (_param.type == BASICBC_BLOC ) {
// that's a standard bloc redistribution
#ifdef DEBUG_INTERNAL
fprintf(stderr, "-- medium: n<->m bloc redistribution case !\n");
#endif
unsigned long slow;
unsigned long shigh;
computeBlocBounds(&slow, &shigh, golen, _nodeRank, _sTopo.total, _sbsz, 0);
#ifdef DEBUG_INTERNAL
std::cerr << "-- sbsz: "<<_sbsz<<" sbounds: "<<slow<<" - "<<shigh<<endl;
#endif
unsigned dbsz = blocSize(golen, _dTopo.total, _param);
#ifdef DEBUG_INTERNAL
std::cerr << "-- dbsz: "<<dbsz<<endl;
#endif
unsigned fpid, lpid;
fpid = getProcRangeInf(slow, dbsz);
lpid = getProcRangeSup(shigh, dbsz);
#ifdef DEBUG_INTERNAL
fprintf(stderr, "-- loop from %d to %d width dtotal: %ld\n", fpid, lpid, _dTopo.total);
#endif
// for each dest bloc
size_out = lpid-fpid+1;
sched = new PieceToSend[size_out];
for(unsigned i=fpid; i <= lpid; i++) {
PieceToSend& s = sched[i-fpid];
s.sourceNode = _nodeRank;
s.destNode = i;
info_t* inf = new info_t();
unsigned tmp = i*dbsz;
unsigned tmp2;
tmp2 = ( slow >= tmp)?slow:tmp; // max : global offset in octet as ID
inf->gstart = tmp2 / _param.unitsize;
inf->lstart = tmp2 - _lstart;
tmp += dbsz;
unsigned end = ( shigh <= tmp)?shigh:tmp; // min
inf->msg_size = s.size = end - tmp2;
inf->sent_size = 0;
// add inf to the list
_infolists[i-fpid]->push_back(inf);
// sched points to the list
s.id = (void*) _infolists[i-fpid];
#ifdef DEBUG_INTERNAL
fprintf(stderr, "-- %2d -> %2d : gstart:%2u lstart:%2u len:%2d\n",
s.sourceNode, s.destNode, inf->gstart, inf->lstart, inf->msg_size);
#endif
}
} else {
// it is a bloccyclic distribution
#ifdef DEBUG_INTERNAL
fprintf(stderr, "-- hard: n<->m bloccyclic redistribution case !\n");
#endif
unsigned stbsz = _sbsz * _sTopo.total;
unsigned nbbloc = NumberOfBlocProc(golen, _sTopo.total, _sbsz, _nodeRank);
#ifdef DEBUG_INTERNAL
std::cerr << "-- sbsz: "<<_sbsz<<" nbbloc: "<<nbbloc<<endl;
#endif
// for each src bloc, find a dst node
// But only one struct for each dst -> pre-count
// should be equal to the number of real dest !
size_out = 0;
unsigned *tmp_dnb = (unsigned*) calloc(_dTopo.total, sizeof(unsigned)); // zeroed array
PieceToSend **tmp_dor = (PieceToSend**) calloc(_dTopo.total, sizeof(PieceToSend*)); // zeroed array
for(unsigned b=0; b<nbbloc; b++) {
unsigned gb = b * _sTopo.total + _nodeRank; // global bloc id
unsigned drank = OwnerBloc(gb, _dTopo.total);
if (tmp_dnb[drank]++ == 0) // detect if it is the 1st time
size_out++;
}
// Allocating output
sched = new PieceToSend[size_out];
unsigned cur=0;
for(unsigned i=0; i<_dTopo.total; i++) {
sched[cur].sourceNode = _nodeRank;
sched[cur].destNode = i;
sched[cur].size = 0;
sched[cur].id = (void*) _infolists[i];
tmp_dor[i] = &sched[cur]; // an index if valid only if tmp_dnb[index]>0 !!!!
cur+= (tmp_dnb[i]>0?1:0); // increment order only if this dest is not zero
}
#ifdef DEBUG_INTERNAL
cerr << "-- size_out: "<<size_out<<endl;
#endif
for(unsigned b=0; b<nbbloc; b++) {
unsigned gb = b * _sTopo.total + _nodeRank; // global bloc id
unsigned drank = OwnerBloc(gb, _dTopo.total);
PieceToSend* s = tmp_dor[drank];
// Allocate new element
info_t* inf = new info_t();
inf->gstart = ((stbsz*b) + (_nodeRank*_sbsz))/ _param.unitsize;
inf->lstart = b * _sbsz;
inf->msg_size = BlocNumberOfElementProc(golen, _nodeRank, _sTopo.total, _sbsz, b);
inf->sent_size = 0;
// Accumulate msg length in PieceToSend
s->size += inf->msg_size;
// insert it in the list
info_list_t* ilsp = (info_list_t*) s->id; // pointer to a list
ilsp->push_back(inf);
#ifdef DEBUG_INTERNAL
fprintf(stderr, "-- %2d -> %2d : gstart:%2u lstart:%2u len:%2d\n",
s->sourceNode, s->destNode, inf->gstart, inf->lstart, inf->msg_size);
#endif
}
}
}
#ifdef DEBUG_INTERNAL
// std::cerr << "computePiecesToSend-------------------- done\n";
#endif
return sched;
}

| bool BasicBC::freeComId | ( | long | id | ) | [virtual] |
Reimplemented from DistributionLibrary.
Definition at line 726 of file BasicBC.cc.
References _cur_id, _info_list_map, and internalFreeComId().
{
if (id == -1) {
#ifdef DEBUG_INTERNAL
cerr << "freeComId: not allowed to free com id -1 (ignoring)\n";
#endif
return true;
}
if (_cur_id == id) {
#ifdef DEBUG_INTERNAL
cerr << "freeComId: not allowed to free current com (ignoring)\n";
#endif
return true;
}
#ifdef DEBUG_INTERNAL
cerr << "freeComid: communication id: "<<id<<endl;
#endif
info_list_map_t::iterator it = _info_list_map.find(id);
this->internalFreeComId(it);
_info_list_map.erase(it);
return true;
}

| void * BasicBC::getClientData | ( | void * | pid, |
| int | server_node, | ||
| long & | size, | ||
| long & | length, | ||
| bool & | end | ||
| ) | [virtual] |
Implements DistributionLibrary.
Definition at line 469 of file BasicBC.cc.
References _clientBuffer, _clientDescr, _descr_to_be_cleaned, _param, DEBUG_INTERNAL2, BasicBC::info_t::gstart, BasicBCLib::BasicBCDescr::ids, BasicBC::info_t::lstart, BasicBC::info_t::sent_size, and BasicBC_param_t::unitsize.
{
info_list_t* ilsp = (info_list_t*) pid;
#ifdef DEBUG_INTERNAL2
std::cerr << "-- getClientData : _clientBuffer=" << (void*) _clientBuffer << std::endl;
std::cerr << "-- getClientData : " << dnode << " " << remaining_size_octet << std::endl;
#endif
if (_descr_to_be_cleaned) {
_descr_to_be_cleaned = false;
_clientDescr.ids.length(0);
}
// look for 1st one not "empty"
long rst_data=0;
info_list_t::const_iterator ci;
for(ci=ilsp->begin(); ci!=ilsp->end(); ++ci) {
rst_data = (*ci)->msg_size - (*ci)->sent_size;
if (rst_data>0)
break;
}
// No more element: return immediatly
if (ci == ilsp->end())
{
#ifdef DEBUG_INTERNAL2
std::cerr << "-- getClientData0 : no more block for this argument\n";
#endif
returned_length_element = 0;
end = true;
return NULL;
}
// No more data of this element but there are more
if (rst_data == 0)
{
#ifdef DEBUG_INTERNAL2
std::cerr << "-- getClientData0 : no more data for this bloc\n";
#endif
returned_length_element = 0;
end = false;
return NULL;
}
// *ci assumed ok here (else return above !!)
info_t* info = *ci;
// More asked data as I can provide -> give all the data of this bloc
if (remaining_size_octet >= rst_data)
{
unsigned descr_len = _clientDescr.ids.length();
_clientDescr.ids.length(descr_len+1);
_clientDescr.ids[descr_len] = info->gstart+(info->sent_size/_param.unitsize);
unsigned start = info->lstart+info->sent_size;
info->sent_size += rst_data;
returned_length_element = rst_data / _param.unitsize; // should divide;
remaining_size_octet -= rst_data;
end = (remaining_size_octet == 0);
#ifdef DEBUG_INTERNAL2
std::cerr << "-- getClientData1 : gstart:"<<_clientDescr.ids[descr_len]<<" #element:"<<returned_length_element<<endl;
#endif
return (void *)&_clientBuffer[start];
}
else
{
// I have more data than requested
unsigned descr_len = _clientDescr.ids.length();
_clientDescr.ids.length(descr_len+1);
_clientDescr.ids[descr_len] = info->gstart+(info->sent_size/_param.unitsize);
unsigned start = info->lstart+info->sent_size;
returned_length_element = (remaining_size_octet+_param.unitsize-1)/_param.unitsize; // max
unsigned mlen = returned_length_element*_param.unitsize;
info->sent_size += mlen;
remaining_size_octet -= mlen;
end = true;
#ifdef DEBUG_INTERNAL2
std::cerr << "-- getClientData1 : gstart:"<<_clientDescr.ids[descr_len]<<" #element:"<<returned_length_element<<endl;
#endif
return (void *)&_clientBuffer[start];
}
}
| void * BasicBC::getDescr | ( | ) | [virtual] |
Implements DistributionLibrary.
Definition at line 572 of file BasicBC.cc.
References _clientDescr, _descr_to_be_cleaned, BasicBCLib::BasicBCDescr::bsz, BasicBCLib::BasicBCDescr::glen, and BasicBCLib::BasicBCDescr::ids.
{
#ifdef DEBUG_INTERNAL
std::cerr << "-- descr: glen: "<<_clientDescr.glen<<" #element: "<<_clientDescr.ids.length()<<" bsz: "<<_clientDescr.bsz;
for(unsigned i=0;i<_clientDescr.ids.length();i++) {
std::cerr<<" "<<_clientDescr.ids[i];
}
std::cerr<<std::endl;
#endif
_descr_to_be_cleaned = true;
return &_clientDescr;
}
| PaCO::PacoTopology_t BasicBC::getDestTopology | ( | ) | [virtual] |
Implements DistributionLibrary.
Definition at line 190 of file BasicBC.cc.
References _dTopo.
{
std::cerr << "****** Why is the method " << __FUNCTION__ << "called?\n";
abort();
return _dTopo;
}
| long BasicBC::getNodeRank | ( | ) | [virtual] |
Implements DistributionLibrary.
Definition at line 207 of file BasicBC.cc.
References _nodeRank.
{
return _nodeRank;
}
| void * BasicBC::getServerData | ( | long & | length | ) | [virtual] |
Implements DistributionLibrary.
Definition at line 616 of file BasicBC.cc.
References _llen, _param, _serverBuffer, and BasicBC_param_t::unitsize.
{
length= _llen / _param.unitsize;
#ifdef DEBUG_INTERNAL
std::cerr << "-- getServerData: ptr : "<<(void*)_serverBuffer<<" #element:"<<length<<std::endl;
#endif
return (void*) _serverBuffer;
}
| PaCO::PacoTopology_t BasicBC::getSourceTopology | ( | ) | [virtual] |
Implements DistributionLibrary.
Definition at line 157 of file BasicBC.cc.
References _sTopo.
{
std::cerr << "****** Why is the method " << __FUNCTION__ << "called?\n";
abort();
return _sTopo;
}
| bool BasicBC::insertData | ( | void * | rcptBuf, |
| unsigned long | element_nb | ||
| ) | [virtual] |
Implements DistributionLibrary.
Definition at line 586 of file BasicBC.cc.
References _dbsz, _descr_ids_counter, _dTopo, _param, _serverBuffer, _serverDescr, _serverToReceived, BASICBC_BLOC, BasicBCLib::BasicBCDescr::ids, PaCO::PacoTopology_s::total, BasicBC_param_t::type, and BasicBC_param_t::unitsize.
{
// We are receiving one bloc
unsigned gstart = _serverDescr->ids[_descr_ids_counter++]; // in octet !!!
unsigned lstart;
unsigned llen = element_nb*_param.unitsize;
// Need to compute lstart :(
if (_param.type == BASICBC_BLOC ) {
lstart = (gstart*_param.unitsize)/ _dbsz; // bloc number
lstart = (gstart*_param.unitsize) - (lstart*_dbsz);
} else {
lstart = (gstart*_param.unitsize)/ _dbsz; // bloc number
lstart /= _dTopo.total; // local number
}
char* rptr = &_serverBuffer[lstart];
#ifdef DEBUG_INTERNAL
std::cerr << " gstart: "<< gstart<<" lstart: "<<lstart<<" #element " << element_nb<<" llen: "<<llen<<std::endl;
#endif
memcpy(rptr, rcptBuf, llen);
_serverToReceived -= llen;
#ifdef DEBUG_INTERNAL
std::cerr << " #missing data"<<_serverToReceived<<std::endl;
#endif
return (_serverToReceived == 0);
}
| void BasicBC::internalFreeComId | ( | info_list_map_t::iterator & | it | ) | [private] |
Definition at line 702 of file BasicBC.cc.
References _dTopo, _info_list_map, and PaCO::PacoTopology_s::total.
Referenced by freeComId(), setDestTopology(), and ~BasicBC().
{
if (it == _info_list_map.end() ) {
#ifdef DEBUG_INTERNAL
cerr << "freeComid: communication id not found (ignoring)\n";
#endif
} else {
#ifdef DEBUG_INTERNAL
cerr << "freeComid: freeing communication "<<endl;
#endif
info_list_t** info = it->second;
// for each destNode
for(unsigned i=0; i< _dTopo.total; i++) {
// for each element of the list
info_list_t *ilp = info[i];
for(info_list_t::const_iterator ci=ilp->begin(); ci!=ilp->end(); ++ci)
delete (*ci);
info[i] -> clear();
delete info[i];
}
}
}
| void BasicBC::internalSetComId | ( | long | id | ) | [private] |
Definition at line 666 of file BasicBC.cc.
References _cur_id, _info_list_map, _infolists, and allocate_new_info_list().
Referenced by BasicBC(), setComId(), and setDestTopology().
{
info_list_map_t::iterator it = _info_list_map.find(id);
if (it == _info_list_map.end() ) {
#ifdef DEBUG_INTERNAL
cerr << "setComiI: set 1st time communication id "<<id<<endl;
#endif
// we must allocate a new one
this->allocate_new_info_list();
#ifdef DEBUG_INTERNAL
cerr << "setComId: allocating a new _infolists: "<<_infolists<<endl;
#endif
_info_list_map[id] = _infolists;
} else {
#ifdef DEBUG_INTERNAL
cerr << "setComId: set (not 1st time) communication id "<<id<<endl;
#endif
_infolists = it->second;
}
_cur_id = id;
}

| void BasicBC::reset_info_list | ( | ) | [private] |
Definition at line 762 of file BasicBC.cc.
References _dTopo, _infolists, and PaCO::PacoTopology_s::total.
Referenced by clientFree().
{
#ifdef DEBUG_INTERNAL
std::cerr << "-- reset info list\n";
#endif
// for each destNode
for(unsigned i=0; i< _dTopo.total; i++) {
// for each element of the list
info_list_t *ilp = _infolists[i];
for(info_list_t::const_iterator ci=ilp->begin(); ci!=ilp->end(); ++ci)
(*ci)->sent_size = 0;
}
}
| void BasicBC::serverFree | ( | ) | [virtual] |
Implements DistributionLibrary.
Definition at line 656 of file BasicBC.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!
}
| void BasicBC::setBlocSize | ( | unsigned long | bsz | ) |
Definition at line 213 of file BasicBC.cc.
References _clientDescr, _config, _param, BASICBC_BLOC, BASICBC_BLOCCYCLIC, BASICBC_CYCLIC, BasicBC_param_t::blocsize, BasicBCLib::BasicBCDescr::bsz, DISTRIBUTION_TYPE, and BasicBC_param_t::type.
Referenced by setDescr().
{
#ifdef DEBUG_INTERNAL
std::cerr << "-- setBlocSize: " << size << std::endl;
#endif
_config |= DISTRIBUTION_TYPE;
switch(size) {
case 0:
#ifdef DEBUG_INTERNAL
cout << "Selecting a BLOC distribution\n";
#endif
_param.type = BASICBC_BLOC;
_clientDescr.bsz = 0;
break;
case 1:
#ifdef DEBUG_INTERNAL
cout << "Selecting a CYCLIC distribution\n";
#endif
_param.type = BASICBC_CYCLIC;
_clientDescr.bsz = 1;
break;
default:
#ifdef DEBUG_INTERNAL
cout << "Selecting a BLOCCYCLIC with bsz= " << size << " \n";
#endif
_param.type = BASICBC_BLOCCYCLIC;
_clientDescr.bsz = _param.blocsize = size;
}
}
| bool BasicBC::setComId | ( | long | id | ) | [virtual] |
Reimplemented from DistributionLibrary.
Definition at line 691 of file BasicBC.cc.
References _cur_id, and internalSetComId().
{
if (_cur_id == id) return true; // already initialized
this->internalSetComId(id);
return true;
}

| virtual void BasicBC::setCommunicator | ( | void * | group | ) | [inline, virtual] |
| void BasicBC::setDataPtr | ( | void * | dataPtr | ) | [virtual] |
Implements DistributionLibrary.
Definition at line 460 of file BasicBC.cc.
References _clientBuffer.
{
_clientBuffer = (char *) dataPtr;
#ifdef DEBUG_INTERNAL
cerr << "-- _clientBuffer set to "<<dataPtr<<endl;
#endif
}
| void BasicBC::setDescr | ( | void * | descr | ) | [virtual] |
Implements DistributionLibrary.
Definition at line 626 of file BasicBC.cc.
References _dbsz, _descr_ids_counter, _dTopo, _llen, _nodeRank, _param, _serverBuffer, _serverDescr, _serverToReceived, _sTopo, blocSize(), BasicBCLib::BasicBCDescr::bsz, BasicBCLib::BasicBCDescr::glen, setBlocSize(), setTotalNbElt(), PaCO::PacoTopology_s::total, TotalNumberOfElementProc(), and BasicBC_param_t::unitsize.
{
_serverDescr = (BasicBCLib::BasicBCDescr*) descr;
_descr_ids_counter=0;
// 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 golen = _serverDescr->glen*_param.unitsize;
this->setTotalNbElt(_serverDescr->glen);
this->setBlocSize(_serverDescr->bsz);
_dbsz = blocSize( golen, _dTopo.total, _param);
_llen = TotalNumberOfElementProc(golen, _nodeRank, _dTopo.total, _dbsz);
#ifdef DEBUG_INTERNAL
fprintf(stderr, "-- setDescr: stopo: %ld\tdtopo: %ld\n",_sTopo.total, _dTopo.total);
fprintf(stderr, " setDescr: golen: %ld\tllen %d\tbsz:%ld\n", _serverDescr->glen, _llen, _serverDescr->bsz);
#endif
_serverBuffer = (char*) malloc(_llen);
#ifdef DEBUG_INTERNAL
std::cerr << "-- serverMalloc: "<<(void*)_serverBuffer<<" - "<<_llen<<endl;
#endif
_serverToReceived = _llen;
}
}

| void BasicBC::setDestTopology | ( | PaCO::PacoTopology_t | topo | ) | [virtual] |
Implements DistributionLibrary.
Definition at line 165 of file BasicBC.cc.
References _config, _cur_id, _dTopo, _info_list_map, DST_TOPOLOGY, internalFreeComId(), internalSetComId(), and PaCO::PacoTopology_s::total.
{
#ifdef DEBUG_INTERNAL
std::cerr << "-- setDestTopology: " << topo.total << std::endl;
#endif
_config |= DST_TOPOLOGY;
if ( _dTopo.total == topo.total ) return ; // Nothing change !!!!
// Delete old entries wrt to old state
info_list_map_t::iterator it = _info_list_map.find(_cur_id);
this->internalFreeComId(it);
_info_list_map.erase(it);
// Change the state of the object
_dTopo = topo;
// Set new entries
this->internalSetComId(_cur_id);
// BUG: MUST ALSO DELETE ALL ENTRIES IN _info_list_map
}

| void BasicBC::setEltSize | ( | unsigned long | size | ) |
Definition at line 244 of file BasicBC.cc.
References _config, _param, ELEMENT_SIZE, and BasicBC_param_t::unitsize.
{
#ifdef DEBUG_INTERNAL
std::cerr << "-- setEltSize: " << size << std::endl;
#endif
_config |= ELEMENT_SIZE;
_param.unitsize = size;
}
| void BasicBC::setNodeRank | ( | long | Rank | ) | [virtual] |
Implements DistributionLibrary.
Definition at line 198 of file BasicBC.cc.
References _nodeRank.
{
#ifdef DEBUG_INTERNAL
std::cerr << "-- setNodeRank: " << Rank << std::endl;
#endif
_nodeRank = Rank;
}
| void BasicBC::setSourceTopology | ( | PaCO::PacoTopology_t | topo | ) | [virtual] |
Implements DistributionLibrary.
Definition at line 147 of file BasicBC.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;
}
| void BasicBC::setTotalNbElt | ( | unsigned long | elt_nb | ) |
Definition at line 254 of file BasicBC.cc.
References _clientDescr, _config, _glen, BasicBCLib::BasicBCDescr::glen, and TOTAL_SIZE.
Referenced by setDescr().
{
#ifdef DEBUG_INTERNAL
std::cerr << "-- setTotalNbElt: " << elt_nb << std::endl;
#endif
_config |= TOTAL_SIZE;
_clientDescr.glen = _glen = elt_nb;
}
char* BasicBC::_clientBuffer [private] |
Definition at line 78 of file BasicBC.h.
Referenced by BasicBC(), getClientData(), and setDataPtr().
Definition at line 79 of file BasicBC.h.
Referenced by getClientData(), getDescr(), setBlocSize(), and setTotalNbElt().
unsigned BasicBC::_config [private] |
Definition at line 42 of file BasicBC.h.
Referenced by BasicBC(), setBlocSize(), setDestTopology(), setEltSize(), setSourceTopology(), and setTotalNbElt().
long BasicBC::_cur_id [private] |
Definition at line 74 of file BasicBC.h.
Referenced by clientFree(), freeComId(), internalSetComId(), setComId(), and setDestTopology().
unsigned BasicBC::_dbsz [private] |
Definition at line 55 of file BasicBC.h.
Referenced by insertData(), and setDescr().
unsigned BasicBC::_descr_ids_counter [private] |
Definition at line 84 of file BasicBC.h.
Referenced by insertData(), and setDescr().
bool BasicBC::_descr_to_be_cleaned [private] |
Definition at line 77 of file BasicBC.h.
Referenced by BasicBC(), getClientData(), and getDescr().
PaCO::PacoTopology_t BasicBC::_dTopo [private] |
Definition at line 45 of file BasicBC.h.
Referenced by allocate_new_info_list(), BasicBC(), clear_info_list(), computePiecesToSend(), getDestTopology(), insertData(), internalFreeComId(), reset_info_list(), setDescr(), and setDestTopology().
unsigned BasicBC::_glen [private] |
Definition at line 50 of file BasicBC.h.
Referenced by computePiecesToSend(), and setTotalNbElt().
info_list_map_t BasicBC::_info_list_map [private] |
Definition at line 72 of file BasicBC.h.
Referenced by freeComId(), internalFreeComId(), internalSetComId(), setDestTopology(), and ~BasicBC().
info_list_t** BasicBC::_infolists [private] |
Definition at line 75 of file BasicBC.h.
Referenced by allocate_new_info_list(), clear_info_list(), computePiecesToSend(), internalSetComId(), and reset_info_list().
unsigned BasicBC::_llen [private] |
Definition at line 51 of file BasicBC.h.
Referenced by computePiecesToSend(), getServerData(), and setDescr().
unsigned BasicBC::_lstart [private] |
Definition at line 53 of file BasicBC.h.
Referenced by computePiecesToSend().
unsigned BasicBC::_nodeRank [private] |
Definition at line 48 of file BasicBC.h.
Referenced by BasicBC(), computePiecesToSend(), getNodeRank(), setDescr(), and setNodeRank().
BasicBC_param_t BasicBC::_param [private] |
Definition at line 47 of file BasicBC.h.
Referenced by BasicBC(), computePiecesToSend(), getClientData(), getServerData(), insertData(), setBlocSize(), setDescr(), and setEltSize().
unsigned BasicBC::_sbsz [private] |
Definition at line 54 of file BasicBC.h.
Referenced by computePiecesToSend().
char* BasicBC::_serverBuffer [private] |
Definition at line 85 of file BasicBC.h.
Referenced by BasicBC(), getServerData(), insertData(), serverFree(), and setDescr().
BasicBCLib::BasicBCDescr* BasicBC::_serverDescr [private] |
Definition at line 87 of file BasicBC.h.
Referenced by BasicBC(), insertData(), and setDescr().
unsigned long BasicBC::_serverToReceived [private] |
Definition at line 83 of file BasicBC.h.
Referenced by insertData(), and setDescr().
PaCO::PacoTopology_t BasicBC::_sTopo [private] |
Definition at line 44 of file BasicBC.h.
Referenced by BasicBC(), computePiecesToSend(), getSourceTopology(), setDescr(), and setSourceTopology().