NAMD
Classes | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
WorkDistrib Class Reference

#include <WorkDistrib.h>

Inheritance diagram for WorkDistrib:

Classes

struct  pe_sortop_compact
 
struct  pe_sortop_diffuse
 

Public Member Functions

 WorkDistrib ()
 
 ~WorkDistrib (void)
 
void enqueueWork (LocalWorkMsg *msg)
 
void enqueueExcls (LocalWorkMsg *msg)
 
void enqueueBonds (LocalWorkMsg *msg)
 
void enqueueAngles (LocalWorkMsg *msg)
 
void enqueueDihedrals (LocalWorkMsg *msg)
 
void enqueueImpropers (LocalWorkMsg *msg)
 
void enqueueThole (LocalWorkMsg *msg)
 
void enqueueAniso (LocalWorkMsg *msg)
 
void enqueueCrossterms (LocalWorkMsg *msg)
 
void enqueueGromacsPair (LocalWorkMsg *msg)
 
void enqueuePme (LocalWorkMsg *msg)
 
void enqueueSelfA1 (LocalWorkMsg *msg)
 
void enqueueSelfA2 (LocalWorkMsg *msg)
 
void enqueueSelfA3 (LocalWorkMsg *msg)
 
void enqueueSelfB1 (LocalWorkMsg *msg)
 
void enqueueSelfB2 (LocalWorkMsg *msg)
 
void enqueueSelfB3 (LocalWorkMsg *msg)
 
void enqueueWorkA1 (LocalWorkMsg *msg)
 
void enqueueWorkA2 (LocalWorkMsg *msg)
 
void enqueueWorkA3 (LocalWorkMsg *msg)
 
void enqueueWorkB1 (LocalWorkMsg *msg)
 
void enqueueWorkB2 (LocalWorkMsg *msg)
 
void enqueueWorkB3 (LocalWorkMsg *msg)
 
void enqueueWorkC (LocalWorkMsg *msg)
 
void enqueueCUDA (LocalWorkMsg *msg)
 
void enqueueCUDAP2 (LocalWorkMsg *msg)
 
void enqueueCUDAP3 (LocalWorkMsg *msg)
 
void finishCUDAPatch (FinishWorkMsg *msg)
 
void finishCUDA (LocalWorkMsg *msg)
 
void finishCUDAP2 (LocalWorkMsg *msg)
 
void finishCUDAP3 (LocalWorkMsg *msg)
 
void enqueueMIC (LocalWorkMsg *msg)
 
void finishMIC (LocalWorkMsg *msg)
 
void enqueueLCPO (LocalWorkMsg *msg)
 
void mapComputes (void)
 
void sendPatchMap (void)
 
void sendComputeMap (void)
 
void saveComputeMapChanges (int, CkGroupID)
 
void recvComputeMapChanges (ComputeMapChangeMsg *)
 
void doneSaveComputeMap (CkReductionMsg *)
 
FullAtomListcreateAtomLists (const char *basename=0)
 
void createHomePatches (void)
 
void distributeHomePatches (void)
 
void reinitAtoms (const char *basename=0)
 
void patchMapInit (void)
 
void assignNodeToPatch (void)
 
void savePatchMap (PatchMapMsg *msg)
 
void setPatchMapArrived (bool s)
 
void initHostDeviceLDB ()
 
void contributeHostDeviceLDB (int peSetLen, int *peSet)
 
void setDeviceLDBParams (int dt, int hs, int sp1, int pp1, int pp2)
 

Static Public Member Functions

static void messageEnqueueWork (Compute *)
 
static void messageFinishCUDA (Compute *)
 
static void messageFinishMIC (Compute *)
 
static void sortPmePes (int *pmepes, int xdim, int ydim)
 
static void peOrderingReady ()
 
static void send_initHostDeviceLDB ()
 
static void send_contributeHostDeviceLDB (int peSetLen, int *peSet)
 
static void send_setDeviceLDBParams (int dt, int hs, int sp1, int pp1, int pp2)
 
static void buildNodeAwarePeOrdering (void)
 

Static Public Attributes

static int peOrderingInit
 
static int * peDiffuseOrdering
 
static int * peDiffuseOrderingIndex
 
static int * peCompactOrdering
 
static int * peCompactOrderingIndex
 

Detailed Description

Definition at line 42 of file WorkDistrib.h.

Constructor & Destructor Documentation

WorkDistrib::WorkDistrib ( )

Definition at line 101 of file WorkDistrib.C.

References eventMachineProgress, and NAMD_bug().

102 {
103  CkpvAccess(BOCclass_group).workDistrib = thisgroup;
104  patchMapArrived = false;
105  computeMapArrived = false;
106 
107 #if CMK_SMP
108 #define MACHINE_PROGRESS
109 #else
110 #define MACHINE_PROGRESS { traceUserEvent(eventMachineProgress); CmiMachineProgressImpl(); }
111  if ( CkMyNodeSize() > 1 ) NAMD_bug("CkMyNodeSize() > 1 for non-smp build");
112  eventMachineProgress = traceRegisterUserEvent("CmiMachineProgressImpl",233);
113 #endif
114 }
void NAMD_bug(const char *err_msg)
Definition: common.C:123
static int eventMachineProgress
Definition: WorkDistrib.C:96
WorkDistrib::~WorkDistrib ( void  )

Definition at line 117 of file WorkDistrib.C.

118 { }

Member Function Documentation

void WorkDistrib::assignNodeToPatch ( void  )

Definition at line 1319 of file WorkDistrib.C.

References endi(), Patch::getNumAtoms(), iINFO(), iout, Node::molecule, NAMD_die(), PatchMap::node(), Molecule::numAtoms, Node::numNodes(), PatchMap::numPatches(), PatchMap::Object(), Node::Object(), PatchMap::patch(), Node::simParameters, SimParameters::simulatedPEs, and SimParameters::simulateInitialMapping.

Referenced by Node::startup().

1320 {
1321  PatchMap *patchMap = PatchMap::Object();
1322  int nNodes = Node::Object()->numNodes();
1323  SimParameters *simparam = Node::Object()->simParameters;
1324  if(simparam->simulateInitialMapping) {
1325  nNodes = simparam->simulatedPEs;
1326  }
1327 
1328 #if (CMK_BLUEGENEP | CMK_BLUEGENEL) && USE_TOPOMAP
1329  TopoManager tmgr;
1330  int numPes = tmgr.getDimNX() * tmgr.getDimNY() * tmgr.getDimNZ();
1331  if (numPes > patchMap->numPatches() && (assignPatchesTopoGridRecBisection() > 0)) {
1332  CkPrintf ("Blue Gene/L topology partitioner finished successfully \n");
1333  }
1334  else
1335 #endif
1336  assignPatchesSpaceFillingCurve();
1337 
1338  int *nAtoms = new int[nNodes];
1339  int numAtoms=0;
1340  int i;
1341  for(i=0; i < nNodes; i++)
1342  nAtoms[i] = 0;
1343 
1344  for(i=0; i < patchMap->numPatches(); i++)
1345  {
1346  // iout << iINFO << "Patch " << i << " has "
1347  // << patchMap->patch(i)->getNumAtoms() << " atoms and "
1348  // << patchMap->patch(i)->getNumAtoms() *
1349  // patchMap->patch(i)->getNumAtoms()
1350  // << " pairs.\n" << endi;
1351 #ifdef MEM_OPT_VERSION
1352  numAtoms += patchMap->numAtoms(i);
1353  nAtoms[patchMap->node(i)] += patchMap->numAtoms(i);
1354 #else
1355  if (patchMap->patch(i)) {
1356  numAtoms += patchMap->patch(i)->getNumAtoms();
1357  nAtoms[patchMap->node(i)] += patchMap->patch(i)->getNumAtoms();
1358  }
1359 #endif
1360  }
1361 
1362  if ( numAtoms != Node::Object()->molecule->numAtoms ) {
1363  for(i=0; i < nNodes; i++)
1364  iout << iINFO << nAtoms[i] << " atoms assigned to node " << i << "\n" << endi;
1365  iout << iINFO << "Assigned " << numAtoms << " atoms but expected " << Node::Object()->molecule->numAtoms << "\n" << endi;
1366  NAMD_die("Incorrect atom count in WorkDistrib::assignNodeToPatch\n");
1367  }
1368 
1369  delete [] nAtoms;
1370 
1371  // PatchMap::Object()->printPatchMap();
1372 }
static Node * Object()
Definition: Node.h:86
std::ostream & iINFO(std::ostream &s)
Definition: InfoStream.C:107
Bool simulateInitialMapping
static PatchMap * Object()
Definition: PatchMap.h:27
SimParameters * simParameters
Definition: Node.h:178
#define iout
Definition: InfoStream.h:87
Patch * patch(PatchID pid)
Definition: PatchMap.h:235
int numNodes()
Definition: Node.h:189
int numAtoms
Definition: Molecule.h:556
void NAMD_die(const char *err_msg)
Definition: common.C:83
int numPatches(void) const
Definition: PatchMap.h:59
int node(int pid) const
Definition: PatchMap.h:114
int getNumAtoms()
Definition: Patch.h:105
infostream & endi(infostream &s)
Definition: InfoStream.C:38
Molecule * molecule
Definition: Node.h:176
void WorkDistrib::buildNodeAwarePeOrdering ( void  )
static

Definition at line 176 of file WorkDistrib.C.

References ResizeArray< T >::begin(), endi(), iout, iWARN(), peCompactOrdering, peCompactOrderingIndex, peDiffuseOrdering, peDiffuseOrderingIndex, peOrderingInit, peOrderingReady(), randtopo, Random::reorder(), and sort.

Referenced by build_ordering().

176  {
177 
178  CmiMemLock();
179  if ( ! peOrderingInit ) {
180  //CkPrintf("WorkDistrib::buildNodeAwarePeOrdering on pe %d\n", CkMyPe());
181 
182  const int numPhys = CmiNumPhysicalNodes();
183  const int numNode = CmiNumNodes();
184  const int numPe = CmiNumPes();
185  ResizeArray<int> numNodeInPhys(numPhys);
186  ResizeArray<int> rankInPhysOfNode(numNode);
187 
188  peDiffuseOrdering = new int[numPe];
189  peDiffuseOrderingIndex = new int[numPe];
190  peCompactOrdering = new int[numPe];
191  peCompactOrderingIndex = new int[numPe];
192 
193  int k = 0;
194  for ( int ph=0; ph<numPhys; ++ph ) {
195  int *pes, npes;
196  CmiGetPesOnPhysicalNode(ph, &pes, &npes);
197  for ( int i=0; i<npes; ++i, ++k ) {
198  peCompactOrdering[k] = pes[i];
199  }
200  numNodeInPhys[ph] = 0;
201  for ( int i=0, j=0; i<npes; i += CmiNodeSize(CmiNodeOf(pes[i])), ++j ) {
202  rankInPhysOfNode[CmiNodeOf(pes[i])] = j;
203  numNodeInPhys[ph] += 1;
204  }
205  }
206 
207  if ( randtopo && numPhys > 2 ) {
208  if ( ! CkMyNode() ) {
209  iout << iWARN << "RANDOMIZING PHYSICAL NODE ORDERING\n" << endi;
210  }
211  ResizeArray<int> randPhysOrder(numPhys);
212  for ( int j=0; j<numPhys; ++j ) {
213  randPhysOrder[j] = j;
214  }
215  Random(314159265).reorder(randPhysOrder.begin()+2, numPhys-2);
216  for ( int j=0, k=0; j<numPhys; ++j ) {
217  const int ph = randPhysOrder[j];
218  int *pes, npes;
219  CmiGetPesOnPhysicalNode(ph, &pes, &npes);
220  for ( int i=0; i<npes; ++i, ++k ) {
221  peCompactOrdering[k] = pes[i];
222  }
223  }
224  }
225 
226  for ( int i=0; i<numPe; ++i ) {
227  peDiffuseOrdering[i] = i;
228  }
230  pe_sortop_bit_reversed(rankInPhysOfNode.begin()));
231 
232  for ( int i=0; i<numPe; ++i ) {
235  }
236 
237  if ( 0 && CmiMyNode() == 0 ) for ( int i=0; i<numPe; ++i ) {
238  CkPrintf("order %5d %5d %5d %5d %5d\n", i,
243  }
244 
245  peOrderingInit = 1;
246  }
247  CmiMemUnlock();
248  peOrderingReady();
249 
250 }
static int * peCompactOrdering
Definition: WorkDistrib.h:117
static void peOrderingReady()
Definition: WorkDistrib.C:166
std::ostream & iWARN(std::ostream &s)
Definition: InfoStream.C:108
#define iout
Definition: InfoStream.h:87
void reorder(Elem *a, int n)
Definition: Random.h:220
Definition: Random.h:37
static int * peDiffuseOrderingIndex
Definition: WorkDistrib.h:116
static int * peDiffuseOrdering
Definition: WorkDistrib.h:115
static int peOrderingInit
Definition: WorkDistrib.h:114
static int * peCompactOrderingIndex
Definition: WorkDistrib.h:118
BlockRadixSort::TempStorage sort
static int randtopo
Definition: WorkDistrib.C:84
infostream & endi(infostream &s)
Definition: InfoStream.C:38
void WorkDistrib::contributeHostDeviceLDB ( int  peSetLen,
int *  peSet 
)

Definition at line 3397 of file WorkDistrib.C.

3397  {
3398  #if defined(NAMD_MIC)
3399  mic_contributeHostDeviceLDB(peSetLen, peSet);
3400  #endif
3401 }
FullAtomList * WorkDistrib::createAtomLists ( const char *  basename = 0)

Definition at line 618 of file WorkDistrib.C.

