--- trunk/src/brains/SimCreator.cpp 2012/08/30 17:18:22 1790 +++ trunk/src/brains/SimCreator.cpp 2012/09/10 18:38:44 1796 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005 The University of Notre Dame. All Rights Reserved. + * copyright (c) 2005 The University of Notre Dame. All Rights Reserved. * * The University of Notre Dame grants you ("Licensee") a * non-exclusive, royalty free, license to use, modify and @@ -100,33 +100,33 @@ namespace OpenMD { #ifdef IS_MPI int streamSize; const int masterNode = 0; - int commStatus; + if (worldRank == masterNode) { - commStatus = MPI_Bcast(&mdFileVersion, 1, MPI_INT, masterNode, MPI_COMM_WORLD); + MPI::COMM_WORLD.Bcast(&mdFileVersion, 1, MPI::INT, masterNode); #endif SimplePreprocessor preprocessor; - preprocessor.preprocess(rawMetaDataStream, filename, startOfMetaDataBlock, ppStream); + preprocessor.preprocess(rawMetaDataStream, filename, startOfMetaDataBlock, + ppStream); #ifdef IS_MPI //brocasting the stream size streamSize = ppStream.str().size() +1; - commStatus = MPI_Bcast(&streamSize, 1, MPI_LONG, masterNode, MPI_COMM_WORLD); - - commStatus = MPI_Bcast(static_cast(const_cast(ppStream.str().c_str())), streamSize, MPI_CHAR, masterNode, MPI_COMM_WORLD); - + MPI::COMM_WORLD.Bcast(&streamSize, 1, MPI::LONG, masterNode); + MPI::COMM_WORLD.Bcast(static_cast(const_cast(ppStream.str().c_str())), + streamSize, MPI::CHAR, masterNode); } else { - commStatus = MPI_Bcast(&mdFileVersion, 1, MPI_INT, masterNode, MPI_COMM_WORLD); + MPI::COMM_WORLD.Bcast(&mdFileVersion, 1, MPI::INT, masterNode); //get stream size - commStatus = MPI_Bcast(&streamSize, 1, MPI_LONG, masterNode, MPI_COMM_WORLD); + MPI::COMM_WORLD.Bcast(&streamSize, 1, MPI::LONG, masterNode); char* buf = new char[streamSize]; assert(buf); //receive file content - commStatus = MPI_Bcast(buf, streamSize, MPI_CHAR, masterNode, MPI_COMM_WORLD); + MPI::COMM_WORLD.Bcast(buf, streamSize, MPI::CHAR, masterNode); ppStream.str(buf); delete [] buf; @@ -499,7 +499,6 @@ namespace OpenMD { int nTarget; int done; int i; - int j; int loops; int which_proc; int nProcessors; @@ -507,7 +506,7 @@ namespace OpenMD { int nGlobalMols = info->getNGlobalMolecules(); std::vector molToProcMap(nGlobalMols, -1); // default to an error condition: - MPI_Comm_size(MPI_COMM_WORLD, &nProcessors); + nProcessors = MPI::COMM_WORLD.Get_size(); if (nProcessors > nGlobalMols) { sprintf(painCave.errMsg, @@ -622,13 +621,11 @@ namespace OpenMD { delete myRandom; // Spray out this nonsense to all other processors: - - MPI_Bcast(&molToProcMap[0], nGlobalMols, MPI_INT, 0, MPI_COMM_WORLD); + MPI::COMM_WORLD.Bcast(&molToProcMap[0], nGlobalMols, MPI::INT, 0); } else { // Listen to your marching orders from processor 0: - - MPI_Bcast(&molToProcMap[0], nGlobalMols, MPI_INT, 0, MPI_COMM_WORLD); + MPI::COMM_WORLD.Bcast(&molToProcMap[0], nGlobalMols, MPI::INT, 0); } info->setMolToProcMap(molToProcMap); @@ -852,8 +849,9 @@ namespace OpenMD { // This would be prettier if we could use MPI_IN_PLACE like the MPI-2 // docs said we could. std::vector tmpGroupMembership(info->getNGlobalAtoms(), 0); - MPI_Allreduce(&globalGroupMembership[0], &tmpGroupMembership[0], nGlobalAtoms, - MPI_INT, MPI_SUM, MPI_COMM_WORLD); + MPI::COMM_WORLD.Allreduce(&globalGroupMembership[0], + &tmpGroupMembership[0], nGlobalAtoms, + MPI::INT, MPI::SUM); info->setGlobalGroupMembership(tmpGroupMembership); #else info->setGlobalGroupMembership(globalGroupMembership); @@ -870,9 +868,9 @@ namespace OpenMD { #ifdef IS_MPI std::vector tmpMolMembership(info->getNGlobalAtoms(), 0); - - MPI_Allreduce(&globalMolMembership[0], &tmpMolMembership[0], nGlobalAtoms, - MPI_INT, MPI_SUM, MPI_COMM_WORLD); + MPI::COMM_WORLD.Allreduce(&globalMolMembership[0], &tmpMolMembership[0], + nGlobalAtoms, + MPI::INT, MPI::SUM); info->setGlobalMolMembership(tmpMolMembership); #else @@ -889,8 +887,8 @@ namespace OpenMD { #ifdef IS_MPI std::vector numIntegrableObjectsPerMol(info->getNGlobalMolecules(), 0); - MPI_Allreduce(&nIOPerMol[0], &numIntegrableObjectsPerMol[0], - info->getNGlobalMolecules(), MPI_INT, MPI_SUM, MPI_COMM_WORLD); + MPI::COMM_WORLD.Allreduce(&nIOPerMol[0], &numIntegrableObjectsPerMol[0], + info->getNGlobalMolecules(), MPI::INT, MPI::SUM); #else std::vector numIntegrableObjectsPerMol = nIOPerMol; #endif @@ -920,10 +918,7 @@ namespace OpenMD { } void SimCreator::loadCoordinates(SimInfo* info, const std::string& mdFileName) { - Globals* simParams; - simParams = info->getSimParams(); - DumpReader reader(info, mdFileName); int nframes = reader.getNFrames();