| version 1.1071 | version 1.1072 |
|---|
| |
| delete computeNonbondedWorkArrays; | delete computeNonbondedWorkArrays; |
| } | } |
| | |
| void ComputeMgr::updateComputes(int ep, CkGroupID chareID) { | void ComputeMgr::updateComputes(int ep, CkGroupID chareID) |
| | { |
| updateComputesReturnEP = ep; | updateComputesReturnEP = ep; |
| updateComputesReturnChareID = chareID; | updateComputesReturnChareID = chareID; |
| updateComputesCount = CkNumPes(); | updateComputesCount = CkNumPes(); |
| | |
| if (CkMyPe()) { | if (CkMyPe()) |
| | { |
| iout << iPE << iERRORF << "updateComputes signaled on wrong Pe!\n" << endi; | iout << iPE << iERRORF << "updateComputes signaled on wrong Pe!\n" << endi; |
| CkExit(); | CkExit(); |
| return; | return; |
| |
| #endif | #endif |
| } | } |
| | |
| void ComputeMgr::updateComputes2(CkQdMsg *msg) { | void ComputeMgr::updateComputes2(CkQdMsg *msg) |
| | { |
| delete msg; | delete msg; |
| | |
| CProxy_WorkDistrib wd(CpvAccess(BOCclass_group).workDistrib); | CProxy_WorkDistrib wd(CpvAccess(BOCclass_group).workDistrib); |
| |
| #endif | #endif |
| } | } |
| | |
| void ComputeMgr::updateComputes3() { | void ComputeMgr::updateComputes3() |
| | { |
| CProxy_ComputeMgr(thisgroup).updateLocalComputes(); | CProxy_ComputeMgr(thisgroup).updateLocalComputes(); |
| } | } |
| | |
| void ComputeMgr::updateLocalComputes() { | void ComputeMgr::updateLocalComputes() |
| | { |
| ComputeMap *computeMap = ComputeMap::Object(); | ComputeMap *computeMap = ComputeMap::Object(); |
| CProxy_ProxyMgr pm(CpvAccess(BOCclass_group).proxyMgr); | CProxy_ProxyMgr pm(CpvAccess(BOCclass_group).proxyMgr); |
| ProxyMgr *proxyMgr = pm.ckLocalBranch(); | ProxyMgr *proxyMgr = pm.ckLocalBranch(); |
| | |
| computeFlag = new int[computeMap->numComputes()]; | computeFlag = new int[computeMap->numComputes()]; |
| | |
| for (int i=0; i<computeMap->numComputes(); i++) { | for (int i=0; i<computeMap->numComputes(); i++) |
| | { |
| DebugM(3, "updateLocalComputes("<<i<<") curnode="<<computeMap->node(i) | DebugM(3, "updateLocalComputes("<<i<<") curnode="<<computeMap->node(i) |
| <<" newnode="<<computeMap->newNode(i)<<"\n"); | <<" newnode="<<computeMap->newNode(i)<<"\n"); |
| computeFlag[i] = 0; | computeFlag[i] = 0; |
| | |
| if (computeMap->newNode(i) == CkMyPe() && computeMap->node(i) != CkMyPe()) { | if (computeMap->newNode(i) == CkMyPe() && computeMap->node(i) != CkMyPe()) |
| | { |
| DebugM(4, "updateLocal - creating new computeID("<<i<<")\n"); | DebugM(4, "updateLocal - creating new computeID("<<i<<")\n"); |
| computeFlag[i] = 1; | computeFlag[i] = 1; |
| computeMap->setNode(i,computeMap->newNode(i)); | computeMap->setNode(i,computeMap->newNode(i)); |
| for (int n=0; n < computeMap->numPids(i); n++) { | for (int n=0; n < computeMap->numPids(i); n++) |
| | { |
| proxyMgr->createProxy(computeMap->pid(i,n)); | proxyMgr->createProxy(computeMap->pid(i,n)); |
| } | } |
| } | } |
| else if (computeMap->node(i) == CkMyPe() && | else if (computeMap->node(i) == CkMyPe() && |
| (computeMap->newNode(i) != -1 && computeMap->newNode(i) != CkMyPe() )) { | (computeMap->newNode(i) != -1 && computeMap->newNode(i) != CkMyPe() )) |
| | { |
| DebugM(4, "updateLocal - deleting computeID("<<i<<")\n"); | DebugM(4, "updateLocal - deleting computeID("<<i<<")\n"); |
| computeFlag[i] = -1; | computeFlag[i] = -1; |
| computeMap->setNode(i,computeMap->newNode(i)); | computeMap->setNode(i,computeMap->newNode(i)); |
| } else if (computeMap->newNode(i) != -1) { | } |
| | else if (computeMap->newNode(i) != -1) |
| | { |
| computeMap->setNode(i,computeMap->newNode(i)); | computeMap->setNode(i,computeMap->newNode(i)); |
| } | } |
| computeMap->setNewNode(i,-1); | computeMap->setNewNode(i,-1); |
| } | } |
| | |
| if (!CkMyPe()) { | if (!CkMyPe()) |
| | { |
| #if CHARM_VERSION > 050402 | #if CHARM_VERSION > 050402 |
| CkStartQD(CkIndex_ComputeMgr::updateLocalComputes2((CkQdMsg*)0), &thishandle); | CkStartQD(CkIndex_ComputeMgr::updateLocalComputes2((CkQdMsg*)0), &thishandle); |
| #else | #else |
| |
| } | } |
| | |
| void | void |
| ComputeMgr::updateLocalComputes2(CkQdMsg *msg) { | ComputeMgr::updateLocalComputes2(CkQdMsg *msg) |
| | { |
| delete msg; | delete msg; |
| CProxy_ComputeMgr(thisgroup).updateLocalComputes3(); | CProxy_ComputeMgr(thisgroup).updateLocalComputes3(); |
| } | } |
| | |
| void | void |
| ComputeMgr::updateLocalComputes3() { | ComputeMgr::updateLocalComputes3() |
| | { |
| ComputeMap *computeMap = ComputeMap::Object(); | ComputeMap *computeMap = ComputeMap::Object(); |
| CProxy_ProxyMgr pm(CpvAccess(BOCclass_group).proxyMgr); | CProxy_ProxyMgr pm(CpvAccess(BOCclass_group).proxyMgr); |
| ProxyMgr *proxyMgr = pm.ckLocalBranch(); | ProxyMgr *proxyMgr = pm.ckLocalBranch(); |
| | |
| ProxyMgr::nodecount = 0; | ProxyMgr::nodecount = 0; |
| | |
| for (int i=0; i<computeMap->numComputes(); i++) { | for (int i=0; i<computeMap->numComputes(); i++) |
| if (1 == computeFlag[i]) { | { |
| | if (1 == computeFlag[i]) |
| | { |
| DebugM(4, "updateLocalCompute3() - create computeID(" << i << ")\n"); | DebugM(4, "updateLocalCompute3() - create computeID(" << i << ")\n"); |
| createCompute(i, computeMap); | createCompute(i, computeMap); |
| } | } |
| else if (-1 == computeFlag[i]) { | else if (-1 == computeFlag[i]) |
| | { |
| // remove this compute | // remove this compute |
| DebugM(4, "updateLocalCompute3() - delete computeID(" << i << ")\n"); | DebugM(4, "updateLocalCompute3() - delete computeID(" << i << ")\n"); |
| delete computeMap->compute(i); | delete computeMap->compute(i); |
| |
| ComputeMap::Object()->checkMap(); | ComputeMap::Object()->checkMap(); |
| PatchMap::Object()->checkMap(); | PatchMap::Object()->checkMap(); |
| | |
| if (!CkMyPe()) { | if (!CkMyPe()) |
| | { |
| #if CHARM_VERSION > 050402 | #if CHARM_VERSION > 050402 |
| CkStartQD(CkIndex_ComputeMgr::updateLocalComputes4((CkQdMsg*)0), &thishandle); | CkStartQD(CkIndex_ComputeMgr::updateLocalComputes4((CkQdMsg*)0), &thishandle); |
| #else | #else |
| |
| } | } |
| | |
| void | void |
| ComputeMgr::updateLocalComputes4(CkQdMsg *msg) { | ComputeMgr::updateLocalComputes4(CkQdMsg *msg) |
| | { |
| delete msg; | delete msg; |
| CProxy_ComputeMgr(thisgroup).updateLocalComputes5(); | CProxy_ComputeMgr(thisgroup).updateLocalComputes5(); |
| } | } |
| |
| int firstphase = 1; | int firstphase = 1; |
| | |
| void | void |
| ComputeMgr::updateLocalComputes5() { | ComputeMgr::updateLocalComputes5() |
| | { |
| // we always use the centralized building of spanning tree | // we always use the centralized building of spanning tree |
| // distributed building of ST called in Node.C only | // distributed building of ST called in Node.C only |
| if(proxySendSpanning || proxyRecvSpanning) | if(proxySendSpanning || proxyRecvSpanning) |
| |
| // shift the creation of ST to the load balancer | // shift the creation of ST to the load balancer |
| | |
| #if 0 | #if 0 |
| if(proxySendSpanning || proxyRecvSpanning) { | if (proxySendSpanning || proxyRecvSpanning) |
| | { |
| if (firstphase) | if (firstphase) |
| ProxyMgr::Object()->buildProxySpanningTree2(); | ProxyMgr::Object()->buildProxySpanningTree2(); |
| else | else |
| |
| #endif | #endif |
| } | } |
| | |
| void ComputeMgr::doneUpdateLocalComputes() { | void ComputeMgr::doneUpdateLocalComputes() |
| | { |
| | |
| // if (!--updateComputesCount) { | // if (!--updateComputesCount) { |
| DebugM(4, "doneUpdateLocalComputes on Pe("<<CkMyPe()<<")\n"); | DebugM(4, "doneUpdateLocalComputes on Pe("<<CkMyPe()<<")\n"); |
| |
| } | } |
| } | } |
| | |
| | void registerUserEventsForAllComputeObjs() |
| | { |
| | #ifdef TRACE_COMPUTE_OBJECTS |
| | ComputeMap *map = ComputeMap::Object(); |
| | char user_des[50]; |
| | for (int i=0; i<map->numComputes(); i++) |
| | { |
| | memset(user_des, 0, 50); |
| | switch ( map->type(i) ) |
| | { |
| | case computeNonbondedSelfType: |
| | sprintf(user_des, "computeNonBondedSelfType_%d", i); |
| | break; |
| | case computeNonbondedPairType: |
| | sprintf(user_des, "computeNonBondedPairType_%d", i); |
| | break; |
| | case computeBondsType: |
| | sprintf(user_des, "computeBondsType_%d", i); |
| | break; |
| | case computeAnglesType: |
| | sprintf(user_des, "computeAnglesType_%d", i); |
| | break; |
| | case computeDihedralsType: |
| | sprintf(user_des, "computeDihedralsType_%d", i); |
| | break; |
| | case computeImpropersType: |
| | sprintf(user_des, "computeImpropersType_%d", i); |
| | break; |
| | case computeCrosstermsType: |
| | sprintf(user_des, "computeCrosstermsType_%d", i); |
| | break; |
| | case computeSelfBondsType: |
| | sprintf(user_des, "computeSelfBondsType_%d", i); |
| | break; |
| | case computeSelfAnglesType: |
| | sprintf(user_des, "computeSelfAnglesType_%d", i); |
| | break; |
| | case computeSelfDihedralsType: |
| | sprintf(user_des, "computeSelfDihedralsType_%d", i); |
| | break; |
| | case computeSelfImpropersType: |
| | sprintf(user_des, "computeSelfImpropersType_%d", i); |
| | break; |
| | case computeSelfCrosstermsType: |
| | sprintf(user_des, "computeSelfCrosstermsType_%d", i); |
| | break; |
| | #ifdef DPMTA |
| | case computeDPMTAType: |
| | sprintf(user_des, "computeDPMTAType_%d", i); |
| | break; |
| | #endif |
| | #ifdef DPME |
| | case computeDPMEType: |
| | sprintf(user_des, "computeDPMEType_%d", i); |
| | break; |
| | #endif |
| | case computePmeType: |
| | sprintf(user_des, "computePMEType_%d", i); |
| | break; |
| | case computeEwaldType: |
| | sprintf(user_des, "computeEwaldType_%d", i); |
| | break; |
| | case computeFullDirectType: |
| | sprintf(user_des, "computeFullDirectType_%d", i); |
| | break; |
| | case computeGlobalType: |
| | sprintf(user_des, "computeGlobalType_%d", i); |
| | break; |
| | case computeStirType: |
| | sprintf(user_des, "computeStirType_%d", i); |
| | break; |
| | case computeExtType: |
| | sprintf(user_des, "computeExtType_%d", i); |
| | break; |
| | case computeEFieldType: |
| | sprintf(user_des, "computeEFieldType_%d", i); |
| | break; |
| | /* BEGIN gf */ |
| | case computeGridForceType: |
| | sprintf(user_des, "computeGridForceType_%d", i); |
| | break; |
| | /* END gf */ |
| | case computeSphericalBCType: |
| | sprintf(user_des, "computeSphericalBCType_%d", i); |
| | break; |
| | case computeCylindricalBCType: |
| | sprintf(user_des, "computeCylindricalBCType_%d", i); |
| | break; |
| | case computeTclBCType: |
| | sprintf(user_des, "computeTclBCType_%d", i); |
| | break; |
| | case computeRestraintsType: |
| | sprintf(user_des, "computeRestraintsType_%d", i); |
| | break; |
| | case computeConsForceType: |
| | sprintf(user_des, "computeConsForceType_%d", i); |
| | break; |
| | case computeConsTorqueType: |
| | sprintf(user_des, "computeConsTorqueType_%d", i); |
| | break; |
| | default: |
| | NAMD_bug("Unknown compute type in ComputeMgr::registerUserEventForAllComputeObjs()."); |
| | break; |
| | } |
| | int user_des_len = strlen(user_des); |
| | char *user_des_cst = new char[user_des_len+1]; |
| | memcpy(user_des_cst, user_des, user_des_len); |
| | user_des_cst[user_des_len] = 0; |
| | //Since the argument in traceRegisterUserEvent is supposed |
| | //to be a const string which will not be copied inside the |
| | //function when a new user event is created, user_des_cst |
| | //has to be allocated in heap. |
| | int reEvenId = traceRegisterUserEvent(user_des_cst, TRACE_COMPOBJ_IDOFFSET+i); |
| | //printf("Register user event (%s) with id (%d)\n", user_des, reEvenId); |
| | } |
| | #else |
| | return; |
| | #endif |
| | } |
| | |
| void | void |
| ComputeMgr::createComputes(ComputeMap *map) | ComputeMgr::createComputes(ComputeMap *map) |
| |
| numNonbondedPair = 0; | numNonbondedPair = 0; |
| ComputeNonbondedUtil::select(); | ComputeNonbondedUtil::select(); |
| | |
| if ( simParams->globalForcesOn && !myNode ) { | if ( simParams->globalForcesOn && !myNode ) |
| | { |
| DebugM(4,"Mgr running on Node "<<CkMyPe()<<"\n"); | DebugM(4,"Mgr running on Node "<<CkMyPe()<<"\n"); |
| /* create a master server to allow multiple masters */ | /* create a master server to allow multiple masters */ |
| masterServerObject = new GlobalMasterServer(this, | masterServerObject = new GlobalMasterServer(this, |
| |
| | |
| void ComputeMgr:: recvComputeGlobalConfig(ComputeGlobalConfigMsg *msg) | void ComputeMgr:: recvComputeGlobalConfig(ComputeGlobalConfigMsg *msg) |
| { | { |
| if ( computeGlobalObject ) { | if ( computeGlobalObject ) |
| | { |
| computeGlobalObject->recvConfig(msg); | computeGlobalObject->recvConfig(msg); |
| } | } |
| else if ( ! (PatchMap::Object())->numHomePatches() ) delete msg; | else if ( ! (PatchMap::Object())->numHomePatches() ) delete msg; |
| |
| | |
| void ComputeMgr:: recvComputeGlobalData(ComputeGlobalDataMsg *msg) | void ComputeMgr:: recvComputeGlobalData(ComputeGlobalDataMsg *msg) |
| { | { |
| if(masterServerObject) { // make sure it has been initialized | if (masterServerObject) // make sure it has been initialized |
| | { |
| masterServerObject->recvData(msg); | masterServerObject->recvData(msg); |
| } else NAMD_die("ComputeMgr::masterServerObject is NULL!"); | } |
| | else NAMD_die("ComputeMgr::masterServerObject is NULL!"); |
| } | } |
| | |
| void ComputeMgr:: sendComputeGlobalResults(ComputeGlobalResultsMsg *msg) | void ComputeMgr:: sendComputeGlobalResults(ComputeGlobalResultsMsg *msg) |
| |
| | |
| void ComputeMgr:: recvComputeGlobalResults(ComputeGlobalResultsMsg *msg) | void ComputeMgr:: recvComputeGlobalResults(ComputeGlobalResultsMsg *msg) |
| { | { |
| if ( computeGlobalObject ) { | if ( computeGlobalObject ) |
| | { |
| computeGlobalObject->recvResults(msg); | computeGlobalObject->recvResults(msg); |
| } | } |
| else if ( ! (PatchMap::Object())->numHomePatches() ) delete msg; | else if ( ! (PatchMap::Object())->numHomePatches() ) delete msg; |
| |
| */ | */ |
| void ComputeMgr:: sendComputeEwaldData(ComputeEwaldMsg *msg) | void ComputeMgr:: sendComputeEwaldData(ComputeEwaldMsg *msg) |
| { | { |
| if (computeEwaldObject) { | if (computeEwaldObject) |
| | { |
| int node = computeEwaldObject->getMasterNode(); | int node = computeEwaldObject->getMasterNode(); |
| CProxy_ComputeMgr cm(CpvAccess(BOCclass_group).computeMgr); | CProxy_ComputeMgr cm(CpvAccess(BOCclass_group).computeMgr); |
| #if CHARM_VERSION > 050402 | #if CHARM_VERSION > 050402 |
| |
| #else | #else |
| cm.recvComputeEwaldData(msg, node); | cm.recvComputeEwaldData(msg, node); |
| #endif | #endif |
| } else if (!PatchMap::Object()->numHomePatches()) { | } |
| | else if (!PatchMap::Object()->numHomePatches()) |
| | { |
| CkPrintf("skipping message on Pe(%d)\n", CkMyPe()); | CkPrintf("skipping message on Pe(%d)\n", CkMyPe()); |
| delete msg; | delete msg; |
| } else NAMD_die("ComputeMgr::computeEwaldObject is NULL!"); | } |
| | else NAMD_die("ComputeMgr::computeEwaldObject is NULL!"); |
| } | } |
| | |
| void ComputeMgr:: recvComputeEwaldData(ComputeEwaldMsg *msg) | void ComputeMgr:: recvComputeEwaldData(ComputeEwaldMsg *msg) |
| |
| else NAMD_die("ComputeMgr::computeEwaldObject in recvData is NULL!"); | else NAMD_die("ComputeMgr::computeEwaldObject in recvData is NULL!"); |
| } | } |
| | |
| void ComputeMgr:: sendComputeEwaldResults(ComputeEwaldMsg *msg) { | void ComputeMgr:: sendComputeEwaldResults(ComputeEwaldMsg *msg) |
| | { |
| (CProxy_ComputeMgr(CpvAccess(BOCclass_group).computeMgr)).recvComputeEwaldResults(msg); | (CProxy_ComputeMgr(CpvAccess(BOCclass_group).computeMgr)).recvComputeEwaldResults(msg); |
| } | } |
| | |
| void ComputeMgr::recvComputeEwaldResults(ComputeEwaldMsg *msg) { | void ComputeMgr::recvComputeEwaldResults(ComputeEwaldMsg *msg) |
| | { |
| if (computeEwaldObject) | if (computeEwaldObject) |
| computeEwaldObject->recvResults(msg); | computeEwaldObject->recvResults(msg); |
| else if ( ! (PatchMap::Object())->numHomePatches() ) delete msg; | else if ( ! (PatchMap::Object())->numHomePatches() ) delete msg; |
| |
| | |
| void ComputeMgr:: sendComputeDPMEData(ComputeDPMEDataMsg *msg) | void ComputeMgr:: sendComputeDPMEData(ComputeDPMEDataMsg *msg) |
| { | { |
| if ( computeDPMEObject ) { | if ( computeDPMEObject ) |
| | { |
| #ifdef DPME | #ifdef DPME |
| int node = computeDPMEObject->getMasterNode(); | int node = computeDPMEObject->getMasterNode(); |
| CProxy_ComputeMgr cm(CpvAccess(BOCclass_group).computeMgr); | CProxy_ComputeMgr cm(CpvAccess(BOCclass_group).computeMgr); |
| |
| | |
| void ComputeMgr:: recvComputeDPMEData(ComputeDPMEDataMsg *msg) | void ComputeMgr:: recvComputeDPMEData(ComputeDPMEDataMsg *msg) |
| { | { |
| if ( computeDPMEObject ) { | if ( computeDPMEObject ) |
| | { |
| #ifdef DPME | #ifdef DPME |
| computeDPMEObject->recvData(msg); | computeDPMEObject->recvData(msg); |
| #endif | #endif |
| |
| | |
| void ComputeMgr:: recvComputeDPMEResults(ComputeDPMEResultsMsg *msg) | void ComputeMgr:: recvComputeDPMEResults(ComputeDPMEResultsMsg *msg) |
| { | { |
| if ( computeDPMEObject ) { | if ( computeDPMEObject ) |
| | { |
| #ifdef DPME | #ifdef DPME |
| computeDPMEObject->recvResults(msg); | computeDPMEObject->recvResults(msg); |
| #endif | #endif |
| |
| delete [] m->consForceIndexes; | delete [] m->consForceIndexes; |
| delete [] m->consForce; | delete [] m->consForce; |
| int n = msg->aid.size(); | int n = msg->aid.size(); |
| if (n > 0) { | if (n > 0) |
| | { |
| m->consForceIndexes = new int32[m->numAtoms]; | m->consForceIndexes = new int32[m->numAtoms]; |
| m->consForce = new Vector[n]; | m->consForce = new Vector[n]; |
| int i; | int i; |
| for (i=0; i<m->numAtoms; i++) m->consForceIndexes[i] = -1; | for (i=0; i<m->numAtoms; i++) m->consForceIndexes[i] = -1; |
| for (i=0; i<msg->aid.size(); i++) { | for (i=0; i<msg->aid.size(); i++) |
| | { |
| m->consForceIndexes[msg->aid[i]] = i; | m->consForceIndexes[msg->aid[i]] = i; |
| m->consForce[i] = msg->f[i]; | m->consForce[i] = msg->f[i]; |
| } | } |
| } else { | } |
| | else |
| | { |
| m->consForceIndexes = NULL; | m->consForceIndexes = NULL; |
| m->consForce = NULL; | m->consForce = NULL; |
| } | } |