References ResizeArray< T >::add(), SimParameters::alchOn, Lattice::apply_transform(), PatchMap::assignToPatch(), Molecule::atomcharge(), CompAtomExt::atomFixed, HydrogenGroupID::atomID, Molecule::atommass(), atoms, HydrogenGroupID::atomsInGroup, HydrogenGroupID::atomsInMigrationGroup, Molecule::atomvdwtype(), ResizeArray< T >::begin(), SimParameters::binaryOutput, CompAtom::charge, SimParameters::comMove, Node::configList, StringList::data, endi(), FALSE, ConfigList::find(), FullAtom::fixedPosition, PDB::get_all_positions(), Molecule::get_fep_type(), Molecule::getAtoms(), PatchMap::gridsize_a(), PatchMap::gridsize_b(), PatchMap::gridsize_c(), CompAtomExt::groupFixed, Molecule::hydrogenGroup, CompAtom::hydrogenGroupSize, CompAtomExt::id, PatchMap::index_a(), PatchMap::index_b(), PatchMap::index_c(), SimParameters::initialTemp, iout, Molecule::is_atom_fixed(), HydrogenGroupID::isGP, HydrogenGroupID::isMP, Molecule::langevin_param(), FullAtom::langevinParam, SimParameters::lattice, SimParameters::lesOn, FullAtom::mass, PatchMap::max_a(), PatchMap::max_b(), PatchMap::max_c(), FullAtom::migrationGroupSize, PatchMap::min_a(), PatchMap::min_b(), PatchMap::min_c(), Node::molecule, NAMD_bug(), NAMD_die(), Lattice::nearest(), CompAtom::nonbondedGroupSize, PDB::num_atoms(), PatchMap::numPatches(), numPatches, PatchMap::Object(), order, SimParameters::outputPatchDetails, SimParameters::pairInteractionOn, CompAtom::partition, Node::pdb, CompAtom::position, SimParameters::pressureProfileAtomTypes, read_binary_file(), FullAtom::recipMass, Molecule::rigid_bond_length(), RIGID_NONE, FullAtom::rigidBondLength, SimParameters::rigidBonds, Node::simParameters, ResizeArray< T >::size(), sortAtomsForPatches(), SimParameters::staticAtomAssignment, atom_constants::status, FullAtom::status, FullAtom::transform, TRUE, CompAtom::vdwType, and FullAtom::velocity.

Referenced by createHomePatches(), and reinitAtoms().

619 {
620  int i;
621  StringList *current; // Pointer used to retrieve configuration items
622  CProxy_Node nd(CkpvAccess(BOCclass_group).node);
623  Node *node = nd.ckLocalBranch();
624  PatchMap *patchMap = PatchMap::Object();
625  CProxy_PatchMgr pm(CkpvAccess(BOCclass_group).patchMgr);
626  PatchMgr *patchMgr = pm.ckLocalBranch();
627  SimParameters *params = node->simParameters;
628  Molecule *molecule = node->molecule;
629  PDB *pdb = node->pdb;
630 
631  int numPatches = patchMap->numPatches();
632  int numAtoms = pdb->num_atoms();
633 
634  Vector *positions = new Position[numAtoms];
635  Vector *velocities = new Velocity[numAtoms];
636 
637  if ( basename ) {
638  if ( params->binaryOutput ) {
639  read_binary_file((std::string(basename)+".coor").c_str(), positions, numAtoms);
640  read_binary_file((std::string(basename)+".vel").c_str(), velocities, numAtoms);
641  } else {
642  PDB coorpdb((std::string(basename)+".coor").c_str());
643  if ( coorpdb.num_atoms() != numAtoms ) {
644  NAMD_die("Incorrect atom count in coordinate pdb file");
645  }
646  coorpdb.get_all_positions(positions);
647  velocities_from_PDB((std::string(basename)+".vel").c_str(), velocities, numAtoms);
648  }
649  } else {
650  pdb->get_all_positions(positions);
651 
652  if ( params->initialTemp < 0.0 ) {
653  Bool binvels=FALSE;
654 
655  // Reading the veolcities from a PDB
656  current = node->configList->find("velocities");
657 
658  if (current == NULL) {
659  current = node->configList->find("binvelocities");
660  binvels = TRUE;
661  }
662 
663  if (!binvels) {
664  velocities_from_PDB(current->data, velocities, numAtoms);
665  }
666  else {
667  velocities_from_binfile(current->data, velocities, numAtoms);
668  }
669  }
670  else {
671  // Random velocities for a given temperature
672  random_velocities(params->initialTemp, molecule, velocities, numAtoms);
673  }
674  }
675 
676  // If COMMotion == no, remove center of mass motion
677  if (!(params->comMove)) {
678  remove_com_motion(velocities, molecule, numAtoms);
679  }
680 
682 
683  const Lattice lattice = params->lattice;
684 
685  if ( params->staticAtomAssignment ) {
686  FullAtomList sortAtoms;
687  for ( i=0; i < numAtoms; i++ ) {
688  HydrogenGroupID &h = molecule->hydrogenGroup[i];
689  if ( ! h.isMP ) continue;
690  FullAtom a;
691  a.id = i;
693  a.position = positions[h.atomID];
694  sortAtoms.add(a);
695  }
696  int *order = new int[sortAtoms.size()];
697  for ( i=0; i < sortAtoms.size(); i++ ) {
698  order[i] = i;
699  }
700  int *breaks = new int[numPatches];
701  sortAtomsForPatches(order,breaks,sortAtoms.begin(),
702  sortAtoms.size(),numAtoms,
703  patchMap->gridsize_c(),
704  patchMap->gridsize_b(),
705  patchMap->gridsize_a());
706 
707  i = 0;
708  for ( int pid = 0; pid < numPatches; ++pid ) {
709  int iend = breaks[pid];
710  for ( ; i<iend; ++i ) {
711  FullAtom &sa = sortAtoms[order[i]];
712  int mgs = sa.migrationGroupSize;
713 /*
714 CkPrintf("patch %d (%d %d %d) has group %d atom %d size %d at %.2f %.2f %.2f\n",
715  pid, patchMap->index_a(pid), patchMap->index_b(pid),
716  patchMap->index_c(pid), order[i], sa.id, mgs,
717  sa.position.x, sa.position.y, sa.position.z);
718 */
719  for ( int k=0; k<mgs; ++k ) {
720  HydrogenGroupID &h = molecule->hydrogenGroup[sa.id + k];
721  int aid = h.atomID;
722  FullAtom a;
723  a.id = aid;
724  a.position = positions[aid];
725  a.velocity = velocities[aid];
726  a.vdwType = molecule->atomvdwtype(aid);
727  a.status = molecule->getAtoms()[aid].status;
728  a.langevinParam = molecule->langevin_param(aid);
729  a.hydrogenGroupSize = h.isGP ? h.atomsInGroup : 0;
731  if(params->rigidBonds != RIGID_NONE) {
732  a.rigidBondLength = molecule->rigid_bond_length(aid);
733  }else{
734  a.rigidBondLength = 0.0;
735  }
736  atoms[pid].add(a);
737  }
738  }
739 CkPrintf("patch %d (%d %d %d) has %d atoms\n",
740  pid, patchMap->index_a(pid), patchMap->index_b(pid),
741  patchMap->index_c(pid), atoms[pid].size());
742  }
743  delete [] order;
744  delete [] breaks;
745  } else
746  {
747  // split atoms into patches based on migration group and position
748  int aid, pid=0;
749  for(i=0; i < numAtoms; i++)
750  {
751  // Assign atoms to patches without splitting hydrogen groups.
752  // We know that the hydrogenGroup array is sorted with group parents
753  // listed first. Thus, only change the pid if an atom is a group parent.
754  HydrogenGroupID &h = molecule->hydrogenGroup[i];
755  aid = h.atomID;
756  FullAtom a;
757  a.id = aid;
758  a.position = positions[aid];
759  a.velocity = velocities[aid];
760  a.vdwType = molecule->atomvdwtype(aid);
761  a.status = molecule->getAtoms()[aid].status;
762  a.langevinParam = molecule->langevin_param(aid);
763  a.hydrogenGroupSize = h.isGP ? h.atomsInGroup : 0;
765  if(params->rigidBonds != RIGID_NONE) {
766  a.rigidBondLength = molecule->rigid_bond_length(aid);
767  }else{
768  a.rigidBondLength = 0.0;
769  }
770  if (h.isMP) {
771  pid = patchMap->assignToPatch(positions[aid],lattice);
772  } // else: don't change pid
773  atoms[pid].add(a);
774  }
775  }
776 
777  delete [] positions;
778  delete [] velocities;
779 
780  for(i=0; i < numPatches; i++)
781  {
782  ScaledPosition center(0.5*(patchMap->min_a(i)+patchMap->max_a(i)),
783  0.5*(patchMap->min_b(i)+patchMap->max_b(i)),
784  0.5*(patchMap->min_c(i)+patchMap->max_c(i)));
785 
786  int n = atoms[i].size();
787  FullAtom *a = atoms[i].begin();
788  int j;
789 //Modifications for alchemical fep
790  Bool alchOn = params->alchOn;
791 //fepe
792  Bool lesOn = params->lesOn;
793 
794  Bool pairInteractionOn = params->pairInteractionOn;
795 
796  Bool pressureProfileTypes = (params->pressureProfileAtomTypes > 1);
797 
798  Transform mother_transform;
799  for(j=0; j < n; j++)
800  {
801  int aid = a[j].id;
802 
803  a[j].nonbondedGroupSize = 0; // must be set based on coordinates
804 
805  a[j].atomFixed = molecule->is_atom_fixed(aid) ? 1 : 0;
806  a[j].fixedPosition = a[j].position;
807 
808  if ( a[j].migrationGroupSize ) {
809  if ( a[j].migrationGroupSize != a[j].hydrogenGroupSize ) {
810  Position pos = a[j].position;
811  int mgs = a[j].migrationGroupSize;
812  int c = 1;
813  for ( int k=a[j].hydrogenGroupSize; k<mgs;
814  k+=a[j+k].hydrogenGroupSize ) {
815  pos += a[j+k].position;
816  ++c;
817  }
818  pos *= 1./c;
819  mother_transform = a[j].transform; // should be 0,0,0
820  pos = lattice.nearest(pos,center,&mother_transform);
821  a[j].position = lattice.apply_transform(a[j].position,mother_transform);
822  a[j].transform = mother_transform;
823  } else {
824  a[j].position = lattice.nearest(
825  a[j].position, center, &(a[j].transform));
826  mother_transform = a[j].transform;
827  }
828  } else {
829  a[j].position = lattice.apply_transform(a[j].position,mother_transform);
830  a[j].transform = mother_transform;
831  }
832 
833  a[j].mass = molecule->atommass(aid);
834  // Using double precision division for reciprocal mass.
835  a[j].recipMass = ( a[j].mass > 0 ? (1. / a[j].mass) : 0 );
836  a[j].charge = molecule->atomcharge(aid);
837 
838 //Modifications for alchemical fep
839  if ( alchOn || lesOn || pairInteractionOn || pressureProfileTypes) {
840  a[j].partition = molecule->get_fep_type(aid);
841  }
842  else {
843  a[j].partition = 0;
844  }
845 //fepe
846 
847  }
848 
849  int size, allfixed, k;
850  for(j=0; j < n; j+=size) {
851  size = a[j].hydrogenGroupSize;
852  if ( ! size ) {
853  NAMD_bug("Mother atom with hydrogenGroupSize of 0!");
854  }
855  allfixed = 1;
856  for ( k = 0; k < size; ++k ) {
857  allfixed = ( allfixed && (a[j+k].atomFixed) );
858  }
859  for ( k = 0; k < size; ++k ) {
860  a[j+k].groupFixed = allfixed ? 1 : 0;
861  }
862  }
863 
864  if ( params->outputPatchDetails ) {
865  int patchId = i;
866  int numAtomsInPatch = n;
867  int numFixedAtomsInPatch = 0;
868  int numAtomsInFixedGroupsInPatch = 0;
869  for(j=0; j < n; j++) {
870  numFixedAtomsInPatch += ( a[j].atomFixed ? 1 : 0 );
871  numAtomsInFixedGroupsInPatch += ( a[j].groupFixed ? 1 : 0 );
872  }
873  iout << "PATCH_DETAILS:"
874  << " patch " << patchId
875  << " atoms " << numAtomsInPatch
876  << " fixed_atoms " << numFixedAtomsInPatch
877  << " fixed_groups " << numAtomsInFixedGroupsInPatch
878  << "\n" << endi;
879  }
880  }
881 
882  return atoms;
883 
884 }
unsigned char partition
Definition: NamdTypes.h:56
Real langevinParam
Definition: NamdTypes.h:110
Real langevin_param(int atomnum) const
Definition: Molecule.h:1296
Definition: PDB.h:35
PatchID assignToPatch(Position p, const Lattice &l)
Definition: PatchMap.inl:14
unsigned int hydrogenGroupSize
Definition: NamdTypes.h:58
Definition: Node.h:78
unsigned int atomFixed
Definition: NamdTypes.h:96
Position fixedPosition
Definition: NamdTypes.h:102
int gridsize_c(void) const
Definition: PatchMap.h:66
static PatchMap * Object()
Definition: PatchMap.h:27
BigReal max_c(int pid) const
Definition: PatchMap.h:96
__global__ void const int const TileList *__restrict__ TileExcl *__restrict__ const int *__restrict__ const int const float2 *__restrict__ const int *__restrict__ const float3 const float3 const float3 const float4 *__restrict__ const float cudaTextureObject_t cudaTextureObject_t cudaTextureObject_t const int const float const PatchPairRecord *__restrict__ const int *__restrict__ const int2 *__restrict__ const unsigned int *__restrict__ unsigned int *__restrict__ int *__restrict__ int *__restrict__ TileListStat *__restrict__ const BoundingBox *__restrict__ float4 *__restrict__ float4 *__restrict__ float *__restrict__ float *__restrict__ float *__restrict__ float *__restrict__ float *__restrict__ float *__restrict__ float *__restrict__ float *__restrict__ const int numPatches
Definition: Vector.h:64
BigReal min_a(int pid) const
Definition: PatchMap.h:91
SimParameters * simParameters
Definition: Node.h:178
int index_a(int pid) const
Definition: PatchMap.h:86
static __thread atom * atoms
Atom * getAtoms() const
Definition: Molecule.h:490
#define FALSE
Definition: common.h:116
Real rigid_bond_length(int atomnum) const
Definition: Molecule.h:1453
Position position
Definition: NamdTypes.h:53
#define iout
Definition: InfoStream.h:87
Velocity velocity
Definition: NamdTypes.h:101
int num_atoms(void)
Definition: PDB.C:323
Position nearest(Position data, ScaledPosition ref) const
Definition: Lattice.h:90
unsigned int groupFixed
Definition: NamdTypes.h:97
Bool pairInteractionOn
BigReal min_b(int pid) const
Definition: PatchMap.h:93
int atomsInGroup
Definition: Hydrogen.h:19
Charge charge
Definition: NamdTypes.h:54
HydrogenGroup hydrogenGroup
Definition: Molecule.h:639
void read_binary_file(const char *fname, Vector *data, int n)
Definition: NamdOneTools.C:52
#define order
Definition: PmeRealSpace.C:235
int gridsize_a(void) const
Definition: PatchMap.h:64
void NAMD_bug(const char *err_msg)
Definition: common.C:123
AtomID atomID
Definition: Hydrogen.h:16
Bool staticAtomAssignment
int Bool
Definition: common.h:131
int index_b(int pid) const
Definition: PatchMap.h:87
void NAMD_die(const char *err_msg)
Definition: common.C:83
PDB * pdb
Definition: Node.h:180
Bool outputPatchDetails
ConfigList * configList
Definition: Node.h:179
unsigned char get_fep_type(int anum) const
Definition: Molecule.h:1345
BigReal max_b(int pid) const
Definition: PatchMap.h:94
int index_c(int pid) const
Definition: PatchMap.h:88
int add(const Elem &elem)
Definition: ResizeArray.h:97
int migrationGroupSize
Definition: NamdTypes.h:117
int32 status
Definition: NamdTypes.h:115
BigReal max_a(int pid) const
Definition: PatchMap.h:92
BigReal initialTemp
Real rigidBondLength
Definition: NamdTypes.h:118
int pressureProfileAtomTypes
short vdwType
Definition: NamdTypes.h:55
int atomsInMigrationGroup
Definition: Hydrogen.h:29
Index atomvdwtype(int anum) const
Definition: Molecule.h:1058
int numPatches(void) const
Definition: PatchMap.h:59
Position apply_transform(Position data, const Transform &t) const
Definition: Lattice.h:132
char * data
Definition: ConfigList.h:48
Real atomcharge(int anum) const
Definition: Molecule.h:1048
Mass mass
Definition: NamdTypes.h:108
StringList * find(const char *name) const
Definition: ConfigList.C:341
Real atommass(int anum) const
Definition: Molecule.h:1038
int size(void) const
Definition: ResizeArray.h:127
unsigned int nonbondedGroupSize
Definition: NamdTypes.h:57
BigReal min_c(int pid) const
Definition: PatchMap.h:95
infostream & endi(infostream &s)
Definition: InfoStream.C:38
Bool is_atom_fixed(int atomnum) const
Definition: Molecule.h:1407
#define RIGID_NONE
Definition: SimParameters.h:77
double recipMass
Definition: NamdTypes.h:103
void get_all_positions(Vector *)
Definition: PDB.C:366
Molecule * molecule
Definition: Node.h:176
int gridsize_b(void) const
Definition: PatchMap.h:65
#define TRUE
Definition: common.h:117
void sortAtomsForPatches(int *order, int *breaks, const FullAtom *atoms, int nmgrps, int natoms, int ni, int nj, int nk)
Definition: SortAtoms.C:131
Transform transform
Definition: NamdTypes.h:116
iterator begin(void)
Definition: ResizeArray.h:36
void WorkDistrib::createHomePatches ( void  )

