void Teuchos::updateParametersFromXmlFileAndBroadcast( const std::string &xmlFileName, const Ptr<ParameterList> ¶mList, const Comm<int> &comm ) { if (comm.getSize()==1) updateParametersFromXmlFile(xmlFileName, paramList); else { if (comm.getRank()==0) { XMLParameterListReader xmlPLReader; xmlPLReader.setAllowsDuplicateSublists( false ); FileInputSource xmlFile(xmlFileName); XMLObject xmlParams = xmlFile.getObject(); std::string xmlString = toString(xmlParams); int strsize = xmlString.size(); broadcast<int, int>(comm, 0, &strsize); broadcast<int, char>(comm, 0, strsize, &xmlString[0]); updateParametersFromXmlString(xmlString, paramList); } else { int strsize; broadcast<int, int>(comm, 0, &strsize); std::string xmlString; xmlString.resize(strsize); broadcast<int, char>(comm, 0, strsize, &xmlString[0]); updateParametersFromXmlString(xmlString, paramList); } } }
void mergeCounterNames (const Comm<int>& comm, const Array<std::string>& localNames, Array<std::string>& globalNames, const ECounterSetOp setOp) { const int myRank = comm.getRank(); const int left = 0; const int right = comm.getSize() - 1; Array<std::string> theGlobalNames; mergeCounterNamesHelper (comm, myRank, left, right, localNames, theGlobalNames, setOp); // Proc 0 has the list of counter names. Now broadcast it back to // all the procs. broadcastStrings (comm, theGlobalNames); // "Transactional" semantics ensure strong exception safety for // output. globalNames.swap (theGlobalNames); }
MachineRepresentation(const Comm<int> &comm): networkDim(0), numProcs(comm.getSize()), myRank(comm.getRank()), procCoords(NULL) { // WIll need this constructor to be specific to RAAMP (MD). // Will need a default constructor using, e.g., GeometricGenerator // or nothing at all, for when RAAMP is not available as TPL. // // (AG) In addition, need to be able to run without special // privileges in system (e.g., on hopper). // Notes: For now, all cores connected to same NIC will get the // same coordinates; later, we could add extra coordinate dimensions // to represent nodes or dies (using hwloc info through RAAMP // data object). // (MD) will modify mapping test to use machine representation // #ifdef HAVE_ZOLTAN2_OVIS // Call initializer for RAAMP data object (AG) //get network dimension. //TODO change. // Call RAAMP Data Object to get the network dimension (AG) networkDim = 3; //allocate memory for processor coordinates. procCoords = new nCoord_t *[networkDim]; for (int i = 0; i < networkDim; ++i){ procCoords[i] = new nCoord_t [numProcs]; memset (procCoords[i], 0, sizeof(nCoord_t) * numProcs); } //obtain the coordinate of the processor. this->getMyCoordinate(/*nCoord_t &xyz[networkDim]*/); // copy xyz into appropriate spot in procCoords. (MD) // KDD I agree with this //reduceAll the coordinates of each processor. this->gatherMachineCoordinates(); }