NAMD
Public Member Functions | Public Attributes | List of all members
ComputeMgr Class Reference

#include <ComputeMgr.h>

Inheritance diagram for ComputeMgr:

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 enableComputeGlobalResults ()
 
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 sendBuildCudaExclusions ()
 
void recvBuildCudaExclusions ()
 
void sendBuildCudaForceTable ()
 
void recvBuildCudaForceTable ()
 
void sendBuildMICForceTable ()
 
void recvBuildMICForceTable ()
 
void sendCreateNonbondedCUDASlave (int, int)
 
void recvCreateNonbondedCUDASlave (NonbondedCUDASlaveMsg *)
 
void sendNonbondedCUDASlaveReady (int, int, int, int)
 
void recvNonbondedCUDASlaveReady (int, int, int)
 
void sendNonbondedCUDASlaveSkip (ComputeNonbondedCUDA *c, int)
 
void recvNonbondedCUDASlaveSkip (NonbondedCUDASkipMsg *)
 
void sendNonbondedCUDASlaveEnqueue (ComputeNonbondedCUDA *c, int, int, int, int)
 
void sendNonbondedCUDASlaveEnqueuePatch (ComputeNonbondedCUDA *c, int, int, int, int, FinishWorkMsg *)
 
void sendAssignPatchesOnPe (std::vector< int > &pes, CudaComputeNonbonded *c)
 
void recvAssignPatchesOnPe (CudaComputeNonbondedMsg *msg)
 
void sendSkipPatchesOnPe (std::vector< int > &pes, CudaComputeNonbonded *c)
 
void recvSkipPatchesOnPe (CudaComputeNonbondedMsg *msg)
 
void sendFinishPatchesOnPe (std::vector< int > &pes, CudaComputeNonbonded *c)
 
void recvFinishPatchesOnPe (CudaComputeNonbondedMsg *msg)
 
void sendFinishPatchOnPe (int pe, CudaComputeNonbonded *c, int i, PatchID patchID)
 
void recvFinishPatchOnPe (CudaComputeNonbondedMsg *msg)
 
void sendOpenBoxesOnPe (std::vector< int > &pes, CudaComputeNonbonded *c)
 
void recvOpenBoxesOnPe (CudaComputeNonbondedMsg *msg)
 
void sendFinishReductions (int pe, CudaComputeNonbonded *c)
 
void recvFinishReductions (CudaComputeNonbondedMsg *msg)
 
void sendMessageEnqueueWork (int pe, CudaComputeNonbonded *c)
 
void recvMessageEnqueueWork (CudaComputeNonbondedMsg *msg)
 
void sendLaunchWork (int pe, CudaComputeNonbonded *c)
 
void recvLaunchWork (CudaComputeNonbondedMsg *msg)
 
void sendUnregisterBoxesOnPe (std::vector< int > &pes, CudaComputeNonbonded *c)
 
void recvUnregisterBoxesOnPe (CudaComputeNonbondedMsg *msg)
 
void sendCreateNonbondedMICSlave (int, int)
 
void recvCreateNonbondedMICSlave (NonbondedMICSlaveMsg *)
 
void sendNonbondedMICSlaveReady (int, int, int, int)
 
void recvNonbondedMICSlaveReady (int, int, int)
 
void sendNonbondedMICSlaveSkip (ComputeNonbondedMIC *c, int)
 
void recvNonbondedMICSlaveSkip (NonbondedMICSkipMsg *)
 
void sendNonbondedMICSlaveEnqueue (ComputeNonbondedMIC *c, int, int, int, int)
 
void sendMICPEData (int, int)
 
void recvMICPEData (int, int)
 
int isMICProcessor (int)
 

Public Attributes

ComputeGlobalcomputeGlobalObject
 
ResizeArray
< ComputeGlobalResultsMsg * > 
computeGlobalResultsMsgs
 
int computeGlobalResultsMsgSeq
 
int computeGlobalResultsMsgMasterSeq
 

Detailed Description

Definition at line 57 of file ComputeMgr.h.

Constructor & Destructor Documentation

ComputeMgr::ComputeMgr ( )

Definition at line 109 of file ComputeMgr.C.

References computeGlobalObject, computeGlobalResultsMsgMasterSeq, computeGlobalResultsMsgSeq, and NAMD_die().

110 {
111  CkpvAccess(BOCclass_group).computeMgr = thisgroup;
115  computeDPMEObject = 0;
116  computeEwaldObject = 0;
117  computeNonbondedCUDAObject = 0;
118  computeNonbondedMICObject = 0;
119  computeNonbondedWorkArrays = new ComputeNonbondedWorkArrays;
120  skipSplitting = 0;
121  masterServerObject = NULL;
122 
123  #if defined(NAMD_MIC)
124  // Create the micPEData flag array (1 bit per PE) and initially set each PE as "not driving
125  // a MIC card" (unset). PEs that are driving MIC card will identify themselves during startup.
126  int numPEs = CkNumPes();
127  int numInts = ((numPEs + (sizeof(int)*8-1)) & (~(sizeof(int)*8-1))) / (sizeof(int)*8); // Round up to sizeof(int) then divide by the size of an int
128  micPEData = new int[numInts];
129  if (micPEData == NULL) { NAMD_die("Unable to allocate memory for micPEData"); }
130  memset(micPEData, 0, sizeof(int) * numInts);
131  #else
132  micPEData = NULL;
133  #endif
134 }
int computeGlobalResultsMsgSeq
Definition: ComputeMgr.h:99
int computeGlobalResultsMsgMasterSeq
Definition: ComputeMgr.h:100
void NAMD_die(const char *err_msg)
Definition: common.C:83
ComputeGlobal * computeGlobalObject
Definition: ComputeMgr.h:97
ComputeMgr::~ComputeMgr ( void  )

Definition at line 136 of file ComputeMgr.C.

137 {
138  delete computeNonbondedWorkArrays;
139  if (masterServerObject != NULL) delete masterServerObject;
140 }

Member Function Documentation

void ComputeMgr::createComputes ( ComputeMap map)

Definition at line 1009 of file ComputeMgr.C.

References GlobalMasterServer::addClient(), ComputeNonbondedMIC::assignPatches(), ComputeNonbondedCUDA::assignPatches(), CudaComputeNonbonded::assignPatches(), SimParameters::bondedCUDA, SimParameters::colvarsOn, computeAnglesType, computeBondsType, computeCrosstermsType, computeDihedralsType, computeExclsType, computeImpropersType, computeNonbondedCUDA2Type, computeNonbondedCUDAType, computeNonbondedMICType, computeNonbondedPairType, computeNonbondedSelfType, computeSelfAnglesType, computeSelfBondsType, computeSelfCrosstermsType, computeSelfDihedralsType, computeSelfExclsType, computeSelfImpropersType, DebugM, DeviceCUDA::device_shared_with_pe(), deviceCUDA, SimParameters::firstTimestep, SimParameters::freeEnergyOn, getCudaComputeNonbonded(), DeviceCUDA::getMasterPe(), SimParameters::globalForcesOn, SimParameters::IMDignore, SimParameters::IMDignoreForces, SimParameters::IMDon, CudaComputeNonbonded::initialize(), mic_device_pe(), mic_device_shared_with_pe(), SimParameters::miscForcesOn, Node::molecule, Node::myid(), Molecule::numAtoms, PatchMap::Object(), Node::Object(), Node::simParameters, SimParameters::SMDDir, SimParameters::SMDFile, SimParameters::SMDk, SimParameters::SMDk2, SimParameters::SMDOn, SimParameters::SMDOutputFreq, SimParameters::SMDVel, SimParameters::symmetryLastStep, SimParameters::symmetryOn, SimParameters::tclForcesOn, SimParameters::TMDOn, ComputeMap::type(), and SimParameters::useCUDA2.

Referenced by Node::startup().