Definition at line 889 of file WorkDistrib.C.

References atoms, createAtomLists(), PatchMgr::createHomePatch(), DebugM, endi(), iINFO(), iout, PatchMap::numPatches(), numPatches, PatchMap::Object(), and ResizeArray< T >::size().

Referenced by Node::startup().

890 {
891  int i;
892  PatchMap *patchMap = PatchMap::Object();
893  CProxy_PatchMgr pm(CkpvAccess(BOCclass_group).patchMgr);
894  PatchMgr *patchMgr = pm.ckLocalBranch();
895 
896  int numPatches = patchMap->numPatches();
897 
899 
900 #ifdef MEM_OPT_VERSION
901 /* CProxy_Node nd(CkpvAccess(BOCclass_group).node);
902  Node *node = nd.ckLocalBranch();
903  node->molecule->delEachAtomSigs();
904  node->molecule->delMassChargeSpace();
905 */
906 #endif
907 
908  int maxAtoms = -1;
909  int maxPatch = -1;
910  for(i=0; i < numPatches; i++) {
911  int numAtoms = atoms[i].size();
912  if ( numAtoms > maxAtoms ) { maxAtoms = numAtoms; maxPatch = i; }
913  }
914  iout << iINFO << "LARGEST PATCH (" << maxPatch <<
915  ") HAS " << maxAtoms << " ATOMS\n" << endi;
916 
917  for(i=0; i < numPatches; i++)
918  {
919  if ( ! ( i % 100 ) )
920  {
921  DebugM(3,"Created " << i << " patches so far.\n");
922  }
923 
924  patchMgr->createHomePatch(i,atoms[i]);
925  }
926 
927  delete [] atoms;
928 }
std::ostream & iINFO(std::ostream &s)
Definition: InfoStream.C:107
static PatchMap * Object()
Definition: PatchMap.h:27
__global__ void const int const TileList *__restrict__ TileExcl *__restrict__ const int *__restrict__ const int const float2 *__restrict__ const int *__restrict__ const float3 const float3 const float3 const float4 *__restrict__ const float cudaTextureObject_t cudaTextureObject_t cudaTextureObject_t const int const float const PatchPairRecord *__restrict__ const int *__restrict__ const int2 *__restrict__ const unsigned int *__restrict__ unsigned int *__restrict__ int *__restrict__ int *__restrict__ TileListStat *__restrict__ const BoundingBox *__restrict__ float4 *__restrict__ float4 *__restrict__ float *__restrict__ float *__restrict__ float *__restrict__ float *__restrict__ float *__restrict__ float *__restrict__ float *__restrict__ float *__restrict__ const int numPatches
static __thread atom * atoms
void createHomePatch(PatchID pid, FullAtomList &a)
Definition: PatchMgr.C:74
#define DebugM(x, y)
Definition: Debug.h:59
#define iout
Definition: InfoStream.h:87
int numPatches(void) const
Definition: PatchMap.h:59
FullAtomList * createAtomLists(const char *basename=0)
Definition: WorkDistrib.C:618
int size(void) const
Definition: ResizeArray.h:127
infostream & endi(infostream &s)
Definition: InfoStream.C:38
void WorkDistrib::distributeHomePatches ( void  )

Definition at line 930 of file WorkDistrib.C.

References DebugM, PatchMgr::movePatch(), Node::myid(), PatchMap::node(), PatchMap::numPatches(), PatchMap::Object(), and PatchMgr::sendMovePatches().

Referenced by Node::startup().

930  {
931  // ref BOC
932  CProxy_Node nd(CkpvAccess(BOCclass_group).node);
933  Node *node = nd.ckLocalBranch();
934  CProxy_PatchMgr pm(CkpvAccess(BOCclass_group).patchMgr);
935  PatchMgr *patchMgr = pm.ckLocalBranch();
936  // ref singleton
937  PatchMap *patchMap = PatchMap::Object();
938 
939  // Move patches to the proper node
940  for(int i=0;i < patchMap->numPatches(); i++)
941  {
942  if (patchMap->node(i) != node->myid() )
943  {
944  DebugM(3,"patchMgr->movePatch("
945  << i << "," << patchMap->node(i) << ")\n");
946  patchMgr->movePatch(i,patchMap->node(i));
947  }
948  }
949  patchMgr->sendMovePatches();
950 }
Definition: Node.h:78
static PatchMap * Object()
Definition: PatchMap.h:27
#define DebugM(x, y)
Definition: Debug.h:59
void movePatch(PatchID, NodeID)
Definition: PatchMgr.C:84
void sendMovePatches()
Definition: PatchMgr.C:110
int myid()
Definition: Node.h:188
int numPatches(void) const
Definition: PatchMap.h:59
int node(int pid) const
Definition: PatchMap.h:114
void WorkDistrib::doneSaveComputeMap ( CkReductionMsg *  msg)

Definition at line 423 of file WorkDistrib.C.

423  {
424  delete msg;
425 
426  CkSendMsgBranch(saveComputeMapReturnEP, CkAllocMsg(0,0,0), 0, saveComputeMapReturnChareID);
427 }
void WorkDistrib::enqueueAngles ( LocalWorkMsg msg)

Definition at line 2968 of file WorkDistrib.C.

References LocalWorkMsg::compute, Compute::doWork(), Compute::localWorkMsg, MACHINE_PROGRESS, and NAMD_bug().

2968  {
2970  if ( msg->compute->localWorkMsg != msg )
2971  NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
2972 }
LocalWorkMsg *const localWorkMsg
Definition: Compute.h:46
#define MACHINE_PROGRESS
virtual void doWork()
Definition: Compute.C:108
Compute * compute
Definition: WorkDistrib.h:27
void NAMD_bug(const char *err_msg)
Definition: common.C:123
void WorkDistrib::enqueueAniso ( LocalWorkMsg msg)

Definition at line 2992 of file WorkDistrib.C.

References LocalWorkMsg::compute, Compute::doWork(), Compute::localWorkMsg, MACHINE_PROGRESS, and NAMD_bug().

2992  {
2994  if ( msg->compute->localWorkMsg != msg )
2995  NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
2996 }
LocalWorkMsg *const localWorkMsg
Definition: Compute.h:46
#define MACHINE_PROGRESS
virtual void doWork()
Definition: Compute.C:108
Compute * compute
Definition: WorkDistrib.h:27
void NAMD_bug(const char *err_msg)
Definition: common.C:123
void WorkDistrib::enqueueBonds ( LocalWorkMsg msg)

Definition at line 2962 of file WorkDistrib.C.

References LocalWorkMsg::compute, Compute::doWork(), Compute::localWorkMsg, MACHINE_PROGRESS, and NAMD_bug().

2962  {
2964  if ( msg->compute->localWorkMsg != msg )
2965  NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
2966 }
LocalWorkMsg *const localWorkMsg
Definition: Compute.h:46
#define MACHINE_PROGRESS
virtual void doWork()
Definition: Compute.C:108
Compute * compute
Definition: WorkDistrib.h:27
void NAMD_bug(const char *err_msg)
Definition: common.C:123
void WorkDistrib::enqueueCrossterms ( LocalWorkMsg msg)

Definition at line 2998 of file WorkDistrib.C.

References LocalWorkMsg::compute, Compute::doWork(), Compute::localWorkMsg, MACHINE_PROGRESS, and NAMD_bug().

2998  {
3000  if ( msg->compute->localWorkMsg != msg )
3001  NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
3002 }
LocalWorkMsg *const localWorkMsg
Definition: Compute.h:46
#define MACHINE_PROGRESS
virtual void doWork()
Definition: Compute.C:108
Compute * compute
Definition: WorkDistrib.h:27
void NAMD_bug(const char *err_msg)
Definition: common.C:123
void WorkDistrib::enqueueCUDA ( LocalWorkMsg msg)

Definition at line 3096 of file WorkDistrib.C.

References LocalWorkMsg::compute, Compute::doWork(), and MACHINE_PROGRESS.

3096  {
3098  // ComputeNonbondedCUDA *c = msg->compute;
3099  // if ( c->localWorkMsg != msg && c->localWorkMsg2 != msg )
3100  // NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
3101 }
#define MACHINE_PROGRESS
virtual void doWork()
Definition: Compute.C:108
Compute * compute
Definition: WorkDistrib.h:27
void WorkDistrib::enqueueCUDAP2 ( LocalWorkMsg msg)

Definition at line 3102 of file WorkDistrib.C.

References LocalWorkMsg::compute, Compute::doWork(), and MACHINE_PROGRESS.

3102  {
3104 }
#define MACHINE_PROGRESS
virtual void doWork()
Definition: Compute.C:108
Compute * compute
Definition: WorkDistrib.h:27
void WorkDistrib::enqueueCUDAP3 ( LocalWorkMsg msg)

Definition at line 3105 of file WorkDistrib.C.

References LocalWorkMsg::compute, Compute::doWork(), and MACHINE_PROGRESS.

3105  {
3107 }
#define MACHINE_PROGRESS
virtual void doWork()
Definition: Compute.C:108
Compute * compute
Definition: WorkDistrib.h:27
void WorkDistrib::enqueueDihedrals ( LocalWorkMsg msg)

Definition at line 2974 of file WorkDistrib.C.

References LocalWorkMsg::compute, Compute::doWork(), Compute::localWorkMsg, MACHINE_PROGRESS, and NAMD_bug().

2974  {
2976  if ( msg->compute->localWorkMsg != msg )
2977  NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
2978 }
LocalWorkMsg *const localWorkMsg
Definition: Compute.h:46
#define MACHINE_PROGRESS
virtual void doWork()
Definition: Compute.C:108
Compute * compute
Definition: WorkDistrib.h:27
void NAMD_bug(const char *err_msg)
Definition: common.C:123
void WorkDistrib::enqueueExcls ( LocalWorkMsg msg)

Definition at line 2956 of file WorkDistrib.C.

References LocalWorkMsg::compute, Compute::doWork(), Compute::localWorkMsg, MACHINE_PROGRESS, and NAMD_bug().

2956  {
2958  if ( msg->compute->localWorkMsg != msg )
2959  NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
2960 }
LocalWorkMsg *const localWorkMsg
Definition: Compute.h:46
#define MACHINE_PROGRESS
virtual void doWork()
Definition: Compute.C:108
Compute * compute
Definition: WorkDistrib.h:27
void NAMD_bug(const char *err_msg)
Definition: common.C:123
void WorkDistrib::enqueueGromacsPair ( LocalWorkMsg msg)

Definition at line 3005 of file WorkDistrib.C.

References LocalWorkMsg::compute, Compute::doWork(), Compute::localWorkMsg, MACHINE_PROGRESS, and NAMD_bug().

3005  {
3006  msg->compute->doWork();
3008  if ( msg->compute->localWorkMsg != msg )
3009  NAMD_bug("\nWorkDistrib LocalWorkMsg recycling failed! Check enqueueGromacsPair from WorkDistrib.C\n");
3010 }
LocalWorkMsg *const localWorkMsg
Definition: Compute.h:46
#define MACHINE_PROGRESS
virtual void doWork()
Definition: Compute.C:108
Compute * compute
Definition: WorkDistrib.h:27
void NAMD_bug(const char *err_msg)
Definition: common.C:123
void WorkDistrib::enqueueImpropers ( LocalWorkMsg msg)

Definition at line 2980 of file WorkDistrib.C.

References LocalWorkMsg::compute, Compute::doWork(), Compute::localWorkMsg, MACHINE_PROGRESS, and NAMD_bug().

2980  {
2982  if ( msg->compute->localWorkMsg != msg )
2983  NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
2984 }
LocalWorkMsg *const localWorkMsg
Definition: Compute.h:46
#define MACHINE_PROGRESS
virtual void doWork()
Definition: Compute.C:108
Compute * compute
Definition: WorkDistrib.h:27
void NAMD_bug(const char *err_msg)
Definition: common.C:123
void WorkDistrib::enqueueLCPO ( LocalWorkMsg msg)

Definition at line 3019 of file WorkDistrib.C.

References LocalWorkMsg::compute, Compute::doWork(), Compute::localWorkMsg, and NAMD_bug().

