18 #include "CPcharmParaInfoGrp.h"
20 #include "uber/Uber.h"
21 #include "EachToManyMulticastStrategy.h"
22 #include "RingMulticastStrategy.h"
23 #include "StreamingStrategy.h"
24 #include "ckhashtable.h"
46 #define LOAD_BALANCE_STEP 100000000
48 #define PRE_BALANCE_STEP 2
50 #define FIRST_BALANCE_STEP 100000000
53 #define TRACE_ON_STEP 4
54 #define TRACE_OFF_STEP 5
58 #define HPM_OFF_STEP 5
61 #define CmiMemcpy(dest, src, size) CmiMemcpy((dest), (src), (size))
66 extern CkVec <MapType1> AtomImaptable;
67 extern CkVec <MapType2> GSImaptable;
68 extern CkVec <MapType2> RSImaptable;
69 extern CkVec <MapType2> RPPImaptable;
70 extern CkVec <MapType2> RhoGSImaptable;
71 extern CkVec <MapType2> RhoRSImaptable;
72 extern CkVec <MapType2> RhoGHartImaptable;
73 extern CkVec <MapType3> RhoRHartImaptable;
75 extern CkHashtableT <intdual, int> GSmaptable;
76 extern CkHashtableT <intdual, int> RSmaptable;
77 extern CkHashtableT <intdual, int> RPPmaptable;
78 extern CkHashtableT <intdual, int> RhoGSmaptable;
79 extern CkHashtableT <intdual, int> RhoRSmaptable;
80 extern CkHashtableT <intdual, int> RhoGHartmaptable;
81 extern CkHashtableT <inttriple, int> RhoRHartmaptable;
82 extern CkHashtableT <intdual, int> AsymScalcmaptable;
83 extern CkHashtableT <intdual, int> SymScalcmaptable;
84 CkReductionMsg *
sumFastDouble(
int nMsg, CkReductionMsg **msgs);
85 void fastAdd (
double *a,
double *b,
int nelem);
98 main(CkMigrateMessage *m) { }
131 inline int procNum(
int,
const CkArrayIndex &iIndex){
132 int *index=(
int *) iIndex.data();
136 if(numPes!=CkNumPes())
137 return(proc%CkNumPes());
159 inline int procNum(
int,
const CkArrayIndex &iIndex){
160 int *index=(
int *) iIndex.data();
164 proc=maptable->get(index[0],index[1]);
166 proc=maptable->get(
intdual(index[0],index[1]));
169 if(numPes!=CkNumPes())
170 return(proc%CkNumPes());
191 inline int procNum(
int,
const CkArrayIndex &iIndex){
192 int *index=(
int *) iIndex.data();
196 proc=maptable->get(index[0],index[1],index[2]);
198 proc=maptable->get(
inttriple(index[0],index[1],index[2]));
201 if(numPes!=CkNumPes())
202 return(proc%CkNumPes());
224 inline int procNum(
int,
const CkArrayIndex &iIndex){
228 short *sindex=(
short *) iIndex.data();
229 proc=maptable->get(sindex[0], sindex[1], sindex[2], sindex[3]);
231 int *index=(
int *) iIndex.data();
232 proc=maptable->get(
intdual(index[0], index[1]));
235 if(numPes!=CkNumPes())
236 return(proc%CkNumPes());
264 thisInstance=_instance;
265 maptable= &AtomImaptable[thisInstance.getPO()];
275 maptable= &AtomImaptable[thisInstance.getPO()];
277 inline int procNum(
int,
const CkArrayIndex &iIndex){
278 int *index=(
int *) iIndex.data();
282 if(numPes!=CkNumPes())
283 return(proc%CkNumPes());
295 thisInstance=_instance;
297 maptable = &GSImaptable[thisInstance.getPO()];
303 maptable = &GSmaptable;
308 CkArrayMapTable2::pup(p);
310 maptable= &GSImaptable[thisInstance.getPO()];
312 maptable= &GSmaptable;
315 inline int procNum(
int,
const CkArrayIndex &iIndex){
316 int *index=(
int *) iIndex.data();
319 if(maptable == NULL) {
320 CkPrintf(
"hey %d\n", CkMyPe());
323 proc=maptable->get(index[0],index[1]);
325 proc=maptable->get(
intdual(index[0],index[1]));
328 if(numPes!=CkNumPes())
329 return(proc%CkNumPes());
354 thisInstance=_instance;
356 maptable= &RSImaptable[thisInstance.getPO()];
358 maptable= &RSmaptable;
363 CkArrayMapTable2::pup(p);
365 maptable= &RSImaptable[thisInstance.getPO()];
367 maptable= &RSmaptable;
371 inline int procNum(
int,
const CkArrayIndex &iIndex){
372 int *index=(
int *) iIndex.data();
376 proc=maptable->get(index[0],index[1]);
378 proc=maptable->get(
intdual(index[0],index[1]));
381 if(numPes!=CkNumPes())
382 return(proc%CkNumPes());
398 thisInstance=_instance;
400 maptable= &RPPImaptable[thisInstance.getPO()];
402 maptable= &RPPmaptable;
407 CkArrayMapTable2::pup(p);
409 maptable= &RPPImaptable[thisInstance.getPO()];
411 maptable= &RPPmaptable;
419 inline int procNum(
int,
const CkArrayIndex &iIndex){
420 int *index=(
int *) iIndex.data();
424 proc=maptable->get(index[0],index[1]);
426 proc=maptable->get(
intdual(index[0],index[1]));
429 if(numPes!=CkNumPes())
430 return(proc%CkNumPes());
450 thisInstance=_instance;
452 maptable= &RhoRSImaptable[thisInstance.getPO()];
454 maptable= &RhoRSmaptable;
463 CkArrayMapTable2::pup(p);
465 maptable= &RhoRSImaptable[thisInstance.getPO()];
467 maptable= &RhoRSmaptable;
472 inline int procNum(
int,
const CkArrayIndex &iIndex){
473 int *index=(
int *) iIndex.data();
477 proc=maptable->get(index[0],index[1]);
479 proc=maptable->get(
intdual(index[0],index[1]));
482 if(numPes!=CkNumPes())
483 return(proc%CkNumPes());
498 thisInstance=_instance;
500 maptable= &RhoGSImaptable[thisInstance.getPO()];
502 maptable= &RhoGSmaptable;
510 inline int procNum(
int,
const CkArrayIndex &iIndex){
511 int *index=(
int *) iIndex.data();
515 proc=maptable->get(index[0],index[1]);
517 proc=maptable->get(
intdual(index[0],index[1]));
520 if(numPes!=CkNumPes())
521 return(proc%CkNumPes());
529 CkArrayMapTable2::pup(p);
538 thisInstance=_instance;
540 maptable= &RhoGHartImaptable[thisInstance.getPO()];
542 maptable= &RhoGHartmaptable;
554 CkArrayMapTable2::pup(p);
556 maptable= &RhoGHartImaptable[thisInstance.getPO()];
558 maptable= &RhoGHartmaptable;
561 inline int procNum(
int,
const CkArrayIndex &iIndex){
562 int *index=(
int *) iIndex.data();
565 proc=maptable->get(index[0],index[1]);
567 proc=maptable->get(
intdual(index[0],index[1]));
570 if(numPes!=CkNumPes())
571 return(proc%CkNumPes());
584 thisInstance=_instance;
586 maptable= &RhoRHartImaptable[thisInstance.getPO()];
588 maptable= &RhoRHartmaptable;
600 CkArrayMapTable3::pup(p);
602 maptable= &RhoRHartImaptable[thisInstance.getPO()];
604 maptable= &RhoRHartmaptable;
607 inline int procNum(
int,
const CkArrayIndex &iIndex){
608 int *index=(
int *) iIndex.data();
612 proc=maptable->get(index[0],index[1],index[2]);
614 proc=maptable->get(
inttriple(index[0],index[1],index[2]));
617 if(numPes!=CkNumPes())
618 return(proc%CkNumPes());
635 #define DoFFTContribute_ 1100
636 #define doRealFwFFT_ 1110
637 #define doRealBwFFT_ 1120
638 #define GspaceFwFFT_ 1130
639 #define GspaceBwFFT_ 1140
640 #define RhoRtoGFFT_ 1150
642 #define PostByrdfwFFTGtoR_ 1152
643 #define BwFFTRtoG_ 1153
644 #define ByrdanddoFwFFTGtoR_ 1154
645 #define HartExcVksG_ 1160
646 #define divRhoVksGspace_ 1161
647 #define AcceptStructFact_ 1162
648 #define eesHartExcG_ 1163
649 #define eesEwaldG_ 1164
650 #define eesAtmForcR_ 1165
651 #define eesAtmBspline_ 1166
652 #define eesZmatR_ 1167
653 #define eesEnergyAtmForcR_ 1168
654 #define eesProjG_ 1169
655 #define fwFFTGtoR0_ 1170
656 #define fwFFTGtoRnot0_ 1171
657 #define doNlFFTGtoR_ 1172
658 #define doNlFFTRtoG_ 1173
659 #define eesPsiForcGspace_ 1174
660 #define GradCorrGGA_ 1180
661 #define WhiteByrdFFTX_ 1181
662 #define WhiteByrdFFTY_ 1182
663 #define WhiteByrdFFTZ_ 1183
664 #define enlMatrixCalc_ 1300
665 #define enlAtmForcCalc_ 1301
666 #define enlForcCalc_ 1302
667 #define doEextFFTRtoG_ 1303
668 #define doEextFFTGtoR_ 1304
669 #define doEextFFTGxtoRx_ 1305
670 #define doEextFFTRytoGy_ 1306
671 #define doRhoFFTRytoGy_ 1307
672 #define doRhoFFTGxtoRx_ 1308
673 #define OrthoDGEMM1_ 1401
674 #define OrthoDGEMM2_ 1402
676 #define IntegrateModForces_ 1000
677 #define Scalcmap_ 2000
678 #define GHartAtmForcCopy_ 3000
679 #define GHartAtmForcSend_ 4000
693 namespace cp {
namespace paircalc {
class pcConfig; } }
694 namespace pc = cp::paircalc;
697 void lst_sort_clean(
int ,
int *,
int *);
707 void get_grp_params(
int natm_nl,
int numSfGrps,
int indexSfGrp,
int planeIndex,
708 int *n_ret,
int *istrt_ret,
int *iend_ret);
709 int atmGrpMap(
int istart,
int nsend,
int listsize,
int *listpe,
int AtmGrp,
710 int dup,
int planeIndex);
712 bool findCuboid(
int &x,
int &y,
int &z,
int &order,
int maxX,
int maxY,
int maxZ,
int maxT,
int volume,
int vn);
713 void create_Rho_fft_numbers(
int ,
int ,
int ,
int,
int,
int,
int *,
int *,
int *,
int *,
int *);
715 void computeMapOffsets();
724 #include "paircalc/ckPairCalculator.h"
725 #include "cpaimd.decl.h"
Helper class for map hashtables copied from femrefine.C.
~main()
Cleanup stuff in the hopes of getting clean valgrind.
holds the UberIndex and the offset for proxies
void control_physics_to_driver(UberCollection thisInstance)
Get the atoms and the parainfo //////////////////////////////////////////////////////////////////////...
== Size or location in a regular 2D array
void init_commlib_strategies(int, int, int, UberCollection thisInstance)
Initialize Commlib communication strategies.
CkReductionMsg * sumFastDouble(int nMsg, CkReductionMsg **msgs)
sum together matrices of doubles possibly faster than sum_double due to minimizing copies and using s...
void init_PIBeads(CPcharmParaInfo *sim, UberCollection thisInstance)
Create the PIBeadAtoms array.
Configuration settings for the ortho world.
int procNum(int, const CkArrayIndex &iIndex)
New functions beind added for the topology mapping of the density objects - RhoR, RhoG...
void init_state_chares(int natm_nl, int natm_nl_grp_max, int numSfGrps, int doublePack, CPcharmParaInfo *sim, UberCollection thisInstance)
Create the array elements for the GSpace, Particle and Real Space planes ////////////////////////////...
void create_Rho_fft_numbers(int, int, int, int, int, int, int *, int *, int *, int *, int *)
Author: Eric J Bohm Date Created: June 4th, 2006.
int procNum(int, const CkArrayIndex &iIndex)
int GSMap::slowprocNum(int arrayHdl, const CkArrayIndex2D &idx2d)
Hacky solution to passing a PeList to GSpace(0,0) for use in paircalc mapping without actually having...
bool fakeTorus
readonly defined in cpaimd.C
void setTraceUserEvents()
Class used for instantiation of real-space group objects.
int procNum(int, const CkArrayIndex &iIndex)
Function for RealSpace objects.
void init_eesNL_chares(int natm_nl, int natm_nl_grp_max, int doublePack, PeList *exclusion, CPcharmParaInfo *sim, UberCollection thisInstance)
/addtogroup Particle
Dumb structure that holds all the configuration inputs required for paircalc instantiation, functioning and interaction.
The class which creates the main chare.
bool findCuboid(int &x, int &y, int &z, int &order, int maxX, int maxY, int maxZ, int maxT, int volume, int vn)
return the cuboid x,y,z of a subpartition exactly matching that volume
Class used for instantiation of G-space group objects.
void paircalcstartup(pc::pcConfig *cfgSymmPC, pc::pcConfig *cfgAsymmPC, CPcharmParaInfo *sim, int doublePack)
stuff to be include before the decl or else
Author: Eric J Bohm Date Created: June 4th, 2006.
provide procnum mapping for RhoR
provide procnum mapping for RhoG
MapType1 * maptable
trivial 1d here for usage consistency
int init_rho_chares(CPcharmParaInfo *, UberCollection thisInstance)
Creating arrays CP_Rho_GSpacePlane, CP_Rho_GSpacePlaneHelper and CP_Rho_RealSpacePlane.
Author: Eric J Bohm Date Created: May 31, 2006.
CkVec< int > PIBImaptable
INT_MAPs are the ones actually used so these are being changed to CkVec's for beads.