lambda.C

Go to the documentation of this file.
00001 //////////////////////////////////////////////////////////////////////////////
00002 //////////////////////////////////////////////////////////////////////////////
00003 //////////////////////////////////////////////////////////////////////////////
00004 /** \file lambda.C
00005  * The Lambda object is basically used to accept the rows of the "L"
00006  * matrix, so they can be summed across the PairCalculators.  Then
00007  * the summed (reduced) form is sent back to the calculators for
00008  * application to their input (gspace) for the asymmetric backward path.
00009  *
00010  * For the dynamics (non minization) case we have an additional
00011  * multiplication of gamma= lambda*lambdaT.  And we pass both gamma and
00012  * lambdaT to the PC instead.
00013  *
00014  * To accomplish that multiply we have to stitch together lambdas
00015  * corresponding to the parts of orthoT in the Ortho object.  Dynamics
00016  * will trigger a send of lambda into ortho to overlap with the S->T
00017  * process.  So that the gamma multiply can proceed once we have T.
00018  *
00019  */
00020 //////////////////////////////////////////////////////////////////////////////
00021 
00022 #include "charm++.h"
00023 #include "../../include/debug_flags.h"
00024 #include "util.h"
00025 #include "cpaimd.h"
00026 #include "groups.h"
00027 #include "fftCacheSlab.h"
00028 #include "CP_State_Plane.h"
00029 #include "lambda.h"
00030 #include <unistd.h>
00031 #include "../../src_mathlib/mathlib.h"
00032 
00033 
00034 //////////////////////////////////////////////////////////////////////////////
00035 
00036 extern Config config;
00037 extern int nstates;
00038 extern CProxy_main                    mainProxy;
00039 extern CProxy_CPcharmParaInfoGrp scProxy;
00040 extern CProxy_CP_State_GSpacePlane gSpacePlaneProxy;
00041 extern  PairCalcID PairCalcID1;
00042 extern  PairCalcID pairCalcID2;
00043 extern CProxy_AtomsGrp atomsGrpProxy;
00044 extern CProxy_CP_Rho_RealSpacePlane rhoRealProxy;
00045 extern CProxy_CP_Rho_GSpacePlane rhoGProxy;
00046 extern CProxy_CP_Rho_GHartExt rhoGHartExtProxy;
00047 
00048 
00049 
00050 //////////////////////////////////////////////////////////////////////////////
00051 //////////////////////////////////////////////////////////////////////////////
00052 //////////////////////////////////////////////////////////////////////////////
00053 void Lambda::acceptAllLambda(CkReductionMsg *msg) {
00054     delete msg;
00055     CkAbort("do not call acceptAllLambda");
00056 }
00057 //////////////////////////////////////////////////////////////////////////////
00058 
00059 
00060 //////////////////////////////////////////////////////////////////////////////
00061 //////////////////////////////////////////////////////////////////////////////
00062 //////////////////////////////////////////////////////////////////////////////
00063 void Lambda::acceptSectionLambda(CkReductionMsg *msg) {
00064 //////////////////////////////////////////////////////////////////////////////
00065 
00066   double *lambda = (double *)msg->getData();
00067   int lambdaCount = msg->getSize()/sizeof(double);
00068 
00069   // finish pair calc
00070   finishPairCalcSection(lambdaCount, lambda, &lPairCalcID2, thisIndex.x, thisIndex.y, 0, lPairCalcID2.priority+1);
00071 #ifdef _CP_DEBUG_LAMBDA_VERBOSE_
00072   if(thisIndex.x==0 && thisIndex.y==0)
00073     CkPrintf("[%d,%d] finishing asymm\n",thisIndex.x, thisIndex.y);
00074 #endif
00075   delete msg;
00076 
00077 //----------------------------------------------------------------------------
00078 }// end routine
00079 ///////////////////////////////////////////////////////////////////////////////=
00080 
00081 
00082 //////////////////////////////////////////////////////////////////////////////
00083 //////////////////////////////////////////////////////////////////////////////
00084 //////////////////////////////////////////////////////////////////////////////
00085 void Lambda::makeSections(int indexSize, int *indexZ){
00086 
00087   int s1=thisIndex.x*lambdaGrainSize;
00088   int s2=thisIndex.y*lambdaGrainSize;
00089   if(lambdaGrainSize!=sGrainSize)
00090     {
00091       // do something clever
00092       s1=s1/sGrainSize*sGrainSize;
00093       s2=s2/sGrainSize*sGrainSize;
00094     }
00095 
00096   // thisIndex.x and thisIndex.y range from 0 to nstates/lambdaGrainSize
00097     initOneRedSect(indexSize, indexZ, config.numChunksAsym, &lPairCalcID2, CkCallback(CkIndex_Lambda::acceptSectionLambda(NULL), thisProxy(thisIndex.x, thisIndex.y)) , CkCallback(CkIndex_main::doneInit(NULL),mainProxy),s1, s2, thisIndex.x, thisIndex.y, lambdaGrainSize, false, false, config.useOrthoDirect);
00098      initOneRedSect(indexSize, indexZ, config.numChunksAsym, &lPairCalcID2, CkCallback(CkIndex_Lambda::acceptSectionLambda(NULL), thisProxy(thisIndex.x, thisIndex.y)) , CkCallback(CkIndex_main::doneInit(NULL),mainProxy),s1, s2, thisIndex.x, thisIndex.y, lambdaGrainSize, false, true, config.useOrthoDirect);
00099 
00100 
00101 //----------------------------------------------------------------------------
00102   }// end routine
00103 ///////////////////////////////////////////////////////////////////////////////=
00104 
00105 
00106 
00107 

Generated on Thu Dec 6 18:25:31 2007 for leanCP by  doxygen 1.5.3