Revision 4185a5162d656d0bdb87a2599198e29c516d6470 authored by Harshitha on 10 May 2014, 01:33:10 UTC, committed by Harshitha on 25 July 2014, 19:22:59 UTC
commit 6a10d6aa7d83ecb6323aa033ef82d69fec0392ff
Author: Harshitha <gplkrsh2@illinois.edu>
Date:   Fri May 2 14:17:23 2014 -0500

    Call TPWorkDone before finishWalk

    Change-Id: Ib118d156cb01f0b93a55176a98d8164c26933290

commit 3f599bb98488be2a1c73d28e799ba196a927d586
Author: Harshitha <gplkrsh2@illinois.edu>
Date:   Mon Apr 28 20:49:58 2014 -0500

    Intra node load balancing using CkLoop

commit 760de0f3b7d294712e11cdec74b30311a7bf540e
Author: Harshitha <gplkrsh2@illinois.edu>
Date:   Mon Apr 28 19:48:42 2014 -0500

    Intra node load balancing using CkLoop

    Change-Id: Ib21eb0a0d2a37e765ee3064ce420b1b310621185

Change-Id: Id1b94c1aef9257161f65ccddd27b1c756dc9d323
1 parent b462e34
Raw File
MultistepOrbLB.h
/*****************************************************************************
 * $Source$
 * $Author$
 * $Date$
 * $Revision$
 *****************************************************************************/

/**
 * \addtogroup CkLdb
*/
/*@{*/

#ifndef _MULTISTEPORBLB_H_
#define _MULTISTEPORBLB_H_

#define MCLBMS          // multistepping enabled

#include "MultistepOrbLB.decl.h"

#include "TaggedVector3D.h"
#include "OrbLB.h"

void CreateMultistepOrbLB();
BaseLB * AllocateMultistepOrbLB();

//**************************************
// ORB3DLB functions
//**************************************


class LightweightLDStats {
  public:
  int n_objs;
  int n_migrateobjs;
  CkVec<LDObjData> objData;

  void pup(PUP::er &p);
};


/// @brief Multistep load balancer where no processor topology
/// information is used.
///
/// This balancer recognizes different "phases" (called rungs in other
/// parts of the code), and uses loads based on measurements of the
/// previous calculation at the same phase.  For large phases, (i.e.,
/// when many particles are active, the TreePieces are divided among
/// by 3 dimensional ORB based on the centroids of the TreePieces.
/// For small phases, a greedy algorithm is used.
///
class MultistepOrbLB : public OrbLB {
private:
  bool firstRound;
  // things are stored in here before work
  // is ever called.
  bool haveTPCentroids;
  int nrecvd;
  TaggedVector3D *tpCentroids;
  CkReductionMsg *tpmsg;

 // CkVec<OrbObject> tps;
  int procsPerNode;

  CkVec<LightweightLDStats> savedPhaseStats;      /// stats saved from previous phases
  
  bool QueryBalanceNow(int step);
  //int prevPhase;

  unsigned int determinePhase(unsigned int activeRung);
  void makeActiveProcessorList(BaseLB::LDStats *stats, int numActiveObjs);
  void mergeInstrumentedData(int phase, BaseLB::LDStats *phaseStats);
  bool havePhaseData(int phase); 
  void printData(BaseLB::LDStats &stats, int phase, int *revObjMap);


//  void orbPartition(CkVec<Event> *events, OrientedBox<float> &box, int procs, OrbObject * tp);
//  int partitionRatioLoad(CkVec<Event> &events, float ratio);


public:
  MultistepOrbLB(const CkLBOptions &);
  MultistepOrbLB(CkMigrateMessage *m):OrbLB(m) { 
    lbname = "MultistepOrbLB"; 
     }
    
  void work(BaseLB::LDStats* stats);
  void receiveCentroids(CkReductionMsg *msg);

public:
  
  void pup(PUP::er &p);
};

#endif /* _MultistepOrbLB */

/*@}*/
back to top