1010 {
1011 // #ifdef NAMD_CUDA
1012 // int ComputePmeCUDACounter = 0;
1013 // #endif
1014  Node *node = Node::Object();
1016  int myNode = node->myid();
1017 
1018  if ( simParams->globalForcesOn && !myNode )
1019  {
1020  DebugM(4,"Mgr running on Node "<<CkMyPe()<<"\n");
1021  /* create a master server to allow multiple masters */
1022  masterServerObject = new GlobalMasterServer(this,
1023  PatchMap::Object()->numNodesWithPatches());
1024 
1025  /* create the individual global masters */
1026  // masterServerObject->addClient(new GlobalMasterTest());
1027  if (simParams->tclForcesOn)
1028  masterServerObject->addClient(new GlobalMasterTcl());
1029  if (simParams->IMDon && ! (simParams->IMDignore || simParams->IMDignoreForces) )
1030  masterServerObject->addClient(new GlobalMasterIMD());
1031 
1032  if (simParams->SMDOn)
1033  masterServerObject->addClient(
1034  new GlobalMasterSMD(simParams->SMDk, simParams->SMDk2,
1035  simParams->SMDVel,
1036  simParams->SMDDir, simParams->SMDOutputFreq,
1037  simParams->firstTimestep, simParams->SMDFile,
1038  node->molecule->numAtoms)
1039  );
1040 
1041  if (simParams->symmetryOn &&
1042  (simParams->firstTimestep < simParams->symmetryLastStep ||
1043  simParams->symmetryLastStep == -1))
1044  masterServerObject->addClient(new GlobalMasterSymmetry());
1045  if (simParams->TMDOn)
1046  masterServerObject->addClient(new GlobalMasterTMD());
1047  if (simParams->miscForcesOn)
1048  masterServerObject->addClient(new GlobalMasterMisc());
1049  if ( simParams->freeEnergyOn )
1050  masterServerObject->addClient(new GlobalMasterFreeEnergy());
1051  if ( simParams->colvarsOn )
1052  masterServerObject->addClient(new GlobalMasterColvars());
1053 
1054  }
1055 
1056  if ( !myNode && simParams->IMDon && (simParams->IMDignore || simParams->IMDignoreForces) ) {
1057  // GlobalMasterIMD constructor saves pointer to node->IMDOutput object
1058  new GlobalMasterIMD();
1059  }
1060 
1061 #ifdef NAMD_CUDA
1062  bool deviceIsMine = ( deviceCUDA->getMasterPe() == CkMyPe() );
1063 #ifdef BONDED_CUDA
1064  // Place bonded forces on Pe different from non-bonded forces
1065  int bondedMasterPe = deviceCUDA->getMasterPe();
1066  // for (int i=0;i < deviceCUDA->getNumPesSharingDevice();i++) {
1067  // int pe = deviceCUDA->getPesSharingDevice(i);
1068  // if (pe != deviceCUDA->getMasterPe()) {
1069  // bondedMasterPe = pe;
1070  // }
1071  // }
1072  bool deviceIsMineBonded = (CkMyPe() == bondedMasterPe);
1073 #endif
1074 #endif
1075 
1076  #ifdef NAMD_MIC
1077  bool deviceIsMine = ( mic_device_pe() == CkMyPe() );
1078  #endif
1079 
1080  for (int i=0; i < map->nComputes; i++)
1081  {
1082  if ( ! ( i % 100 ) )
1083  {
1084  }
1085 
1086 #if defined(NAMD_CUDA) || defined(NAMD_MIC)
1087  switch ( map->type(i) )
1088  {
1089 #ifdef NAMD_CUDA
1090  // case computePmeCUDAType:
1091  // // Only create single ComputePmeCUDA object per Pe
1092  // if ( map->computeData[i].node != myNode ) continue;
1093  // if (ComputePmeCUDACounter > 0) continue;
1094  // ComputePmeCUDACounter++;
1095  // break;
1097  if ( ! deviceIsMine ) continue;
1098  if ( ! deviceCUDA->device_shared_with_pe(map->computeData[i].node) ) continue;
1099  break;
1100 
1102  if ( ! deviceIsMine ) continue;
1103  if ( ! deviceCUDA->device_shared_with_pe(map->computeData[i].node) ) continue;
1104  break;
1105 
1106 #ifdef BONDED_CUDA
1107  case computeSelfBondsType:
1108  case computeBondsType:
1109  if (simParams->bondedCUDA & 1) {
1110  if ( ! deviceIsMineBonded ) continue;
1111  if ( ! deviceCUDA->device_shared_with_pe(map->computeData[i].node) ) continue;
1112  } else {
1113  if ( map->computeData[i].node != myNode ) continue;
1114  }
1115  break;
1116 
1117  case computeSelfAnglesType:
1118  case computeAnglesType:
1119  if (simParams->bondedCUDA & 2) {
1120  if ( ! deviceIsMineBonded ) continue;
1121  if ( ! deviceCUDA->device_shared_with_pe(map->computeData[i].node) ) continue;
1122  } else {
1123  if ( map->computeData[i].node != myNode ) continue;
1124  }
1125  break;
1126 
1128  case computeDihedralsType:
1129  if (simParams->bondedCUDA & 4) {
1130  if ( ! deviceIsMineBonded ) continue;
1131  if ( ! deviceCUDA->device_shared_with_pe(map->computeData[i].node) ) continue;
1132  } else {
1133  if ( map->computeData[i].node != myNode ) continue;
1134  }
1135  break;
1136 
1138  case computeImpropersType:
1139  if (simParams->bondedCUDA & 8) {
1140  if ( ! deviceIsMineBonded ) continue;
1141  if ( ! deviceCUDA->device_shared_with_pe(map->computeData[i].node) ) continue;
1142  } else {
1143  if ( map->computeData[i].node != myNode ) continue;
1144  }
1145  break;
1146 
1147  case computeSelfExclsType:
1148  case computeExclsType:
1149  if (simParams->bondedCUDA & 16) {
1150  if ( ! deviceIsMineBonded ) continue;
1151  if ( ! deviceCUDA->device_shared_with_pe(map->computeData[i].node) ) continue;
1152  } else {
1153  if ( map->computeData[i].node != myNode ) continue;
1154  }
1155  break;
1156 
1158  case computeCrosstermsType:
1159  if (simParams->bondedCUDA & 32) {
1160  if ( ! deviceIsMineBonded ) continue;
1161  if ( ! deviceCUDA->device_shared_with_pe(map->computeData[i].node) ) continue;
1162  } else {
1163  if ( map->computeData[i].node != myNode ) continue;
1164  }
1165  break;
1166 
1167  case computeBondedCUDAType:
1168  if ( ! deviceIsMineBonded ) continue;
1169  if ( map->computeData[i].node != myNode ) continue;
1170  break;
1171 #endif
1172 
1173 #endif
1174 #ifdef NAMD_MIC
1175 
1177  if (map->directToDevice(i) != 0) { // If should be directed to the device...
1178  if ( ! deviceIsMine ) continue;
1179  if ( ! mic_device_shared_with_pe(map->computeData[i].node) ) continue;
1180  } else { // ... otherwise, direct to host...
1181  if (map->computeData[i].node != myNode) { continue; }
1182  }
1183  break;
1184 
1186  if (map->directToDevice(i)) { // If should be directed to the device...
1187  if ( ! deviceIsMine ) continue;
1188  if ( ! mic_device_shared_with_pe(map->computeData[i].node) ) continue;
1189  } else { // ... otherwise, direct to host...
1190  if (map->computeData[i].node != myNode) { continue; }
1191  }
1192  break;
1193 
1194 #endif
1196 #ifdef NAMD_CUDA
1198 // #ifdef BONDED_CUDA
1199 // case computeBondedCUDAType:
1200 // #endif
1201 #endif
1203  if ( ! deviceIsMine ) continue;
1204  default:
1205  if ( map->computeData[i].node != myNode ) continue;
1206  }
1207 #else // defined(NAMD_CUDA) || defined(NAMD_MIC)
1208  if ( map->computeData[i].node != myNode ) continue;
1209 #endif
1210  DebugM(1,"Compute " << i << '\n');
1211  DebugM(1," node = " << map->computeData[i].node << '\n');
1212  DebugM(1," type = " << map->computeData[i].type << '\n');
1213  DebugM(1," numPids = " << map->computeData[i].numPids << '\n');
1214 // DebugM(1," numPidsAllocated = " << map->computeData[i].numPidsAllocated << '\n');
1215  for (int j=0; j < map->computeData[i].numPids; j++)
1216  {
1217  DebugM(1," pid " << map->computeData[i].pids[j].pid << '\n');
1218  if (!((j+1) % 6))
1219  DebugM(1,'\n');
1220  }
1221  DebugM(1,"\n---------------------------------------");
1222  DebugM(1,"---------------------------------------\n");
1223 
1224  createCompute(i, map);
1225 
1226  }
1227 
1228 #ifdef NAMD_CUDA
1229  if (simParams->useCUDA2) {
1230  if (deviceIsMine) {
1233  }
1234  } else {
1235  if ( computeNonbondedCUDAObject ) {
1236  computeNonbondedCUDAObject->assignPatches();
1237  }
1238  }
1239 #ifdef BONDED_CUDA
1240  if (simParams->bondedCUDA) {
1241  if (deviceIsMineBonded) {
1242  getComputeBondedCUDA()->initialize();
1243  }
1244  }
1245 #endif
1246 #endif
1247 #ifdef NAMD_MIC
1248  if ( computeNonbondedMICObject ) {
1249  computeNonbondedMICObject->assignPatches();
1250  }
1251 #endif
1252 
1253 }
static Node * Object()
Definition: Node.h:86
Definition: Node.h:78
CudaComputeNonbonded * getCudaComputeNonbonded()
Definition: ComputeMgr.C:360
static PatchMap * Object()
Definition: PatchMap.h:27
SimParameters * simParameters
Definition: Node.h:178
#define DebugM(x, y)
Definition: Debug.h:59
bool mic_device_shared_with_pe(int pe)
int getMasterPe()
Definition: DeviceCUDA.h:100
ComputeType type(ComputeID cid)
Definition: ComputeMap.C:120
bool device_shared_with_pe(int pe)
Definition: DeviceCUDA.C:388
int numAtoms
Definition: Molecule.h:556
char SMDFile[128]
void addClient(GlobalMaster *newClient)
int myid()
Definition: Node.h:188
#define simParams
Definition: Output.C:127
__thread DeviceCUDA * deviceCUDA
Definition: DeviceCUDA.C:18
void assignPatches(ComputeMgr *computeMgrIn)
Molecule * molecule
Definition: Node.h:176
int mic_device_pe()
colvarproxy_namd GlobalMasterColvars
void ComputeMgr::doneUpdateLocalComputes ( )

