Changeset 127:3e368f5be1d3
- Timestamp:
- 02/26/2012 10:26:34 PM (15 months ago)
- Branch:
- default
- Location:
- src/parallelization
- Files:
-
- 22 modified
-
hiparsimulator.h (modified) (7 diffs)
-
hiparsimulator/intersectingregionaccumulator.h (modified) (1 diff)
-
hiparsimulator/partitionmanager.h (modified) (1 diff)
-
hiparsimulator/regionaccumulator.h (modified) (1 diff)
-
hiparsimulator/stepper.h (modified) (2 diffs)
-
hiparsimulator/test/parallel_mpi_1/innersetmarkertest.h (modified) (2 diffs)
-
hiparsimulator/test/parallel_mpi_1/intersectingregionaccumulatortest.h (modified) (1 diff)
-
hiparsimulator/test/parallel_mpi_1/partitionmanagertest.h (modified) (4 diffs)
-
hiparsimulator/test/parallel_mpi_1/rimmarkertest.h (modified) (2 diffs)
-
hiparsimulator/test/parallel_mpi_1/updategrouptest.h (modified) (3 diffs)
-
hiparsimulator/test/parallel_mpi_1/vanillaregionaccumulatortest.h (modified) (1 diff)
-
hiparsimulator/test/parallel_mpi_1/vanillastepperbasictest.h (modified) (1 diff)
-
hiparsimulator/test/parallel_mpi_1/vanillastepperregiontest.h (modified) (2 diffs)
-
hiparsimulator/test/parallel_mpi_4/updategrouptest.h (modified) (4 diffs)
-
hiparsimulator/test/parallel_mpi_4/vanillasteppertest.h (modified) (4 diffs)
-
hiparsimulator/test/parallel_mpi_9/partitionmanagertest.h (modified) (2 diffs)
-
hiparsimulator/updategroup.h (modified) (3 diffs)
-
hiparsimulator/vanillaregionaccumulator.h (modified) (2 diffs)
-
hiparsimulator/vanillastepper.h (modified) (1 diff)
-
simulator.h (modified) (1 diff)
-
test/parallel_mpi_1/hiparsimulatortest.h (modified) (1 diff)
-
test/parallel_mpi_4/hiparsimulatortest.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/parallelization/hiparsimulator.h
r108 r127 10 10 #include <libgeodecomp/parallelization/distributedsimulator.h> 11 11 #include <libgeodecomp/parallelization/hiparsimulator/partitions/stripingpartition.h> 12 #include <libgeodecomp/parallelization/hiparsimulator/partitionmanager.h>13 12 #include <libgeodecomp/parallelization/hiparsimulator/intersectingregionaccumulator.h> 14 13 #include <libgeodecomp/parallelization/hiparsimulator/vanillaregionaccumulator.h> … … 17 16 #include <libgeodecomp/parallelization/hiparsimulator/updategroup.h> 18 17 19 // fixme: move implementation to hiparsimulator/implementation?20 21 18 namespace LibGeoDecomp { 22 19 namespace HiParSimulator { 23 20 24 enum EventPoint {LOAD_BALANCING =0, OUTPUT=1, SIMULATION_END=2, PAUSE=3};21 enum EventPoint {LOAD_BALANCING, END, PAUSE}; 25 22 typedef SuperSet<EventPoint> EventSet; 26 23 typedef SuperMap<unsigned, EventSet> EventMap; … … 31 28 case LOAD_BALANCING: 32 29 return "LOAD_BALANCING"; 33 case OUTPUT:34 return " OUTPUT";35 case SIMULATION_END:36 return " SIMULATION_END";30 case END: 31 return "END"; 32 case PAUSE: 33 return "PAUSE"; 37 34 default: 38 35 return "invalid"; … … 47 44 typedef typename CELL_TYPE::Topology Topology; 48 45 typedef DisplacedGrid<CELL_TYPE, Topology> GridType; 49 static const int DIM ENSIONS= Topology::DIMENSIONS;46 static const int DIM = Topology::DIMENSIONS; 50 47 51 48 inline HiParSimulator( 52 49 Initializer<CELL_TYPE> *_initializer, 53 50 LoadBalancer *_balancer = 0, 54 const unsigned& _outputPeriod = 1,55 51 const unsigned& _loadBalancingPeriod = 1, 56 // fixme: move ghostZoneWidth to partition manager 57 const unsigned &ghostZoneWidth = 1, 58 const unsigned& _root = 0, 59 // fixme: forward this to regionStepper 60 MPI::Comm *communicator = &MPI::COMM_WORLD) : 52 const unsigned &_ghostZoneWidth = 1, 53 MPI::Comm *_communicator = &MPI::COMM_WORLD) : 61 54 DistributedSimulator<CELL_TYPE>(_initializer), 62 55 balancer(_balancer), 63 outputPeriod(_outputPeriod * CELL_TYPE::nanoSteps()),64 56 loadBalancingPeriod(_loadBalancingPeriod * CELL_TYPE::nanoSteps()), 65 root(_root), 66 mpiLayer(communicator), 67 eventRepetitionHorizon(4) 68 { 69 resetSimulation(ghostZoneWidth); 57 ghostZoneWidth(_ghostZoneWidth), 58 communicator(_communicator) 59 { 60 CoordBox<DIM> box = this->initializer->gridBox(); 61 updateGroup.reset(new UpdateGroup<CELL_TYPE, PARTITION>( 62 PARTITION(box.origin, box.dimensions), 63 initialWeights(box.dimensions.prod(), communicator->Get_size()), 64 0, 65 box, 66 ghostZoneWidth, 67 this->initializer, 68 communicator)); 69 70 // resetSimulation(ghostZoneWidth); 70 71 } 71 72 … … 73 74 inline void run() 74 75 { 75 unsigned remainingNanoSteps = this->initializer->maxSteps() *76 CELL_TYPE::nanoSteps() - nanoStepCounter;77 nanoStep(remainingNanoSteps);76 // unsigned remainingNanoSteps = this->initializer->maxSteps() * 77 // CELL_TYPE::nanoSteps() - nanoStepCounter; 78 // nanoStep(remainingNanoSteps); 78 79 } 79 80 … … 81 82 inline void step() 82 83 { 83 nanoStep(CELL_TYPE::nanoSteps());84 // nanoStep(CELL_TYPE::nanoSteps()); 84 85 } 85 86 … … 89 90 const Region<2> **validRegion) 90 91 { 91 *validRegion = &partitionManager.ownRegion();92 } 93 94 inline const DisplacedGrid<CELL_TYPE> *getDisplacedGrid()95 {96 return 0;97 // return regionStepper.getGrid();98 }92 // *validRegion = &partitionManager.ownRegion(); 93 } 94 95 // inline const DisplacedGrid<CELL_TYPE> *getDisplacedGrid() 96 // { 97 // return 0; 98 // // return regionStepper.getGrid(); 99 // } 99 100 100 101 private: 101 // SuperMap<unsigned, Outgroup<PARTITION> > outgroups; 102 // fixme: who deletes the balancer? 103 LoadBalancer *balancer; 104 unsigned outputPeriod; 102 boost::shared_ptr<LoadBalancer> balancer; 105 103 unsigned loadBalancingPeriod; 106 unsigned nanoStepCounter;104 unsigned ghostZoneWidth; 107 105 EventMap events; 108 PartitionManager<2> partitionManager; 109 unsigned root; 110 // fixme: can we get rid of this? 111 MPILayer mpiLayer; 112 unsigned eventRepetitionHorizon; 113 114 inline void nanoStep(const unsigned& s) 115 { 116 unsigned endNanoStep = nanoStepCounter + s; 117 events[endNanoStep].insert(PAUSE); 106 PartitionManager<DIM, Topology> partitionManager; 107 MPI::Comm *communicator; 108 boost::shared_ptr<UpdateGroup<CELL_TYPE, PARTITION> > updateGroup; 109 110 SuperVector<long> initialWeights(const long& items, const long& size) const 111 { 112 SuperVector<long> ret(size); 113 long lastPos = 0; 114 115 for (long i = 0; i < size; i++) { 116 long currentPos = items * (i + 1) / size; 117 ret[i] = currentPos - lastPos; 118 lastPos = currentPos; 119 } 120 121 return ret; 122 } 123 124 // inline void nanoStep(const unsigned& s) 125 // { 126 // unsigned endNanoStep = nanoStepCounter + s; 127 // events[endNanoStep].insert(PAUSE); 118 128 119 while (nanoStepCounter < endNanoStep) {120 std::pair<unsigned, EventSet> currentEvents = extractCurrentEvents();121 nanoStepCounter = currentEvents.first;122 handleEvents(currentEvents.second);123 }124 }125 126 inline std::pair<unsigned, EventSet> extractCurrentEvents()127 {128 EventMap::iterator curEventsPair = events.begin();129 unsigned curStop = curEventsPair->first;130 EventSet curEvents = curEventsPair->second;131 if (curStop < nanoStepCounter)132 throw std::logic_error("Stale events found in event point queue");133 events.erase(curEventsPair);134 return std::make_pair(curStop, curEvents);135 }136 137 138 inline void handleEvents(const EventSet& curEvents)139 {140 //fixme: handle events141 // for (EventSet::iterator event = curEvents.begin(); event != curEvents.end(); ++event)142 // std::cout << " nanoStep: " << nanoStepCounter << " got event: " << eventToStr(*event) << "\n";143 // if (curEvents.size() > 1)144 // std::cout << "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\n";145 // std::cout << "\n";129 // while (nanoStepCounter < endNanoStep) { 130 // std::pair<unsigned, EventSet> currentEvents = extractCurrentEvents(); 131 // nanoStepCounter = currentEvents.first; 132 // handleEvents(currentEvents.second); 133 // } 134 // } 135 136 // inline std::pair<unsigned, EventSet> extractCurrentEvents() 137 // { 138 // EventMap::iterator curEventsPair = events.begin(); 139 // unsigned curStop = curEventsPair->first; 140 // EventSet curEvents = curEventsPair->second; 141 // if (curStop < nanoStepCounter) 142 // throw std::logic_error("Stale events found in event point queue"); 143 // events.erase(curEventsPair); 144 // return std::make_pair(curStop, curEvents); 145 // } 146 147 148 // inline void handleEvents(const EventSet& curEvents) 149 // { 150 // //fixme: handle events 151 // // for (EventSet::iterator event = curEvents.begin(); event != curEvents.end(); ++event) 152 // // std::cout << " nanoStep: " << nanoStepCounter << " got event: " << eventToStr(*event) << "\n"; 153 // // if (curEvents.size() > 1) 154 // // std::cout << "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\n"; 155 // // std::cout << "\n"; 146 156 147 if (curEvents.count(OUTPUT))148 events[this->nextOutput(eventRepetitionHorizon)].insert(OUTPUT);149 if (curEvents.count(LOAD_BALANCING))150 events[this->nextLoadBalancing(eventRepetitionHorizon)].insert(LOAD_BALANCING);151 }152 153 154 inline void resetSimulation(const unsigned &ghostZoneWidth)155 {156 // this->resetEvents();157 // this->resetRegions(ghostZoneWidth);158 }159 160 inline void resetRegions(const unsigned &ghostZoneWidth)161 {162 partitionManager.resetRegions(163 CoordBox<2>(Coord<2>(),164 this->initializer->gridDimensions()),165 new VanillaRegionAccumulator<PARTITION>(166 myPartition(),167 myOffset(),168 initialWeights()),169 mpiLayer.rank(),170 ghostZoneWidth);171 172 SuperVector<CoordBox<2> > boundingBoxes(mpiLayer.size());173 CoordBox<2> ownBoundingBox(partitionManager.ownRegion().boundingBox());174 mpiLayer.allGather(ownBoundingBox, &boundingBoxes);175 partitionManager.resetGhostZones(boundingBoxes);176 // fixme: care for validGhostZoneWidth177 }178 179 inline SuperVector<unsigned> initialWeights() const180 {181 SuperVector<unsigned> weights(mpiLayer.size());182 if (mpiLayer.rank() == root) {183 unsigned remainingCells = this->initializer->gridBox().size();184 for (unsigned i = mpiLayer.size(); i > 0; --i) {185 unsigned curWeight = (unsigned)round((double)remainingCells / i);186 weights[i - 1] = curWeight;187 remainingCells -= curWeight;188 }189 }190 mpiLayer.broadcastVector(&weights, root);191 return weights;192 }157 // if (curEvents.count(OUTPUT)) 158 // events[this->nextOutput(eventRepetitionHorizon)].insert(OUTPUT); 159 // if (curEvents.count(LOAD_BALANCING)) 160 // events[this->nextLoadBalancing(eventRepetitionHorizon)].insert(LOAD_BALANCING); 161 // } 162 163 164 // inline void resetSimulation(const unsigned &ghostZoneWidth) 165 // { 166 // // this->resetEvents(); 167 // // this->resetRegions(ghostZoneWidth); 168 // } 169 170 // inline void resetRegions(const unsigned &ghostZoneWidth) 171 // { 172 // partitionManager.resetRegions( 173 // CoordBox<2>(Coord<2>(), 174 // this->initializer->gridDimensions()), 175 // new VanillaRegionAccumulator<PARTITION>( 176 // myPartition(), 177 // myOffset(), 178 // initialWeights()), 179 // mpiLayer.rank(), 180 // ghostZoneWidth); 181 182 // SuperVector<CoordBox<2> > boundingBoxes(mpiLayer.size()); 183 // CoordBox<2> ownBoundingBox(partitionManager.ownRegion().boundingBox()); 184 // mpiLayer.allGather(ownBoundingBox, &boundingBoxes); 185 // partitionManager.resetGhostZones(boundingBoxes); 186 // // fixme: care for validGhostZoneWidth 187 // } 188 189 // inline SuperVector<unsigned> initialWeights() const 190 // { 191 // SuperVector<unsigned> weights(mpiLayer.size()); 192 // if (mpiLayer.rank() == root) { 193 // unsigned remainingCells = this->initializer->gridBox().size(); 194 // for (unsigned i = mpiLayer.size(); i > 0; --i) { 195 // unsigned curWeight = (unsigned)round((double)remainingCells / i); 196 // weights[i - 1] = curWeight; 197 // remainingCells -= curWeight; 198 // } 199 // } 200 // mpiLayer.broadcastVector(&weights, root); 201 // return weights; 202 // } 193 203 194 inline void resetEvents()195 {196 nanoStepCounter = this->initializer->startStep() * CELL_TYPE::nanoSteps();197 events.clear();198 unsigned firstOutput = ((int)ceil(nanoStepCounter / (double)outputPeriod)) * outputPeriod;199 unsigned firstLoadBalancing = ((int)ceil(nanoStepCounter / (double)loadBalancingPeriod)) * loadBalancingPeriod;200 for (int i = 0; i < eventRepetitionHorizon; ++i) {201 events[firstOutput + i * outputPeriod ].insert(OUTPUT);202 events[firstLoadBalancing + i * loadBalancingPeriod].insert(LOAD_BALANCING);203 }204 events[this->initializer->maxSteps() * CELL_TYPE::nanoSteps()].insert(SIMULATION_END);205 }206 207 inline unsigned nextOutput(const unsigned& horizon=1) const208 {209 return (nanoStepCounter / outputPeriod + horizon) * outputPeriod;210 }211 212 inline unsigned nextLoadBalancing(const unsigned horizon=1) const213 {214 return (nanoStepCounter / loadBalancingPeriod + horizon) * loadBalancingPeriod;215 }216 217 inline Region<2> allGatherGroupRegion()218 {219 return allGatherGroupRegion(partitionManager.ownRegion());220 }221 222 inline Region<2> allGatherGroupRegion(const Region<2>& region)223 {224 int streakNum = region.numStreaks();225 SuperVector<int> streakNums(mpiLayer.allGather(streakNum));226 SuperVector<Streak<2> > ownStreaks(region.toVector());227 SuperVector<Streak<2> > allStreaks(mpiLayer.allGatherV(&ownStreaks[0], streakNums));228 Region<2> ret;229 for (SuperVector<Streak<2> >::iterator i = allStreaks.begin();230 i != allStreaks.end(); ++i)231 ret << *i;232 return ret;233 }234 235 inline void registerOutgroupRegion(const unsigned& relativeLevel, const Region<2>& region)236 {237 // outgroupSteppers[relativeLevel].resetRegions(238 239 // IntersectingRegionAccumulator<PARTITION>(region, myPartition(), myOffset(), initialWeights());240 }241 242 inline void updateOutgroupRegion(const unsigned& relativeLevel, const unsigned& steps)243 {204 // inline void resetEvents() 205 // { 206 // nanoStepCounter = this->initializer->startStep() * CELL_TYPE::nanoSteps(); 207 // events.clear(); 208 // unsigned firstOutput = ((int)ceil(nanoStepCounter / (double)outputPeriod)) * outputPeriod; 209 // unsigned firstLoadBalancing = ((int)ceil(nanoStepCounter / (double)loadBalancingPeriod)) * loadBalancingPeriod; 210 // for (int i = 0; i < eventRepetitionHorizon; ++i) { 211 // events[firstOutput + i * outputPeriod ].insert(OUTPUT); 212 // events[firstLoadBalancing + i * loadBalancingPeriod].insert(LOAD_BALANCING); 213 // } 214 // events[this->initializer->maxSteps() * CELL_TYPE::nanoSteps()].insert(SIMULATION_END); 215 // } 216 217 // inline unsigned nextOutput(const unsigned& horizon=1) const 218 // { 219 // return (nanoStepCounter / outputPeriod + horizon) * outputPeriod; 220 // } 221 222 // inline unsigned nextLoadBalancing(const unsigned horizon=1) const 223 // { 224 // return (nanoStepCounter / loadBalancingPeriod + horizon) * loadBalancingPeriod; 225 // } 226 227 // inline Region<2> allGatherGroupRegion() 228 // { 229 // return allGatherGroupRegion(partitionManager.ownRegion()); 230 // } 231 232 // inline Region<2> allGatherGroupRegion(const Region<2>& region) 233 // { 234 // int streakNum = region.numStreaks(); 235 // SuperVector<int> streakNums(mpiLayer.allGather(streakNum)); 236 // SuperVector<Streak<2> > ownStreaks(region.toVector()); 237 // SuperVector<Streak<2> > allStreaks(mpiLayer.allGatherV(&ownStreaks[0], streakNums)); 238 // Region<2> ret; 239 // for (SuperVector<Streak<2> >::iterator i = allStreaks.begin(); 240 // i != allStreaks.end(); ++i) 241 // ret << *i; 242 // return ret; 243 // } 244 245 // inline void registerOutgroupRegion(const unsigned& relativeLevel, const Region<2>& region) 246 // { 247 // // outgroupSteppers[relativeLevel].resetRegions( 248 249 // // IntersectingRegionAccumulator<PARTITION>(region, myPartition(), myOffset(), initialWeights()); 250 // } 251 252 // inline void updateOutgroupRegion(const unsigned& relativeLevel, const unsigned& steps) 253 // { 244 254 245 }246 247 inline PARTITION myPartition() const248 {249 return PARTITION(Coord<2>(0, 0),250 this->initializer->gridDimensions());251 }252 253 inline unsigned myOffset() const254 {255 return 0;256 }255 // } 256 257 // inline PARTITION myPartition() const 258 // { 259 // return PARTITION(Coord<2>(0, 0), 260 // this->initializer->gridDimensions()); 261 // } 262 263 // inline unsigned myOffset() const 264 // { 265 // return 0; 266 // } 257 267 258 268 }; -
src/parallelization/hiparsimulator/intersectingregionaccumulator.h
r108 r127 18 18 const Region<DIM>& _intersectionRegion, 19 19 const PARTITION& _partition, 20 const unsigned& offset=0,21 const SuperVector< unsigned>& weights=SuperVector<unsigned>()) :20 const long& offset=0, 21 const SuperVector<long>& weights=SuperVector<long>()) : 22 22 VanillaRegionAccumulator<PARTITION>(_partition, offset, weights), 23 23 intersectionRegion(_intersectionRegion) 24 24 {} 25 25 26 inline virtual Region<DIM> getRegion(const unsigned& node)26 inline virtual Region<DIM> getRegion(const long& node) 27 27 { 28 28 return this->VanillaRegionAccumulator<PARTITION>::getRegion(node) & intersectionRegion; -
src/parallelization/hiparsimulator/partitionmanager.h
r108 r127 30 30 const CoordBox<DIM>& _simulationArea=CoordBox<DIM>()) 31 31 { 32 SuperVector< unsigned> weights(1, _simulationArea.size());32 SuperVector<long> weights(1, _simulationArea.size()); 33 33 StripingPartition<DIM> partition( 34 34 Coord<DIM>(), _simulationArea.dimensions); -
src/parallelization/hiparsimulator/regionaccumulator.h
r0 r127 13 13 { 14 14 public: 15 virtual Region<DIM> getRegion(const unsigned& node) = 0;15 virtual Region<DIM> getRegion(const long& node) = 0; 16 16 }; 17 17 -
src/parallelization/hiparsimulator/stepper.h
r119 r127 41 41 inline Stepper( 42 42 const boost::shared_ptr<MyPartitionManager>& _partitionManager, 43 const boost::shared_ptr<Initializer<CELL_TYPE> >&_initializer) :43 Initializer<CELL_TYPE> *_initializer) : 44 44 partitionManager(_partitionManager), 45 45 initializer(_initializer) … … 69 69 protected: 70 70 boost::shared_ptr<MyPartitionManager> partitionManager; 71 boost::shared_ptr<Initializer<CELL_TYPE> >initializer;71 Initializer<CELL_TYPE> *initializer; 72 72 PatchProviderList patchProviders[2]; 73 73 PatchAccepterList patchAccepters[2]; -
src/parallelization/hiparsimulator/test/parallel_mpi_1/innersetmarkertest.h
r108 r127 28 28 ghostZoneWidth = 6; 29 29 rank = 0; 30 weights = SuperVector< unsigned> (9, 30 * dimensions.x());30 weights = SuperVector<long> (9, 30 * dimensions.x()); 31 31 weights[3] = 40 * dimensions.x(); 32 32 weights[5] = 20 * dimensions.x(); … … 65 65 StripingPartition<2> partition; 66 66 Coord<2> dimensions; 67 SuperVector< unsigned> weights;67 SuperVector<long> weights; 68 68 unsigned startLine; 69 69 unsigned offset; -
src/parallelization/hiparsimulator/test/parallel_mpi_1/intersectingregionaccumulatortest.h
r108 r127 21 21 22 22 unsigned offset = 9; 23 SuperVector< unsigned> weights;23 SuperVector<long> weights; 24 24 weights += 25, 58, 8; 25 25 Region<2> overlay; -
src/parallelization/hiparsimulator/test/parallel_mpi_1/partitionmanagertest.h
r108 r127 19 19 offset = 10 * 20 + 8; 20 20 partition = StripingPartition<2>(Coord<2>(), dimensions); 21 weights.clear(); 21 22 weights += 15, 12, 1, 32, 25, 40, 67; 22 23 /** … … 144 145 145 146 StripingPartition<3> partition(Coord<3>(), box.dimensions); 146 SuperVector<unsigned> weights; 147 weights << 10000; 148 weights << 15000; 149 weights << 25000; 147 SuperVector<long> weights; 148 weights += 10000, 15000, 25000; 150 149 weights << box.dimensions.prod() - weights.sum(); 151 150 … … 189 188 unsigned offset; 190 189 StripingPartition<2> partition; 191 SuperVector< unsigned> weights;190 SuperVector<long> weights; 192 191 unsigned rank; 193 192 unsigned ghostZoneWidth; … … 199 198 const unsigned& size, 200 199 const unsigned& ghostZoneWidth, 201 const SuperVector< unsigned>& weights,200 const SuperVector<long>& weights, 202 201 const StripingPartition<2>& partition) 203 202 { 204 203 SuperVector<CoordBox<2> > boundingBoxes(size); 205 unsignedstartOffset = offset;206 unsignedendOffset = offset;204 long startOffset = offset; 205 long endOffset = offset; 207 206 for (unsigned i = 0; i < size; ++i) { 208 207 endOffset += weights[i]; -
src/parallelization/hiparsimulator/test/parallel_mpi_1/rimmarkertest.h
r108 r127 28 28 ghostZoneWidth = 6; 29 29 rank = 0; 30 weights = SuperVector< unsigned> (9, 30 * dimensions.x());30 weights = SuperVector<long> (9, 30 * dimensions.x()); 31 31 weights[3] = 40 * dimensions.x(); 32 32 weights[5] = 20 * dimensions.x(); … … 70 70 StripingPartition<2> partition; 71 71 Coord<2> dimensions; 72 SuperVector< unsigned> weights;72 SuperVector<long> weights; 73 73 unsigned startLine; 74 74 unsigned offset; -
src/parallelization/hiparsimulator/test/parallel_mpi_1/updategrouptest.h
r118 r127 33 33 weights << dimensions.prod(); 34 34 ghostZoneWidth = 10; 35 init .reset(new TestInitializer<3>(dimensions));35 init = new TestInitializer<3>(dimensions); 36 36 updateGroup.reset( 37 37 new MyUpdateGroup( 38 Partition(Coord<3>(), dimensions),38 partition, 39 39 weights, 40 40 0, … … 51 51 void tearDown() 52 52 { 53 init.reset();53 delete init; 54 54 updateGroup.reset(); 55 55 } … … 70 70 unsigned rank; 71 71 Coord<3> dimensions; 72 SuperVector< unsigned> weights;72 SuperVector<long> weights; 73 73 Partition partition; 74 74 unsigned ghostZoneWidth; 75 boost::shared_ptr<Initializer<TestCell<3> > >init;75 Initializer<TestCell<3> > *init; 76 76 boost::shared_ptr<UpdateGroup<TestCell<3>, Partition > > updateGroup; 77 77 boost::shared_ptr<MockPatchAccepter<GridType> > mockPatchAccepter; -
src/parallelization/hiparsimulator/test/parallel_mpi_1/vanillaregionaccumulatortest.h
r108 r127 23 23 24 24 unsigned offset = 9; 25 SuperVector< unsigned> weights;25 SuperVector<long> weights; 26 26 weights += 25, 58, 8; 27 27 // should look like this: -
src/parallelization/hiparsimulator/test/parallel_mpi_1/vanillastepperbasictest.h
r110 r127 30 30 partitionManager.reset(new PartitionManager<2>(rect)); 31 31 stepper.reset( 32 new MyStepper(partitionManager, init));32 new MyStepper(partitionManager, &*init)); 33 33 34 34 stepper->addPatchAccepter(patchAccepter, MyStepper::GHOST); -
src/parallelization/hiparsimulator/test/parallel_mpi_1/vanillastepperregiontest.h
r108 r127 59 59 // between the two others 0 and 2. 60 60 StripingPartition<2> partition(Coord<2>(0, 0), rect.dimensions); 61 SuperVector< unsigned> weights(3);61 SuperVector<long> weights(3); 62 62 weights[0] = 4*17 + 7; 63 63 weights[1] = 2*17 - 1; … … 82 82 83 83 // The Unit Under Test: the stepper 84 stepper.reset(new MyStepper(partitionManager, init));84 stepper.reset(new MyStepper(partitionManager, &*init)); 85 85 } 86 86 -
src/parallelization/hiparsimulator/test/parallel_mpi_4/updategrouptest.h
r118 r127 29 29 weights = genWeights(dimensions.x(), dimensions.y(), MPILayer().size()); 30 30 ghostZoneWidth = 10; 31 init .reset(new TestInitializer<2>(dimensions));31 init = new TestInitializer<2>(dimensions); 32 32 updateGroup.reset( 33 33 new MyUpdateGroup( … … 47 47 void tearDown() 48 48 { 49 init.reset();49 delete init; 50 50 updateGroup.reset(); 51 51 } … … 59 59 unsigned rank; 60 60 Coord<2> dimensions; 61 SuperVector< unsigned> weights;61 SuperVector<long> weights; 62 62 Partition partition; 63 63 unsigned ghostZoneWidth; 64 boost::shared_ptr<Initializer<TestCell<2> > >init;64 Initializer<TestCell<2> > *init; 65 65 boost::shared_ptr<UpdateGroup<TestCell<2>, Partition > > updateGroup; 66 66 boost::shared_ptr<MockPatchAccepter<GridType> > mockPatchAccepter; 67 67 68 SuperVector< unsigned> genWeights(68 SuperVector<long> genWeights( 69 69 const unsigned& width, 70 70 const unsigned& height, 71 71 const unsigned& size) 72 72 { 73 SuperVector< unsigned> ret(size);73 SuperVector<long> ret(size); 74 74 unsigned totalSize = width * height; 75 75 for (int i = 0; i < ret.size(); ++i) … … 78 78 } 79 79 80 unsignedpos(const unsigned& i, const unsigned& size, const unsigned& totalSize)80 long pos(const unsigned& i, const unsigned& size, const unsigned& totalSize) 81 81 { 82 82 return i * totalSize / size; -
src/parallelization/hiparsimulator/test/parallel_mpi_4/vanillasteppertest.h
r119 r127 1 #include <boost/assign/std/vector.hpp> 1 2 #include <cxxtest/TestSuite.h> 2 3 … … 8 9 #include <libgeodecomp/parallelization/hiparsimulator/vanillastepper.h> 9 10 11 using namespace boost::assign; 10 12 using namespace LibGeoDecomp; 11 13 using namespace HiParSimulator; … … 73 75 74 76 StripingPartition<3> partition(Coord<3>(), box.dimensions); 75 SuperVector<unsigned> weights; 76 weights << 10000; 77 weights << 15000; 78 weights << 25000; 77 SuperVector<long> weights; 78 weights += 10000, 15000, 25000; 79 79 weights << box.dimensions.prod() - weights.sum(); 80 80 … … 94 94 partitionManager->resetGhostZones(boundingBoxes); 95 95 96 stepper.reset(new MyStepper(partitionManager, init));96 stepper.reset(new MyStepper(partitionManager, &*init)); 97 97 98 98 // verify that the grids got set up properly -
src/parallelization/hiparsimulator/test/parallel_mpi_9/partitionmanagertest.h
r108 r127 29 29 offset = 130 * dimensions.x(); 30 30 ghostZoneWidth = 6; 31 weights = SuperVector< unsigned>(layer.size(), 30 * dimensions.x());31 weights = SuperVector<long>(layer.size(), 30 * dimensions.x()); 32 32 weights[3] = 40 * dimensions.x(); 33 33 weights[5] = 20 * dimensions.x(); … … 169 169 StripingPartition<2> partition; 170 170 Coord<2> dimensions; 171 SuperVector< unsigned> weights;171 SuperVector<long> weights; 172 172 unsigned offset; 173 173 unsigned ghostZoneWidth; -
src/parallelization/hiparsimulator/updategroup.h
r118 r127 38 38 UpdateGroup( 39 39 const PARTITION& _partition, 40 const SuperVector< unsigned>& _weights,40 const SuperVector<long>& _weights, 41 41 const unsigned& _offset, 42 42 const CoordBox<DIM>& box, 43 43 const unsigned& _ghostZoneWidth, 44 boost::shared_ptr<Initializer<CELL_TYPE> >_initializer,44 Initializer<CELL_TYPE> *_initializer, 45 45 MPI::Comm *communicator = &MPI::COMM_WORLD) : 46 46 partition(_partition), … … 66 66 partitionManager->resetGhostZones(boundingBoxes); 67 67 68 stepper.reset( new STEPPER( partitionManager, initializer));68 stepper.reset(new STEPPER( partitionManager, initializer)); 69 69 70 70 RegionVecMap map = partitionManager->getInnerGhostZoneFragments(); … … 125 125 SuperVector<PatchLinkPtr> patchLinks; 126 126 PARTITION partition; 127 SuperVector< unsigned> weights;127 SuperVector<long> weights; 128 128 unsigned offset; 129 129 unsigned ghostZoneWidth; 130 boost::shared_ptr<Initializer<CELL_TYPE> >initializer;130 Initializer<CELL_TYPE> *initializer; 131 131 MPILayer mpiLayer; 132 132 unsigned rank; -
src/parallelization/hiparsimulator/vanillaregionaccumulator.h
r108 r127 18 18 inline VanillaRegionAccumulator( 19 19 const PARTITION& _partition=PARTITION(), 20 const unsigned& offset=0,21 const SuperVector< unsigned>& weights=SuperVector<unsigned>(2)) :20 const long& offset=0, 21 const SuperVector<long>& weights=SuperVector<long>(2)) : 22 22 partition(_partition) 23 23 { 24 24 startOffsets.resize(weights.size() + 1); 25 25 startOffsets[0] = offset; 26 for ( unsignedi = 0; i < weights.size(); ++i)26 for (long i = 0; i < weights.size(); ++i) 27 27 startOffsets[i + 1] = startOffsets[i] + weights[i]; 28 28 } 29 29 30 inline virtual Region<DIM> getRegion(const unsigned& node)30 inline virtual Region<DIM> getRegion(const long& node) 31 31 { 32 32 return Region<DIM>( … … 37 37 private: 38 38 PARTITION partition; 39 SuperVector< unsigned> startOffsets;39 SuperVector<long> startOffsets; 40 40 }; 41 41 -
src/parallelization/hiparsimulator/vanillastepper.h
r119 r127 28 28 inline VanillaStepper( 29 29 boost::shared_ptr<MyPartitionManager> _partitionManager, 30 boost::shared_ptr<Initializer<CELL_TYPE> >_initializer) :30 Initializer<CELL_TYPE> *_initializer) : 31 31 ParentType(_partitionManager, _initializer) 32 32 { -
src/parallelization/simulator.h
r0 r127 20 20 typedef Grid<CELL_TYPE, Topology> GridType; 21 21 22 inline Simulator(Initializer<CELL_TYPE> *_initializer) : 23 stepNum(0), 24 initializer(_initializer) 25 {} 26 22 27 inline virtual ~Simulator() 23 28 { 24 29 delete initializer; 25 30 } 26 27 inline Simulator(Initializer<CELL_TYPE> *_initializer) :28 stepNum(0), initializer(_initializer)29 {}30 31 31 32 /** -
src/parallelization/test/parallel_mpi_1/hiparsimulatortest.h
r108 r127 32 32 ghostzZoneWidth = 10; 33 33 s.reset(new HiParSimulator<TestCell<2>, StripingPartition<2> >( 34 init, 0, outputPeriod,loadBalancingPeriod, ghostzZoneWidth));34 init, 0, loadBalancingPeriod, ghostzZoneWidth)); 35 35 // fixme 36 36 // mockWriter = new MockWriter(&(*s)); -
src/parallelization/test/parallel_mpi_4/hiparsimulatortest.h
r108 r127 32 32 ghostZoneWidth = 10; 33 33 s.reset(new HiParSimulator<TestCell<2>, StripingPartition<2> >( 34 init, 0, outputPeriod, 35 loadBalancingPeriod, ghostZoneWidth)); 34 init, 0, loadBalancingPeriod, ghostZoneWidth)); 36 35 // mockWriter = new MockWriter(&(*s)); 37 36 }
