OpenAtom  Version1.5a
pcCreationManager.C
1 #include "pcCreationManager.h"
2 #include "paircalc/pcBuilder.h"
3 #include "orthog_ctrl/orthoBuilder.h"
4 #include "load_balance/IntMap.h"
5 #include "ortho.decl.h"
6 
7 namespace cp {
8  namespace startup {
9 
10 PCCreationManager::PCCreationManager(const paircalc::pcConfig &_symmCfg, const paircalc::pcConfig &_asymmCfg, const ortho::orthoConfig &_orthoCfg):
11  symmCfg(_symmCfg), asymmCfg(_asymmCfg), orthoCfg(_orthoCfg)
12 {
13  if (symmCfg.orthoGrainSize != asymmCfg.orthoGrainSize)
14  CkAbort("Ortho grain size mismatch in supllied configs\n");
15  if (symmCfg.instanceIndex != asymmCfg.instanceIndex)
16  CkAbort("Cannot wire together two PCs from different instances!!");
17 }
18 
19 
20 
21 
22 void PCCreationManager::build(CkCallback cb, const PCMapConfig &mapCfg)
23 {
24  /// Create the message that will hold the handles to created chares
25  pcSetupMsg *msg = new pcSetupMsg();
26  msg->symmCfg = symmCfg;
27  msg->asymmCfg = asymmCfg;
28 
29  // Create the symmetric (psi) and asymmetric (lambda) paircalc instances
30  CkPrintf("\n\nCreating the symmetric (psi) and asymmetric (lambda) paircalculators\n");
31  cp::paircalc::Builder symmBuilder(symmCfg), asymmBuilder(asymmCfg);
32  msg->symmIDs = symmBuilder.build (mapCfg);
33  msg->asymmIDs = asymmBuilder.build(mapCfg);
34 
35  // Spawn the ortho array and its world of chares/classes (CLA_Matrix, OrthoHelper etc.)
36  CkPrintf("Creating the ortho array\n");
37  cp::ortho::Builder orthoBuilder(orthoCfg);
38  msg->orthoAID = orthoBuilder.build(msg->asymmIDs, mapCfg);
39 
40  // Ask ortho to setup its communication sections of paircalcs
41  CkPrintf("Setting up communication between gspace <--> paircalc <--> ortho\n");
42  CProxy_Ortho ortho = CProxy_Ortho(msg->orthoAID);
43  ortho.makeSections(symmCfg, asymmCfg, msg->symmIDs.pcAID, msg->asymmIDs.pcAID);
44 
45  /// Send handles to the created chares via a callback
46  cb.send(msg);
47 }
48 
49  } // end namespace startup
50 } // end namespace cp
51 
InstanceIDs build(const startup::PCMapConfig &mapCfg)
Trigger the creation of a pc array with the given configs, within the given pes/boxes etc...
Definition: pcBuilder.C:18
CkArrayID build(cp::paircalc::InstanceIDs &asymmHandle, const startup::PCMapConfig mapCfg)
Construct an ortho world given the configs.
Definition: orthoBuilder.C:24
A container for assorted mapping inputs to pass around easily.
Definition: pcMapConfig.h:15
Author: Eric J Bohm Date Created: June 4th, 2006.
paircalc::CreationManager returns relevant chare array handles via this msg
A class that orchestrates the mapping and creation of one ortho array and accompanying chares like Or...
Definition: orthoBuilder.h:17
CkArrayID pcAID
The array IDs of the paircalc and its servant input handler arrays.
Definition: pcInstanceIDs.h:17
A class that orchestrates the mapping and creation of one paircalc array and accompanying chares like...
Definition: pcBuilder.h:20