1 #include "pcSectionManager.h"
2 #include "paircalc/pcConfig.h"
7 extern ComlibInstanceHandle mcastInstanceCP;
8 extern ComlibInstanceHandle mcastInstanceACP;
55 orthoRedGrpID = oRedGID;
71 for(
int chunk =
numChunks-1; chunk >=0; chunk--)
72 for(
int numX =
numPlanes-1; numX >=0; numX--)
74 CkArrayIndex4D idx4d(numX,s1,s2,chunk);
75 elems[ecount++]=idx4d;
81 orthoIndexX= (orthoIndexX>maxorthostateindex) ? maxorthostateindex : orthoIndexX;
83 orthoIndexY= (orthoIndexY>maxorthostateindex) ? maxorthostateindex : orthoIndexY;
86 int orthoArrIndex=orthoIndexX*numOrthoCol+orthoIndexY;
88 std::random_shuffle(elems, elems + ecount);
141 { s1 = pc.y; s2 = pc.x; }
143 { s1 = pc.x; s2 = pc.y; }
145 #ifdef VERBOSE_SECTIONMANAGER
146 CkPrintf(
"Ortho[%d,%d] PCSectionManager setting up a paircalc section that includes PC[%d-%d,%d,%d,%d-%d,%d]\n",
orthoIndex.x,
orthoIndex.y,0,
numPlanes-1,s1,s2,0,
numChunks-1,
isSymmetric);
160 CkMulticastMgr *mcastGrp = CProxy_CkMulticastMgr(orthoRedGrpID).ckLocalBranch();
165 gredMsg->mCastGrpId= orthoRedGrpID;
166 gredMsg->lbsync=
false;
173 if(useComlibForOrthoToPC)
176 CkPrintf(
"NOTE: Rectangular Send In USE\n");
178 ComlibAssociateProxy(mcastInstanceCP,
pcSection);
180 ComlibAssociateProxy(mcastInstanceACP,
pcSection);
185 CkMulticastMgr *mcastGrp = CProxy_CkMulticastMgr(
orthomCastGrpID).ckLocalBranch();
195 #ifdef VERBOSE_SECTIONMANAGER
196 CkPrintf(
"PCSectionManager::sendResults()\n");
201 int size2 = (ptr2)? n : 0;
205 *(
int*)CkPriorityPtr(omsg) = priority;
206 CkSetQueueing(omsg, CK_QUEUEING_IFIFO);
213 omsg->init1(n, ptr1, orthoX, orthoY, actionType);
215 omsg->init(n, n, ptr1, ptr2, orthoX, orthoY, actionType);
217 for(
int i=0;i<n ;i++)
219 CkAssert( isfinite(ptr1[i]) );
220 CkAssert( isfinite(omsg->matrix1[i]) );
231 #ifdef VERBOSE_SECTIONMANAGER
232 CkPrintf(
"PCSectionManager::sendMatrix()\n");
237 int size2 = (ptr2)? n : 0;
241 *(
int*)CkPriorityPtr(omsg) = priority;
242 CkSetQueueing(omsg, CK_QUEUEING_IFIFO);
249 omsg->init1(n, ptr1, orthoX, orthoY, actionType);
251 omsg->init(n, n, ptr1, ptr2, orthoX, orthoY, actionType);
253 for(
int i=0;i<n ;i++)
255 CkAssert( isfinite(ptr1[i]) );
256 CkAssert( isfinite(omsg->matrix1[i]) );
bool isSymmetric
Is this a symmetric or asymmetric paircalc instance.
int inputMsgPriority
The priority (set by GSpace) of the input messages.
int numPlanes
The total number of planes in the system.
CkIndex2D computePCStateIndices()
Overloaded version that uses the stored ortho indices to compute the PC state indices.
CkArrayID pcArrayID
The array ID of the paircalc instance that I will manage comm with.
void pup(PUP::er &p)
PUP serializer.
int numStates
Number of states in this simulation.
int numStates
The total number of states in the system.
void sendMatrix(int n, internalType *ptr1, internalType *ptr2, int orthoX, int orthoY, int actionType, int priority)
Used to send OrthoT to the asymm instance. Replaces sendMatrix()
CProxySection_PairCalculator pcSection
The section of the array that my owner ortho chare will be talking to.
void createPCsection(const int s1, const int s2)
Create a paircalc section containing all chares with the specified two state indices.
int grainSize
The grain size along the states dimensions (plural) (number of states per PC chare) ...
CkGroupID orthomCastGrpID
The multicast and reduction groups that handle comm.
int numChunks
The number of chunks (4th dimension decomposition) of paircalcs.
int numChunks
The number of chunks (4th dimension of decomposition)
void sendResults(int n, internalType *ptr1, internalType *ptr2, int orthoX, int orthoY, int actionType, int priority)
Sends out the results to the paircalc section. Replaces finishPairCalcSection()
int pcGrainSize
The statewise decomposition grain size for the paircalcs.
int orthoGrainSize
The statewise decomposition grain size for the ortho chares.
Dumb structure that holds all the configuration inputs required for paircalc instantiation, functioning and interaction.
int orthoGrainSize
The grain size along the states dimensions for Ortho chares.
bool isSymmetric
Is this paircalc array a symmetric or asymmetric instance.
int numPlanes
Number of planes that GSpace is decomposed into.
void init(const CkIndex2D orthoIdx, const pc::pcConfig &pcCfg, CkArrayID pcAID, CkGroupID oMCastGID, CkGroupID oRedGID)
An initializer method that fills this with data.
CkIndex2D orthoIndex
The index of the calling Ortho chare.
int msgPriority
The priority to use for messages to PC.
void setupArraySection(CkCallback cb, bool arePhantomsOn, bool useComlibForOrthoToPC)
Creates a paircalc array section given the necessary info. Replaces initOneRedSect() ...