Definition at line 348 of file ComputeMgr.C.

References DebugM.

349 {
350 
351 // if (!--updateComputesCount) {
352  DebugM(4, "doneUpdateLocalComputes on Pe("<<CkMyPe()<<")\n");
353  void *msg = CkAllocMsg(0,0,0);
354  CkSendMsgBranch(updateComputesReturnEP,msg,0,updateComputesReturnChareID);
355 // }
356 }
#define DebugM(x, y)
Definition: Debug.h:59
void ComputeMgr::enableComputeGlobalResults ( )

Definition at line 1293 of file ComputeMgr.C.

References computeGlobalResultsMsgs, computeGlobalResultsMsgSeq, ResizeArray< T >::del(), recvComputeGlobalResults(), and ResizeArray< T >::size().

Referenced by ComputeGlobal::doWork().

1294 {
1296  for ( int i=0; i<computeGlobalResultsMsgs.size(); ++i ) {
1301  break;
1302  }
1303  }
1304 }
void del(int index, int num=1)
Definition: ResizeArray.h:104
int computeGlobalResultsMsgSeq
Definition: ComputeMgr.h:99
void recvComputeGlobalResults(ComputeGlobalResultsMsg *)
Definition: ComputeMgr.C:1306
ResizeArray< ComputeGlobalResultsMsg * > computeGlobalResultsMsgs
Definition: ComputeMgr.h:98
int size(void) const
Definition: ResizeArray.h:127
int ComputeMgr::isMICProcessor ( int  pe)

Definition at line 1885 of file ComputeMgr.C.

1885  {
1886  if (pe < 0 || pe >= CkNumPes() || micPEData == NULL) { return 0; }
1887  int majorIndex = pe / (sizeof(int)*8);
1888  int minorIndex = pe % (sizeof(int)*8);
1889  return ((micPEData[majorIndex] >> minorIndex) & 0x01);
1890 }
void ComputeMgr::recvAssignPatchesOnPe ( CudaComputeNonbondedMsg msg)

Definition at line 1594 of file ComputeMgr.C.

References CudaComputeNonbonded::assignPatchesOnPe(), and CudaComputeNonbondedMsg::c.

1594  {
1595  msg->c->assignPatchesOnPe();
1596  delete msg;
1597 }
CudaComputeNonbonded * c
Definition: ComputeMgr.C:1582
void ComputeMgr::recvBuildCudaExclusions ( )

Definition at line 1461 of file ComputeMgr.C.

References build_cuda_exclusions().

1461  {
1462 #ifdef NAMD_CUDA
1464 #endif
1465 }
void build_cuda_exclusions()
void ComputeMgr::recvBuildCudaForceTable ( )

Definition at line 1480 of file ComputeMgr.C.

References build_cuda_force_table().

1480  {
1481 #ifdef NAMD_CUDA
1483 #endif
1484 }
void build_cuda_force_table()
void ComputeMgr::recvBuildMICForceTable ( )

Definition at line 1499 of file ComputeMgr.C.

1499  {
1500  #ifdef NAMD_MIC
1501  build_mic_force_table();
1502  #endif
1503 }
void ComputeMgr::recvComputeConsForceMsg ( ComputeConsForceMsg msg)

Definition at line 1408 of file ComputeMgr.C.

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

1409 {
1410  Molecule *m = Node::Object()->molecule;
1411  delete [] m->consForceIndexes;
1412  delete [] m->consForce;
1413  int n = msg->aid.size();
1414  if (n > 0)
1415  {
1416  m->consForceIndexes = new int32[m->numAtoms];
1417  m->consForce = new Vector[n];
1418  int i;
1419  for (i=0; i<m->numAtoms; i++) m->consForceIndexes[i] = -1;
1420  for (i=0; i<msg->aid.size(); i++)
1421  {
1422  m->consForceIndexes[msg->aid[i]] = i;
1423  m->consForce[i] = msg->f[i];
1424  }
1425  }
1426  else
1427  {
1428  m->consForceIndexes = NULL;
1429  m->consForce = NULL;
1430  }
1431  delete msg;
1432 }
static Node * Object()
Definition: Node.h:86
short int32
Definition: dumpdcd.c:24
Definition: Vector.h:64
int numAtoms
Definition: Molecule.h:556
int32 * consForceIndexes
Definition: Molecule.h:612
Vector * consForce
Definition: Molecule.h:613
int size(void) const
Definition: ResizeArray.h:127
Molecule * molecule
Definition: Node.h:176
for(int i=0;i< n1;++i)
void ComputeMgr::recvComputeDPMEData ( ComputeDPMEDataMsg msg)

Definition at line 1378 of file ComputeMgr.C.

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

1379 {
1380  if ( computeDPMEObject )
1381  {
1382 #ifdef DPME
1383  computeDPMEObject->recvData(msg);
1384 #endif
1385  }
1386  else if ( ! (PatchMap::Object())->numHomePatches() ) delete msg;
1387  else NAMD_die("ComputeMgr::computeDPMEObject is NULL!");
1388 }
static PatchMap * Object()
Definition: PatchMap.h:27
void NAMD_die(const char *err_msg)
Definition: common.C:83
void ComputeMgr::recvComputeDPMEResults ( ComputeDPMEResultsMsg msg)

Definition at line 1396 of file ComputeMgr.C.

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

1397 {
1398  if ( computeDPMEObject )
1399  {
1400 #ifdef DPME
1401  computeDPMEObject->recvResults(msg);
1402 #endif
1403  }
1404  else if ( ! (PatchMap::Object())->numHomePatches() ) delete msg;
1405  else NAMD_die("ComputeMgr::computeDPMEObject is NULL!");
1406 }
static PatchMap * Object()
Definition: PatchMap.h:27
void NAMD_die(const char *err_msg)
Definition: common.C:83
void ComputeMgr::recvComputeEwaldData ( ComputeEwaldMsg msg)

Definition at line 1341 of file ComputeMgr.C.

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

1342 {
1343  if (computeEwaldObject)
1344  computeEwaldObject->recvData(msg);
1345  else NAMD_die("ComputeMgr::computeEwaldObject in recvData is NULL!");
1346 }
void recvData(ComputeEwaldMsg *)
Definition: ComputeEwald.C:187
void NAMD_die(const char *err_msg)
Definition: common.C:83
void ComputeMgr::recvComputeEwaldResults ( ComputeEwaldMsg msg)

