OpenAtom  Version1.5a
pcConfig.h
1 #include "debug_flags.h"
2 #include "charm++.h"
3 
4 #ifndef PC_CONFIG_H
5 #define PC_CONFIG_H
6 /*
7  * @addtogroup PairCalculator
8  * @{
9  */
10 
11 namespace cp {
12  namespace paircalc {
13 
14 /**
15  * Dumb structure that holds all the configuration inputs required for paircalc
16  * instantiation, functioning and interaction.
17  *
18  * Almost all of these are invariant through the lifetime of the PC array.
19  * Notably, booleans used in if conditions scattered throughout the code are known at instantiation time.
20  * In the perfect future, values like message priorities and branching factors could change adaptively during the run.
21  * Perhaps, even the decomposition values (grain sizes etc.)
22  */
23 class pcConfig
24 {
25  public:
26  //-------------------- Vars that determine the type of the PC array -----------------------
27  /// Is this a minimization or dynamics run
28  bool isDynamics; ///< @note: This could turn into an enum as more run modes are introduced
29  /// Is this a symmetric or asymmetric paircalc instance
31  /// If this is a symmetric instance, should it use phantom chares to balance the BW path
32  bool arePhantomsOn; ///< @note: Originally, phantomSym
33  /// Should the actual matrix multiplies be handled as real math or complex math
35 
36 
37  //-------------------- Vars that indicate problem size / decomposition --------------------
38  /// The total number of planes in the system
39  int numPlanes; ///< @warning: Not used in the original code. WHY?
40  /// The total number of states in the system
41  int numStates;
42  /// The number of chunks (4th dimension of decomposition)
43  int numChunks; ///< @note: Originally, blkSize
44  /// The grain size along the states dimensions (plural) (number of states per PC chare)
45  int grainSize;
46  /** The grain size along the states dimensions for Ortho chares
47  *
48  * ie, the number of states per ortho chare. Ortho chares along the right and bottom
49  * chare array boundaries may have to deal with remainders and may hence
50  * have a larger orthoGrainSize
51  */
53 
54 
55  //------------------- Instance, Array, Group identification etc. --------------------------
56  /// The proxyOffset value of thisInstance of OpenAtom computations
58  /// Callback to trigger at the end of a paircalc array's init
59  CkCallback uponSetupCompletion;
60  /// The array ID of the GSpace chare array this instance talks to
61  CkArrayID gSpaceAID; ///< @note: Originally, final_callbackid
62  /// The entry point to which this instance should send results to
63  int gSpaceEP; ///< @note: Originally, final_callback_ep
64  /// The entry point to which this instance should send PsiV tolerance update results to
65  int PsiVEP; ///< @note: Originally, callback_ep_tol
66 
67 
68  //------------------- Configure the PC array behavior -------------------------------------
69  /** The mem footprint vs performance setting for the paircalcs (tribool)
70  *
71  * -1: dont conserve memory at all
72  * 0: default (balance mem usage with performance)
73  * +1: conserve memory aggresively and free up matrices when not in use
74  */
76  /// Should the paircalcs worry about load balancing
77  bool isLBon; ///< @note: Originally, lbpaircalc
78  /// Is double-packing on?
80 
81  //------------------- Input communication configs -----------------------------------------
82  /// Will the input data be multicast to PC sections or sent directly (p2p)
83  bool isInputMulticast; ///< @note: Originally, usePairDirectSend
84  /// The branching factor of the spanning trees that carry the input msgs
85  int inputSpanningTreeFactor; ///< config.PCSpanFactor
86  /// The priority (set by GSpace) of the input messages
87  int inputMsgPriority; ///< Originally, PairCalcID::priority
88 
89  //------------------- Output communication configs ----------------------------------------
90  /// Should the results from each PC chare be reduced or delivered individually to GSpace?
91  bool isOutputReduced; ///< @note: Originally, !gSpaceSum
92  /// If shouldDelayBWsend, what priority should this instance use for the result msgs
93  int resultMsgPriority; ///< @note: Originally, gpriority
94 
95  //------------------- Backward path configs -----------------------------------------------
96  /// Should this instance collect result fragments and send them out together in the BW path?
97  bool areBWTilesCollected; ///< @note: Originally, collectAllTiles
98  /// Should this instance stream the result fragments in the BW path as they become ready?
99  bool isBWstreaming; ///< @note: Originally, PCstreamBWout
100  /// Should we impose a hard barrier in the BW path to sync all PC chares?
101  bool isBWbarriered; ///< @note: Originally, useBWBarrier
102  /// Should we tweak msg priority to delay msgs to GSpace carrying the results?
103  bool shouldDelayBWsend; ///< @note: Originally, delaybw
104 
105  //------------------- Timing / Tracing configs --------------------------------------------
106  #ifdef _CP_SUBSTEP_TIMING_
107  /// The timer ID for the forward path
108  int forwardTimerID;
109  /// The timer ID for the backward path
110  int backwardTimerID;
111  /// The callback that will start the substep timer
112  CkCallback beginTimerCB;
113  /// The callback that will stop the substep timer
114  CkCallback endTimerCB;
115  #endif
116 
117  /**{
118  * BGL's painful NIC forces us to split long computations. Configure GEMM splitting here
119  * @note: PURELY for the BGL
120  */
122  int gemmSplitFWm;
123  int gemmSplitBW;
124  ///}
125 
126 
127 
128  void pup(PUP::er &p)
129  {
130  p|isDynamics;
131  p|isSymmetric;
132  p|arePhantomsOn;
133  p|useComplexMath;
134  // Vars that indicate problem size / decomposition
135  p|numPlanes;
136  p|numStates;
137  p|numChunks;
138  p|grainSize;
139  p|orthoGrainSize;
140  // Instance, Array, Group identification etc.
141  p|instanceIndex;
143  p|gSpaceAID;
144  p|gSpaceEP;
145  p|PsiVEP;
146  // Configure the PC array behavior
147  p|conserveMemory;
148  p|isLBon;
149  p|isDoublePackOn;
150  // Input communication configs
154  // Output communication configs
155  p|isOutputReduced;
157  // Backward path configs
159  p|isBWstreaming;
160  p|isBWbarriered;
162  // Timing / Tracing configs
163  #ifdef _CP_SUBSTEP_TIMING_
164  p|forwardTimerID;
165  p|backwardTimerID;
166  p|beginTimerCB;
167  p|endTimerCB;
168  #endif
169  p|gemmSplitFWk;
170  p|gemmSplitFWm;
171  p|gemmSplitBW;
172  }
173 };
174 
175  } // end namespace paircalc
176 } // end namespace cp
177 /*@}*/
178 #endif // PC_CONFIG_H
179 
bool isSymmetric
Is this a symmetric or asymmetric paircalc instance.
Definition: pcConfig.h:30
int gSpaceEP
The entry point to which this instance should send results to.
Definition: pcConfig.h:63
int inputMsgPriority
The priority (set by GSpace) of the input messages.
Definition: pcConfig.h:87
int numPlanes
The total number of planes in the system.
Definition: pcConfig.h:39
bool isDoublePackOn
Is double-packing on?
Definition: pcConfig.h:79
bool isBWbarriered
Should we impose a hard barrier in the BW path to sync all PC chares?
Definition: pcConfig.h:101
CkArrayID gSpaceAID
The array ID of the GSpace chare array this instance talks to.
Definition: pcConfig.h:61
bool isInputMulticast
Will the input data be multicast to PC sections or sent directly (p2p)
Definition: pcConfig.h:83
int inputSpanningTreeFactor
The branching factor of the spanning trees that carry the input msgs.
Definition: pcConfig.h:85
CkCallback uponSetupCompletion
Callback to trigger at the end of a paircalc array's init.
Definition: pcConfig.h:59
int gemmSplitFWk
{ BGL's painful NIC forces us to split long computations.
Definition: pcConfig.h:121
int numStates
The total number of states in the system.
Definition: pcConfig.h:41
int conserveMemory
The mem footprint vs performance setting for the paircalcs (tribool)
Definition: pcConfig.h:75
int grainSize
The grain size along the states dimensions (plural) (number of states per PC chare) ...
Definition: pcConfig.h:45
bool isDynamics
Is this a minimization or dynamics run.
Definition: pcConfig.h:28
int PsiVEP
The entry point to which this instance should send PsiV tolerance update results to.
Definition: pcConfig.h:65
int instanceIndex
The proxyOffset value of thisInstance of OpenAtom computations.
Definition: pcConfig.h:57
bool isOutputReduced
Should the results from each PC chare be reduced or delivered individually to GSpace?
Definition: pcConfig.h:91
int numChunks
The number of chunks (4th dimension of decomposition)
Definition: pcConfig.h:43
bool useComplexMath
Should the actual matrix multiplies be handled as real math or complex math.
Definition: pcConfig.h:34
void pup(PUP::er &p)
}
Definition: pcConfig.h:128
bool isLBon
Should the paircalcs worry about load balancing.
Definition: pcConfig.h:77
bool shouldDelayBWsend
Should we tweak msg priority to delay msgs to GSpace carrying the results?
Definition: pcConfig.h:103
Dumb structure that holds all the configuration inputs required for paircalc instantiation, functioning and interaction.
Definition: pcConfig.h:23
bool isBWstreaming
Should this instance stream the result fragments in the BW path as they become ready?
Definition: pcConfig.h:99
int orthoGrainSize
The grain size along the states dimensions for Ortho chares.
Definition: pcConfig.h:52
bool arePhantomsOn
If this is a symmetric instance, should it use phantom chares to balance the BW path.
Definition: pcConfig.h:32
Useful debugging flags.
int resultMsgPriority
If shouldDelayBWsend, what priority should this instance use for the result msgs. ...
Definition: pcConfig.h:93
bool areBWTilesCollected
Should this instance collect result fragments and send them out together in the BW path...
Definition: pcConfig.h:97