/[escript]/trunk/escriptcore/src/MPIDataReducer.cpp
ViewVC logotype

Diff of /trunk/escriptcore/src/MPIDataReducer.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 5683 by jfenwick, Wed Jun 24 02:00:12 2015 UTC revision 5697 by jfenwick, Fri Jun 26 04:29:19 2015 UTC
# Line 155  bool MPIDataReducer::reduceLocalValue(bo Line 155  bool MPIDataReducer::reduceLocalValue(bo
155      {      {
156          if (had_an_export_this_round)          if (had_an_export_this_round)
157          {          {
158            reset();
159          errstring="reduceLocalValue: Multiple 'simultaneous' attempts to export a 'SET' variable.";          errstring="reduceLocalValue: Multiple 'simultaneous' attempts to export a 'SET' variable.";
160          return false;          return false;
161          }          }
# Line 229  bool MPIDataReducer::checkRemoteCompatib Line 230  bool MPIDataReducer::checkRemoteCompatib
230    
231  // By the time this function is called, we know that all the values  // By the time this function is called, we know that all the values
232  // are compatible  // are compatible
233  bool MPIDataReducer::reduceRemoteValues(esysUtils::JMPI& mpi_info, bool active)  bool MPIDataReducer::reduceRemoteValues(MPI_Comm& comm)
234  {  {
     if (!active)  
     {  
     return false;   // shutting down this option until I implement it  
     }  
235  #ifdef ESYS_MPI  #ifdef ESYS_MPI
236      DataTypes::ValueType& vr=value.getExpandedVectorReference();      DataTypes::ValueType& vr=value.getExpandedVectorReference();
237      Data result(0, value.getDataPointShape(), value.getFunctionSpace(), true);      Data result(0, value.getDataPointShape(), value.getFunctionSpace(), true);
238      DataTypes::ValueType& rr=result.getExpandedVectorReference();      DataTypes::ValueType& rr=result.getExpandedVectorReference();
239      if (reduceop==MPI_OP_NULL)      if (reduceop==MPI_OP_NULL)
240      {      {
241        reset();    // we can't be sure what the value should be
242      return false;       // this will stop bad things happening but won't give an informative error message      return false;       // this will stop bad things happening but won't give an informative error message
243      }      }
244      if (MPI_Allreduce(&(vr[0]), &(rr[0]), vr.size(), MPI_DOUBLE, reduceop, mpi_info->comm)!=MPI_SUCCESS)      if (MPI_Allreduce(&(vr[0]), &(rr[0]), vr.size(), MPI_DOUBLE, reduceop, comm)!=MPI_SUCCESS)
245      {      {
246      return false;      return false;
247      }      }
# Line 304  void MPIDataReducer::getCompatibilityInf Line 302  void MPIDataReducer::getCompatibilityInf
302      // This is not a reduction and will replace any existing value      // This is not a reduction and will replace any existing value
303  bool MPIDataReducer::recvFrom(Esys_MPI_rank localid, Esys_MPI_rank source, esysUtils::JMPI& mpiinfo)  bool MPIDataReducer::recvFrom(Esys_MPI_rank localid, Esys_MPI_rank source, esysUtils::JMPI& mpiinfo)
304  {  {
305  #ifdef ESYS_MPI    #ifdef ESYS_MPI
306        // first we need to find out what we are expecting        // first we need to find out what we are expecting
307      unsigned params[7];      unsigned params[7];
308      MPI_Status stat;      MPI_Status stat;
# Line 442  bool MPIDataReducer::groupSend(MPI_Comm& Line 440  bool MPIDataReducer::groupSend(MPI_Comm&
440        }        }
441        else  // we are receiving        else  // we are receiving
442        {        {
443        
444          // first we need to find out what we are expecting          // first we need to find out what we are expecting
445        unsigned params[7];        unsigned params[7];
446        if (MPI_Bcast(params, 7, MPI_UNSIGNED, 0, comm)!=MPI_SUCCESS)        if (MPI_Bcast(params, 7, MPI_UNSIGNED, 0, comm)!=MPI_SUCCESS)
# Line 492  bool MPIDataReducer::groupSend(MPI_Comm& Line 491  bool MPIDataReducer::groupSend(MPI_Comm&
491      return true;      return true;
492  }  }
493    
494        // We assume compatible values at this point
495  bool MPIDataReducer::groupReduce(MPI_Comm& com, char mystate)  bool MPIDataReducer::groupReduce(MPI_Comm& com, char mystate)
496  {  {
497      throw SplitWorldException("groupReduce Not implemented yet.");      throw SplitWorldException("groupReduce Not implemented yet.");
# Line 516  void MPIDataReducer::copyValueFrom(boost Line 516  void MPIDataReducer::copyValueFrom(boost
516      valueadded=true;      valueadded=true;
517  }  }
518    
519    bool MPIDataReducer::canClash()
520    {
521        return (reduceop==MPI_OP_NULL);
522    }

Legend:
Removed from v.5683  
changed lines
  Added in v.5697

  ViewVC Help
Powered by ViewVC 1.1.26