Definition at line 1353 of file ComputeMgr.C.

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

Referenced by sendComputeEwaldResults().

1354 {
1355  if (computeEwaldObject) {
1356  CmiEnableUrgentSend(1);
1357  computeEwaldObject->recvResults(msg);
1358  CmiEnableUrgentSend(0);
1359  }
1360  else if ( ! (PatchMap::Object())->numHomePatches() ) delete msg;
1361  else NAMD_die("ComputeMgr::computeEwaldObject in recvResults is NULL!");
1362 }
void recvResults(ComputeEwaldMsg *)
Definition: ComputeEwald.C:204
static PatchMap * Object()
Definition: PatchMap.h:27
void NAMD_die(const char *err_msg)
Definition: common.C:83
void ComputeMgr::recvComputeGlobalConfig ( ComputeGlobalConfigMsg *  )
void ComputeMgr::recvComputeGlobalData ( ComputeGlobalDataMsg msg)

Definition at line 1278 of file ComputeMgr.C.

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

1279 {
1280  if (masterServerObject) // make sure it has been initialized
1281  {
1282  masterServerObject->recvData(msg);
1283  }
1284  else NAMD_die("ComputeMgr::masterServerObject is NULL!");
1285 }
void NAMD_die(const char *err_msg)
Definition: common.C:83
void recvData(ComputeGlobalDataMsg *)
void ComputeMgr::recvComputeGlobalResults ( ComputeGlobalResultsMsg msg)

Definition at line 1306 of file ComputeMgr.C.

References ResizeArray< T >::add(), computeGlobalObject, computeGlobalResultsMsgs, computeGlobalResultsMsgSeq, NAMD_die(), PatchMap::Object(), ComputeGlobal::recvResults(), and ComputeGlobalResultsMsg::seq.

Referenced by enableComputeGlobalResults().

1307 {
1308  if ( computeGlobalObject )
1309  {
1310  if ( msg->seq == computeGlobalResultsMsgSeq ) {
1311  CmiEnableUrgentSend(1);
1313  CmiEnableUrgentSend(0);
1314  } else {
1316  }
1317  }
1318  else if ( ! (PatchMap::Object())->numHomePatches() ) delete msg;
1319  else NAMD_die("ComputeMgr::computeGlobalObject is NULL!");
1320 }
void recvResults(ComputeGlobalResultsMsg *)
static PatchMap * Object()
Definition: PatchMap.h:27
int computeGlobalResultsMsgSeq
Definition: ComputeMgr.h:99
void NAMD_die(const char *err_msg)
Definition: common.C:83
ResizeArray< ComputeGlobalResultsMsg * > computeGlobalResultsMsgs
Definition: ComputeMgr.h:98
ComputeGlobal * computeGlobalObject
Definition: ComputeMgr.h:97
int add(const Elem &elem)
Definition: ResizeArray.h:97
void ComputeMgr::recvCreateNonbondedCUDASlave ( NonbondedCUDASlaveMsg msg)

Definition at line 1519 of file ComputeMgr.C.

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

1519  {
1520 #ifdef NAMD_CUDA
1521  new ComputeNonbondedCUDA(msg->master->cid,this,msg->master,msg->index);
1522 #endif
1523 }
ComputeNonbondedCUDA * master
Definition: ComputeMgr.C:1508
const ComputeID cid
Definition: Compute.h:43
void ComputeMgr::recvCreateNonbondedMICSlave ( NonbondedMICSlaveMsg msg)

Definition at line 1819 of file ComputeMgr.C.

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

1819  {
1820 #ifdef NAMD_MIC
1821  ComputeNonbondedMIC *c = new ComputeNonbondedMIC(msg->master->cid,this,msg->master,msg->index);
1822 #endif
1823 }
ComputeNonbondedMIC * master
Definition: ComputeMgr.C:1576
const ComputeID cid
Definition: Compute.h:43
void ComputeMgr::recvFinishPatchesOnPe ( CudaComputeNonbondedMsg msg)

Definition at line 1621 of file ComputeMgr.C.

References CudaComputeNonbondedMsg::c, and CudaComputeNonbonded::finishPatchesOnPe().

1621  {
1622  msg->c->finishPatchesOnPe();
1623  delete msg;
1624 }
CudaComputeNonbonded * c
Definition: ComputeMgr.C:1582
void ComputeMgr::recvFinishPatchOnPe ( CudaComputeNonbondedMsg msg)

Definition at line 1634 of file ComputeMgr.C.

References CudaComputeNonbondedMsg::c, CudaComputeNonbonded::finishPatchOnPe(), and CudaComputeNonbondedMsg::i.

1634  {
1635  msg->c->finishPatchOnPe(msg->i);
1636  delete msg;
1637 }
CudaComputeNonbonded * c
Definition: ComputeMgr.C:1582
void ComputeMgr::recvFinishReductions ( CudaComputeNonbondedMsg msg)

Definition at line 1659 of file ComputeMgr.C.

References CudaComputeNonbondedMsg::c, and CudaComputeNonbonded::finishReductions().

1659  {
1660  msg->c->finishReductions();
1661  delete msg;
1662 }
CudaComputeNonbonded * c
Definition: ComputeMgr.C:1582
void ComputeMgr::recvLaunchWork ( CudaComputeNonbondedMsg msg)

Definition at line 1681 of file ComputeMgr.C.

References CudaComputeNonbondedMsg::c, and CudaComputeNonbonded::launchWork().

1681  {
1682  msg->c->launchWork();
1683  delete msg;
1684 }
CudaComputeNonbonded * c
Definition: ComputeMgr.C:1582
void ComputeMgr::recvMessageEnqueueWork ( CudaComputeNonbondedMsg msg)

Definition at line 1670 of file ComputeMgr.C.

References CudaComputeNonbondedMsg::c, and CudaComputeNonbonded::messageEnqueueWork().

1670  {
1671  msg->c->messageEnqueueWork();
1672  delete msg;
1673 }
CudaComputeNonbonded * c
Definition: ComputeMgr.C:1582
void ComputeMgr::recvMICPEData ( int  pe,
int  data 
)

Definition at line 1870 of file ComputeMgr.C.

1870  {
1871  if (pe < 0 || pe >= CkNumPes() || micPEData == NULL) { return; }
1872  int majorIndex = pe / (sizeof(int)*8);
1873  int minorIndex = pe % (sizeof(int)*8);
1874  if (data != 0) {
1875  micPEData[majorIndex] |= (0x01 << minorIndex);
1876  } else {
1877  micPEData[majorIndex] &= ((~0x01) << minorIndex);
1878  }
1879 }
void ComputeMgr::recvNonbondedCUDASlaveReady ( int  np,
int  ac,
int  seq 
)

Definition at line 1530 of file ComputeMgr.C.

References Compute::patchReady().

1530  {
1531  for ( int i=0; i<np; ++i ) {
1532  computeNonbondedCUDAObject->patchReady(-1,ac,seq);
1533  }
1534 }
virtual void patchReady(PatchID, int doneMigration, int seq)
Definition: Compute.C:63
void ComputeMgr::recvNonbondedCUDASlaveSkip ( NonbondedCUDASkipMsg msg)

Definition at line 1547 of file ComputeMgr.C.

References NonbondedCUDASkipMsg::compute, and ComputeNonbondedCUDA::skip().

1547  {
1548 #ifdef NAMD_CUDA
1549  msg->compute->skip();
1550 #endif
1551  delete msg;
1552 }
ComputeNonbondedCUDA * compute
Definition: ComputeMgr.C:1538
void ComputeMgr::recvNonbondedMICSlaveReady ( int  np,
int  ac,
int  seq 
)

Definition at line 1830 of file ComputeMgr.C.

References Compute::patchReady().

1830  {
1831  for ( int i=0; i<np; ++i ) {
1832  computeNonbondedMICObject->patchReady(-1,ac,seq);
1833  }
1834 }
virtual void patchReady(PatchID, int doneMigration, int seq)
Definition: Compute.C:63
void ComputeMgr::recvNonbondedMICSlaveSkip ( NonbondedMICSkipMsg msg)

Definition at line 1847 of file ComputeMgr.C.

References NonbondedMICSkipMsg::compute, and ComputeNonbondedMIC::skip().

1847  {
1848 #ifdef NAMD_MIC
1849  msg->compute->skip();
1850 #endif
1851  delete msg;
1852 }
ComputeNonbondedMIC * compute
Definition: ComputeMgr.C:1838
void ComputeMgr::recvOpenBoxesOnPe ( CudaComputeNonbondedMsg msg)

Definition at line 1648 of file ComputeMgr.C.

References CudaComputeNonbondedMsg::c, and CudaComputeNonbonded::openBoxesOnPe().

1648  {
1649  msg->c->openBoxesOnPe();
1650  delete msg;
1651 }
CudaComputeNonbonded * c
Definition: ComputeMgr.C:1582
void ComputeMgr::recvSkipPatchesOnPe ( CudaComputeNonbondedMsg msg)

Definition at line 1607 of file ComputeMgr.C.

References CudaComputeNonbondedMsg::c, and CudaComputeNonbonded::skipPatchesOnPe().

1607  {
1608  msg->c->skipPatchesOnPe();
1609  delete msg;
1610 }
CudaComputeNonbonded * c
Definition: ComputeMgr.C:1582
void ComputeMgr::recvUnregisterBoxesOnPe ( CudaComputeNonbondedMsg msg)

Definition at line 1694 of file ComputeMgr.C.

References CudaComputeNonbondedMsg::c, and CudaComputeNonbonded::unregisterBoxesOnPe().

1694  {
1695  msg->c->unregisterBoxesOnPe();
1696  delete msg;
1697 }
CudaComputeNonbonded * c
Definition: ComputeMgr.C:1582
void ComputeMgr::recvYieldDevice ( int  pe)

Definition at line 1439 of file ComputeMgr.C.

References ComputeNonbondedMIC::recvYieldDevice(), and ComputeNonbondedCUDA::recvYieldDevice().

1439  {
1440 #ifdef NAMD_CUDA
1441  computeNonbondedCUDAObject->recvYieldDevice(pe);
1442 #endif
1443 #ifdef NAMD_MIC
1444  computeNonbondedMICObject->recvYieldDevice(pe);
1445 #endif
1446 }
void recvYieldDevice(int pe)
void ComputeMgr::sendAssignPatchesOnPe ( std::vector< int > &  pes,
CudaComputeNonbonded c 
)

Definition at line 1586 of file ComputeMgr.C.

References CudaComputeNonbondedMsg::c.

Referenced by CudaComputeNonbonded::assignPatches().

1586  {
1587  for (int i=0;i < pes.size();i++) {
1589  msg->c = c;
1590  thisProxy[pes[i]].recvAssignPatchesOnPe(msg);
1591  }
1592 }
CudaComputeNonbonded * c
Definition: ComputeMgr.C:1582
void ComputeMgr::sendBuildCudaExclusions ( )

Definition at line 1448 of file ComputeMgr.C.

Referenced by Node::resendMolecule().

1448  {
1449  CProxy_ComputeMgr cm(CkpvAccess(BOCclass_group).computeMgr);
1450  int pe = CkNodeFirst(CkMyNode());
1451  int end = pe + CkNodeSize(CkMyNode());
1452  for( ; pe != end; ++pe ) {
1453  cm[pe].recvBuildCudaExclusions();
1454  }
1455 }
static __thread ComputeMgr * computeMgr
void ComputeMgr::sendBuildCudaForceTable ( )

Definition at line 1467 of file ComputeMgr.C.

Referenced by send_build_cuda_force_table().

1467  {
1468  CProxy_ComputeMgr cm(CkpvAccess(BOCclass_group).computeMgr);
1469  int pe = CkNodeFirst(CkMyNode());
1470  int end = pe + CkNodeSize(CkMyNode());
1471  for( ; pe != end; ++pe ) {
1472  cm[pe].recvBuildCudaForceTable();
1473  }
1474 }
static __thread ComputeMgr * computeMgr
void ComputeMgr::sendBuildMICForceTable ( )

Definition at line 1486 of file ComputeMgr.C.

1486  {
1487  CProxy_ComputeMgr cm(CkpvAccess(BOCclass_group).computeMgr);
1488  int pe = CkNodeFirst(CkMyNode());
1489  int end = pe + CkNodeSize(CkMyNode());
1490  for( ; pe != end; ++pe ) {
1491  cm[pe].recvBuildMICForceTable();
1492  }
1493 }
static __thread ComputeMgr * computeMgr
void ComputeMgr::sendComputeDPMEData ( ComputeDPMEDataMsg msg)

Definition at line 1364 of file ComputeMgr.C.

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

1365 {
1366  if ( computeDPMEObject )
1367  {
1368 #ifdef DPME
1369  int node = computeDPMEObject->getMasterNode();
1370  CProxy_ComputeMgr cm(CkpvAccess(BOCclass_group).computeMgr);
1371  cm.recvComputeDPMEData(msg,node);
1372 #endif
1373  }
1374  else if ( ! (PatchMap::Object())->numHomePatches() ) delete msg;
1375  else NAMD_die("ComputeMgr::computeDPMEObject is NULL!");
1376 }
static PatchMap * Object()
Definition: PatchMap.h:27
static __thread ComputeMgr * computeMgr
void NAMD_die(const char *err_msg)
Definition: common.C:83
void ComputeMgr::sendComputeDPMEResults ( ComputeDPMEResultsMsg msg,
int  node 
)

Definition at line 1390 of file ComputeMgr.C.

1391 {
1392  CProxy_ComputeMgr cm(CkpvAccess(BOCclass_group).computeMgr);
1393  cm[node].recvComputeDPMEResults(msg);
1394 }
static __thread ComputeMgr * computeMgr
void ComputeMgr::sendComputeEwaldData ( ComputeEwaldMsg msg)

Definition at line 1325 of file ComputeMgr.C.

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

Referenced by ComputeEwald::doWork().

1326 {
1327  if (computeEwaldObject)
1328  {
1329  int node = computeEwaldObject->getMasterNode();
1330  CProxy_ComputeMgr cm(CkpvAccess(BOCclass_group).computeMgr);
1331  cm[node].recvComputeEwaldData(msg);
1332  }
1333  else if (!PatchMap::Object()->numHomePatches())
1334  {
1335  CkPrintf("skipping message on Pe(%d)\n", CkMyPe());
1336  delete msg;
1337  }
1338  else NAMD_die("ComputeMgr::computeEwaldObject is NULL!");
1339 }
static PatchMap * Object()
Definition: PatchMap.h:27
static __thread ComputeMgr * computeMgr
void NAMD_die(const char *err_msg)
Definition: common.C:83
int getMasterNode() const
Definition: ComputeEwald.h:86
void ComputeMgr::sendComputeEwaldResults ( ComputeEwaldMsg msg)

Definition at line 1348 of file ComputeMgr.C.

References recvComputeEwaldResults().

Referenced by ComputeEwald::recvData().

1349 {
1350  (CProxy_ComputeMgr(CkpvAccess(BOCclass_group).computeMgr)).recvComputeEwaldResults(msg);
1351 }
static __thread ComputeMgr * computeMgr
void recvComputeEwaldResults(ComputeEwaldMsg *)
Definition: ComputeMgr.C:1353
void ComputeMgr::sendComputeGlobalConfig ( ComputeGlobalConfigMsg *  )
void ComputeMgr::sendComputeGlobalData ( ComputeGlobalDataMsg msg)

Definition at line 1272 of file ComputeMgr.C.

Referenced by ComputeGlobal::doWork().

1273 {
1274  CProxy_ComputeMgr cm(CkpvAccess(BOCclass_group).computeMgr);
1275  cm[0].recvComputeGlobalData(msg);
1276 }
static __thread ComputeMgr * computeMgr
void ComputeMgr::sendComputeGlobalResults ( ComputeGlobalResultsMsg msg)

Definition at line 1287 of file ComputeMgr.C.

References computeGlobalResultsMsgMasterSeq, and ComputeGlobalResultsMsg::seq.

1288 {
1290  thisProxy.recvComputeGlobalResults(msg);
1291 }
int computeGlobalResultsMsgMasterSeq
Definition: ComputeMgr.h:100
void ComputeMgr::sendCreateNonbondedCUDASlave ( int  pe,
int  index 
)

Definition at line 1511 of file ComputeMgr.C.

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

