ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/trunk/src/io/DumpWriter.cpp
(Generate patch)

Comparing trunk/src/io/DumpWriter.cpp (file contents):
Revision 1437 by gezelter, Wed Apr 21 14:59:18 2010 UTC vs.
Revision 1564 by chuckv, Wed May 18 19:28:52 2011 UTC

# Line 306 | Line 306 | namespace OpenMD {
306      }
307      
308      const int masterNode = 0;
309 <
309 >    int nProc;
310 >    MPI_Comm_size(MPI_COMM_WORLD, &nProc);
311      if (worldRank == masterNode) {      
312        os << "  <Snapshot>\n";  
313        writeFrameProperties(os, info_->getSnapshotManager()->getCurrentSnapshot());
# Line 314 | Line 315 | namespace OpenMD {
315          
316        os << buffer;
317  
318 <      int nProc;
318 <      MPI_Comm_size(MPI_COMM_WORLD, &nProc);
318 >    
319        for (int i = 1; i < nProc; ++i) {
320  
321          // receive the length of the string buffer that was
322          // prepared by processor i
323 <
323 >      
324 >        MPI_Bcast(&i, 1, MPI_INT,masterNode,MPI_COMM_WORLD);
325          int recvLength;
326          MPI_Recv(&recvLength, 1, MPI_INT, i, 0, MPI_COMM_WORLD, &istatus);
327          char* recvBuffer = new char[recvLength];
# Line 337 | Line 338 | namespace OpenMD {
338        os.flush();
339      } else {
340        int sendBufferLength = buffer.size() + 1;
341 <      MPI_Send(&sendBufferLength, 1, MPI_INT, masterNode, 0, MPI_COMM_WORLD);
342 <      MPI_Send((void *)buffer.c_str(), sendBufferLength, MPI_CHAR, masterNode, 0, MPI_COMM_WORLD);
341 >      int myturn = 0;
342 >      for (int i = 1; i < nProc; ++i){
343 >        MPI_Bcast(&myturn,1, MPI_INT,masterNode,MPI_COMM_WORLD);
344 >        if (myturn == worldRank){
345 >          MPI_Send(&sendBufferLength, 1, MPI_INT, masterNode, 0, MPI_COMM_WORLD);
346 >          MPI_Send((void *)buffer.c_str(), sendBufferLength, MPI_CHAR, masterNode, 0, MPI_COMM_WORLD);
347 >        }
348 >      }
349      }
350  
351   #endif // is_mpi

Comparing trunk/src/io/DumpWriter.cpp (property svn:keywords):
Revision 1437 by gezelter, Wed Apr 21 14:59:18 2010 UTC vs.
Revision 1564 by chuckv, Wed May 18 19:28:52 2011 UTC

# Line 0 | Line 1
1 + Author Id Revision Date

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines