Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

ComputeMgr Class Reference

#include <ComputeMgr.h>

Inheritance diagram for ComputeMgr:

BOCclass List of all members.

Public Member Functions

 ComputeMgr ()
 ~ComputeMgr ()
void createComputes (ComputeMap *map)
void updateComputes (int, CkGroupID)
void updateComputes2 (CkQdMsg *)
void updateComputes3 ()
void splitComputes ()
void splitComputes2 (CkQdMsg *)
void updateLocalComputes ()
void updateLocalComputes2 (CkQdMsg *)
void updateLocalComputes3 ()
void updateLocalComputes4 (CkQdMsg *)
void updateLocalComputes5 ()
void doneUpdateLocalComputes ()
void sendComputeGlobalConfig (ComputeGlobalConfigMsg *)
void recvComputeGlobalConfig (ComputeGlobalConfigMsg *)
void sendComputeGlobalData (ComputeGlobalDataMsg *)
void recvComputeGlobalData (ComputeGlobalDataMsg *)
void sendComputeGlobalResults (ComputeGlobalResultsMsg *)
void recvComputeGlobalResults (ComputeGlobalResultsMsg *)
void sendComputeDPMEData (ComputeDPMEDataMsg *)
void recvComputeDPMEData (ComputeDPMEDataMsg *)
void sendComputeDPMEResults (ComputeDPMEResultsMsg *, int)
void recvComputeDPMEResults (ComputeDPMEResultsMsg *)
void sendComputeEwaldData (ComputeEwaldMsg *)
void recvComputeEwaldData (ComputeEwaldMsg *)
void sendComputeEwaldResults (ComputeEwaldMsg *)
void recvComputeEwaldResults (ComputeEwaldMsg *)
void recvComputeConsForceMsg (ComputeConsForceMsg *)
void sendYieldDevice (int pe)
void recvYieldDevice (int pe)
void sendBuildCudaForceTable ()
void recvBuildCudaForceTable ()
void sendCreateNonbondedCUDASlave (int, int)
void recvCreateNonbondedCUDASlave (NonbondedCUDASlaveMsg *)
void sendNonbondedCUDASlaveReady (int, int, int, int)
void recvNonbondedCUDASlaveReady (int, int, int)
void sendNonbondedCUDASlaveEnqueue (ComputeNonbondedCUDA *c, int, int, int, int)

Public Attributes

ComputeGlobalcomputeGlobalObject

Constructor & Destructor Documentation

ComputeMgr::ComputeMgr  ) 
 

Definition at line 89 of file ComputeMgr.C.

References computeGlobalObject.

00090 {
00091     CkpvAccess(BOCclass_group).computeMgr = thisgroup;
00092     computeGlobalObject = 0;
00093     computeDPMEObject = 0;
00094     computeEwaldObject = 0;
00095     computeNonbondedCUDAObject = 0;
00096     computeNonbondedWorkArrays = new ComputeNonbondedWorkArrays;
00097     skipSplitting = 0;
00098 }

ComputeMgr::~ComputeMgr  ) 
 

Definition at line 100 of file ComputeMgr.C.

00101 {
00102     delete computeNonbondedWorkArrays;
00103 }


Member Function Documentation

void ComputeMgr::createComputes ComputeMap map  ) 
 

Definition at line 757 of file ComputeMgr.C.

References GlobalMasterServer::addClient(), ComputeNonbondedCUDA::assignPatches(), SimParameters::colvarsOn, ComputeMap::computeData, computeNonbondedCUDAType, computeNonbondedPairType, computeNonbondedSelfType, cuda_device_pe(), cuda_device_shared_with_pe(), DebugM, SimParameters::firstTimestep, SimParameters::freeEnergyOn, SimParameters::globalForcesOn, GlobalMasterColvars, SimParameters::IMDignore, SimParameters::IMDon, j, SimParameters::miscForcesOn, Node::molecule, Node::myid(), ComputeMap::nComputes, Molecule::numAtoms, Node::Object(), ComputeNonbondedUtil::select(), Node::simParameters, simParams, SimParameters::SMDDir, SimParameters::SMDFile, SimParameters::SMDk, SimParameters::SMDk2, SimParameters::SMDOn, SimParameters::SMDOutputFreq, SimParameters::SMDVel, SimParameters::symmetryLastStep, SimParameters::symmetryOn, SimParameters::tclForcesOn, SimParameters::TMDOn, and ComputeMap::type().

