Changeset 7ff84e0


Ignore:
Timestamp:
08/26/16 20:03:03 (8 years ago)
Author:
Hal Finkel <hfinkel@…>
Branches:
master, pympi
Children:
95f86a3
Parents:
fc4fc2f
git-author:
Hal Finkel <hfinkel@…> (08/26/16 20:03:03)
git-committer:
Hal Finkel <hfinkel@…> (08/26/16 20:03:03)
Message:

When rewriting, allow for redistribution; preserve topology info when a cart comm can be created

File:
1 edited

Legend:

Unmodified
Added
Removed
  • GenericIORewrite.cxx

    rfc4fc2f r7ff84e0  
    3939 
    4040    GenericIO GIO(MPI_COMM_WORLD, FileName, Method); 
    41     GIO.openAndReadHeader(GenericIO::MismatchDisallowed); 
     41    GIO.openAndReadHeader(GenericIO::MismatchRedistribute); 
     42 
     43    int NR = GIO.readNRanks(); 
     44    if (!Rank && NR != NRanks) { 
     45      cout << "Redistributing data from " << NR << " ranks to " << NRanks << 
     46              " ranks; dropping rank topology information!\n"; 
     47    } 
    4248 
    4349    vector<GenericIO::VariableInfo> VI; 
     
    5864    GIO.readData(-1, false); 
    5965 
    60     GenericIO NewGIO(MPI_COMM_WORLD, NewFileName); 
     66    MPI_Comm Comm = MPI_COMM_WORLD; 
     67    if (NR == NRanks) { 
     68      int Periods[3] = { 0, 0, 0 }; 
     69      int Dims[3]; 
     70      GIO.readDims(Dims); 
     71      MPI_Cart_create(Comm, 3, Dims, Periods, 0, &Comm); 
     72    } 
     73 
     74    GenericIO NewGIO(Comm, NewFileName); 
    6175    NewGIO.setNumElems(NElem); 
    6276 
Note: See TracChangeset for help on using the changeset viewer.