4 #include "ckPairCalculator.decl.h"
5 #include "InputDataHandler.h"
7 #include "ckmulticast.h"
20 traceRegisterUserEvent(
"calcpairDGEMM", 210);
21 traceRegisterUserEvent(
"calcpairContrib", 220);
22 traceRegisterUserEvent(
"multiplyResultDGEMM1", 230);
23 traceRegisterUserEvent(
"multiplyResultDGEMM2", 240);
24 traceRegisterUserEvent(
"multiplyResultDGEMM1R", 250);
33 Strategy *multistrat =
new DirectMulticastStrategy();
35 mcastInstanceCP=ComlibRegister(multistrat);
37 mcastInstanceACP=ComlibRegister(multistrat);
45 namespace impl {
MapType4 *dirtyGlobalMapTable4PCsym, *dirtyGlobalMapTable4PCasym; }
53 int achunks = config.numChunksAsym;
57 achunks=config.numChunksSym;
60 MapType4 **inst0MapTable =
cfg.
isSymmetric ? &impl::dirtyGlobalMapTable4PCsym : &impl::dirtyGlobalMapTable4PCasym;
62 std::string mapName =
cfg.
isSymmetric ?
"SymScalcMap" :
"AsymScalcMap";
64 PeList *availGlobG = mapCfg.getPeList();
70 int pm = config.numPesPerInstance / pl;
83 double mapCreationTime = CmiWallTimer();
91 if(config.loadMapFiles)
94 success = mf->loadMap(mapName.c_str(), &mapTable);
102 planes_per_pe, achunks, config.numChunksSym, mapCfg.gSpaceMap, config.useCuboidMap, config.useCentroidMap, mapCfg.boxSize);
106 *inst0MapTable =
new MapType4(mapTable);
111 int x = mapCfg.mapOffset.getx();
112 int y = mapCfg.mapOffset.gety();
113 int z = mapCfg.mapOffset.getz();
114 if((CkNumPes()==1) && !mapCfg.isTorusFake)
115 mapTable = *(
new MapType4(**inst0MapTable));
117 mapTable.translate(*inst0MapTable, x, y, z, mapCfg.isTorusMap);
121 CProxy_SCalcMap pcMapGrp = CProxy_SCalcMap::ckNew(mapTable);
123 mapCreationTime = CmiWallTimer() - mapCreationTime;
124 CkPrintf(
"PairCalculator[%dx%dx%dx%d,%d] map created in %g\n", size[0], size[1], size[2],
cfg.
numChunks,
cfg.
isSymmetric, mapCreationTime);
127 if(config.dumpMapFiles)
135 if(config.dumpMapCoordFiles)
154 handlerOpts.bindTo(pairCalculatorProxy);
155 CProxy_InputDataHandler<CollatorType,CollatorType> inputHandlerProxy = CProxy_InputDataHandler<CollatorType,CollatorType> ::ckNew(pairCalculatorProxy,handlerOpts);
163 CkArrayOptions paircalcOpts,handlerOpts;
164 CProxy_PairCalculator pairCalculatorProxy;
169 paircalcOpts.setAnytimeMigration(
false);
170 pairCalculatorProxy = CProxy_PairCalculator::ckNew(inputHandlerProxy,
cfg, paircalcOpts);
172 #ifdef DEBUG_CP_PAIRCALC_CREATION
173 CkPrintf(
"Builder: Creating a%s paircalc instance\n", (
cfg.
isSymmetric?
" symmetric":
"n asymmetric") );
175 #ifdef CP_PAIRCALC_USES_COMPLEX_MATH
176 CkPrintf(
"Builder: Creating paircalcs for instance %d that use complex math\n",
cfg.
instanceIndex);
178 CkPrintf(
"Builder: Creating paircalcs for instance %d that do not use complex math\n",
cfg.
instanceIndex);
182 handlerOpts.bindTo(pairCalculatorProxy);
187 pcHandle.handlerAID = inputHandlerProxy.ckGetArrayID();
194 for (
int s1 = 0; s1 <= pcMaxStateDimIndex; s1 +=
cfg.
grainSize)
198 for (
int s2 = s2start; s2 <= pcMaxStateDimIndex; s2 +=
cfg.
grainSize)
202 #ifdef DEBUG_CP_PAIRCALC_CREATION
203 CkPrintf(
"\tInserting PC element [%d %d %d %d %d]\n",numX,s1,s2,c,
cfg.
isSymmetric);
205 pairCalculatorProxy(numX,s1,s2,c).insert(inputHandlerProxy,
cfg);
212 pairCalculatorProxy.doneInserting();
221 #include "pcMaps.def.h"
bool isSymmetric
Is this a symmetric or asymmetric paircalc instance.
CkGroupID mapperGID
The group providing procNum() for placing the objects of this paircalc array instance.
int numPlanes
The total number of planes in the system.
InstanceIDs build(const startup::PCMapConfig &mapCfg)
Trigger the creation of a pc array with the given configs, within the given pes/boxes etc...
void createMap(const startup::PCMapConfig &mapCfg)
Create the mapping required to instantiate a PC array.
const pcConfig cfg
The configs for the paircalc array that I am charged with building.
Author: Abhinav S Bhatele Date Created: December 28th, 2006.
int inputSpanningTreeFactor
The branching factor of the spanning trees that carry the input msgs.
A container for assorted mapping inputs to pass around easily.
void createPairCalcs()
Create a paircalc array using info in the supplied pcConfig object.
CkGroupID mCastMgrGID
The CkMulticast group that will handle gspace <–> pc comm.
int numStates
The total number of states in the system.
int grainSize
The grain size along the states dimensions (plural) (number of states per PC chare) ...
int instanceIndex
The proxyOffset value of thisInstance of OpenAtom computations.
int numChunks
The number of chunks (4th dimension of decomposition)
InstanceIDs pcHandle
The result of an array build.
bool arePhantomsOn
If this is a symmetric instance, should it use phantom chares to balance the BW path.
CkArrayID pcAID
The array IDs of the paircalc and its servant input handler arrays.
A tiny structure to hold the relevant IDs/ proxies required to interact with a paircalc instance...