Referenced by Node::startup().

00758 {
00759     Node *node = Node::Object();
00760     SimParameters *simParams = node->simParameters;
00761     int myNode = node->myid();
00762 
00763     ComputeNonbondedUtil::select();
00764 
00765     if ( simParams->globalForcesOn && !myNode )
00766     {
00767         DebugM(4,"Mgr running on Node "<<CkMyPe()<<"\n");
00768         /* create a master server to allow multiple masters */
00769         masterServerObject = new GlobalMasterServer(this,
00770                 PatchMap::Object()->numNodesWithPatches());
00771 
00772         /* create the individual global masters */
00773         // masterServerObject->addClient(new GlobalMasterTest());
00774         if (simParams->tclForcesOn)
00775             masterServerObject->addClient(new GlobalMasterTcl());
00776         if (simParams->IMDon && ! simParams->IMDignore)
00777             masterServerObject->addClient(new GlobalMasterIMD());
00778 
00779         if (simParams->SMDOn)
00780             masterServerObject->addClient(
00781                 new GlobalMasterSMD(simParams->SMDk, simParams->SMDk2,
00782                                     simParams->SMDVel,
00783                                     simParams->SMDDir, simParams->SMDOutputFreq,
00784                                     simParams->firstTimestep, simParams->SMDFile,
00785                                     node->molecule->numAtoms)
00786             );
00787             
00788         if (simParams->symmetryOn && 
00789           (simParams->firstTimestep < simParams->symmetryLastStep || 
00790           simParams->symmetryLastStep == -1))
00791             masterServerObject->addClient(new GlobalMasterSymmetry());    
00792         if (simParams->TMDOn)
00793             masterServerObject->addClient(new GlobalMasterTMD());
00794         if (simParams->miscForcesOn)
00795             masterServerObject->addClient(new GlobalMasterMisc());
00796         if ( simParams->freeEnergyOn )
00797             masterServerObject->addClient(new GlobalMasterFreeEnergy());
00798                 if ( simParams->colvarsOn )
00799                         masterServerObject->addClient(new GlobalMasterColvars());
00800 
00801     }
00802 
00803     if ( !myNode && simParams->IMDon && simParams->IMDignore ) {
00804       // GlobalMasterIMD constructor saves pointer to node->IMDOutput object
00805       new GlobalMasterIMD();
00806     }
00807 
00808 #ifdef NAMD_CUDA
00809     bool deviceIsMine = ( cuda_device_pe() == CkMyPe() );
00810 #endif
00811 
00812     for (int i=0; i < map->nComputes; i++)
00813     {
00814         if ( ! ( i % 100 ) )
00815         {
00816         }
00817 #ifdef NAMD_CUDA
00818         switch ( map->type(i) )
00819         {
00820           case computeNonbondedSelfType:
00821           case computeNonbondedPairType:
00822             if ( ! deviceIsMine ) continue;
00823             if ( ! cuda_device_shared_with_pe(map->computeData[i].node) ) continue;
00824           break;
00825           case computeNonbondedCUDAType:
00826             if ( ! deviceIsMine ) continue;
00827           default:
00828             if ( map->computeData[i].node != myNode ) continue;
00829         }
00830 #else
00831         if ( map->computeData[i].node != myNode ) continue;
00832 #endif
00833         DebugM(1,"Compute " << i << '\n');
00834         DebugM(1,"  node = " << map->computeData[i].node << '\n');
00835         DebugM(1,"  type = " << map->computeData[i].type << '\n');
00836         DebugM(1,"  numPids = " << map->computeData[i].numPids << '\n');
00837         DebugM(1,"  numPidsAllocated = " << map->computeData[i].numPidsAllocated << '\n');
00838         for (int j=0; j < map->computeData[i].numPids; j++)
00839         {
00840             //      DebugM(1,"  pid " << map->computeData[i].pids[j] << '\n');
00841             if (!((j+1) % 6))
00842                 DebugM(1,'\n');
00843         }
00844         DebugM(1,"\n---------------------------------------");
00845         DebugM(1,"---------------------------------------\n");
00846 
00847         createCompute(i, map);
00848 
00849     }
00850 
00851 #ifdef NAMD_CUDA
00852     if ( computeNonbondedCUDAObject ) {
00853       computeNonbondedCUDAObject->assignPatches();
00854     }
00855 #endif
00856 
00857 }

void ComputeMgr::doneUpdateLocalComputes  ) 
 

Definition at line 313 of file ComputeMgr.C.

References DebugM.

00314 {
00315 
00316 //  if (!--updateComputesCount) {
00317     DebugM(4, "doneUpdateLocalComputes on Pe("<<CkMyPe()<<")\n");
00318     void *msg = CkAllocMsg(0,0,0);
00319     CkSendMsgBranch(updateComputesReturnEP,msg,0,updateComputesReturnChareID);
00320 //  }
00321 }

void ComputeMgr::recvBuildCudaForceTable  ) 
 

Definition at line 1044 of file ComputeMgr.C.

References build_cuda_force_table().

01044                                          {
01045 #ifdef NAMD_CUDA
01046     build_cuda_force_table();
01047 #endif
01048 }

void ComputeMgr::recvComputeConsForceMsg ComputeConsForceMsg  ) 
 

Definition at line 994 of file ComputeMgr.C.

References ComputeConsForceMsg::aid, Molecule::consForce, Molecule::consForceIndexes, ComputeConsForceMsg::f, int32, Node::molecule, Molecule::numAtoms, Node::Object(), and ResizeArray< Elem >::size().

00995 {
00996     Molecule *m = Node::Object()->molecule;
00997     delete [] m->consForceIndexes;
00998     delete [] m->consForce;
00999     int n = msg->aid.size();
01000     if (n > 0)
01001     {
01002         m->consForceIndexes = new int32[m->numAtoms];
01003         m->consForce = new Vector[n];
01004         int i;
01005         for (i=0; i<m->numAtoms; i++) m->consForceIndexes[i] = -1;
01006         for (i=0; i<msg->aid.size(); i++)
01007         {
01008             m->consForceIndexes[msg->aid[i]] = i;
01009             m->consForce[i] = msg->f[i];
01010         }
01011     }
01012     else
01013     {
01014         m->consForceIndexes = NULL;
01015         m->consForce = NULL;
01016     }
01017     delete msg;
01018 }

void ComputeMgr::recvComputeDPMEData ComputeDPMEDataMsg  ) 
 

Definition at line 964 of file ComputeMgr.C.

References NAMD_die(), and PatchMap::Object().

00965 {
00966     if ( computeDPMEObject )
00967     {
00968 #ifdef DPME
00969         computeDPMEObject->recvData(msg);
00970 #endif
00971     }
00972     else if ( ! (PatchMap::Object())->numHomePatches() ) delete msg;
00973     else NAMD_die("ComputeMgr::computeDPMEObject is NULL!");
00974 }

void ComputeMgr::recvComputeDPMEResults ComputeDPMEResultsMsg  ) 
 

Definition at line 982 of file ComputeMgr.C.

References NAMD_die(), and PatchMap::Object().

00983 {
00984     if ( computeDPMEObject )
00985     {
00986 #ifdef DPME
00987         computeDPMEObject->recvResults(msg);
00988 #endif
00989     }
00990     else if ( ! (PatchMap::Object())->numHomePatches() ) delete msg;
00991     else NAMD_die("ComputeMgr::computeDPMEObject is NULL!");
00992 }

void ComputeMgr::recvComputeEwaldData ComputeEwaldMsg  ) 
 

Definition at line 927 of file ComputeMgr.C.

References NAMD_die(), and ComputeEwald::recvData().

00928 {
00929     if (computeEwaldObject)
00930         computeEwaldObject->recvData(msg);
00931     else NAMD_die("ComputeMgr::computeEwaldObject in recvData is NULL!");
00932 }