Referenced by ComputeNonbondedCUDA::assignPatches().

1511  {
1513  msg->master = computeNonbondedCUDAObject;
1514  msg->index = index;
1515  CProxy_ComputeMgr cm(CkpvAccess(BOCclass_group).computeMgr);
1516  cm[pe].recvCreateNonbondedCUDASlave(msg);
1517 }
static __thread ComputeMgr * computeMgr
ComputeNonbondedCUDA * master
Definition: ComputeMgr.C:1508
void ComputeMgr::sendCreateNonbondedMICSlave ( int  pe,
int  index 
)

Definition at line 1811 of file ComputeMgr.C.

References NonbondedMICSlaveMsg::index, and NonbondedMICSlaveMsg::master.

1811  {
1813  msg->master = computeNonbondedMICObject;
1814  msg->index = index;
1815  CProxy_ComputeMgr cm(CkpvAccess(BOCclass_group).computeMgr);
1816  cm[pe].recvCreateNonbondedMICSlave(msg);
1817 }
ComputeNonbondedMIC * master
Definition: ComputeMgr.C:1576
static __thread ComputeMgr * computeMgr
void ComputeMgr::sendFinishPatchesOnPe ( std::vector< int > &  pes,
CudaComputeNonbonded c 
)

Definition at line 1612 of file ComputeMgr.C.

References CudaComputeNonbondedMsg::c, COMPUTE_PROXY_PRIORITY, PRIORITY_SIZE, Compute::sequence(), and SET_PRIORITY.

1612  {
1613  for (int i=0;i < pes.size();i++) {
1616  msg->c = c;
1617  thisProxy[pes[i]].recvFinishPatchesOnPe(msg);
1618  }
1619 }
#define COMPUTE_PROXY_PRIORITY
Definition: Priorities.h:71
int sequence(void)
Definition: Compute.h:64
CudaComputeNonbonded * c
Definition: ComputeMgr.C:1582
#define PRIORITY_SIZE
Definition: Priorities.h:13
#define SET_PRIORITY(MSG, SEQ, PRIO)
Definition: Priorities.h:18
void ComputeMgr::sendFinishPatchOnPe ( int  pe,
CudaComputeNonbonded c,
int  i,
PatchID  patchID 
)

Definition at line 1626 of file ComputeMgr.C.

References CudaComputeNonbondedMsg::c, COMPUTE_PROXY_PRIORITY, CudaComputeNonbondedMsg::i, PATCH_PRIORITY, PRIORITY_SIZE, Compute::sequence(), and SET_PRIORITY.

1626  {
1629  msg->c = c;
1630  msg->i = i;
1631  thisProxy[pe].recvFinishPatchOnPe(msg);
1632 }
#define COMPUTE_PROXY_PRIORITY
Definition: Priorities.h:71
int sequence(void)
Definition: Compute.h:64
CudaComputeNonbonded * c
Definition: ComputeMgr.C:1582
#define PRIORITY_SIZE
Definition: Priorities.h:13
#define SET_PRIORITY(MSG, SEQ, PRIO)
Definition: Priorities.h:18
#define PATCH_PRIORITY(PID)
Definition: Priorities.h:25
void ComputeMgr::sendFinishReductions ( int  pe,
CudaComputeNonbonded c 
)

Definition at line 1653 of file ComputeMgr.C.

References CudaComputeNonbondedMsg::c.

Referenced by CudaComputeNonbonded::skipPatchesOnPe().

1653  {
1655  msg->c = c;
1656  thisProxy[pe].recvFinishReductions(msg);
1657 }
CudaComputeNonbonded * c
Definition: ComputeMgr.C:1582
void ComputeMgr::sendLaunchWork ( int  pe,
CudaComputeNonbonded c 
)

Definition at line 1675 of file ComputeMgr.C.

References CudaComputeNonbondedMsg::c.

Referenced by CudaComputeNonbonded::openBoxesOnPe().

1675  {
1677  msg->c = c;
1678  thisProxy[pe].recvLaunchWork(msg);
1679 }
CudaComputeNonbonded * c
Definition: ComputeMgr.C:1582
void ComputeMgr::sendMessageEnqueueWork ( int  pe,
CudaComputeNonbonded c 
)

Definition at line 1664 of file ComputeMgr.C.

References CudaComputeNonbondedMsg::c.

Referenced by CudaComputeNonbonded::noWork().

1664  {
1666  msg->c = c;
1667  thisProxy[pe].recvMessageEnqueueWork(msg);
1668 }
CudaComputeNonbonded * c
Definition: ComputeMgr.C:1582
void ComputeMgr::sendMICPEData ( int  pe,
int  data 
)

Definition at line 1865 of file ComputeMgr.C.

1865  {
1866  CProxy_ComputeMgr cm(CkpvAccess(BOCclass_group).computeMgr);
1867  cm.recvMICPEData(pe, data);
1868 }
static __thread ComputeMgr * computeMgr
void ComputeMgr::sendNonbondedCUDASlaveEnqueue ( ComputeNonbondedCUDA c,
int  pe,
int  seq,
int  prio,
int  ws 
)

Definition at line 1554 of file ComputeMgr.C.

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

Referenced by ComputeNonbondedCUDA::finishWork().

1554  {
1555  if ( ws == 2 && c->localHostedPatches.size() == 0 ) return;
1556  LocalWorkMsg *msg = ( ws == 1 ? c->localWorkMsg : c->localWorkMsg2 );
1557  msg->compute = c;
1558  int type = c->type();
1559  int cid = c->cid;
1560  SET_PRIORITY(msg,seq,prio);
1561  CProxy_WorkDistrib wdProxy(CkpvAccess(BOCclass_group).workDistrib);
1562  wdProxy[pe].enqueueCUDA(msg);
1563 }
LocalWorkMsg *const localWorkMsg
Definition: Compute.h:46
Compute * compute
Definition: WorkDistrib.h:27
LocalWorkMsg * localWorkMsg2
ResizeArray< int > localHostedPatches
int type()
Definition: Compute.h:48
int size(void) const
Definition: ResizeArray.h:127
#define SET_PRIORITY(MSG, SEQ, PRIO)
Definition: Priorities.h:18
const ComputeID cid
Definition: Compute.h:43
void ComputeMgr::sendNonbondedCUDASlaveEnqueuePatch ( ComputeNonbondedCUDA c,
int  pe,
int  seq,
int  prio,
int  data,
FinishWorkMsg msg 
)

Definition at line 1565 of file ComputeMgr.C.

References FinishWorkMsg::compute, FinishWorkMsg::data, and SET_PRIORITY.

Referenced by ComputeNonbondedCUDA::messageFinishPatch().

1565  {
1566  msg->compute = c;
1567  msg->data = data;
1568  SET_PRIORITY(msg,seq,prio);
1569  CProxy_WorkDistrib wdProxy(CkpvAccess(BOCclass_group).workDistrib);
1570  wdProxy[pe].finishCUDAPatch(msg);
1571 }
Compute * compute
Definition: WorkDistrib.h:33
#define SET_PRIORITY(MSG, SEQ, PRIO)
Definition: Priorities.h:18
void ComputeMgr::sendNonbondedCUDASlaveReady ( int  pe,
int  np,
int  ac,
int  seq 
)

Definition at line 1525 of file ComputeMgr.C.

Referenced by ComputeNonbondedCUDA::noWork().

1525  {
1526  CProxy_ComputeMgr cm(CkpvAccess(BOCclass_group).computeMgr);
1527  cm[pe].recvNonbondedCUDASlaveReady(np,ac,seq);
1528 }
static __thread ComputeMgr * computeMgr
void ComputeMgr::sendNonbondedCUDASlaveSkip ( ComputeNonbondedCUDA c,
int  pe 
)

Definition at line 1541 of file ComputeMgr.C.

References NonbondedCUDASkipMsg::compute.

Referenced by ComputeNonbondedCUDA::noWork().

1541  {
1543  msg->compute = c;
1544  thisProxy[pe].recvNonbondedCUDASlaveSkip(msg);
1545 }
ComputeNonbondedCUDA * compute
Definition: ComputeMgr.C:1538
void ComputeMgr::sendNonbondedMICSlaveEnqueue ( ComputeNonbondedMIC c,
int  pe,
int  seq,
int  prio,
int  ws 
)

Definition at line 1854 of file ComputeMgr.C.

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

