PaCO++
0.05
|
Go to the source code of this file.
Functions | |
bool | computeReceiveDataBlock1D (vAbstrait *vdarray, const PaCO::distLoc_t &mode, const unsigned dtotal, const unsigned drank, const ParisBlock_param_t *param, Abstrait *varray, void *comm) |
void | computeReceiveDataBlock1DServer (vAbstrait *vdarray, const Topology_t &dtopo, const ParisBlock_param_t *param, Abstrait *varray, void *comm) |
unsigned | nbofPart (const PaCO::distLoc_t &mode, const unsigned stotal, const unsigned dtotal, const unsigned drank) |
unsigned | posofPart (const PaCO::distLoc_t &mode, const unsigned dtotal, const unsigned srank) |
bool computeReceiveDataBlock1D | ( | vAbstrait * | vdarray, |
const PaCO::distLoc_t & | mode, | ||
const unsigned | dtotal, | ||
const unsigned | drank, | ||
const ParisBlock_param_t * | param, | ||
Abstrait * | varray, | ||
void * | comm | ||
) |
Definition at line 151 of file ServerSide.cc.
References PaCO::ClientSide, PaCO::CommSide, computeReceiveDataBlock1DServer(), PaCO::none, and PaCO::ServerSide.
Referenced by ParisBlockMPC::computeReceive(), BasicDistributionLibrary::computeReceive(), and ParisBlock::computeReceive().
{ #ifdef DEBUG_INTERNAL cerr << "In computeReceiveDataBlock1D...\n"; #endif switch(mode) { case PaCO::none: cerr << "INTERNAL ERROR: " << __FILE__ << " " << __FUNCTION__ << endl; break; case PaCO::ClientSide: #ifdef DEBUG_INTERNAL cerr << "Client Side case" <<endl; #endif varray->CopyAndGetSequenceOwner((*vdarray)[0]); #ifdef DEBUG_INTERNAL cerr << "Return true" << endl; #endif return true; break; case PaCO::ServerSide: { // data has been sent from source i to dest i % dtopo.total // so dest j has : j, j + dtopo.total, j+2*dtopo.total // so it may be 1 (at least activation) or more cerr << " vdaray size: " << vdarray->size() << endl; // unsigned stotal = (*vdarray)[0]->topo().total; // unsigned int nvdarray = stotal/dtotal; // unsigned int remaining = (nvdarray*dtotal + drank < stotal)?1:0; // nvdarray += remaining; // if ( nvdarray == 0 ) nvdarray=1; // alway at least one // fprintf(stderr, "computeReceiveDataBlock1D: Node %d : got %d of %d data\n", drank, vdarray->size(), nvdarray); // if (vdarray->size() == nvdarray) { #ifdef DEBUG_INTERNAL cerr << "DOING LOCAL REDISTRIBUTION width drank: "<< drank << endl; #endif Topology_t dtopo; dtopo.total = dtotal; varray->topo() = (*vdarray)[0]->topo(); varray->gd() = (*vdarray)[0]->gd(); varray->dist().length(1); varray->dist()[0].rank = drank; computeReceiveDataBlock1DServer(vdarray, dtopo, param, varray, comm); return true; break; } case PaCO::CommSide: break; } return false; }
void computeReceiveDataBlock1DServer | ( | vAbstrait * | vdarray, |
const Topology_t & | dtopo, | ||
const ParisBlock_param_t * | param, | ||
Abstrait * | varray, | ||
void * | comm | ||
) |
Definition at line 19 of file ServerSide.cc.
References blockSize(), computeReceiveBlock1D(), computeSendBlock1D(), doSchedule(), PaCO::PacoLocalData_s::len, PaCO::PacoLocalData_s::rank, sd, PaCO::PacoLocalData_s::start, and TotalNumberOfElementProc().
Referenced by computeReceiveDataBlock1D().
{ #ifdef DEBUG_INTERNAL cerr << "In computeReceiveDataBlock1DServer...\n"; #endif vector<LocalData_t> sched_send; vector<LocalData_t> sched_recv; sched_send.clear(); sched_recv.clear(); // Init data from 1st: all entries are assumed to be identical ! GlobalData_t& gd = (*vdarray)[0]->gd(); Topology_t& stopo= (*vdarray)[0]->topo(); // Compute what to send #ifdef DEBUG_INTERNAL cerr << "In computeReceiveDataBlock1DServer...computing what to send\n"; #endif for (unsigned it=0; it<vdarray->size(); it++) { if ((*vdarray)[it]->dist().length()==0) { #ifdef DEBUG_INTERNAL cerr << "Dist data empty: nothing to send\n"; #endif } else { #ifdef DEBUG_INTERNAL cerr << "it = " << it << endl; #endif PaCO::PacoLocalData_t psd = (*vdarray)[it]->dist()[0]; LocalData_t sd; sd.rank = psd.rank; sd.start = psd.start; sd.len = psd.len; sd.base = (*vdarray)[it]->getDataBuffer(0, false); computeSendBlock1D(gd, sd, stopo, dtopo, param, sched_send); } } // Compute what to receive #ifdef DEBUG_INTERNAL cerr << "In computeReceiveDataBlock1DServer...computing what to receive\n"; #endif // Allocating memory unsigned dlbsz = blockSize(gd.len, dtopo.total, param); LocalData_t vd; vd.rank = varray->dist()[0].rank; vd.start = vd.rank * dlbsz; vd.len = TotalNumberOfElementProc(gd.len, vd.rank, dtopo.total, dlbsz); #ifdef DEBUG_INTERNAL cerr << "Allocating a sequence of length " << vd.len << endl; #endif varray->setSeqLength(1); varray->setDataLength(0, vd.len); if (vd.len > 0 ) vd.base = varray->getDataBuffer(0, false); else vd.base = (char*) 1; if (vd.base==0) { cerr << "Cannot allocate memory for #elements" << vd.len << endl; } else { #ifdef DEBUG_INTERNAL fprintf(stderr, "dd.base = %p\n", vd.base); #endif } computeReceiveBlock1D(gd, vd, stopo, dtopo, param, sched_recv); // Doing local communication //fprintf(stderr, "In computeReceiveDataBlock1DServer...Doing local communications with ctopo: %ld\n", dtopo.total); doSchedule(gd, vd, dtopo, sched_send, sched_recv, comm); cerr << "In computeReceiveDataBlock1DServer...ok\n"; }
unsigned nbofPart | ( | const PaCO::distLoc_t & | mode, |
const unsigned | stotal, | ||
const unsigned | dtotal, | ||
const unsigned | drank | ||
) |
Definition at line 120 of file ServerSide.cc.
{ switch(mode) { case PaCO::none: cerr << "INTERNAL ERROR: " << __FILE__ << " " << __FUNCTION__ << endl; return 0; case PaCO::ClientSide: return 1; case PaCO::ServerSide: { unsigned int nvdarray = stotal/dtotal; unsigned int remaining = (nvdarray*dtotal + drank < stotal)?1:0; nvdarray += remaining; if ( nvdarray == 0 ) return 1; // alway at least one return nvdarray; } case PaCO::CommSide: cerr << "INTERNAL ERROR: not yet implemented in " << __FILE__ << " " << __FUNCTION__ << endl; return 0; } return 0; }
unsigned posofPart | ( | const PaCO::distLoc_t & | mode, |
const unsigned | dtotal, | ||
const unsigned | srank | ||
) |
Definition at line 138 of file ServerSide.cc.
{ switch(mode) { case PaCO::none: cerr << "INTERNAL ERROR: " << __FILE__ << " " << __FUNCTION__ << endl; return 0; case PaCO::ClientSide: return 0; case PaCO::ServerSide: return srank / dtotal; case PaCO::CommSide: cerr << "INTERNAL ERROR: not yet implemented in " << __FILE__ << " " << __FUNCTION__ << endl; return 0; } return 0; }