void ComputeMgr::recvComputeEwaldResults ComputeEwaldMsg  ) 
 

Definition at line 939 of file ComputeMgr.C.

References NAMD_die(), PatchMap::Object(), and ComputeEwald::recvResults().

00940 {
00941     if (computeEwaldObject) {
00942         CmiEnableUrgentSend(1);
00943         computeEwaldObject->recvResults(msg);
00944         CmiEnableUrgentSend(0);
00945     }
00946     else if ( ! (PatchMap::Object())->numHomePatches() ) delete msg;
00947     else NAMD_die("ComputeMgr::computeEwaldObject in recvResults is NULL!");
00948 }

void ComputeMgr::recvComputeGlobalConfig ComputeGlobalConfigMsg *   ) 
 

void ComputeMgr::recvComputeGlobalData ComputeGlobalDataMsg  ) 
 

Definition at line 882 of file ComputeMgr.C.

References NAMD_die(), and GlobalMasterServer::recvData().

00883 {
00884     if (masterServerObject)  // make sure it has been initialized
00885     {
00886         masterServerObject->recvData(msg);
00887     }
00888     else NAMD_die("ComputeMgr::masterServerObject is NULL!");
00889 }

void ComputeMgr::recvComputeGlobalResults ComputeGlobalResultsMsg  ) 
 

Definition at line 896 of file ComputeMgr.C.

References computeGlobalObject, NAMD_die(), PatchMap::Object(), and ComputeGlobal::recvResults().

00897 {
00898     if ( computeGlobalObject )
00899     {
00900         CmiEnableUrgentSend(1);
00901         computeGlobalObject->recvResults(msg);
00902         CmiEnableUrgentSend(0);
00903     }
00904     else if ( ! (PatchMap::Object())->numHomePatches() ) delete msg;
00905     else NAMD_die("ComputeMgr::computeGlobalObject is NULL!");
00906 }

void ComputeMgr::recvCreateNonbondedCUDASlave NonbondedCUDASlaveMsg  ) 
 

Definition at line 1064 of file ComputeMgr.C.

References Compute::cid, NonbondedCUDASlaveMsg::index, and NonbondedCUDASlaveMsg::master.

01064                                                                         {
01065 #ifdef NAMD_CUDA
01066   new ComputeNonbondedCUDA(msg->master->cid,this,msg->master,msg->index);
01067 #endif
01068 }

void ComputeMgr::recvNonbondedCUDASlaveReady int  ,
int  ,
int 
 

Definition at line 1075 of file ComputeMgr.C.

References Compute::patchReady().

01075                                                                     {
01076   for ( int i=0; i<np; ++i ) {
01077     computeNonbondedCUDAObject->patchReady(-1,ac,seq);
01078   }
01079 }

void ComputeMgr::recvYieldDevice int  pe  ) 
 

Definition at line 1025 of file ComputeMgr.C.

References ComputeNonbondedCUDA::recvYieldDevice().

01025                                        {
01026 #ifdef NAMD_CUDA
01027     computeNonbondedCUDAObject->recvYieldDevice(pe);
01028 #endif
01029 }

void ComputeMgr::sendBuildCudaForceTable  ) 
 

Definition at line 1031 of file ComputeMgr.C.

Referenced by send_build_cuda_force_table().

01031                                          {
01032     CProxy_ComputeMgr cm(CkpvAccess(BOCclass_group).computeMgr);
01033     int pe = CkNodeFirst(CkMyNode());
01034     int end = pe + CkNodeSize(CkMyNode());
01035     for( ; pe != end; ++pe ) {
01036       cm[pe].recvBuildCudaForceTable();
01037     }
01038 }

void ComputeMgr::sendComputeDPMEData ComputeDPMEDataMsg  ) 
 

Definition at line 950 of file ComputeMgr.C.

References NAMD_die(), and PatchMap::Object().

00951 {
00952     if ( computeDPMEObject )
00953     {
00954 #ifdef DPME
00955         int node = computeDPMEObject->getMasterNode();
00956         CProxy_ComputeMgr cm(CkpvAccess(BOCclass_group).computeMgr);
00957         cm.recvComputeDPMEData(msg,node);
00958 #endif
00959     }
00960     else if ( ! (PatchMap::Object())->numHomePatches() ) delete msg;
00961     else NAMD_die("ComputeMgr::computeDPMEObject is NULL!");
00962 }

void ComputeMgr::sendComputeDPMEResults ComputeDPMEResultsMsg ,
int 
 

Definition at line 976 of file ComputeMgr.C.

00977 {
00978     CProxy_ComputeMgr cm(CkpvAccess(BOCclass_group).computeMgr);
00979     cm[node].recvComputeDPMEResults(msg);
00980 }

void ComputeMgr::sendComputeEwaldData ComputeEwaldMsg  ) 
 

Definition at line 911 of file ComputeMgr.C.

References ComputeEwald::getMasterNode(), NAMD_die(), PatchMap::numHomePatches(), and PatchMap::Object().

Referenced by ComputeEwald::doWork().

00912 {
00913     if (computeEwaldObject)
00914     {
00915         int node = computeEwaldObject->getMasterNode();
00916         CProxy_ComputeMgr cm(CkpvAccess(BOCclass_group).computeMgr);
00917         cm[node].recvComputeEwaldData(msg);
00918     }
00919     else if (!PatchMap::Object()->numHomePatches())
00920     {
00921         CkPrintf("skipping message on Pe(%d)\n", CkMyPe());
00922         delete msg;
00923     }
00924     else NAMD_die("ComputeMgr::computeEwaldObject is NULL!");
00925 }

void ComputeMgr::sendComputeEwaldResults ComputeEwaldMsg  ) 
 

Definition at line 934 of file ComputeMgr.C.

Referenced by ComputeEwald::recvData().

00935 {
00936     (CProxy_ComputeMgr(CkpvAccess(BOCclass_group).computeMgr)).recvComputeEwaldResults(msg);
00937 }

void ComputeMgr::sendComputeGlobalConfig ComputeGlobalConfigMsg *   ) 
 

void ComputeMgr::sendComputeGlobalData ComputeGlobalDataMsg  ) 
 

Definition at line 876 of file ComputeMgr.C.

Referenced by ComputeGlobal::doWork().

00877 {
00878     CProxy_ComputeMgr cm(CkpvAccess(BOCclass_group).computeMgr);
00879     cm[0].recvComputeGlobalData(msg);
00880 }

void ComputeMgr::sendComputeGlobalResults ComputeGlobalResultsMsg  ) 
 

Definition at line 891 of file ComputeMgr.C.

00892 {
00893     (CProxy_ComputeMgr(CkpvAccess(BOCclass_group).computeMgr)).recvComputeGlobalResults(msg);
00894 }

void ComputeMgr::sendCreateNonbondedCUDASlave int  ,
int 
 

Definition at line 1056 of file ComputeMgr.C.

References NonbondedCUDASlaveMsg::index, and NonbondedCUDASlaveMsg::master.

Referenced by ComputeNonbondedCUDA::assignPatches().

01056                                                                {
01057   NonbondedCUDASlaveMsg *msg = new NonbondedCUDASlaveMsg;
01058   msg->master = computeNonbondedCUDAObject;
01059   msg->index = index;
01060   CProxy_ComputeMgr cm(CkpvAccess(BOCclass_group).computeMgr);
01061   cm[pe].recvCreateNonbondedCUDASlave(msg);
01062 }

void ComputeMgr::sendNonbondedCUDASlaveEnqueue ComputeNonbondedCUDA c,
int  ,
int  ,
int  ,
int 
 

Definition at line 1081 of file ComputeMgr.C.

References Compute::cid, LocalWorkMsg::compute, ComputeNonbondedCUDA::localHostedPatches, Compute::localWorkMsg, ComputeNonbondedCUDA::localWorkMsg2, SET_PRIORITY, ResizeArray< Elem >::size(), and Compute::type().

Referenced by ComputeNonbondedCUDA::messageFinishWork().

01081                                                                                                          {
01082   if ( ws == 2 && c->localHostedPatches.size() == 0 ) return;
01083   LocalWorkMsg *msg = ( ws == 1 ? c->localWorkMsg : c->localWorkMsg2 );
01084   msg->compute = c;
01085   int type = c->type();
01086   int cid = c->cid;
01087   SET_PRIORITY(msg,seq,prio);
01088   CProxy_WorkDistrib wdProxy(CkpvAccess(BOCclass_group).workDistrib);
01089   wdProxy[pe].enqueueCUDA(msg);
01090 }

void ComputeMgr::sendNonbondedCUDASlaveReady int  ,
int  ,
int  ,
int 
 

Definition at line 1070 of file ComputeMgr.C.

Referenced by ComputeNonbondedCUDA::noWork().

01070                                                                             {
01071   CProxy_ComputeMgr cm(CkpvAccess(BOCclass_group).computeMgr);
01072   cm[pe].recvNonbondedCUDASlaveReady(np,ac,seq);
01073 }

void ComputeMgr::sendYieldDevice int  pe  ) 
 

Definition at line 1020 of file ComputeMgr.C.

Referenced by cuda_check_local_calc(), and cuda_check_remote_calc().

01020                                        {
01021     CProxy_ComputeMgr cm(CkpvAccess(BOCclass_group).computeMgr);
01022     cm[pe].recvYieldDevice(CkMyPe());
01023 }

void ComputeMgr::splitComputes  ) 
 

Definition at line 140 of file ComputeMgr.C.

References ComputeMap::cloneCompute(), ComputeMap::extendPtrs(), j, ComputeMap::newNode(), ComputeMap::newNumPartitions(), ComputeMap::node(), ComputeMap::numComputes(), ComputeMap::numPartitions(), ComputeMap::Object(), ComputeMap::setNewNode(), ComputeMap::setNewNumPartitions(), and ComputeMap::setNumPartitions().

00141 {
00142   if ( ! CkMyRank() ) {
00143     ComputeMap *computeMap = ComputeMap::Object();
00144     const int nc = computeMap->numComputes();
00145 
00146     for (int i=0; i<nc; i++) {
00147       int nnp = computeMap->newNumPartitions(i);
00148       if ( nnp > 0 ) {
00149         if ( computeMap->numPartitions(i) != 1 ) {
00150           CkPrintf("Warning: unable to partition compute %d\n", i);
00151           computeMap->setNewNumPartitions(i,0);
00152           continue;
00153         }
00154         //CkPrintf("splitting compute %d by %d\n",i,nnp);
00155         computeMap->setNumPartitions(i,nnp);
00156         if (computeMap->newNode(i) == -1) {
00157           computeMap->setNewNode(i,computeMap->node(i));
00158         }
00159         for ( int j=1; j<nnp; ++j ) {
00160           int newcid = computeMap->cloneCompute(i,j);
00161           //CkPrintf("compute %d partition %d is %d\n",i,j,newcid);
00162         }
00163       }
00164     }
00165     computeMap->extendPtrs();
00166   }
00167 
00168   if (!CkMyPe())
00169   {
00170     CkStartQD(CkIndex_ComputeMgr::splitComputes2((CkQdMsg*)0), &thishandle);
00171   }
00172 }

void ComputeMgr::splitComputes2 CkQdMsg *   ) 
 

Definition at line 174 of file ComputeMgr.C.

00175 {
00176     delete msg;
00177     CProxy_ComputeMgr(thisgroup).updateLocalComputes();
00178 }

void ComputeMgr::updateComputes int  ,
CkGroupID 
 

Definition at line 105 of file ComputeMgr.C.

References iERRORF, iout, and iPE().

Referenced by LdbCoordinator::ExecuteMigrations().

00106 {
00107     updateComputesReturnEP = ep;
00108     updateComputesReturnChareID = chareID;
00109     updateComputesCount = CkNumPes();
00110 
00111     if (CkMyPe())
00112     {
00113         iout << iPE << iERRORF << "updateComputes signaled on wrong Pe!\n" << endi;
00114         CkExit();
00115         return;
00116     }
00117 
00118     CkStartQD(CkIndex_ComputeMgr::updateComputes2((CkQdMsg*)0),&thishandle);
00119 }