3019  {
3020  msg->compute->doWork();
3021  if ( msg->compute->localWorkMsg != msg )
3022  NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
3023 }
LocalWorkMsg *const localWorkMsg
Definition: Compute.h:46
virtual void doWork()
Definition: Compute.C:108
Compute * compute
Definition: WorkDistrib.h:27
void NAMD_bug(const char *err_msg)
Definition: common.C:123
void WorkDistrib::enqueueMIC ( LocalWorkMsg msg)

Definition at line 3126 of file WorkDistrib.C.

References LocalWorkMsg::compute, Compute::doWork(), and MACHINE_PROGRESS.

3126  {
3128 }
#define MACHINE_PROGRESS
virtual void doWork()
Definition: Compute.C:108
Compute * compute
Definition: WorkDistrib.h:27
void WorkDistrib::enqueuePme ( LocalWorkMsg msg)

Definition at line 3013 of file WorkDistrib.C.

References LocalWorkMsg::compute, Compute::doWork(), Compute::localWorkMsg, MACHINE_PROGRESS, and NAMD_bug().

3013  {
3015  if ( msg->compute->localWorkMsg != msg )
3016  NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
3017 }
LocalWorkMsg *const localWorkMsg
Definition: Compute.h:46
#define MACHINE_PROGRESS
virtual void doWork()
Definition: Compute.C:108
Compute * compute
Definition: WorkDistrib.h:27
void NAMD_bug(const char *err_msg)
Definition: common.C:123
void WorkDistrib::enqueueSelfA1 ( LocalWorkMsg msg)

Definition at line 3024 of file WorkDistrib.C.

References LocalWorkMsg::compute, Compute::doWork(), Compute::localWorkMsg, MACHINE_PROGRESS, and NAMD_bug().

3024  {
3026  if ( msg->compute->localWorkMsg != msg )
3027  NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
3028 }
LocalWorkMsg *const localWorkMsg
Definition: Compute.h:46
#define MACHINE_PROGRESS
virtual void doWork()
Definition: Compute.C:108
Compute * compute
Definition: WorkDistrib.h:27
void NAMD_bug(const char *err_msg)
Definition: common.C:123
void WorkDistrib::enqueueSelfA2 ( LocalWorkMsg msg)

Definition at line 3029 of file WorkDistrib.C.

References LocalWorkMsg::compute, Compute::doWork(), Compute::localWorkMsg, MACHINE_PROGRESS, and NAMD_bug().

3029  {
3031  if ( msg->compute->localWorkMsg != msg )
3032  NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
3033 }
LocalWorkMsg *const localWorkMsg
Definition: Compute.h:46
#define MACHINE_PROGRESS
virtual void doWork()
Definition: Compute.C:108
Compute * compute
Definition: WorkDistrib.h:27
void NAMD_bug(const char *err_msg)
Definition: common.C:123
void WorkDistrib::enqueueSelfA3 ( LocalWorkMsg msg)

Definition at line 3034 of file WorkDistrib.C.

References LocalWorkMsg::compute, Compute::doWork(), Compute::localWorkMsg, MACHINE_PROGRESS, and NAMD_bug().

3034  {
3036  if ( msg->compute->localWorkMsg != msg )
3037  NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
3038 }
LocalWorkMsg *const localWorkMsg
Definition: Compute.h:46
#define MACHINE_PROGRESS
virtual void doWork()
Definition: Compute.C:108
Compute * compute
Definition: WorkDistrib.h:27
void NAMD_bug(const char *err_msg)
Definition: common.C:123
void WorkDistrib::enqueueSelfB1 ( LocalWorkMsg msg)

Definition at line 3040 of file WorkDistrib.C.

References LocalWorkMsg::compute, Compute::doWork(), Compute::localWorkMsg, MACHINE_PROGRESS, and NAMD_bug().

3040  {
3042  if ( msg->compute->localWorkMsg != msg )
3043  NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
3044 }
LocalWorkMsg *const localWorkMsg
Definition: Compute.h:46
#define MACHINE_PROGRESS
virtual void doWork()
Definition: Compute.C:108
Compute * compute
Definition: WorkDistrib.h:27
void NAMD_bug(const char *err_msg)
Definition: common.C:123
void WorkDistrib::enqueueSelfB2 ( LocalWorkMsg msg)

Definition at line 3045 of file WorkDistrib.C.

References LocalWorkMsg::compute, Compute::doWork(), Compute::localWorkMsg, MACHINE_PROGRESS, and NAMD_bug().

3045  {
3047  if ( msg->compute->localWorkMsg != msg )
3048  NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
3049 }
LocalWorkMsg *const localWorkMsg
Definition: Compute.h:46
#define MACHINE_PROGRESS
virtual void doWork()
Definition: Compute.C:108
Compute * compute
Definition: WorkDistrib.h:27
void NAMD_bug(const char *err_msg)
Definition: common.C:123
void WorkDistrib::enqueueSelfB3 ( LocalWorkMsg msg)

Definition at line 3050 of file WorkDistrib.C.

References LocalWorkMsg::compute, Compute::doWork(), Compute::localWorkMsg, MACHINE_PROGRESS, and NAMD_bug().

3050  {
3052  if ( msg->compute->localWorkMsg != msg )
3053  NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
3054 }
LocalWorkMsg *const localWorkMsg
Definition: Compute.h:46
#define MACHINE_PROGRESS
virtual void doWork()
Definition: Compute.C:108
Compute * compute
Definition: WorkDistrib.h:27
void NAMD_bug(const char *err_msg)
Definition: common.C:123
void WorkDistrib::enqueueThole ( LocalWorkMsg msg)

Definition at line 2986 of file WorkDistrib.C.

References LocalWorkMsg::compute, Compute::doWork(), Compute::localWorkMsg, MACHINE_PROGRESS, and NAMD_bug().

2986  {
2988  if ( msg->compute->localWorkMsg != msg )
2989  NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
2990 }
LocalWorkMsg *const localWorkMsg
Definition: Compute.h:46
#define MACHINE_PROGRESS
virtual void doWork()
Definition: Compute.C:108
Compute * compute
Definition: WorkDistrib.h:27
void NAMD_bug(const char *err_msg)
Definition: common.C:123
void WorkDistrib::enqueueWork ( LocalWorkMsg msg)

Definition at line 2950 of file WorkDistrib.C.

References LocalWorkMsg::compute, Compute::doWork(), Compute::localWorkMsg, MACHINE_PROGRESS, and NAMD_bug().

2950  {
2952  if ( msg->compute->localWorkMsg != msg )
2953  NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
2954 }
LocalWorkMsg *const localWorkMsg
Definition: Compute.h:46
#define MACHINE_PROGRESS
virtual void doWork()
Definition: Compute.C:108
Compute * compute
Definition: WorkDistrib.h:27
void NAMD_bug(const char *err_msg)
Definition: common.C:123
void WorkDistrib::enqueueWorkA1 ( LocalWorkMsg msg)

Definition at line 3056 of file WorkDistrib.C.

References LocalWorkMsg::compute, Compute::doWork(), Compute::localWorkMsg, MACHINE_PROGRESS, and NAMD_bug().

3056  {
3058  if ( msg->compute->localWorkMsg != msg )
3059  NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
3060 }
LocalWorkMsg *const localWorkMsg
Definition: Compute.h:46
#define MACHINE_PROGRESS
virtual void doWork()
Definition: Compute.C:108
Compute * compute
Definition: WorkDistrib.h:27
void NAMD_bug(const char *err_msg)
Definition: common.C:123
void WorkDistrib::enqueueWorkA2 ( LocalWorkMsg msg)

Definition at line 3061 of file WorkDistrib.C.

References LocalWorkMsg::compute, Compute::doWork(), Compute::localWorkMsg, MACHINE_PROGRESS, and NAMD_bug().

3061  {
3063  if ( msg->compute->localWorkMsg != msg )
3064  NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
3065 }
LocalWorkMsg *const localWorkMsg
Definition: Compute.h:46
#define MACHINE_PROGRESS
virtual void doWork()
Definition: Compute.C:108
Compute * compute
Definition: WorkDistrib.h:27
void NAMD_bug(const char *err_msg)
Definition: common.C:123
void WorkDistrib::enqueueWorkA3 ( LocalWorkMsg msg)

Definition at line 3066 of file WorkDistrib.C.

References LocalWorkMsg::compute, Compute::doWork(), Compute::localWorkMsg, MACHINE_PROGRESS, and NAMD_bug().

3066  {
3068  if ( msg->compute->localWorkMsg != msg )
3069  NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
3070 }
LocalWorkMsg *const localWorkMsg
Definition: Compute.h:46
#define MACHINE_PROGRESS
virtual void doWork()
Definition: Compute.C:108
Compute * compute
Definition: WorkDistrib.h:27
void NAMD_bug(const char *err_msg)
Definition: common.C:123
void WorkDistrib::enqueueWorkB1 ( LocalWorkMsg msg)

Definition at line 3072 of file WorkDistrib.C.

References LocalWorkMsg::compute, Compute::doWork(), Compute::localWorkMsg, MACHINE_PROGRESS, and NAMD_bug().

3072  {
3074  if ( msg->compute->localWorkMsg != msg )
3075  NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
3076 }
LocalWorkMsg *const localWorkMsg
Definition: Compute.h:46
#define MACHINE_PROGRESS
virtual void doWork()
Definition: Compute.C:108
Compute * compute
Definition: WorkDistrib.h:27
void NAMD_bug(const char *err_msg)
Definition: common.C:123
void WorkDistrib::enqueueWorkB2 ( LocalWorkMsg msg)

Definition at line 3077 of file WorkDistrib.C.

References LocalWorkMsg::compute, Compute::doWork(), Compute::localWorkMsg, MACHINE_PROGRESS, and NAMD_bug().

3077  {
3079  if ( msg->compute->localWorkMsg != msg )
3080  NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
3081 }
LocalWorkMsg *const localWorkMsg
Definition: Compute.h:46
#define MACHINE_PROGRESS
virtual void doWork()
Definition: Compute.C:108
Compute * compute
Definition: WorkDistrib.h:27
void NAMD_bug(const char *err_msg)
Definition: common.C:123
void WorkDistrib::enqueueWorkB3 ( LocalWorkMsg msg)

Definition at line 3082 of file WorkDistrib.C.

References LocalWorkMsg::compute, Compute::doWork(), Compute::localWorkMsg, MACHINE_PROGRESS, and NAMD_bug().

3082  {
3084  if ( msg->compute->localWorkMsg != msg )
3085  NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
3086 }
LocalWorkMsg *const localWorkMsg
Definition: Compute.h:46
#define MACHINE_PROGRESS
virtual void doWork()
Definition: Compute.C:108
Compute * compute
Definition: WorkDistrib.h:27
void NAMD_bug(const char *err_msg)
Definition: common.C:123
void WorkDistrib::enqueueWorkC ( LocalWorkMsg msg)

Definition at line 3090 of file WorkDistrib.C.

References LocalWorkMsg::compute, Compute::doWork(), Compute::localWorkMsg, MACHINE_PROGRESS, and NAMD_bug().

3090  {
3092  if ( msg->compute->localWorkMsg != msg )
3093  NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
3094 }
LocalWorkMsg *const localWorkMsg
Definition: Compute.h:46
#define MACHINE_PROGRESS
virtual void doWork()
Definition: Compute.C:108
Compute * compute
Definition: WorkDistrib.h:27
void NAMD_bug(const char *err_msg)
Definition: common.C:123
void WorkDistrib::finishCUDA ( LocalWorkMsg msg)

Definition at line 3113 of file WorkDistrib.C.

References LocalWorkMsg::compute, Compute::doWork(), and MACHINE_PROGRESS.

3113  {
3115  // ComputeNonbondedCUDA *c = msg->compute;
3116  // if ( c->localWorkMsg != msg && c->localWorkMsg2 != msg )
3117  // NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
3118 }
#define MACHINE_PROGRESS
virtual void doWork()
Definition: Compute.C:108
Compute * compute
Definition: WorkDistrib.h:27
void WorkDistrib::finishCUDAP2 ( LocalWorkMsg msg)

Definition at line 3119 of file WorkDistrib.C.

References LocalWorkMsg::compute, Compute::doWork(), and MACHINE_PROGRESS.

3119  {
3121 }
#define MACHINE_PROGRESS
virtual void doWork()
Definition: Compute.C:108
Compute * compute
Definition: WorkDistrib.h:27
void WorkDistrib::finishCUDAP3 ( LocalWorkMsg msg)

Definition at line 3122 of file WorkDistrib.C.

References LocalWorkMsg::compute, Compute::doWork(), and MACHINE_PROGRESS.

3122  {
3124 }
#define MACHINE_PROGRESS
virtual void doWork()
Definition: Compute.C:108
Compute * compute
Definition: WorkDistrib.h:27
void WorkDistrib::finishCUDAPatch ( FinishWorkMsg msg)

Definition at line 3109 of file WorkDistrib.C.

References FinishWorkMsg::compute, FinishWorkMsg::data, and Compute::finishPatch().

3109  {
3110  msg->compute->finishPatch(msg->data);
3111 }
Compute * compute
Definition: WorkDistrib.h:33
virtual void finishPatch(int)
Definition: Compute.C:112
void WorkDistrib::finishMIC ( LocalWorkMsg msg)

Definition at line 3129 of file WorkDistrib.C.

References LocalWorkMsg::compute, Compute::doWork(), and MACHINE_PROGRESS.

3129  {
3131 }
#define MACHINE_PROGRESS
virtual void doWork()
Definition: Compute.C:108
Compute * compute
Definition: WorkDistrib.h:27
void WorkDistrib::initHostDeviceLDB ( )

Definition at line 3384 of file WorkDistrib.C.

3384  {
3385  #if defined(NAMD_MIC)
3386  mic_hostDeviceLDB();
3387  #endif
3388 }
void WorkDistrib::mapComputes ( void  )

Definition at line 2269 of file WorkDistrib.C.