1854  {
1855  if ( ws == 2 && c->localHostedPatches.size() == 0 ) return;
1856  LocalWorkMsg *msg = ( ws == 1 ? c->localWorkMsg : c->localWorkMsg2 );
1857  msg->compute = c;
1858  int type = c->type();
1859  int cid = c->cid;
1860  SET_PRIORITY(msg,seq,prio);
1861  CProxy_WorkDistrib wdProxy(CkpvAccess(BOCclass_group).workDistrib);
1862  wdProxy[pe].enqueueMIC(msg);
1863 }
LocalWorkMsg * localWorkMsg2
LocalWorkMsg *const localWorkMsg
Definition: Compute.h:46
Compute * compute
Definition: WorkDistrib.h:27
int type()
Definition: Compute.h:48
int size(void) const
Definition: ResizeArray.h:127
#define SET_PRIORITY(MSG, SEQ, PRIO)
Definition: Priorities.h:18
const ComputeID cid
Definition: Compute.h:43
ResizeArray< int > localHostedPatches
void ComputeMgr::sendNonbondedMICSlaveReady ( int  pe,
int  np,
int  ac,
int  seq 
)

Definition at line 1825 of file ComputeMgr.C.

1825  {
1826  CProxy_ComputeMgr cm(CkpvAccess(BOCclass_group).computeMgr);
1827  cm[pe].recvNonbondedMICSlaveReady(np,ac,seq);
1828 }
static __thread ComputeMgr * computeMgr
void ComputeMgr::sendNonbondedMICSlaveSkip ( ComputeNonbondedMIC c,
int  pe 
)

Definition at line 1841 of file ComputeMgr.C.

References NonbondedMICSkipMsg::compute.

1841  {
1843  msg->compute = c;
1844  thisProxy[pe].recvNonbondedMICSlaveSkip(msg);
1845 }
ComputeNonbondedMIC * compute
Definition: ComputeMgr.C:1838
void ComputeMgr::sendOpenBoxesOnPe ( std::vector< int > &  pes,
CudaComputeNonbonded c 
)

Definition at line 1639 of file ComputeMgr.C.

References CudaComputeNonbondedMsg::c, PRIORITY_SIZE, PROXY_DATA_PRIORITY, Compute::sequence(), and SET_PRIORITY.

Referenced by CudaComputeNonbonded::doWork().

1639  {
1640  for (int i=0;i < pes.size();i++) {
1642  SET_PRIORITY(msg, c->sequence(), PROXY_DATA_PRIORITY+1); // after bonded
1643  msg->c = c;
1644  thisProxy[pes[i]].recvOpenBoxesOnPe(msg);
1645  }
1646 }
int sequence(void)
Definition: Compute.h:64
#define PROXY_DATA_PRIORITY
Definition: Priorities.h:40
CudaComputeNonbonded * c
Definition: ComputeMgr.C:1582
#define PRIORITY_SIZE
Definition: Priorities.h:13
#define SET_PRIORITY(MSG, SEQ, PRIO)
Definition: Priorities.h:18
void ComputeMgr::sendSkipPatchesOnPe ( std::vector< int > &  pes,
CudaComputeNonbonded c 
)

Definition at line 1599 of file ComputeMgr.C.

References CudaComputeNonbondedMsg::c.

1599  {
1600  for (int i=0;i < pes.size();i++) {
1602  msg->c = c;
1603  thisProxy[pes[i]].recvSkipPatchesOnPe(msg);
1604  }
1605 }
CudaComputeNonbonded * c
Definition: ComputeMgr.C:1582
void ComputeMgr::sendUnregisterBoxesOnPe ( std::vector< int > &  pes,
CudaComputeNonbonded c 
)

Definition at line 1686 of file ComputeMgr.C.

References CudaComputeNonbondedMsg::c.

Referenced by CudaComputeNonbonded::~CudaComputeNonbonded().

1686  {
1687  for (int i=0;i < pes.size();i++) {
1689  msg->c = c;
1690  thisProxy[pes[i]].recvUnregisterBoxesOnPe(msg);
1691  }
1692 }
CudaComputeNonbonded * c
Definition: ComputeMgr.C:1582
void ComputeMgr::sendYieldDevice ( int  pe)

Definition at line 1434 of file ComputeMgr.C.

Referenced by cuda_check_local_calc(), and cuda_check_remote_calc().

1434  {
1435  CProxy_ComputeMgr cm(CkpvAccess(BOCclass_group).computeMgr);
1436  cm[pe].recvYieldDevice(CkMyPe());
1437 }
static __thread ComputeMgr * computeMgr
void ComputeMgr::splitComputes ( )

Definition at line 175 of file ComputeMgr.C.

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

176 {
177  if ( ! CkMyRank() ) {
178  ComputeMap *computeMap = ComputeMap::Object();
179  const int nc = computeMap->numComputes();
180 
181  for (int i=0; i<nc; i++) {
182  int nnp = computeMap->newNumPartitions(i);
183  if ( nnp > 0 ) {
184  if ( computeMap->numPartitions(i) != 1 ) {
185  CkPrintf("Warning: unable to partition compute %d\n", i);
186  computeMap->setNewNumPartitions(i,0);
187  continue;
188  }
189  //CkPrintf("splitting compute %d by %d\n",i,nnp);
190  computeMap->setNumPartitions(i,nnp);
191  if (computeMap->newNode(i) == -1) {
192  computeMap->setNewNode(i,computeMap->node(i));
193  }
194  for ( int j=1; j<nnp; ++j ) {
195  int newcid = computeMap->cloneCompute(i,j);
196  //CkPrintf("compute %d partition %d is %d\n",i,j,newcid);
197  }
198  }
199  }
200  computeMap->extendPtrs();
201  }
202 
203  if (!CkMyPe())
204  {
205  CkStartQD(CkIndex_ComputeMgr::splitComputes2((CkQdMsg*)0), &thishandle);
206  }
207 }
void setNewNumPartitions(ComputeID cid, char numPartitions)
Definition: ComputeMap.h:144
int numComputes(void)
Definition: ComputeMap.h:101
void setNumPartitions(ComputeID cid, char numPartitions)
Definition: ComputeMap.h:138
char newNumPartitions(ComputeID cid)
Definition: ComputeMap.h:141
int numPartitions(ComputeID cid)
Definition: ComputeMap.C:135
void setNewNode(ComputeID cid, NodeID node)
Definition: ComputeMap.h:120
void extendPtrs()
Definition: ComputeMap.C:89
ComputeID cloneCompute(ComputeID src, int partition)
Definition: ComputeMap.C:185
static ComputeMap * Object()
Definition: ComputeMap.h:89
int node(ComputeID cid)
Definition: ComputeMap.h:106
NodeID newNode(ComputeID cid)
Definition: ComputeMap.h:116
void ComputeMgr::splitComputes2 ( CkQdMsg *  msg)

Definition at line 209 of file ComputeMgr.C.

210 {
211  delete msg;
212  CProxy_ComputeMgr(thisgroup).updateLocalComputes();
213 }
void ComputeMgr::updateComputes ( int  ep,
CkGroupID  chareID 
)

Definition at line 142 of file ComputeMgr.C.

References NAMD_bug().

Referenced by LdbCoordinator::ExecuteMigrations().

143 {
144  updateComputesReturnEP = ep;
145  updateComputesReturnChareID = chareID;
146  updateComputesCount = CkNumPes();
147 
148  if (CkMyPe())
149  {
150  NAMD_bug("updateComputes signaled on wrong Pe!");
151  }
152 
153  CkStartQD(CkIndex_ComputeMgr::updateComputes2((CkQdMsg*)0),&thishandle);
154 }
void NAMD_bug(const char *err_msg)
Definition: common.C:123
void ComputeMgr::updateComputes2 ( CkQdMsg *  msg)

Definition at line 156 of file ComputeMgr.C.

References WorkDistrib::saveComputeMapChanges().

157 {
158  delete msg;
159 
160  CProxy_WorkDistrib wd(CkpvAccess(BOCclass_group).workDistrib);
161  WorkDistrib *workDistrib = wd.ckLocalBranch();
162  workDistrib->saveComputeMapChanges(CkIndex_ComputeMgr::updateComputes3(),thisgroup);
163 }
void saveComputeMapChanges(int, CkGroupID)
Definition: WorkDistrib.C:352
void ComputeMgr::updateComputes3 ( )