void ComputeMgr::updateComputes2 CkQdMsg *   ) 
 

Definition at line 121 of file ComputeMgr.C.

References WorkDistrib::saveComputeMapChanges().

00122 {
00123     delete msg;
00124 
00125     CProxy_WorkDistrib wd(CkpvAccess(BOCclass_group).workDistrib);
00126     WorkDistrib  *workDistrib = wd.ckLocalBranch();
00127     workDistrib->saveComputeMapChanges(CkIndex_ComputeMgr::updateComputes3(),thisgroup);
00128 }

void ComputeMgr::updateComputes3  ) 
 

Definition at line 130 of file ComputeMgr.C.

00131 {
00132     if ( skipSplitting ) {
00133       CProxy_ComputeMgr(thisgroup).updateLocalComputes();
00134     } else {
00135       CProxy_ComputeMgr(thisgroup).splitComputes();
00136       skipSplitting = 1;
00137     }
00138 }

void ComputeMgr::updateLocalComputes  ) 
 

Definition at line 180 of file ComputeMgr.C.

References ResizeArray< Elem >::add(), ComputeMap::compute(), ProxyMgr::createProxy(), Compute::ldObjHandle, LdbCoordinator::Migrate(), ComputeMap::newNode(), ComputeMap::newNumPartitions(), ComputeMap::node(), ComputeMap::numComputes(), ComputeMap::numPids(), LdbCoordinator::Object(), ComputeMap::Object(), ComputeMap::pid(), ComputeMap::registerCompute(), and ResizeArray< Elem >::resize().

00181 {
00182     ComputeMap *computeMap = ComputeMap::Object();
00183     CProxy_ProxyMgr pm(CkpvAccess(BOCclass_group).proxyMgr);
00184     ProxyMgr *proxyMgr = pm.ckLocalBranch();
00185     LdbCoordinator *ldbCoordinator = LdbCoordinator::Object();
00186 
00187      computeFlag.resize(0);
00188 
00189     const int nc = computeMap->numComputes();
00190     for (int i=0; i<nc; i++) {
00191 
00192         if ( computeMap->node(i) == CkMyPe() &&
00193              computeMap->newNumPartitions(i) > 1 ) {
00194            Compute *c = computeMap->compute(i);
00195            ldbCoordinator->Migrate(c->ldObjHandle,CkMyPe());
00196            delete c;
00197            computeMap->registerCompute(i,NULL);
00198            if ( computeMap->newNode(i) == CkMyPe() ) computeFlag.add(i); 
00199         } else
00200         if (computeMap->newNode(i) == CkMyPe() && computeMap->node(i) != CkMyPe())
00201         {
00202             computeFlag.add(i);
00203             for (int n=0; n < computeMap->numPids(i); n++)
00204             {
00205                 proxyMgr->createProxy(computeMap->pid(i,n));
00206             }
00207         }
00208         else if (computeMap->node(i) == CkMyPe() &&
00209                  (computeMap->newNode(i) != -1 && computeMap->newNode(i) != CkMyPe() ))
00210         {
00211             // CkPrintf("delete compute %d on pe %d\n",i,CkMyPe());
00212             delete computeMap->compute(i);
00213             computeMap->registerCompute(i,NULL);
00214         }
00215     }
00216 
00217     if (!CkMyPe())
00218     {
00219         CkStartQD(CkIndex_ComputeMgr::updateLocalComputes2((CkQdMsg*)0), &thishandle);
00220     }
00221 }

void ComputeMgr::updateLocalComputes2 CkQdMsg *   ) 
 

Definition at line 224 of file ComputeMgr.C.

00225 {
00226     delete msg;
00227     CProxy_ComputeMgr(thisgroup).updateLocalComputes3();
00228 }

void ComputeMgr::updateLocalComputes3  ) 
 

Definition at line 231 of file ComputeMgr.C.