References ComputeMap::allocateCids(), SimParameters::bondedCUDA, computeAnglesType, computeAnisoType, computeBondsType, computeConsForceType, computeConsTorqueType, computeCrosstermsType, computeCylindricalBCType, computeDihedralsType, computeEFieldType, computeEwaldType, computeExclsType, computeExtType, computeFmmType, computeFullDirectType, computeGBISserType, computeGlobalType, computeGridForceType, computeGromacsPairType, computeImpropersType, SimParameters::computeMapFilename, computeMsmMsaType, computeMsmSerialType, computeMsmType, computeNonbondedCUDA2Type, computeNonbondedCUDAType, computeNonbondedMICType, computePmeCUDAType, computePmeType, computeQMType, computeRestraintsType, computeSelfAnglesType, computeSelfAnisoType, computeSelfBondsType, computeSelfCrosstermsType, computeSelfDihedralsType, computeSelfExclsType, computeSelfGromacsPairType, computeSelfImpropersType, computeSelfTholeType, computeSphericalBCType, computeStirType, computeTclBCType, computeTholeType, SimParameters::consForceOn, SimParameters::consTorqueOn, SimParameters::constraintsOn, SimParameters::cylindricalBCOn, DebugM, SimParameters::drudeOn, SimParameters::eFieldOn, SimParameters::extForcesOn, SimParameters::FMAOn, SimParameters::FMMOn, SimParameters::fullDirectOn, SimParameters::GBISserOn, SimParameters::globalForcesOn, SimParameters::goGroPair, SimParameters::LCPOOn, ComputeMap::loadComputeMap(), SimParameters::loadComputeMap, SimParameters::mgridforceOn, SimParameters::MSMOn, SimParameters::MsmSerialOn, NAMD_die(), PatchMap::Object(), Node::Object(), ComputeMap::Object(), SimParameters::pairInteractionOn, SimParameters::pairInteractionSelf, SimParameters::PMEOn, SimParameters::pressureProfileEwaldOn, SimParameters::qmForcesOn, ComputeMap::saveComputeMap(), Node::simParameters, SimParameters::sphericalBCOn, SimParameters::stirOn, SimParameters::storeComputeMap, SimParameters::tclBCOn, SimParameters::useCUDA2, SimParameters::useDPME, and SimParameters::usePMECUDA.

Referenced by Node::startup().

2270 {
2271  PatchMap *patchMap = PatchMap::Object();
2272  ComputeMap *computeMap = ComputeMap::Object();
2273  CProxy_Node nd(CkpvAccess(BOCclass_group).node);
2274  Node *node = nd.ckLocalBranch();
2275 
2276  DebugM(3,"Mapping computes\n");
2277 
2278  computeMap->allocateCids();
2279 
2280  // Handle full electrostatics
2281  if ( node->simParameters->fullDirectOn )
2282  mapComputeHomePatches(computeFullDirectType);
2283  if ( node->simParameters->FMAOn )
2284 #ifdef DPMTA
2285  mapComputeHomePatches(computeDPMTAType);
2286 #else
2287  NAMD_die("This binary does not include DPMTA (FMA).");
2288 #endif
2289  if ( node->simParameters->PMEOn ) {
2290 #ifdef DPME
2291  if ( node->simParameters->useDPME )
2292  mapComputeHomePatches(computeDPMEType);
2293  else {
2294  mapComputeHomePatches(computePmeType);
2296  mapComputeHomePatches(computeEwaldType);
2297  }
2298 #else
2299 #ifdef NAMD_CUDA
2300  if (node->simParameters->usePMECUDA) {
2301  mapComputePatch(computePmeCUDAType);
2302  } else
2303 #endif
2304  {
2305  mapComputePatch(computePmeType);
2306  }
2308  mapComputeHomePatches(computeEwaldType);
2309 #endif
2310  }
2311 
2312  if ( node->simParameters->globalForcesOn ) {
2313  DebugM(2,"adding ComputeGlobal\n");
2314  mapComputeHomePatches(computeGlobalType);
2315  }
2316 
2317  if ( node->simParameters->extForcesOn )
2318  mapComputeHomePatches(computeExtType);
2319 
2320  if ( node->simParameters->qmForcesOn )
2321  mapComputeHomePatches(computeQMType);
2322 
2323  if ( node->simParameters->GBISserOn )
2324  mapComputeHomePatches(computeGBISserType);
2325 
2326  if ( node->simParameters->MsmSerialOn )
2327  mapComputeHomePatches(computeMsmSerialType);
2328 #ifdef CHARM_HAS_MSA
2329  else if ( node->simParameters->MSMOn )
2330  mapComputeHomePatches(computeMsmMsaType);
2331 #else
2332  else if ( node->simParameters->MSMOn )
2333  mapComputeHomePatches(computeMsmType);
2334 #endif
2335 
2336  if ( node->simParameters->FMMOn )
2337  mapComputeHomePatches(computeFmmType);
2338 
2339 #ifdef NAMD_CUDA
2340 #ifdef BONDED_CUDA
2341  if (node->simParameters->bondedCUDA) {
2342  mapComputeNode(computeBondedCUDAType);
2343  }
2344 #endif
2345 #endif
2346 
2347 #ifdef NAMD_CUDA
2348  if (node->simParameters->useCUDA2) {
2349  mapComputeNode(computeNonbondedCUDA2Type);
2350  } else {
2351  mapComputeNode(computeNonbondedCUDAType);
2352  }
2353  mapComputeHomeTuples(computeExclsType);
2354  mapComputePatch(computeSelfExclsType);
2355 #endif
2356 
2357 #ifdef NAMD_MIC
2358  mapComputeNode(computeNonbondedMICType);
2359 #endif
2360 
2361  mapComputeNonbonded();
2362 
2363  if ( node->simParameters->LCPOOn ) {
2364  mapComputeLCPO();
2365  }
2366 
2367  // If we're doing true pair interactions, no need for bonded terms.
2368  // But if we're doing within-group interactions, we do need them.
2369  if ( !node->simParameters->pairInteractionOn ||
2371  mapComputeHomeTuples(computeBondsType);
2372  mapComputeHomeTuples(computeAnglesType);
2373  mapComputeHomeTuples(computeDihedralsType);
2374  mapComputeHomeTuples(computeImpropersType);
2375  mapComputeHomeTuples(computeCrosstermsType);
2376  mapComputePatch(computeSelfBondsType);
2377  mapComputePatch(computeSelfAnglesType);
2378  mapComputePatch(computeSelfDihedralsType);
2379  mapComputePatch(computeSelfImpropersType);
2380  mapComputePatch(computeSelfCrosstermsType);
2381  }
2382 
2383  if ( node->simParameters->goGroPair ) {
2384  // JLai
2385  mapComputeHomeTuples(computeGromacsPairType);
2386  mapComputePatch(computeSelfGromacsPairType);
2387  // End of JLai
2388  }
2389 
2390  if ( node->simParameters->drudeOn ) {
2391  mapComputeHomeTuples(computeTholeType);
2392  mapComputePatch(computeSelfTholeType);
2393  mapComputeHomeTuples(computeAnisoType);
2394  mapComputePatch(computeSelfAnisoType);
2395  }
2396 
2397  if ( node->simParameters->eFieldOn )
2398  mapComputePatch(computeEFieldType);
2399  /* BEGIN gf */
2400  if ( node->simParameters->mgridforceOn )
2401  mapComputePatch(computeGridForceType);
2402  /* END gf */
2403  if ( node->simParameters->stirOn )
2404  mapComputePatch(computeStirType);
2405  if ( node->simParameters->sphericalBCOn )
2406  mapComputePatch(computeSphericalBCType);
2407  if ( node->simParameters->cylindricalBCOn )
2408  mapComputePatch(computeCylindricalBCType);
2409  if ( node->simParameters->tclBCOn ) {
2410  mapComputeHomePatches(computeTclBCType);
2411  }
2412  if ( node->simParameters->constraintsOn )
2413  mapComputePatch(computeRestraintsType);
2414  if ( node->simParameters->consForceOn )
2415  mapComputePatch(computeConsForceType);
2416  if ( node->simParameters->consTorqueOn )
2417  mapComputePatch(computeConsTorqueType);
2418 
2419  // store the latest compute map
2421  if (simParams->storeComputeMap) {
2422  computeMap->saveComputeMap(simParams->computeMapFilename);
2423  }
2424  // override mapping decision
2425  if (simParams->loadComputeMap) {
2426  computeMap->loadComputeMap(simParams->computeMapFilename);
2427  CkPrintf("ComputeMap has been loaded from %s.\n", simParams->computeMapFilename);
2428  }
2429 }
static Node * Object()
Definition: Node.h:86
void saveComputeMap(const char *fname)
Definition: ComputeMap.C:262
Definition: Node.h:78
char computeMapFilename[128]
static PatchMap * Object()
Definition: PatchMap.h:27
SimParameters * simParameters
Definition: Node.h:178
void loadComputeMap(const char *fname)
Definition: ComputeMap.C:278
#define DebugM(x, y)
Definition: Debug.h:59
Bool pairInteractionOn
int allocateCids()
Definition: ComputeMap.C:143
void NAMD_die(const char *err_msg)
Definition: common.C:83
Bool pressureProfileEwaldOn
#define simParams
Definition: Output.C:127
static ComputeMap * Object()
Definition: ComputeMap.h:89
Bool pairInteractionSelf
void WorkDistrib::messageEnqueueWork ( Compute compute)
static

Definition at line 2727 of file WorkDistrib.C.

References Compute::cid, LocalWorkMsg::compute, computeAnglesType, computeAnisoType, computeBondsType, computeCrosstermsType, computeDihedralsType, computeExclsType, computeGromacsPairType, computeImpropersType, computeNonbondedCUDA2Type, computeNonbondedCUDAType, computeNonbondedMICType, computeNonbondedPairType, computeNonbondedSelfType, computePmeCUDAType, computePmeType, computeSelfAnglesType, computeSelfAnisoType, computeSelfBondsType, computeSelfCrosstermsType, computeSelfDihedralsType, computeSelfExclsType, computeSelfGromacsPairType, computeSelfImpropersType, computeSelfTholeType, computeTholeType, Compute::doWork(), Compute::getGBISPhase(), Compute::localWorkMsg, MACHINE_PROGRESS, NAMD_bug(), Compute::priority(), Compute::sequence(), SET_PRIORITY, and Compute::type().

Referenced by cuda_check_pme_forces(), Compute::enqueueWork(), CudaComputeNonbonded::messageEnqueueWork(), ComputePmeMgr::submitReductions(), and ComputePmeMgr::ungridCalc().

2727  {
2728  LocalWorkMsg *msg = compute->localWorkMsg;
2729  int seq = compute->sequence();
2730  int gbisPhase = compute->getGBISPhase();
2731 
2732  if ( seq < 0 ) {
2733  NAMD_bug("compute->sequence() < 0 in WorkDistrib::messageEnqueueWork");
2734  } else {
2735  SET_PRIORITY(msg,seq,compute->priority());
2736  }
2737 
2738  msg->compute = compute; // pointer is valid since send is to local Pe
2739  int type = compute->type();
2740  int cid = compute->cid;
2741 
2742  CProxy_WorkDistrib wdProxy(CkpvAccess(BOCclass_group).workDistrib);
2743  switch ( type ) {
2744  case computeExclsType:
2745  case computeSelfExclsType:
2746  wdProxy[CkMyPe()].enqueueExcls(msg);
2747  break;
2748  case computeBondsType:
2749  case computeSelfBondsType:
2750  wdProxy[CkMyPe()].enqueueBonds(msg);
2751  break;
2752  case computeAnglesType:
2753  case computeSelfAnglesType:
2754  wdProxy[CkMyPe()].enqueueAngles(msg);
2755  break;
2756  case computeDihedralsType:
2758  wdProxy[CkMyPe()].enqueueDihedrals(msg);
2759  break;
2760  case computeImpropersType:
2762  wdProxy[CkMyPe()].enqueueImpropers(msg);
2763  break;
2764  case computeTholeType:
2765  case computeSelfTholeType:
2766  wdProxy[CkMyPe()].enqueueThole(msg);
2767  break;
2768  case computeAnisoType:
2769  case computeSelfAnisoType:
2770  wdProxy[CkMyPe()].enqueueAniso(msg);
2771  break;
2772  case computeCrosstermsType:
2774  wdProxy[CkMyPe()].enqueueCrossterms(msg);
2775  break;
2776  // JLai
2779  wdProxy[CkMyPe()].enqueueGromacsPair(msg);
2780  break;
2781  // End of JLai
2782  case computeLCPOType:
2783  wdProxy[CkMyPe()].enqueueLCPO(msg);
2784  break;
2786  switch ( seq % 2 ) {
2787  case 0:
2788  //wdProxy[CkMyPe()].enqueueSelfA(msg);
2789  switch ( gbisPhase ) {
2790  case 1:
2791  wdProxy[CkMyPe()].enqueueSelfA1(msg);
2792  break;
2793  case 2:
2794  wdProxy[CkMyPe()].enqueueSelfA2(msg);
2795  break;
2796  case 3:
2797  wdProxy[CkMyPe()].enqueueSelfA3(msg);
2798  break;
2799  }
2800  break;
2801  case 1:
2802  //wdProxy[CkMyPe()].enqueueSelfB(msg);
2803  switch ( gbisPhase ) {
2804  case 1:
2805  wdProxy[CkMyPe()].enqueueSelfB1(msg);
2806  break;
2807  case 2:
2808  wdProxy[CkMyPe()].enqueueSelfB2(msg);
2809  break;
2810  case 3:
2811  wdProxy[CkMyPe()].enqueueSelfB3(msg);
2812  break;
2813  }
2814  break;
2815  default:
2816  NAMD_bug("WorkDistrib::messageEnqueueSelf case statement error!");
2817  }
2818  break;
2820  switch ( seq % 2 ) {
2821  case 0:
2822  //wdProxy[CkMyPe()].enqueueWorkA(msg);
2823  switch ( gbisPhase ) {
2824  case 1:
2825  wdProxy[CkMyPe()].enqueueWorkA1(msg);
2826  break;
2827  case 2:
2828  wdProxy[CkMyPe()].enqueueWorkA2(msg);
2829  break;
2830  case 3:
2831  wdProxy[CkMyPe()].enqueueWorkA3(msg);
2832  break;
2833  }
2834  break;
2835  case 1:
2836  //wdProxy[CkMyPe()].enqueueWorkB(msg);
2837  switch ( gbisPhase ) {
2838  case 1:
2839  wdProxy[CkMyPe()].enqueueWorkB1(msg);
2840  break;
2841  case 2:
2842  wdProxy[CkMyPe()].enqueueWorkB2(msg);
2843  break;
2844  case 3:
2845  wdProxy[CkMyPe()].enqueueWorkB3(msg);
2846  break;
2847  }
2848  break;
2849  case 2:
2850  wdProxy[CkMyPe()].enqueueWorkC(msg);
2851  break;
2852  default:
2853  NAMD_bug("WorkDistrib::messageEnqueueWork case statement error!");
2854  }
2855  break;
2857 #ifdef NAMD_CUDA
2859 // CkPrintf("WorkDistrib[%d]::CUDA seq=%d phase=%d\n", CkMyPe(), seq, gbisPhase);
2860  //wdProxy[CkMyPe()].enqueueCUDA(msg);
2861  switch ( gbisPhase ) {
2862  case 1:
2863  wdProxy[CkMyPe()].enqueueCUDA(msg);
2864  break;
2865  case 2:
2866  wdProxy[CkMyPe()].enqueueCUDAP2(msg);
2867  break;
2868  case 3:
2869  wdProxy[CkMyPe()].enqueueCUDAP3(msg);
2870  break;
2871  }
2872 #else
2874 #endif
2875  break;
2877 #ifdef NAMD_MIC
2878  wdProxy[CkMyPe()].enqueueMIC(msg);
2879 #endif
2880  break;
2881  case computePmeType:
2882  // CkPrintf("PME %d %d %x\n", CkMyPe(), seq, compute->priority());
2883  wdProxy[CkMyPe()].enqueuePme(msg);
2884  break;
2885 #ifdef NAMD_CUDA
2886  case computePmeCUDAType:
2887  wdProxy[CkMyPe()].enqueuePme(msg);
2888  break;
2889 #endif
2890  default:
2891  wdProxy[CkMyPe()].enqueueWork(msg);
2892  }
2893 }
int sequence(void)
Definition: Compute.h:64
int getGBISPhase(void)
Definition: Compute.h:66
LocalWorkMsg *const localWorkMsg
Definition: Compute.h:46
#define MACHINE_PROGRESS
virtual void doWork()
Definition: Compute.C:108
Compute * compute
Definition: WorkDistrib.h:27
void NAMD_bug(const char *err_msg)
Definition: common.C:123
int priority(void)
Definition: Compute.h:65
int type()
Definition: Compute.h:48
#define SET_PRIORITY(MSG, SEQ, PRIO)
Definition: Priorities.h:18
const ComputeID cid
Definition: Compute.h:43
void WorkDistrib::messageFinishCUDA ( Compute compute)
static

Definition at line 2896 of file WorkDistrib.C.

References LocalWorkMsg::compute, Compute::doWork(), Compute::getGBISPhase(), Compute::localWorkMsg, MACHINE_PROGRESS, NAMD_bug(), Compute::priority(), Compute::sequence(), and SET_PRIORITY.

Referenced by cuda_check_local_progress(), and cuda_check_remote_progress().

2896  {
2897  LocalWorkMsg *msg = compute->localWorkMsg;
2898  int seq = compute->sequence();
2899  int gbisPhase = compute->getGBISPhase();
2900 
2901  if ( seq < 0 ) {
2902  NAMD_bug("compute->sequence() < 0 in WorkDistrib::messageEnqueueWork");
2903  } else {
2904  SET_PRIORITY(msg,seq,compute->priority());
2905  }
2906 
2907  msg->compute = compute; // pointer is valid since send is to local Pe
2908  CProxy_WorkDistrib wdProxy(CkpvAccess(BOCclass_group).workDistrib);
2909 
2910 #ifdef NAMD_CUDA
2911  //wdProxy[CkMyPe()].finishCUDA(msg);
2912  switch ( gbisPhase ) {
2913  case 1:
2914  wdProxy[CkMyPe()].finishCUDA(msg);
2915  break;
2916  case 2:
2917  wdProxy[CkMyPe()].finishCUDAP2(msg);
2918  break;
2919  case 3:
2920  wdProxy[CkMyPe()].finishCUDAP3(msg);
2921  break;
2922  }
2923 #else
2925 #endif
2926 }
int sequence(void)
Definition: Compute.h:64
int getGBISPhase(void)
Definition: Compute.h:66
LocalWorkMsg *const localWorkMsg
Definition: Compute.h:46
#define MACHINE_PROGRESS
virtual void doWork()
Definition: Compute.C:108
Compute * compute
Definition: WorkDistrib.h:27
void NAMD_bug(const char *err_msg)
Definition: common.C:123
int priority(void)
Definition: Compute.h:65
#define SET_PRIORITY(MSG, SEQ, PRIO)
Definition: Priorities.h:18
void WorkDistrib::messageFinishMIC ( Compute compute)
static

Definition at line 2929 of file WorkDistrib.C.

References LocalWorkMsg::compute, Compute::doWork(), Compute::getGBISPhase(), Compute::localWorkMsg, MACHINE_PROGRESS, NAMD_bug(), Compute::priority(), Compute::sequence(), and SET_PRIORITY.

2929  {
2930  LocalWorkMsg *msg = compute->localWorkMsg;
2931  int seq = compute->sequence();
2932  int gbisPhase = compute->getGBISPhase();
2933 
2934  if ( seq < 0 ) {
2935  NAMD_bug("compute->sequence() < 0 in WorkDistrib::messageFinishMIC");
2936  } else {
2937  SET_PRIORITY(msg,seq,compute->priority());
2938  }
2939 
2940  msg->compute = compute; // pointer is valid since send is to local Pe
2941  CProxy_WorkDistrib wdProxy(CkpvAccess(BOCclass_group).workDistrib);
2942 
2943 #ifdef NAMD_MIC
2944  wdProxy[CkMyPe()].finishMIC(msg);
2945 #else
2947 #endif
2948 }
int sequence(void)
Definition: Compute.h:64
int getGBISPhase(void)
Definition: Compute.h:66
LocalWorkMsg *const localWorkMsg
Definition: Compute.h:46
#define MACHINE_PROGRESS
virtual void doWork()
Definition: Compute.C:108
Compute * compute
Definition: WorkDistrib.h:27
void NAMD_bug(const char *err_msg)
Definition: common.C:123
int priority(void)
Definition: Compute.h:65
#define SET_PRIORITY(MSG, SEQ, PRIO)
Definition: Priorities.h:18
void WorkDistrib::patchMapInit ( void  )

Definition at line 1105 of file WorkDistrib.C.

References Lattice::a_p(), Lattice::a_r(), Lattice::b_p(), Lattice::b_r(), Lattice::c_p(), Lattice::c_r(), DebugM, endi(), PDB::find_extremes(), SimParameters::FMAOn, SimParameters::FMMOn, PDB::get_extremes(), iINFO(), iout, isOutputProcessor(), iWARN(), SimParameters::lattice, SimParameters::LCPOOn, PatchMap::makePatches(), SimParameters::maxPatches, SimParameters::minAtomsPerPatch, Node::molecule, SimParameters::MSMOn, NAMD_die(), SimParameters::noPatchesOnOne, SimParameters::noPatchesOnOutputPEs, SimParameters::noPatchesOnZero, PDB::num_atoms(), Molecule::numAtoms, SimParameters::numoutputprocs, numPatches, PatchMap::Object(), Node::Object(), Lattice::origin(), SimParameters::patchDimension, Node::pdb, SimParameters::replicaUniformPatchGrids, Node::simParameters, SimParameters::simulatedPEs, SimParameters::simulateInitialMapping, PatchMap::sizeGrid(), SimParameters::staticAtomAssignment, SimParameters::twoAwayX, SimParameters::twoAwayY, SimParameters::twoAwayZ, Vector::x, Vector::y, and Vector::z.

Referenced by Node::startup().

1106 {
1107  PatchMap *patchMap = PatchMap::Object();
1108  CProxy_Node nd(CkpvAccess(BOCclass_group).node);
1109  Node *node = nd.ckLocalBranch();
1110  SimParameters *params = node->simParameters;
1111  Lattice lattice = params->lattice;
1112 
1113  BigReal patchSize = params->patchDimension;
1114 
1115 #ifndef MEM_OPT_VERSION
1116  const int totalAtoms = node->pdb->num_atoms();
1117 #else
1118  const int totalAtoms = node->molecule->numAtoms;
1119 #endif
1120 
1121  ScaledPosition xmin, xmax;
1122 
1123  double maxNumPatches = 1.e9; // need to adjust fractional values
1124  if ( params->minAtomsPerPatch > 0 )
1125  maxNumPatches = totalAtoms / params->minAtomsPerPatch;
1126 
1127  DebugM(3,"Mapping patches\n");
1128  if ( lattice.a_p() && lattice.b_p() && lattice.c_p() ) {
1129  xmin = 0.; xmax = 0.;
1130  }
1131  else if ( params->FMAOn || params->MSMOn || params->FMMOn ) {
1132  // Need to use full box for FMA to match NAMD 1.X results.
1133 #if 0
1134  node->pdb->find_extremes(&(xmin.x),&(xmax.x),lattice.a_r());
1135  node->pdb->find_extremes(&(xmin.y),&(xmax.y),lattice.b_r());
1136  node->pdb->find_extremes(&(xmin.z),&(xmax.z),lattice.c_r());
1137 #endif
1138  node->pdb->find_extremes(lattice);
1139  node->pdb->get_extremes(xmin, xmax);
1140 #if 0
1141  printf("+++ center=%.4f %.4f %.4f\n",
1142  lattice.origin().x, lattice.origin().y, lattice.origin().z);
1143  printf("+++ xmin=%.4f xmax=%.4f\n", xmin.x, xmax.x);
1144  printf("+++ ymin=%.4f ymax=%.4f\n", xmin.y, xmax.y);
1145  printf("+++ zmin=%.4f zmax=%.4f\n", xmin.z, xmax.z);
1146 #endif
1147  // Otherwise, this allows a small number of stray atoms.
1148  }
1149  else {
1150 #if 0
1151  node->pdb->find_extremes(&(xmin.x),&(xmax.x),lattice.a_r(),0.9);
1152  node->pdb->find_extremes(&(xmin.y),&(xmax.y),lattice.b_r(),0.9);
1153  node->pdb->find_extremes(&(xmin.z),&(xmax.z),lattice.c_r(),0.9);
1154 #endif
1155  node->pdb->find_extremes(lattice, 1.0);
1156  node->pdb->get_extremes(xmin, xmax);
1157  iout << iINFO << "ORIGINAL ATOMS MINMAX IS " << xmin << " " << xmax << "\n" << endi;
1158  double frac = ( (double)totalAtoms - 10000. ) / (double)totalAtoms;
1159  if ( frac < 0.9 ) { frac = 0.9; }
1160  node->pdb->find_extremes(lattice, frac);
1161  node->pdb->get_extremes(xmin, xmax);
1162  iout << iINFO << "ADJUSTED ATOMS MINMAX IS " << xmin << " " << xmax << "\n" << endi;
1163  }
1164 
1165 #if 0
1166  BigReal origin_shift;
1167  origin_shift = lattice.a_r() * lattice.origin();
1168  xmin.x -= origin_shift;
1169  xmax.x -= origin_shift;
1170  origin_shift = lattice.b_r() * lattice.origin();
1171  xmin.y -= origin_shift;
1172  xmax.y -= origin_shift;
1173  origin_shift = lattice.c_r() * lattice.origin();
1174  xmin.z -= origin_shift;
1175  xmax.z -= origin_shift;
1176 #endif
1177 
1178  // SimParameters default is -1 for unset
1179  int twoAwayX = params->twoAwayX;
1180  int twoAwayY = params->twoAwayY;
1181  int twoAwayZ = params->twoAwayZ;
1182 
1183  // SASA implementation is not compatible with twoAway patches
1184  if (params->LCPOOn && patchSize < 32.4) {
1185  if ( twoAwayX > 0 || twoAwayY > 0 || twoAwayZ > 0 ) {
1186  iout << iWARN << "Ignoring twoAway[XYZ] due to LCPO SASA implementation.\n" << endi;
1187  }
1188  twoAwayX = twoAwayY = twoAwayZ = 0;
1189  }
1190 
1191  // if you think you know what you're doing go right ahead
1192  if ( twoAwayX > 0 ) maxNumPatches = 1.e9;
1193  if ( twoAwayY > 0 ) maxNumPatches = 1.e9;
1194  if ( twoAwayZ > 0 ) maxNumPatches = 1.e9;
1195  if ( params->maxPatches > 0 ) {
1196  maxNumPatches = params->maxPatches;
1197  iout << iINFO << "LIMITING NUMBER OF PATCHES TO " <<
1198  maxNumPatches << "\n" << endi;
1199  }
1200 
1201  int numpes = CkNumPes();
1202  SimParameters *simparam = Node::Object()->simParameters;
1203  if(simparam->simulateInitialMapping) {
1204  numpes = simparam->simulatedPEs;
1205  delete [] patchMap->nPatchesOnNode;
1206  patchMap->nPatchesOnNode = new int[numpes];
1207  memset(patchMap->nPatchesOnNode, 0, numpes*sizeof(int));
1208  }
1209 
1210 #if defined(NAMD_CUDA) || defined(NAMD_MIC)
1211  // for CUDA be sure there are more patches than pes
1212 
1213  int numPatches = patchMap->sizeGrid(
1214  xmin,xmax,lattice,patchSize,maxNumPatches,params->staticAtomAssignment,
1215  twoAwayX>0 ? 2 : 1, twoAwayY>0 ? 2 : 1, twoAwayZ>0 ? 2 : 1);
1216  if ( numPatches < numpes && twoAwayX < 0 ) {
1217  twoAwayX = 1;
1218  numPatches = patchMap->sizeGrid(
1219  xmin,xmax,lattice,patchSize,maxNumPatches,params->staticAtomAssignment,
1220  twoAwayX>0 ? 2 : 1, twoAwayY>0 ? 2 : 1, twoAwayZ>0 ? 2 : 1);
1221  }
1222  if ( numPatches < numpes && twoAwayY < 0 ) {
1223  twoAwayY = 1;
1224  numPatches = patchMap->sizeGrid(
1225  xmin,xmax,lattice,patchSize,maxNumPatches,params->staticAtomAssignment,
1226  twoAwayX>0 ? 2 : 1, twoAwayY>0 ? 2 : 1, twoAwayZ>0 ? 2 : 1);
1227  }
1228  if ( numPatches < numpes && twoAwayZ < 0 ) {
1229  twoAwayZ = 1;
1230  numPatches = patchMap->sizeGrid(
1231  xmin,xmax,lattice,patchSize,maxNumPatches,params->staticAtomAssignment,
1232  twoAwayX>0 ? 2 : 1, twoAwayY>0 ? 2 : 1, twoAwayZ>0 ? 2 : 1);
1233  }
1234  if ( numPatches < numpes ) {
1235  #if defined(NAMD_MIC)
1236  NAMD_die("MIC-enabled NAMD requires at least one patch per thread.");
1237  #endif
1238  }
1239  if ( numPatches % numpes && numPatches <= 1.4 * numpes ) {
1240  int exactFit = numPatches - numPatches % numpes;
1241  int newNumPatches = patchMap->sizeGrid(
1242  xmin,xmax,lattice,patchSize,exactFit,params->staticAtomAssignment,
1243  twoAwayX>0 ? 2 : 1, twoAwayY>0 ? 2 : 1, twoAwayZ>0 ? 2 : 1);
1244  if ( newNumPatches == exactFit ) {
1245  iout << iINFO << "REDUCING NUMBER OF PATCHES TO IMPROVE LOAD BALANCE\n" << endi;
1246  maxNumPatches = exactFit;
1247  }
1248  }
1249 
1250  patchMap->makePatches(xmin,xmax,lattice,patchSize,maxNumPatches,
1251  params->staticAtomAssignment, params->replicaUniformPatchGrids, params->LCPOOn,
1252  twoAwayX>0 ? 2 : 1, twoAwayY>0 ? 2 : 1, twoAwayZ>0 ? 2 : 1);
1253 
1254 #else
1255 
1256  int availPes = numpes;
1257  if ( params->noPatchesOnZero && numpes > 1 ) {
1258  availPes -= 1;
1259  if(params->noPatchesOnOne && numpes > 2)
1260  availPes -= 1;
1261  }
1262 #ifdef MEM_OPT_VERSION
1263  if(params->noPatchesOnOutputPEs && numpes - params->numoutputprocs >2)
1264  {
1265  availPes -= params->numoutputprocs;
1266  if ( params->noPatchesOnZero && numpes > 1 && isOutputProcessor(0)){
1267  availPes++;
1268  }
1269  if ( params->noPatchesOnOne && numpes > 2 && isOutputProcessor(1)){
1270  availPes++;
1271  }
1272  }
1273 #endif
1274 
1275  int numPatches = patchMap->sizeGrid(
1276  xmin,xmax,lattice,patchSize,1.e9,params->staticAtomAssignment,
1277  twoAwayX ? 2 : 1, twoAwayY ? 2 : 1, twoAwayZ ? 2 : 1);
1278  if ( ( numPatches > (0.3*availPes) || numPatches > maxNumPatches
1279  ) && twoAwayZ < 0 ) {
1280  twoAwayZ = 0;
1281  numPatches = patchMap->sizeGrid(
1282  xmin,xmax,lattice,patchSize,1.e9,params->staticAtomAssignment,
1283  twoAwayX ? 2 : 1, twoAwayY ? 2 : 1, twoAwayZ ? 2 : 1);
1284  }
1285  if ( ( numPatches > (0.6*availPes) || numPatches > maxNumPatches
1286  ) && twoAwayY < 0 ) {
1287  twoAwayY = 0;
1288  numPatches = patchMap->sizeGrid(
1289  xmin,xmax,lattice,patchSize,1.e9,params->staticAtomAssignment,
1290  twoAwayX ? 2 : 1, twoAwayY ? 2 : 1, twoAwayZ ? 2 : 1);
1291  }
1292  if ( ( numPatches > availPes || numPatches > maxNumPatches
1293  ) && twoAwayX < 0 ) {
1294  twoAwayX = 0;
1295  numPatches = patchMap->sizeGrid(
1296  xmin,xmax,lattice,patchSize,1.e9,params->staticAtomAssignment,
1297  twoAwayX ? 2 : 1, twoAwayY ? 2 : 1, twoAwayZ ? 2 : 1);
1298  }
1299  if ( numPatches > availPes && numPatches <= (1.4*availPes) && availPes <= maxNumPatches ) {
1300  int newNumPatches = patchMap->sizeGrid(
1301  xmin,xmax,lattice,patchSize,availPes,params->staticAtomAssignment,
1302  twoAwayX ? 2 : 1, twoAwayY ? 2 : 1, twoAwayZ ? 2 : 1);
1303  if ( newNumPatches <= availPes && numPatches <= (1.4*newNumPatches) ) {
1304  iout << iINFO << "REDUCING NUMBER OF PATCHES TO IMPROVE LOAD BALANCE\n" << endi;
1305  maxNumPatches = availPes;
1306  }
1307  }
1308 
1309  patchMap->makePatches(xmin,xmax,lattice,patchSize,maxNumPatches,
1310  params->staticAtomAssignment, params->replicaUniformPatchGrids, params->LCPOOn,
1311  twoAwayX ? 2 : 1, twoAwayY ? 2 : 1, twoAwayZ ? 2 : 1);
1312 
1313 #endif
1314 
1315 }
static Node * Object()
Definition: Node.h:86
std::ostream & iINFO(std::ostream &s)
Definition: InfoStream.C:107
Bool simulateInitialMapping
Vector a_r() const
Definition: Lattice.h:268
Definition: Node.h:78
static PatchMap * Object()
Definition: PatchMap.h:27
__global__ void const int const TileList *__restrict__ TileExcl *__restrict__ const int *__restrict__ const int const float2 *__restrict__ const int *__restrict__ const float3 const float3 const float3 const float4 *__restrict__ const float cudaTextureObject_t cudaTextureObject_t cudaTextureObject_t const int const float const PatchPairRecord *__restrict__ const int *__restrict__ const int2 *__restrict__ const unsigned int *__restrict__ unsigned int *__restrict__ int *__restrict__ int *__restrict__ TileListStat *__restrict__ const BoundingBox *__restrict__ float4 *__restrict__ float4 *__restrict__ float *__restrict__ float *__restrict__ float *__restrict__ float *__restrict__ float *__restrict__ float *__restrict__ float *__restrict__ float *__restrict__ const int numPatches
Definition: Vector.h:64
SimParameters * simParameters
Definition: Node.h:178
Vector c_r() const
Definition: Lattice.h:270
#define DebugM(x, y)
Definition: Debug.h:59
BigReal z
Definition: Vector.h:66
std::ostream & iWARN(std::ostream &s)
Definition: InfoStream.C:108
#define iout
Definition: InfoStream.h:87
int sizeGrid(ScaledPosition xmin, ScaledPosition xmax, const Lattice &lattice, BigReal patchSize, double maxNumPatches, int staticAtomAssignment, int asplit, int bsplit, int csplit)
Definition: PatchMap.C:62
int num_atoms(void)
Definition: PDB.C:323
Vector origin() const
Definition: Lattice.h:262
Vector b_r() const
Definition: Lattice.h:269
Bool staticAtomAssignment
Bool replicaUniformPatchGrids
BigReal x
Definition: Vector.h:66
int numAtoms
Definition: Molecule.h:556
void NAMD_die(const char *err_msg)
Definition: common.C:83
PDB * pdb
Definition: Node.h:180
void makePatches(ScaledPosition xmin, ScaledPosition xmax, const Lattice &lattice, BigReal patchSize, double maxNumPatches, int staticAtomAssignment, int replicaUniformPatchGrids, int lcpo, int asplit, int bsplit, int csplit)
Definition: PatchMap.C:171
void find_extremes(const Lattice &, BigReal frac=1.0)
Definition: PDB.C:438
BigReal y
Definition: Vector.h:66
BigReal patchDimension
infostream & endi(infostream &s)
Definition: InfoStream.C:38
int b_p() const
Definition: Lattice.h:274
int isOutputProcessor(int pe)
int a_p() const
Definition: Lattice.h:273
Molecule * molecule
Definition: Node.h:176
Bool noPatchesOnOutputPEs
void get_extremes(ScaledPosition &xmin, ScaledPosition &xmax) const
Definition: PDB.h:102
double BigReal
Definition: common.h:112
int c_p() const
Definition: Lattice.h:275
void WorkDistrib::peOrderingReady ( )
static

Definition at line 166 of file WorkDistrib.C.

References cuda_initialize(), and mic_initialize().

Referenced by buildNodeAwarePeOrdering().

166  {
167  //CkPrintf("WorkDistrib::peOrderingReady on %d\n", CkMyPe());
168 #ifdef NAMD_CUDA
169  cuda_initialize();
170 #endif
171 #ifdef NAMD_MIC
172  mic_initialize();
173 #endif
174 }
void mic_initialize()
void cuda_initialize()
Definition: DeviceCUDA.C:20
void WorkDistrib::recvComputeMapChanges ( ComputeMapChangeMsg msg)

Definition at line 370 of file WorkDistrib.C.

References ALLBUTME, BUFSIZE, COMPUTEMAPTAG, MOStream::end(), MIStream::get(), NAMD_bug(), ComputeMap::newNode(), ComputeMap::newNumPartitions(), ComputeMap::numComputes(), ComputeMap::Object(), MOStream::put(), ComputeMap::setNewNode(), and ComputeMap::setNewNumPartitions().

370  {
371 
372  delete msg;
373 
374  ComputeMap *computeMap = ComputeMap::Object();
375 
376  int i;
377  int nc = computeMap->numComputes();
378 
379  if ( ! CkMyPe() ) { // send
380  // CkPrintf("At %f on %d WorkDistrib::recvComputeMapChanges %d\n", CmiWallTimer(), CkMyPe(), nc);
381  MOStream *msg = CkpvAccess(comm)->newOutputStream(ALLBUTME, COMPUTEMAPTAG, BUFSIZE);
382  msg->put(nc);
383  for (i=0; i<nc; i++) {
384  int data = computeMap->newNode(i);
385  msg->put(data);
386  }
387  msg->put(nc);
388  for (i=0; i<nc; i++) {
389  char data = computeMap->newNumPartitions(i);
390  msg->put(data);
391  }
392  msg->put(nc);
393  msg->end();
394  delete msg;
395  // CkPrintf("At %f on %d done WorkDistrib::recvComputeMapChanges %d\n", CmiWallTimer(), CkMyPe(), nc);
396  } else if ( ! CkMyRank() ) { // receive
397  // if ( CkMyNode() == 1 ) CkPrintf("At %f on %d WorkDistrib::recvComputeMapChanges %d\n", CmiWallTimer(), CkMyPe(), nc);
398  MIStream *msg = CkpvAccess(comm)->newInputStream(0, COMPUTEMAPTAG);
399  msg->get(i);
400  if ( i != nc ) NAMD_bug("WorkDistrib::recvComputeMapChanges check 1 failed\n");
401  for (i=0; i<nc; i++) {
402  int data;
403  msg->get(data);
404  computeMap->setNewNode(i,data);
405  }
406  msg->get(i);
407  if ( i != nc ) NAMD_bug("WorkDistrib::recvComputeMapChanges check 2 failed\n");
408  for (i=0; i<nc; i++) {
409  char data;
410  msg->get(data);
411  computeMap->setNewNumPartitions(i,data);
412  }
413  msg->get(i);
414  if ( i != nc ) NAMD_bug("WorkDistrib::recvComputeMapChanges check 3 failed\n");
415  delete msg;
416  // if ( CkMyNode() == 1 ) CkPrintf("At %f on %d done WorkDistrib::recvComputeMapChanges %d\n", CmiWallTimer(), CkMyPe(), nc);
417  }
418 
419  CkCallback cb(CkIndex_WorkDistrib::doneSaveComputeMap(NULL), 0, thisgroup);
420  contribute(0, NULL, CkReduction::random, cb);
421 }
void end(void)
Definition: MStream.C:176
void setNewNumPartitions(ComputeID cid, char numPartitions)
Definition: ComputeMap.h:144
int numComputes(void)
Definition: ComputeMap.h:101
#define ALLBUTME
Definition: Communicate.h:14
MIStream * get(char &data)
Definition: MStream.h:29
char newNumPartitions(ComputeID cid)
Definition: ComputeMap.h:141
void NAMD_bug(const char *err_msg)
Definition: common.C:123
#define COMPUTEMAPTAG
Definition: common.h:157
void setNewNode(ComputeID cid, NodeID node)
Definition: ComputeMap.h:120
#define BUFSIZE
Definition: Communicate.h:15
static ComputeMap * Object()
Definition: ComputeMap.h:89
MOStream * put(char data)
Definition: MStream.h:112
NodeID newNode(ComputeID cid)
Definition: ComputeMap.h:116
void WorkDistrib::reinitAtoms ( const char *  basename = 0)

Definition at line 952 of file WorkDistrib.C.

References atoms, createAtomLists(), PatchMap::numPatches(), numPatches, PatchMap::Object(), and PatchMgr::sendAtoms().

952  {
953 
954  PatchMap *patchMap = PatchMap::Object();
955  CProxy_PatchMgr pm(CkpvAccess(BOCclass_group).patchMgr);
956  PatchMgr *patchMgr = pm.ckLocalBranch();
957 
958  int numPatches = patchMap->numPatches();
959 
960  FullAtomList *atoms = createAtomLists(basename);
961 
962  for(int i=0; i < numPatches; i++) {
963  patchMgr->sendAtoms(i,atoms[i]);
964  }
965 
966  delete [] atoms;
967 
968 }
static PatchMap * Object()
Definition: PatchMap.h:27
__global__ void const int const TileList *__restrict__ TileExcl *__restrict__ const int *__restrict__ const int const float2 *__restrict__ const int *__restrict__ const float3 const float3 const float3 const float4 *__restrict__ const float cudaTextureObject_t cudaTextureObject_t cudaTextureObject_t const int const float const PatchPairRecord *__restrict__ const int *__restrict__ const int2 *__restrict__ const unsigned int *__restrict__ unsigned int *__restrict__ int *__restrict__ int *__restrict__ TileListStat *__restrict__ const BoundingBox *__restrict__ float4 *__restrict__ float4 *__restrict__ float *__restrict__ float *__restrict__ float *__restrict__ float *__restrict__ float *__restrict__ float *__restrict__ float *__restrict__ float *__restrict__ const int numPatches
static __thread atom * atoms
void sendAtoms(PatchID pid, FullAtomList &a)
Definition: PatchMgr.C:157
int numPatches(void) const
Definition: PatchMap.h:59
FullAtomList * createAtomLists(const char *basename=0)
Definition: WorkDistrib.C:618
void WorkDistrib::saveComputeMapChanges ( int  ep,
CkGroupID  chareID 
)

Definition at line 352 of file WorkDistrib.C.

Referenced by ComputeMgr::updateComputes2().

353 {
354  saveComputeMapReturnEP = ep;
355  saveComputeMapReturnChareID = chareID;
356 
357  ComputeMapChangeMsg *mapMsg = new (0, 0, 0) ComputeMapChangeMsg;
358  CProxy_WorkDistrib(thisgroup).recvComputeMapChanges(mapMsg);
359 
360 /*
361  // store the latest compute map
362  SimParameters *simParams = Node::Object()->simParameters;
363  if (simParams->storeComputeMap) {
364  computeMap->saveComputeMap(simParams->computeMapFilename);
365  CkPrintf("ComputeMap has been stored in %s.\n", simParams->computeMapFilename);
366  }
367 */
368 }
void WorkDistrib::savePatchMap ( PatchMapMsg msg)

