25 #include "src_piny_physics_v1.0/include/class_defs/CP_OPERATIONS/class_cplocal.h"
26 #include "src_piny_physics_v1.0/include/class_defs/CP_OPERATIONS/class_cpxcfnctls.h"
30 extern CkVec <CProxy_CP_Rho_RealSpacePlane> UrhoRealProxy;
31 extern CkVec <CProxy_AtomsCache> UatomsCacheProxy;
32 extern CkVec <CProxy_CP_Rho_RHartExt> UrhoRHartExtProxy;
33 extern CkVec <CProxy_CP_Rho_GHartExt> UrhoGHartExtProxy;
34 extern CkVec <CProxy_eesCache> UeesCacheProxy;
35 extern CkVec <CProxy_FFTcache> UfftCacheProxy;
37 extern ComlibInstanceHandle commRHartGHartIns;
57 CP_Rho_RHartExt::CP_Rho_RHartExt(
int _ngrida,
int _ngridb,
int _ngridc,
58 int _ees_eext_on,
int _natmTyp,
60 : thisInstance(_instance)
66 nplane_rho_x = sim->nplane_rho_x;
67 listSubFlag = sim->listSubFlag;
68 rhoRsubplanes = config.rhoRsubplanes;
70 CkAssert(nplane_rho_x >= rhoRsubplanes);
75 ees_eext_on = _ees_eext_on;
76 natmTypTot = _natmTyp;
78 nchareHartAtmT = config.nchareHartAtmT;
79 int div = (natmTypTot/nchareHartAtmT);
80 int rem = (natmTypTot % nchareHartAtmT);
81 int max = (thisIndex.z < rem ? thisIndex.z : rem);
82 natmTyp = (thisIndex.z<rem ? div+1 : div);
83 atmTypoff = div*thisIndex.z + max;
85 iplane_ind = thisIndex.y*ngridc + thisIndex.x;
90 int nchareG = sim->nchareRhoGEext;
92 recvCountFromGHartExt = 0;
93 for(
int i=0;i<nchareG;i++){
94 if(sim->nline_send_eext_y[i][thisIndex.y]>0){recvCountFromGHartExt++;}
97 recvCountFromGHartExt=nchareG;
106 registrationFlag = 0;
117 div = (ngridb/rhoRsubplanes);
118 rem = (ngridb % rhoRsubplanes);
119 max = (thisIndex.y < rem ? thisIndex.y : rem);
120 myNgridb = (thisIndex.y<rem ? div+1 : div);
121 myBoff = div*thisIndex.y + max;
122 nptsB = ngrida*myNgridb;
123 nptsExpndB = (ngrida+2)*myNgridb;
128 myNplane_rho = sim->numSubGx[thisIndex.y];
130 myNplane_rho = nplane_rho_x;
132 nptsA = 2*myNplane_rho*ngridb;
133 nptsExpndA = 2*myNplane_rho*ngridb;
150 csize = (ngrida/2+1)*myNgridb;
152 eesCache *eesData = UeesCacheProxy[thisInstance.proxyOffset].ckLocalBranch();
156 atmSFR =
reinterpret_cast<double*
> (atmSFC);
161 atmEwdSFR =
reinterpret_cast<double*
> (atmEwdSFC);
162 atmEwdForcC = atmEwdSFC;
163 atmEwdForcR = atmEwdSFR;
168 atmSFRint =
reinterpret_cast<double*
> (atmSFC);
169 atmForcCint = atmSFCint;
170 atmForcRint = atmSFRint;
173 atmEwdSFRint =
reinterpret_cast<double*
> (atmEwdSFC);
174 atmEwdForcCint = atmEwdSFCint;
175 atmEwdForcRint = atmEwdSFRint;
180 CkCallback cb(CkIndex_CP_Rho_RHartExt::registrationDone(NULL),thisProxy);
181 contribute(
sizeof(
int),&i,CkReduction::sum_int,cb);
187 rhoGHartProxy_com = UrhoGHartExtProxy[thisInstance.proxyOffset];;
189 if (config.useRHartInsGHart){
190 ComlibAssociateProxy(commRHartGHartIns,rhoGHartProxy_com);
202 CP_Rho_RHartExt::~CP_Rho_RHartExt(){
210 void CP_Rho_RHartExt::pup(PUP::er &p){
213 ArrayElement3D::pup(p);
246 if (p.isUnpacking() && ees_eext_on==1) {
248 atmSFR =
reinterpret_cast<double*
> (atmSFC);
252 atmEwdSFR =
reinterpret_cast<double*
> (atmEwdSFC);
253 atmEwdForcC = atmEwdSFC;
254 atmEwdForcR = atmEwdSFR;
257 atmSFRint =
reinterpret_cast<double*
> (atmSFCint);
258 atmForcCint = atmSFC;
259 atmForcRint = atmSFR;
261 atmEwdSFRint =
reinterpret_cast<double*
> (atmEwdSFCint);
262 atmEwdForcCint = atmEwdSFCint;
263 atmEwdForcRint = atmEwdSFRint;
268 p((
char*)atmSFC,csize*
sizeof(
complex));
269 p((
char*)atmEwdSFC,csize*
sizeof(
complex));
271 p((
char*)atmSFCint,csizeInt*
sizeof(
complex));
272 p((
char*)atmEwdSFCint,csizeInt*
sizeof(
complex));
292 int cp_min_opt = sim->cp_min_opt;
297 if(UatomsCacheProxy[thisInstance.proxyOffset].ckLocalBranch()->iteration != iteration-1){
298 CkPrintf(
"@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
299 CkPrintf(
"Flow of Control Error in GHartExtVks : atoms slow %d %d\n",
300 UatomsCacheProxy[thisInstance.proxyOffset].ckLocalBranch()->iteration,iteration);
301 CkPrintf(
"@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
310 #ifdef _CP_RHART_VERBOSE_
311 CkPrintf(
"HI, I am rhart chare %d %d in start : %d on %d\n",
312 thisIndex.x,thisIndex.y,registrationFlag,CkMyPe());
315 if(iterAtmTyp==natmTyp){CkPrintf(
"%d signing off\n",thisIndex.x);CkExit();}
336 int sum = ((
int *)msg->getData())[0];
339 #ifdef _CP_RHART_VERBOSE_
340 CkPrintf(
"HI, I am rhart chare %d %d in reg : %d on %d\n",
341 thisIndex.x,thisIndex.y,sum,CkMyPe());
345 if(iterAtmTyp==natmTyp){
346 CkPrintf(
"HI, I am rhart chare %d exiting at %d\n",thisIndex.x,iterAtmTyp+1);
367 if(iterAtmTyp>natmTyp){
368 CkPrintf(
"@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
369 CkPrintf(
"Too many iterations RHartExtVks\n");
370 CkPrintf(
"@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
374 #ifdef _CP_RHART_VERBOSE_
375 CkPrintf(
"HI, I am rhart chare %d %d %d in computeatmsf at iter %d on %d\n",
376 thisIndex.x,thisIndex.y,thisIndex.z, iterAtmTyp,CkMyPe());
382 int myPlane = thisIndex.x;
383 int mySubplane = thisIndex.y;
384 int itime = iteration;
385 int iterAtmTypFull = iterAtmTyp+atmTypoff;
387 eesCache *eesData= UeesCacheProxy[thisInstance.proxyOffset].ckLocalBranch ();
390 int *plane_index = eesData->RhoRHartData[myPlane]->plane_index;
391 int **nSub = eesData->RhoRHartData[myPlane]->nSub;
392 int ***igrid = eesData->RhoRHartData[myPlane]->igrid;
393 double ***mn = eesData->RhoRHartData[myPlane]->mn;
395 AtomsCache *ag = UatomsCacheProxy[thisInstance.proxyOffset].ckLocalBranch();
398 CPLOCAL::eesPackGridRchare(natm,iterAtmTypFull,atmSFR,myPlane,
400 plane_index,nSub,myNgridb);
419 #ifdef _CP_RHART_VERBOSE_
420 CkPrintf(
"HI, I am rhart chare %d %d %d in fftsback at %d on %d\n",
421 thisIndex.x,thisIndex.y,thisIndex.z, iterAtmTyp,CkMyPe());
426 #if CMK_TRACE_ENABLED
427 double StartTime=CmiWallTimer();
430 FFTcache *fftcache = UfftCacheProxy[thisInstance.proxyOffset].ckLocalBranch();
438 #if CMK_TRACE_ENABLED
439 traceUserBracketEvent(doEextFFTRtoG_, StartTime, CmiWallTimer());
448 #ifdef DEBUG_INT_TRANS_FWD
450 sprintf(name,
"partFFTGxGyZ%d.out.%d.%d",rhoRsubplanes,thisIndex.x,thisIndex.y);
451 FILE *fp = fopen(name,
"w");
452 for(
int ix =0;ix<nplane_rho_x;ix++){
453 for(
int iy =0;iy<ngridb;iy++){
454 int i = iy*(ngrida/2+1) + ix;
455 fprintf(fp,
"%d %d : %g %g\n",iy,ix,atmSFC[i].re,atmSFC[i].im);
461 #ifdef _GLENN_DBG_KPT_
463 sprintf(name,
"sfAtmTypGxGyZ_inR.p%d.t%d.out",thisIndex.x,iterAtmTyp);
464 FILE *fp = fopen(name,
"w");
465 for(
int ix =0;ix<nplane_rho_x;ix++){
466 for(
int iy =0;iy<ngridb;iy++){
467 int i = iy*(ngrida/2+1) + ix;
468 fprintf(fp,
"%d %d : %g %g\n",iy,ix,atmSFC[i].re,atmSFC[i].im);
496 CkAssert(rhoRsubplanes>1);
498 int **listSubGx = sim->listSubGx;
499 int *numSubGx = sim->numSubGx;
504 #ifdef _ERIC_SETS_UP_COMMLIB_
505 if(config.useRInsRhoRP) commRealInstanceRx.beginIteration();
512 int stride = ngrida/2+1;
513 int ix = thisIndex.x;
514 for(
int ic = 0; ic < rhoRsubplanes; ic ++) {
515 int num = numSubGx[ic];
516 int size = num*myNgridb;
518 int sendFFTDataSize = size;
521 msg->offset = myBoff;
523 msg->iter = iterAtmTyp;
526 if(config.prioFFTMsg){
527 CkSetQueueing(msg, CK_QUEUEING_IFIFO);
528 *(
int*)CkPriorityPtr(msg) = config.rhogpriority+thisIndex.y;
532 for(
int i=0,koff=0;i<num;i++,koff+=myNgridb){
533 for(
int k=koff,ii=listSubGx[ic][i];k<myNgridb+koff;k++,ii+=stride){
534 data[k] = atmSFC[ii];
538 int nst=listSubGx[ic][0];
539 for(
int i=0,ist=nst,koff=0;i<num;i++,koff+=myNgridb,ist++){
540 for(
int k=koff,ii=ist;k<myNgridb+koff;k++,ii+=stride){
541 data[k] = atmSFC[ii];
546 UrhoRHartExtProxy[thisInstance.proxyOffset](ix,ic,thisIndex.z).
recvAtmSfRyToGy(msg);
548 #ifdef _ERIC_SETS_UP_COMMLIB_
549 UrhoRHartExtProxy[thisInstance.proxyOffset](ix,ic,thisIndex.z).
recvAtmSfRyToGy(msg);
557 #ifdef _ERIC_SETS_UP_COMMLIB_
558 if(config.useRInsRhoRP) commRealInstanceRx.endIteration();
580 int size = msg->size;
581 int iter = msg->iter;
583 int offset = msg->offset;
586 CkAssert(size==myNplane_rho*num);
587 CkAssert(rhoRsubplanes>1);
591 for(
int js=0,j=offset;js<size;js+=num,j+=ngridb){
592 for(
int is=js,i=j;is<num+js;is++,i++){
593 atmSFCint[i] = msgData[is];
603 if(countIntRtoG==rhoRsubplanes){
606 FFTcache *fftcache = UfftCacheProxy[thisInstance.proxyOffset].ckLocalBranch();
607 #if CMK_TRACE_ENABLED
608 double StartTime=CmiWallTimer();
611 ngrida,ngridb,iplane_ind);
612 #if CMK_TRACE_ENABLED
613 traceUserBracketEvent(doEextFFTRytoGy_, StartTime, CmiWallTimer());
616 #ifndef DEBUG_INT_TRANS_FWD
624 #ifdef DEBUG_INT_TRANS_FWD
625 if(countIntRtoG==rhoRsubplanes){
627 int **listSubGx = sim->listSubGx;
628 int ic = thisIndex.y;
630 sprintf(name,
"partFFTGxGyZ%d.out.%d.%d",rhoRsubplanes,thisIndex.x,thisIndex.y);
631 FILE *fp = fopen(name,
"w");
632 for(
int ix =0;ix<myNplane_rho;ix++){
633 for(
int iy =0;iy<ngridb;iy++){
634 int i = ix*ngridb + iy;
635 fprintf(fp,
"%d %d : %g %g\n",iy,listSubGx[ic][ix],atmSFCint[i].re,atmSFCint[i].im);
657 #ifdef _CP_RHART_VERBOSE_
658 CkPrintf(
"HI, I am rhart chare %d %d %d in sendsf at %d on %d\n",
659 thisIndex.x,thisIndex.y,thisIndex.z,iterAtmTyp,CkMyPe());
663 int nchareG = sim->nchareRhoGEext;
665 int **tranpack = sim->index_tran_upack_eext;
666 int *nlines_per_chareG = sim->nlines_per_chareRhoGEext;
668 int ***tranupack_Y = sim->index_tran_upack_eext_y;
669 int **nlines_per_chareG_Y = sim->nline_send_eext_y;
677 if(rhoRsubplanes==1){
679 if(config.useRHartInsGHart){commRHartGHartIns.beginIteration();}
681 if(config.useRHartInsGHart){ComlibBegin(rhoGHartProxy_com,0);}
689 int iy = thisIndex.y;
690 for (
int ic=0;ic<nchareG;ic++) {
694 int sendFFTDataSize = nlines_per_chareG[ic];
695 if(rhoRsubplanes!=1){sendFFTDataSize = nlines_per_chareG_Y[ic][iy];}
696 if(sendFFTDataSize>0)
702 if(config.prioEextFFTMsg){
703 CkSetQueueing(msg, CK_QUEUEING_IFIFO);
704 *(
int*)CkPriorityPtr(msg) = config.rhogHartpriority+thisIndex.x*10;
706 msg->iter = iterAtmTyp;
707 msg->size = sendFFTDataSize;
708 msg->offset = thisIndex.x;
709 msg->offsetGx = thisIndex.y;
712 if(rhoRsubplanes==1){
713 for(
int i=0;i<sendFFTDataSize;i++){data[i] = atmSFC[tranpack[ic][i]];}
715 for(
int i=0;i<sendFFTDataSize;i++){
716 data[i] = atmSFCint[tranupack_Y[ic][iy][i]];
722 if(rhoRsubplanes==1){
723 rhoGHartProxy_com(ic,thisIndex.z).recvAtmSFFromRhoRHart(msg);
725 UrhoGHartExtProxy[thisInstance.proxyOffset](ic,thisIndex.z).recvAtmSFFromRhoRHart(msg);
733 if(rhoRsubplanes==1){
735 if(config.useRHartInsGHart){commRHartGHartIns.endIteration();}
737 if(config.useRHartInsGHart){ComlibBegin(rhoGHartProxy_com,1);}
757 int nchareG = sim->nchareRhoGEext;
759 int **tranUnpack = sim->index_tran_upack_eext;
760 int *nlines_per_chareG = sim->nlines_per_chareRhoGEext;
762 int ***tranupack_Y = sim->index_tran_upack_eext_y;
763 int **nlines_per_chareG_Y = sim->nline_send_eext_y;
764 int iy = thisIndex.y;
766 int size = msg->size;
767 int Index = msg->senderIndex;
768 int iopt = msg->iopt;
769 int iter = msg->iter;
770 complex *partiallyFFTd = msg->data;
774 if(rhoRsubplanes==1){
775 mySize = nlines_per_chareG[Index];
778 mySize = nlines_per_chareG_Y[Index][iy];
783 for(
int i=0;i<msg->size ;i++){
784 CkAssert(isnan(msg->data[i].re)==0);
785 CkAssert(isnan(msg->data[i].im)==0);
793 if (countFFT[iopt] > recvCountFromGHartExt) {
794 CkPrintf(
"@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
795 CkPrintf(
"Mismatch in allowed rho_gspace chare arrays : %d %d %d %d\n",
796 countFFT[iopt],nchareG,thisIndex.x,thisIndex.y);
797 CkPrintf(
"@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
802 CkPrintf(
"@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
803 CkPrintf(
"Dude.1, %d != %d for rho rhart chare %d %d\n",size,mySize,
805 CkPrintf(
"@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
809 if(iter!=iterAtmTyp){
810 CkPrintf(
"@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
811 CkPrintf(
"Dude.2, %d != %d for rho rhart chare %d %d %d\n",iter,iterAtmTyp,
812 thisIndex.x,Index,iopt);
813 CkPrintf(
"@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
817 if((iopt==1) && (iterAtmTyp!=natmTyp) ){
818 CkPrintf(
"@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
819 CkPrintf(
"Dude.3, %d != %d for rho rhart chare %d %d : %d %d\n",iter,natmTyp,
820 thisIndex.x,iy,Index,iopt);
821 CkPrintf(
"@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
829 if(rhoRsubplanes==1){
831 case 0 : data = atmSFC;
break;
832 case 1 : data = atmEwdSFC;
break;
833 default: CkAbort(
"impossible iopt");
break;
837 case 0 : data = atmSFCint;
break;
838 case 1 : data = atmEwdSFCint;
break;
839 default: CkAbort(
"impossible iopt");
break;
843 if(countFFT[iopt]==1){memset(data,0,
sizeof(
complex)*csizenow);}
845 if(rhoRsubplanes==1){
846 for(
int i=0;i<size;i++){data[tranUnpack[Index][i]] = partiallyFFTd[i];}
848 for(
int i=0;i<size;i++){
849 data[tranupack_Y[Index][iy][i]] = partiallyFFTd[i];
858 if (countFFT[iopt] == recvCountFromGHartExt){
859 #ifdef _CP_RHART_VERBOSE_
860 CkPrintf(
"HI, I am rhart chare %d %d %d in recvsf with opt %d at %d on %d\n",
861 thisIndex.x,thisIndex.y, thisIndex.z,iopt,iterAtmTyp,CkMyPe());
864 if(rhoRsubplanes==1){nAtmTypRecv++;}
881 #ifdef _CP_RHART_VERBOSE_
882 CkPrintf(
"HI, I am rhart chare %d %d %d in FFTAtmForc w %d at %d on %d\n",
883 thisIndex.x,thisIndex.y,thisIndex.z,flagEwd,iterAtmTyp,CkMyPe());
888 if(rhoRsubplanes==1){
890 case 0: dataR=atmSFR; dataC=atmSFC;
break;
891 case 1: dataR=atmEwdSFR; dataC=atmEwdSFC;
break;
892 default: CkAbort(
"impossible iopt");
break;
896 case 0: dataR=atmSFRint; dataC=atmSFCint;
break;
897 case 1: dataR=atmEwdSFRint; dataC=atmEwdSFCint;
break;
898 default: CkAbort(
"impossible iopt");
break;
904 #if CMK_TRACE_ENABLED
905 double StartTime=CmiWallTimer();
908 FFTcache *fftcache = UfftCacheProxy[thisInstance.proxyOffset].ckLocalBranch();
909 if(rhoRsubplanes==1){
917 #if CMK_TRACE_ENABLED
918 traceUserBracketEvent(doEextFFTGtoR_, StartTime, CmiWallTimer());
932 CkAssert(rhoRsubplanes>1);
936 case 0 : FFTresult = atmSFCint;
break;
937 case 1 : FFTresult = atmEwdSFCint;
break;
938 default: CkAbort(
"impossible iopt");
break;
947 #ifdef _ERIC_SETS_UP_COMMLIB_
949 case 0 :
if(config.useRInsRhoRP) commRealInstanceRx.beginIteration();
break;
950 case 1 :
if(config.useRInsIGXRhoRP) commRealIGXInstanceRx.beginIteration();
break;
951 default: CkAbort(
"impossible iopt");
break;
959 int ix = thisIndex.x;
960 for(
int ic = 0; ic < rhoRsubplanes; ic ++) {
961 int div = (ngridb/rhoRsubplanes);
962 int rem = (ngridb % rhoRsubplanes);
963 int add = (ic < rem ? 1 : 0);
964 int max = (ic < rem ? ic : rem);
965 int ist = div*ic + max;
966 int iend = ist + div + add;
967 int size = (iend-ist)*myNplane_rho;
969 int sendFFTDataSize = size;
973 msg->iter = iterAtmTyp;
974 msg->offset = thisIndex.y;
975 msg->num = myNplane_rho;
978 if(config.prioFFTMsg){
979 CkSetQueueing(msg, CK_QUEUEING_IFIFO);
980 *(
int*)CkPriorityPtr(msg) = config.rhogpriority+thisIndex.y;
983 for(
int i=ist,koff=0;i<iend;i++,koff+=myNplane_rho){
984 for(
int k=koff,ii=i;k<myNplane_rho+koff;k++,ii+=ngridb){
985 data[k] = FFTresult[ii];
990 UrhoRHartExtProxy[thisInstance.proxyOffset](ix,ic,thisIndex.z).
recvAtmForcGxToRx(msg);
992 #ifdef _ERIC_SETS_UP_COMMLIB_
994 case 0 : UrhoGProxy[thisInstance.proxyOffset]_com(ic,0).acceptRhoGradVksGxToRx(msg);
break;
995 case 1 : UrhoGProxy[thisInstance.proxyOffset]IGX_com(ic,0).acceptRhoGradVksGxToRx(msg);
break;
996 default: CkAbort(
"impossible iopt");
break;
1005 #ifdef _ERIC_SETS_UP_COMMLIB_
1007 case 0 :
if(config.useRInsRhoRP) commRealInstanceRx.endIteration();
break;
1008 case 1 :
if(config.useRInsIGXRhoRP) commRealIGXInstanceRx.endIteration();
break;
1009 default: CkAbort(
"impossible iopt");
break;
1025 int **listSubGx = sim->listSubGx;
1026 int *numSubGx = sim->numSubGx;
1028 int size = msg->size;
1029 int iopt = msg->iopt;
1030 int iter = msg->iter;
1032 int offset = msg->offset;
1035 CkAssert(rhoRsubplanes>1);
1036 CkAssert(size==myNgridb*num);
1037 if(iterAtmTyp!=iter){
1038 CkPrintf(
"@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
1039 CkPrintf(
"iter!=iterAtmTyp recvatmforcgxtorx : %d %d %d : %d %d %d\n",
1040 thisIndex.x,thisIndex.y,thisIndex.z,iterAtmTyp,iter,iopt);
1041 CkPrintf(
"@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
1048 case 0: dataR=atmSFR; dataC=atmSFC;
break;
1049 case 1: dataR=atmEwdSFR; dataC=atmEwdSFC;
break;
1050 default: CkAbort(
"impossible iopt");
break;
1056 countIntGtoR[iopt]++;
1057 if(countIntGtoR[iopt]==1){bzero(dataR,
sizeof(
double)*nptsExpndB);}
1059 int stride = ngrida/2+1;
1061 for(
int js=0,j=0;js<size;js+=num,j++){
1063 for(
int is=js,i=0;is<(num+js);is++,i++){
1064 dataC[(listSubGx[offset][i]+jj)] = msgData[is];
1068 int nst = listSubGx[offset][0];
1069 for(
int js=0,j=0;js<size;js+=num,j++){
1070 int jj = j*stride+nst;
1071 for(
int is=js,i=jj;is<(num+js);is++,i++){
1072 dataC[i] = msgData[is];
1081 if(countIntGtoR[iopt]==rhoRsubplanes){
1082 countIntGtoR[iopt]=0;
1083 FFTcache *fftcache = UfftCacheProxy[thisInstance.proxyOffset].ckLocalBranch();
1084 #if CMK_TRACE_ENABLED
1085 double StartTime=CmiWallTimer();
1088 #if CMK_TRACE_ENABLED
1089 traceUserBracketEvent(doEextFFTGxtoRx_, StartTime, CmiWallTimer());
1109 #ifdef _CP_RHART_VERBOSE_
1110 CkPrintf(
"HI, I am rhart chare %d %d %d in computeAtmForc.1 w %d at %d %d %d on %d\n",
1111 thisIndex.x,thisIndex.y, thisIndex.z, flagEwd,iterAtmTyp,nAtmTypRecv,natmTyp,CkMyPe());
1118 if( (flagEwd==1) && (iterAtmTyp!=natmTyp)){
1119 CkPrintf(
"@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
1120 CkPrintf(
"You can't have flagEwd==1 unless you are on the last step\n");
1121 CkPrintf(
"@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
1127 if( (flagEwd==0) && (iterAtmTyp!=nAtmTypRecv) && (iterAtmTyp!=natmTyp)){
1128 CkPrintf(
"@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
1129 CkPrintf(
"Atm SF Recv and atm SF calc out of sync %d\n",thisIndex.x);
1130 CkPrintf(
"@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
1135 if( iterAtmTyp>natmTyp || nAtmTypRecv>natmTyp+1 ){
1136 CkPrintf(
"@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
1137 CkPrintf(
"Too much action for rhoRhart\n");
1138 CkPrintf(
"@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
1145 int myPlane = thisIndex.x;
1146 int mySubplane = thisIndex.y;
1147 int iterAtmTypFull = iterAtmTyp+atmTypoff;
1150 if(flagEwd==0){data=atmSFR;}
else{data=atmEwdSFR;}
1153 eesCache *eesData = UeesCacheProxy[thisInstance.proxyOffset].ckLocalBranch ();
1154 AtomsCache *ag = UatomsCacheProxy[thisInstance.proxyOffset].ckLocalBranch();
1156 CkAssert(eesData->allowedRhoRHartChares[myPlane]!=0);
1157 int *plane_index = eesData->RhoRHartData[myPlane]->plane_index;
1158 int **nSub = eesData->RhoRHartData[myPlane]->nSub;
1159 int ***igrid = eesData->RhoRHartData[myPlane]->igrid;
1160 double ***dmn_x = eesData->RhoRHartData[myPlane]->dmn_x;
1161 double ***dmn_y = eesData->RhoRHartData[myPlane]->dmn_y;
1162 double ***dmn_z = eesData->RhoRHartData[myPlane]->dmn_z;
1164 FastAtoms *fastAtoms = &(ag->fastAtoms);
1165 int natm = ag->natm;
1167 #if CMK_TRACE_ENABLED
1168 double StartTime=CmiWallTimer();
1171 CPLOCAL::eesAtmForceRchare(natm,fastAtoms,iterAtmTypFull,igrid,
1172 dmn_x,dmn_y,dmn_z, plane_index,nSub,data,
1173 myPlane,mySubplane,flagEwd);
1174 #if CMK_TRACE_ENABLED
1175 traceUserBracketEvent(eesAtmForcR_, StartTime, CmiWallTimer());
1186 int nrecvMax=natmTyp;
1187 if(thisIndex.z==0){nrecvMax++;}
1189 #define _CP_DEBUG_STOP_RHART_OFF
1191 #ifndef _CP_DEBUG_STOP_RHART_
1192 if(iterAtmTyp==natmTyp && nAtmTypRecv==nrecvMax){
1193 #ifdef _CP_RHART_VERBOSE_
1194 CkPrintf(
"HI, I am rhart chare %d %d %d in computeAtmForc.2 w %d at %d done on %d\n",
1195 thisIndex.x,thisIndex.y,thisIndex.z,flagEwd,iterAtmTyp,CkMyPe());
1198 int index = (thisIndex.x % sim->sizeZ);
1199 UrhoRealProxy[thisInstance.proxyOffset](index,thisIndex.y).RHartReport();
1208 #ifdef _CP_DEBUG_STOP_RHART_
1209 if(iterAtmTyp==natmTyp && nAtmTypRecv==nrecvMax){
1210 CkPrintf(
"HI, I am rhart chare %d in computeAtmForc w %d at %d contrib\n",
1211 thisIndex.x,flagEwd,iterAtmTyp);
1213 CkCallback cb(CkIndex_CP_Rho_RHartExt::registrationDone(NULL),UrhoRHartExtProxy[thisInstance.proxyOffset]);
1214 contribute(
sizeof(
int),&i,CkReduction::sum_int,cb);
1230 if(countDebug==(rhoRsubplanes*ngridc*nchareHartAtmT)){
1232 CkPrintf(
"I am in the exitfordebuging rhorhartext puppy. Bye-bye\n");
void registerCacheRHart(int)
= RhoRhart Cache Management tool
holds the UberIndex and the offset for proxies
void startEextIter()
Invoke by Rspace-density : Density has arrived in r-space and will soon arrive in g-space...
void doEextFFTGxToRx_Rchare(complex *, double *, int, int, int, int)
Eext : Rchare : data(gx,gy,z) -> data(x,y,z) : forward //////////////////////////////////////////////...
void queryCacheRHart(int, int, int)
= RhoGhart Cache Management tool
void sendAtmSfRyToGy()
Double Transpose Fwd Send : A(gx,y,z) on the way to A(gx,gy,z) Send so that (y,z) parallelism is swit...
void exitForDebugging()
Glenn's Rhart exit.
void doEextFFTGtoR_Rchare(complex *, double *, int, int, int, int)
Eext : Rchare : data(gx,gy,z) -> data(x,y,z) : forward //////////////////////////////////////////////...
void computeAtmForc(int)
Get forces on atoms from Ewald or electrons /////////////////////////////////////////////////////////...
void doEextFFTRtoG_Rchare(complex *, double *, int, int, int, int)
Eext : Rchare : data(x,y,z) -> data(gx,gy,z) : Backward /////////////////////////////////////////////...
void fftAtmSfRtoG()
FFT of SF(x,y,z,iatmTyp) -> SF(gx,gy,z,iatmTyp)
Add type declarations for simulationConstants class (readonly vars) and once class for each type of o...
void sendAtmSfRhoGHart()
Send SF(gx,gy,z,iatmTYP) to g-space whence the FFT will be completed.
void computeAtmSF()
Start the real space part of the EES interpolation for atmSF(iatmTyp) ///////////////////////////////...
Some basic data structures and the array map classes are defined here.
void fftAtmForcGtoR(int flagEwd)
Complete the FFT : sf(gx,gy,z) ->sf(x,y,z) //////////////////////////////////////////////////////////...
void doEextFFTRxToGx_Rchare(complex *, double *, int, int, int, int)
Eext : Rchare : data(x,y,z) -> data(gx,gy,z) : Backward /////////////////////////////////////////////...
void doEextFFTGyToRy_Rchare(complex *, double *, int, int, int, int)
Eext : Rchare : data(gx,gy,z) -> data(x,y,z) : forward //////////////////////////////////////////////...
void recvAtmForcGxToRx(RhoGHartMsg *msg)
Group Container class : Only allowed chare data classes have data.
void registrationDone(CkReductionMsg *msg)
= Make sure everyone is registered on the 1st time step
void recvAtmSfRyToGy(RhoGHartMsg *msg)
Double Transpose Fwd Recv : A(gx,y,z) on the way to A(gx,gy,z) Recv so that (y,z) parallel switched t...
void recvAtmForcFromRhoGHart(RhoRHartMsg *msg)
Hartree sends back atom forces from e-atm interation Depending on the flag, it is Ewald or e-atm inte...
void doEextFFTRyToGy_Rchare(complex *, double *, int, int, int, int)
Eext : Rchare : data(x,y,z) -> data(gx,gy,z) : Backward /////////////////////////////////////////////...
void sendAtmForcGxToRx(int iopt)