References ResizeArray< Elem >::clear(), ComputeMap::newNode(), ComputeMap::numComputes(), ComputeMap::Object(), ProxyMgr::removeUnusedProxies(), ComputeMap::setNewNode(), ComputeMap::setNewNumPartitions(), ComputeMap::setNode(), and ResizeArray< Elem >::size().

00232 {
00233     ComputeMap *computeMap = ComputeMap::Object();
00234     CProxy_ProxyMgr pm(CkpvAccess(BOCclass_group).proxyMgr);
00235     ProxyMgr *proxyMgr = pm.ckLocalBranch();
00236 
00237     ProxyMgr::nodecount = 0;
00238 
00239     const int nc = computeMap->numComputes();
00240 
00241     if ( ! CkMyRank() ) {
00242       for (int i=0; i<nc; i++) {
00243         computeMap->setNewNumPartitions(i,0);
00244         if (computeMap->newNode(i) != -1) {
00245           computeMap->setNode(i,computeMap->newNode(i));
00246           computeMap->setNewNode(i,-1);
00247         }
00248       }
00249     }
00250  
00251     for(int i=0; i<computeFlag.size(); i++) createCompute(computeFlag[i], computeMap);
00252     computeFlag.clear();
00253 
00254     proxyMgr->removeUnusedProxies();
00255 
00256     if (!CkMyPe())
00257     {
00258         CkStartQD(CkIndex_ComputeMgr::updateLocalComputes4((CkQdMsg*)0), &thishandle);
00259     }
00260 }

void ComputeMgr::updateLocalComputes4 CkQdMsg *   ) 
 

Definition at line 263 of file ComputeMgr.C.

References SimParameters::computeMapFilename, ComputeMap::Object(), Node::Object(), ComputeMap::saveComputeMap(), Node::simParameters, simParams, and SimParameters::storeComputeMap.

00264 {
00265     delete msg;
00266     CProxy_ComputeMgr(thisgroup).updateLocalComputes5();
00267 
00268     // store the latest compute map
00269            SimParameters *simParams = Node::Object()->simParameters;
00270     if (simParams->storeComputeMap) {
00271       ComputeMap *computeMap = ComputeMap::Object();
00272       computeMap->saveComputeMap(simParams->computeMapFilename);
00273     }
00274 }

void ComputeMgr::updateLocalComputes5  ) 
 

Definition at line 281 of file ComputeMgr.C.

References ProxyMgr::buildProxySpanningTree2(), PatchMap::checkMap(), ComputeMap::checkMap(), ProxyMgr::Object(), PatchMap::Object(), ComputeMap::Object(), proxySendSpanning, and ProxyMgr::sendSpanningTrees().

00282 {
00283     if ( ! CkMyRank() ) {
00284       ComputeMap::Object()->checkMap();
00285       PatchMap::Object()->checkMap();
00286     }
00287 
00288     // we always use the centralized building of spanning tree
00289     // distributed building of ST called in Node.C only
00290     if (proxySendSpanning || proxyRecvSpanning)
00291         ProxyMgr::Object()->buildProxySpanningTree2();
00292 
00293     // this code needs to be turned on if we want to
00294     // shift the creation of ST to the load balancer
00295 
00296 #if 0
00297     if (proxySendSpanning || proxyRecvSpanning)
00298     {
00299         if (firstphase)
00300             ProxyMgr::Object()->buildProxySpanningTree2();
00301         else
00302             if (CkMyPe() == 0)
00303                 ProxyMgr::Object()->sendSpanningTrees();
00304 
00305         firstphase = 0;
00306     }
00307 #endif
00308 
00309     if (!CkMyPe())
00310         CkStartQD(CkIndex_ComputeMgr::doneUpdateLocalComputes(), &thishandle);
00311 }


Member Data Documentation

ComputeGlobal* ComputeMgr::computeGlobalObject
 

Definition at line 84 of file ComputeMgr.h.

Referenced by ComputeMgr(), Sequencer::integrate(), and recvComputeGlobalResults().


The documentation for this class was generated from the following files:
Generated on Fri May 25 04:07:21 2012 for NAMD by  doxygen 1.3.9.1