PaCO++  0.05
BasicDistributionLibrary.cc
Go to the documentation of this file.
2 
3 #include "Schedule.h"
4 
6  setFabric(f);
7  _darray = f->creer();
8  _vdarray = f->vcreer();
9  _vdarray->clear();
10 
11  _clttopo.total = 123; // debug
12  _srvtopo.total = 123; // debug
13 }
14 
15 BasicDistributionLibrary::BasicDistributionLibrary(Fabrique* f, void* comm ) : _comm(comm) {
16  setFabric(f);
17  _darray = f->creer();
18  _vdarray = f->vcreer();
19  _vdarray->clear();
20 
21  _clttopo.total = 123; // debug
22  _srvtopo.total = 123; // debug
23 }
24 
26  delete _fab; delete _darray; delete _vdarray;
27 }
28 
30 
31 void BasicDistributionLibrary::setFabric(Fabrique* f) { _fab = f; }
32 
34 
36 
37 bool BasicDistributionLibrary::setMode(const PaCO::distLoc_t mode) { _mode = mode; return true; } // true if ok
38 
41 
44  _ld.rank = ld.rank;
45  _ld.start = ld.start;
46  _ld.len = ld.len;
47  return true;
48 }
49 
50 void BasicDistributionLibrary::computeSend(const void* data, vAbstrait& vdarray, vector<unsigned>& destid) {
51  _ld.base = (char*) data;
52 
53  computeSendDataBlock1D(_gd, _ld, _clttopo, _srvtopo, vdarray, destid, _mode, _comm);
54 }
55 
57 
58  this->setClientConfiguration(darray->topo());
59 
60  // Get the mode of the client
61  this->setMode(darray->mode());
62 
63  unsigned nb = nbofPart(_mode, _clttopo.total, _srvtopo.total, _ld.rank);
64 
65  unsigned pos;
66 
67  // In server side redistribution, empty dist for server nodes whose id > max client node
68  if (darray->dist().length() != 0 ) {
69  pos = posofPart(_mode, _srvtopo.total, darray->dist()[0].rank);
70  } else {
71  pos = 0;
72  }
73 
74  // Initialize _vdarray & remaining (assumed clean)
75  if (_vdarray->size() == 0) {
76  // _vdarray is empty: so let's define its size
77  _vdarray->size(nb);
78  _remaining = nb;
79  }
80 
81 
82  fprintf(stderr, "computeReceive: Node %d : set entry %d/%d to %p\n", _ld.rank, pos, nb, darray);
83  _vdarray->setAbstrait(pos, darray);
84  _remaining--;
85 
86  fprintf(stderr, "computeReceive: Node %d : got %d of %d data\n", _ld.rank, _vdarray->size() - _remaining, _vdarray->size());
87 
88  if (_remaining == 0) {
90  return true;
91  } else {
92  return false;
93  }
94 }
95 
96 Abstrait* BasicDistributionLibrary::getResult() const { return _darray; }
bool setLocalDataConfiguration(const PaCO::PacoLocalData_t &ld)
bool computeReceive(Abstrait *darray)
Compute communication schedule on the server side.
bool computeReceiveDataBlock1D(vAbstrait *sdata, const PaCO::distLoc_t &mode, const unsigned total, const unsigned rank, const ParisBlock_param_t *param, Abstrait *varray, void *comm)
Definition: ServerSide.cc:151
Abstrait * getResult() const
If computeReceive returns ok, get the data.
bool setGlobalDataConfiguration(const PaCO::PacoGlobalData_t &gd)
const PaCO::distLoc_t & getMode() const
bool setClientConfiguration(const PaCO::PacoTopology_t &ctopo)
void computeSend(const void *data, vAbstrait &vdarray, vector< unsigned > &destid)
Compute communication schedule on the client side.
bool setServerConfiguration(const PaCO::PacoTopology_t &stopo)
unsigned nbofPart(const PaCO::distLoc_t &mode, const unsigned stotal, const unsigned dtotal, const unsigned drank)
Definition: ServerSide.cc:120
distLoc_t
Definition: PaCO++.idl:12
bool setMode(const PaCO::distLoc_t mode)
void computeSendDataBlock1D(const GlobalData_t &gd, const LocalData_t &sd, const Topology_t &stopo, const Topology_t &dtopo, const ParisBlock_param_t *param, vAbstrait &vdarray, vector< unsigned > &destid, const PaCO::distLoc_t &mode, void *comm)
Definition: ClientSide.cc:215
unsigned long total
Definition: PaCO++.idl:35
unsigned posofPart(const PaCO::distLoc_t &mode, const unsigned dtotal, const unsigned srank)
Definition: ServerSide.cc:138
unsigned long start
Definition: PaCO++.idl:27
unsigned long rank
Definition: PaCO++.idl:26
unsigned long len
Definition: PaCO++.idl:28