Definition at line 1014 of file WorkDistrib.C.

References SimParameters::isRecvSpanningTreeUnset(), SimParameters::isSendSpanningTreeUnset(), numPatches, PatchMap::Object(), ProxyMgr::Object(), PatchMapMsg::patchMapData, ProxyMgr::setRecvSpanning(), ProxyMgr::setSendSpanning(), Node::simParameters, split(), and PatchMap::unpack().

1015 {
1016  // Use a resend to forward messages before processing. Otherwise the
1017  // map distribution is slow on many CPUs. We need to use a tree
1018  // rather than a broadcast because some implementations of broadcast
1019  // generate a copy of the message on the sender for each recipient.
1020  // This is because MPI doesn't allow re-use of an outstanding buffer.
1021 
1022  if ( CkMyRank() ) patchMapArrived = true;
1023 
1024  if ( patchMapArrived && CkMyPe() ) {
1026 
1027  //Automatically enable spanning tree
1028  CProxy_Node nd(CkpvAccess(BOCclass_group).node);
1029  Node *node = nd.ckLocalBranch();
1030  SimParameters *params = node->simParameters;
1031  if( ( PatchMap::Object()->numPatches() <= CkNumPes()/4
1032 #ifdef NODEAWARE_PROXY_SPANNINGTREE
1033  || CkNumPes() > CkNumNodes()
1034  ) && ( CkNumNodes() > 1
1035 #endif
1036  ) && params->isSendSpanningTreeUnset() )
1038 
1039 #ifdef NODEAWARE_PROXY_SPANNINGTREE
1040  if ( CkNumPes() > CkNumNodes() && CkNumNodes() > 1
1041  && params->isRecvSpanningTreeUnset() )
1043 #endif
1044  }
1045 
1046  if ( patchMapArrived ) {
1047  if ( CkMyRank() + 1 < CkNodeSize(CkMyNode()) ) {
1048  ((CProxy_WorkDistrib(thisgroup))[CkMyPe()+1]).savePatchMap(msg);
1049  } else {
1050  delete msg;
1051  }
1052  return;
1053  }
1054 
1055  patchMapArrived = true;
1056 
1057  int self = CkMyNode();
1058  int range_begin = 0;
1059  int range_end = CkNumNodes();
1060  while ( self != range_begin ) {
1061  ++range_begin;
1062  int split = range_begin + ( range_end - range_begin ) / 2;
1063  if ( self < split ) { range_end = split; }
1064  else { range_begin = split; }
1065  }
1066  int send_near = self + 1;
1067  int send_far = send_near + ( range_end - send_near ) / 2;
1068 
1069  int pids[3];
1070  int npid = 0;
1071  if ( send_far < range_end ) pids[npid++] = CkNodeFirst(send_far);
1072  if ( send_near < send_far ) pids[npid++] = CkNodeFirst(send_near);
1073  pids[npid++] = CkMyPe(); // always send the message to ourselves
1074  CProxy_WorkDistrib(thisgroup).savePatchMap(msg,npid,pids);
1075 }
int isSendSpanningTreeUnset()
void setRecvSpanning()
Definition: ProxyMgr.C:371
static ProxyMgr * Object()
Definition: ProxyMgr.h:394
Definition: Node.h:78
int isRecvSpanningTreeUnset()
static PatchMap * Object()
Definition: PatchMap.h:27
__global__ void const int const TileList *__restrict__ TileExcl *__restrict__ const int *__restrict__ const int const float2 *__restrict__ const int *__restrict__ const float3 const float3 const float3 const float4 *__restrict__ const float cudaTextureObject_t cudaTextureObject_t cudaTextureObject_t const int const float const PatchPairRecord *__restrict__ const int *__restrict__ const int2 *__restrict__ const unsigned int *__restrict__ unsigned int *__restrict__ int *__restrict__ int *__restrict__ TileListStat *__restrict__ const BoundingBox *__restrict__ float4 *__restrict__ float4 *__restrict__ float *__restrict__ float *__restrict__ float *__restrict__ float *__restrict__ float *__restrict__ float *__restrict__ float *__restrict__ float *__restrict__ const int numPatches
SimParameters * simParameters
Definition: Node.h:178
void setSendSpanning()
Definition: ProxyMgr.C:362
char * patchMapData
Definition: WorkDistrib.C:975
void unpack(char *buf)
Definition: PatchMap.C:365
std::vector< std::string > split(const std::string &text, std::string delimiter)
Definition: MoleculeQM.C:73
void savePatchMap(PatchMapMsg *msg)
Definition: WorkDistrib.C:1014
void WorkDistrib::send_contributeHostDeviceLDB ( int  peSetLen,
int *  peSet 
)
static

Definition at line 3390 of file WorkDistrib.C.

3390  {
3391  #if defined(NAMD_MIC)
3392  CProxy_WorkDistrib wdProxy(CkpvAccess(BOCclass_group).workDistrib);
3393  wdProxy[0].contributeHostDeviceLDB(peSetLen, peSet);
3394  #endif
3395 }
void WorkDistrib::send_initHostDeviceLDB ( )
static

Definition at line 3377 of file WorkDistrib.C.

3377  {
3378  #if defined(NAMD_MIC)
3379  CProxy_WorkDistrib wdProxy(CkpvAccess(BOCclass_group).workDistrib);
3380  wdProxy.initHostDeviceLDB();
3381  #endif
3382 }
void WorkDistrib::send_setDeviceLDBParams ( int  dt,
int  hs,
int  sp1,
int  pp1,
int  pp2 
)
static

Definition at line 3403 of file WorkDistrib.C.

3403  {
3404  #if defined(NAMD_MIC)
3405  CProxy_WorkDistrib wdProxy(CkpvAccess(BOCclass_group).workDistrib);
3406  wdProxy.setDeviceLDBParams(dt, hs, sp1, pp1, pp2);
3407  #endif
3408 }
void WorkDistrib::sendComputeMap ( void  )

Definition at line 1078 of file WorkDistrib.C.

References ALLBUTME, BUFSIZE, COMPUTEMAPTAG, MOStream::end(), ComputeMap::initPtrs(), ComputeMap::Object(), ComputeMap::pack(), and ComputeMap::unpack().

Referenced by Node::startup().

1079 {
1080  if ( CkMyRank() ) return;
1081 
1082  if ( CkNumNodes() == 1 ) {
1083  computeMapArrived = true;
1085  return;
1086  }
1087 
1088  if ( ! CkMyPe() ) { // send
1089  MOStream *msg = CkpvAccess(comm)->newOutputStream(ALLBUTME, COMPUTEMAPTAG, BUFSIZE);
1090  ComputeMap::Object()->pack(msg);
1091  msg->end();
1092  delete msg;
1093  } else if ( ! CkMyRank() ) { // receive
1094  MIStream *msg = CkpvAccess(comm)->newInputStream(0, COMPUTEMAPTAG);
1095  ComputeMap::Object()->unpack(msg);
1096  delete msg;
1097  }
1098 
1099  computeMapArrived = true;
1101 }
void end(void)
Definition: MStream.C:176
void initPtrs()
Definition: ComputeMap.C:82
#define ALLBUTME
Definition: Communicate.h:14
void pack(MOStream *msg)
Definition: ComputeMap.C:63
#define COMPUTEMAPTAG
Definition: common.h:157
#define BUFSIZE
Definition: Communicate.h:15
static ComputeMap * Object()
Definition: ComputeMap.h:89
void unpack(MIStream *msg)
Definition: ComputeMap.C:70
void WorkDistrib::sendPatchMap ( void  )

Definition at line 978 of file WorkDistrib.C.

References SimParameters::isRecvSpanningTreeUnset(), SimParameters::isSendSpanningTreeUnset(), numPatches, PatchMap::Object(), ProxyMgr::Object(), PatchMap::pack(), PatchMap::packSize(), PatchMapMsg::patchMapData, ProxyMgr::setRecvSpanning(), ProxyMgr::setSendSpanning(), and Node::simParameters.

Referenced by Node::startup().

979 {
980  if ( CkNumPes() == 1 ) {
981  patchMapArrived = true;
982  return;
983  }
984 
985  //Automatically enable spanning tree
986  CProxy_Node nd(CkpvAccess(BOCclass_group).node);
987  Node *node = nd.ckLocalBranch();
988  SimParameters *params = node->simParameters;
989  if( ( PatchMap::Object()->numPatches() <= CkNumPes()/4
990 #ifdef NODEAWARE_PROXY_SPANNINGTREE
991  || CkNumPes() > CkNumNodes()
992  ) && ( CkNumNodes() > 1
993 #endif
994  ) && params->isSendSpanningTreeUnset() )
996 
997 #ifdef NODEAWARE_PROXY_SPANNINGTREE
998  if ( CkNumPes() > CkNumNodes() && CkNumNodes() > 1
999  && params->isRecvSpanningTreeUnset() )
1001 #endif
1002 
1003  int size = PatchMap::Object()->packSize();
1004 
1005  PatchMapMsg *mapMsg = new (size, 0) PatchMapMsg;
1006 
1007  PatchMap::Object()->pack(mapMsg->patchMapData, size);
1008 
1009  CProxy_WorkDistrib workProxy(thisgroup);
1010  workProxy[0].savePatchMap(mapMsg);
1011 }
int isSendSpanningTreeUnset()
void setRecvSpanning()
Definition: ProxyMgr.C:371
static ProxyMgr * Object()
Definition: ProxyMgr.h:394
Definition: Node.h:78
int isRecvSpanningTreeUnset()
static PatchMap * Object()
Definition: PatchMap.h:27
__global__ void const int const TileList *__restrict__ TileExcl *__restrict__ const int *__restrict__ const int const float2 *__restrict__ const int *__restrict__ const float3 const float3 const float3 const float4 *__restrict__ const float cudaTextureObject_t cudaTextureObject_t cudaTextureObject_t const int const float const PatchPairRecord *__restrict__ const int *__restrict__ const int2 *__restrict__ const unsigned int *__restrict__ unsigned int *__restrict__ int *__restrict__ int *__restrict__ TileListStat *__restrict__ const BoundingBox *__restrict__ float4 *__restrict__ float4 *__restrict__ float *__restrict__ float *__restrict__ float *__restrict__ float *__restrict__ float *__restrict__ float *__restrict__ float *__restrict__ float *__restrict__ const int numPatches
SimParameters * simParameters
Definition: Node.h:178
void setSendSpanning()
Definition: ProxyMgr.C:362
int packSize(void)
Definition: PatchMap.C:314
char * patchMapData
Definition: WorkDistrib.C:975
void pack(char *buf, int size)
Definition: PatchMap.C:328
void WorkDistrib::setDeviceLDBParams ( int  dt,
int  hs,
int  sp1,
int  pp1,
int  pp2 
)

Definition at line 3410 of file WorkDistrib.C.

3410  {
3411  #if defined(NAMD_MIC)
3412  mic_setDeviceLDBParams(dt, hs, sp1, pp1, pp2);
3413  #endif
3414 }
void WorkDistrib::setPatchMapArrived ( bool  s)
inline

Definition at line 107 of file WorkDistrib.h.

Referenced by Node::startup().

107 {patchMapArrived=s;}
void WorkDistrib::sortPmePes ( int *  pmepes,
int  xdim,
int  ydim 
)
static

Definition at line 300 of file WorkDistrib.C.

References ResizeArray< T >::begin(), PatchMap::center(), PatchMap::node(), PatchMap::numPatches(), PatchMap::Object(), and recursive_bisect_coord().

Referenced by ComputePmeMgr::initialize().

300  {
301  int numpes = CkNumPes();
302  ResizeArray<int> count(numpes);
303  ResizeArray<ScaledPosition> sumPos(numpes);
304  ResizeArray<ScaledPosition> avgPos(numpes);
305  for ( int i=0; i<numpes; ++i ) {
306  count[i] = 0;
307  sumPos[i] = 0;
308  avgPos[i] = 0;
309  }
310  PatchMap *patchMap = PatchMap::Object();
311  for ( int i=0, npatches=patchMap->numPatches(); i<npatches; ++i ) {
312  int pe = patchMap->node(i);
313  count[pe] += 1;
314  sumPos[pe] += patchMap->center(i);
315  }
316  const int npmepes = xdim*ydim;
317  ResizeArray<int> sortpes(npmepes);
318  for ( int i=0; i<npmepes; ++i ) {
319  int pe = sortpes[i] = pmepes[i];
320  int cnt = count[pe];
321  ScaledPosition sum = sumPos[pe];
322  if ( cnt == 0 ) {
323  // average over node
324  int node = CkNodeOf(pe);
325  int nsize = CkNodeSize(node);
326  int pe2 = CkNodeFirst(node);
327  for ( int j=0; j<nsize; ++j, ++pe2 ) {
328  cnt += count[pe2];
329  sum += sumPos[pe2];
330  }
331  }
332  if ( cnt == 0 ) {
333  // average over physical node
334  int node = CmiPhysicalNodeID(pe);
335  int nsize, *nlist;
336  CmiGetPesOnPhysicalNode(node, &nlist, &nsize);
337  for ( int j=0; j<nsize; ++j ) {
338  int pe2 = nlist[j];
339  cnt += count[pe2];
340  sum += sumPos[pe2];
341  }
342  }
343  if ( cnt ) {
344  avgPos[pe] = sum / cnt;
345  }
346  }
347  recursive_bisect_coord(0, xdim, 0, ydim, sortpes.begin(), avgPos.begin(), pmepes, ydim);
348 }
static PatchMap * Object()
Definition: PatchMap.h:27
Definition: Vector.h:64
static void recursive_bisect_coord(int x_begin, int x_end, int y_begin, int y_end, int *pe_begin, ScaledPosition *coord, int *result, int ydim)
Definition: WorkDistrib.C:268
ScaledPosition center(int pid) const
Definition: PatchMap.h:99
int numPatches(void) const
Definition: PatchMap.h:59
int node(int pid) const
Definition: PatchMap.h:114

Member Data Documentation

int * WorkDistrib::peCompactOrdering
static

Definition at line 117 of file WorkDistrib.h.

Referenced by buildNodeAwarePeOrdering().

int * WorkDistrib::peCompactOrderingIndex
static
int * WorkDistrib::peDiffuseOrdering
static
int * WorkDistrib::peDiffuseOrderingIndex
static
int WorkDistrib::peOrderingInit
static

Definition at line 114 of file WorkDistrib.h.

Referenced by buildNodeAwarePeOrdering().


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