Definition at line 165 of file ComputeMgr.C.

166 {
167  if ( skipSplitting ) {
168  CProxy_ComputeMgr(thisgroup).updateLocalComputes();
169  } else {
170  CProxy_ComputeMgr(thisgroup).splitComputes();
171  skipSplitting = 1;
172  }
173 }
void ComputeMgr::updateLocalComputes ( )

Definition at line 215 of file ComputeMgr.C.

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

216 {
217  ComputeMap *computeMap = ComputeMap::Object();
218  CProxy_ProxyMgr pm(CkpvAccess(BOCclass_group).proxyMgr);
219  ProxyMgr *proxyMgr = pm.ckLocalBranch();
220  LdbCoordinator *ldbCoordinator = LdbCoordinator::Object();
221 
222  computeFlag.resize(0);
223 
224  const int nc = computeMap->numComputes();
225  for (int i=0; i<nc; i++) {
226 
227  if ( computeMap->node(i) == CkMyPe() &&
228  computeMap->newNumPartitions(i) > 1 ) {
229  Compute *c = computeMap->compute(i);
230  ldbCoordinator->Migrate(c->ldObjHandle,CkMyPe());
231  delete c;
232  computeMap->registerCompute(i,NULL);
233  if ( computeMap->newNode(i) == CkMyPe() ) computeFlag.add(i);
234  } else
235  if (computeMap->newNode(i) == CkMyPe() && computeMap->node(i) != CkMyPe())
236  {
237  computeFlag.add(i);
238  for (int n=0; n < computeMap->numPids(i); n++)
239  {
240  proxyMgr->createProxy(computeMap->pid(i,n));
241  }
242  }
243  else if (computeMap->node(i) == CkMyPe() &&
244  (computeMap->newNode(i) != -1 && computeMap->newNode(i) != CkMyPe() ))
245  {
246  // CkPrintf("delete compute %d on pe %d\n",i,CkMyPe());
247  delete computeMap->compute(i);
248  computeMap->registerCompute(i,NULL);
249  }
250  }
251 
252  if (!CkMyPe())
253  {
254  CkStartQD(CkIndex_ComputeMgr::updateLocalComputes2((CkQdMsg*)0), &thishandle);
255  }
256 }
int numComputes(void)
Definition: ComputeMap.h:101
void registerCompute(ComputeID cid, Compute *c)
Definition: ComputeMap.h:95
void Migrate(LDObjHandle handle, int dest)
LDObjHandle ldObjHandle
Definition: Compute.h:44
char newNumPartitions(ComputeID cid)
Definition: ComputeMap.h:141
void createProxy(PatchID pid)
Definition: ProxyMgr.C:493
static LdbCoordinator * Object()
int add(const Elem &elem)
Definition: ResizeArray.h:97
void resize(int i)
Definition: ResizeArray.h:84
Compute * compute(ComputeID cid)
Definition: ComputeMap.h:171
static ComputeMap * Object()
Definition: ComputeMap.h:89
int node(ComputeID cid)
Definition: ComputeMap.h:106
int numPids(ComputeID cid)
Definition: ComputeMap.C:103
int pid(ComputeID cid, int i)
Definition: ComputeMap.C:109
NodeID newNode(ComputeID cid)
Definition: ComputeMap.h:116
void ComputeMgr::updateLocalComputes2 ( CkQdMsg *  msg)

Definition at line 259 of file ComputeMgr.C.

260 {
261  delete msg;
262  CProxy_ComputeMgr(thisgroup).updateLocalComputes3();
263 }
void ComputeMgr::updateLocalComputes3 ( )

Definition at line 266 of file ComputeMgr.C.

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

267 {
268  ComputeMap *computeMap = ComputeMap::Object();
269  CProxy_ProxyMgr pm(CkpvAccess(BOCclass_group).proxyMgr);
270  ProxyMgr *proxyMgr = pm.ckLocalBranch();
271 
273 
274  const int nc = computeMap->numComputes();
275 
276  if ( ! CkMyRank() ) {
277  for (int i=0; i<nc; i++) {
278  computeMap->setNewNumPartitions(i,0);
279  if (computeMap->newNode(i) != -1) {
280  computeMap->setNode(i,computeMap->newNode(i));
281  computeMap->setNewNode(i,-1);
282  }
283  }
284  }
285 
286  for(int i=0; i<computeFlag.size(); i++) createCompute(computeFlag[i], computeMap);
287  computeFlag.clear();
288 
289  proxyMgr->removeUnusedProxies();
290 
291  if (!CkMyPe())
292  {
293  CkStartQD(CkIndex_ComputeMgr::updateLocalComputes4((CkQdMsg*)0), &thishandle);
294  }
295 }
void setNewNumPartitions(ComputeID cid, char numPartitions)
Definition: ComputeMap.h:144
int numComputes(void)
Definition: ComputeMap.h:101
void setNode(ComputeID cid, NodeID node)
Definition: ComputeMap.h:110
void removeUnusedProxies(void)
Definition: ProxyMgr.C:399
void clear()
Definition: ResizeArray.h:87
void setNewNode(ComputeID cid, NodeID node)
Definition: ComputeMap.h:120
static ComputeMap * Object()
Definition: ComputeMap.h:89
static int nodecount
Definition: ProxyMgr.h:398
int size(void) const
Definition: ResizeArray.h:127
NodeID newNode(ComputeID cid)
Definition: ComputeMap.h:116
void ComputeMgr::updateLocalComputes4 ( CkQdMsg *  msg)

Definition at line 298 of file ComputeMgr.C.

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

299 {
300  delete msg;
301  CProxy_ComputeMgr(thisgroup).updateLocalComputes5();
302 
303  // store the latest compute map
305  if (simParams->storeComputeMap) {
306  ComputeMap *computeMap = ComputeMap::Object();
307  computeMap->saveComputeMap(simParams->computeMapFilename);
308  }
309 }
static Node * Object()
Definition: Node.h:86
void saveComputeMap(const char *fname)
Definition: ComputeMap.C:262
char computeMapFilename[128]
SimParameters * simParameters
Definition: Node.h:178
#define simParams
Definition: Output.C:127
static ComputeMap * Object()
Definition: ComputeMap.h:89
void ComputeMgr::updateLocalComputes5 ( )

Definition at line 316 of file ComputeMgr.C.

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

317 {
318  if ( ! CkMyRank() ) {
321  }
322 
323  // we always use the centralized building of spanning tree
324  // distributed building of ST called in Node.C only
327 
328  // this code needs to be turned on if we want to
329  // shift the creation of ST to the load balancer
330 
331 #if 0
333  {
334  if (firstphase)
336  else
337  if (CkMyPe() == 0)
339 
340  firstphase = 0;
341  }
342 #endif
343 
344  if (!CkMyPe())
345  CkStartQD(CkIndex_ComputeMgr::doneUpdateLocalComputes(), &thishandle);
346 }
void checkMap()
Definition: ComputeMap.C:48
int proxyRecvSpanning
Definition: ProxyMgr.C:46
static ProxyMgr * Object()
Definition: ProxyMgr.h:394
static PatchMap * Object()
Definition: PatchMap.h:27
void buildProxySpanningTree2()
Definition: ProxyMgr.C:577
void checkMap()
Definition: PatchMap.C:274
static ComputeMap * Object()
Definition: ComputeMap.h:89
void sendSpanningTrees()
Definition: ProxyMgr.C:1107
int proxySendSpanning
Definition: ProxyMgr.C:45

Member Data Documentation

ComputeGlobal* ComputeMgr::computeGlobalObject
int ComputeMgr::computeGlobalResultsMsgMasterSeq

Definition at line 100 of file ComputeMgr.h.

Referenced by ComputeMgr(), and sendComputeGlobalResults().

ResizeArray<ComputeGlobalResultsMsg*> ComputeMgr::computeGlobalResultsMsgs

Definition at line 98 of file ComputeMgr.h.

Referenced by enableComputeGlobalResults(), and recvComputeGlobalResults().

int ComputeMgr::computeGlobalResultsMsgSeq

Definition at line 99 of file ComputeMgr.h.

Referenced by ComputeMgr(), enableComputeGlobalResults(), and recvComputeGlobalResults().


The documentation for this class was generated from the following files: