escript  Revision_
MPIDataReducer.h
Go to the documentation of this file.
1 /*****************************************************************************
2 *
3 * Copyright (c) 2014-2016 by The University of Queensland
4 * http://www.uq.edu.au
5 *
6 * Primary Business: Queensland, Australia
7 * Licensed under the Apache License, version 2.0
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
11 * Development 2012-2013 by School of Earth Sciences
12 * Development from 2014 by Centre for Geoscience Computing (GeoComp)
13 *
14 *****************************************************************************/
15 
16 #ifndef __ESCRIPT_MPIDATAREDUCER_H__
17 #define __ESCRIPT_MPIDATAREDUCER_H__
18 
19 #include "AbstractReducer.h"
20 #include "Data.h"
21 
22 namespace escript
23 {
24 
25 // Reduces using pointwise MPI operations
27 {
28 public:
31 
32  // This is not a constructor parameter because
33  // if these are created outside the subworld, they won't have
34  // access to a domain yet.
35  // I also want SplitWorld to be able to set this
37  bool valueCompatible(boost::python::object v);
38  bool reduceLocalValue(boost::python::object v, std::string& errstring);
39  void reset();
40  bool checkRemoteCompatibility(JMPI& mpi_info, std::string& errstring);
41 
42  void getCompatibilityInfo(std::vector<unsigned>& params);
43 
44  // talk to corresponding processes in other subworlds
45  bool reduceRemoteValues(MPI_Comm& com);
46 
47  // human readable description
48  std::string description();
49 
50  // Get a value for this variable from another process
51  // This is not a reduction and will replace any existing value
52  bool recvFrom(int localid, int source, JMPI& mpiinfo);
53 
54  // Send a value to this variable to another process
55  // This is not a reduction and will replace any existing value
56  bool sendTo(int localid, int target, JMPI& mpiinfo);
57  virtual boost::python::object getPyObj();
58 
59  // send from proc 0 in the communicator to all others
60  bool groupSend(MPI_Comm& com, bool imsending);
61 
62  bool canClash();
63 
64  // reduction with some procs submitting identity values
65  bool groupReduce(MPI_Comm& com, char mystate);
66 
67 
68  void newRunJobs();
69  void copyValueFrom(boost::shared_ptr<AbstractReducer>& src);
70 private:
75 };
76 
77 Reducer_ptr makeDataReducer(std::string type);
78 
79 }
80 
81 #endif // __ESCRIPT_MPIDATAREDUCER_H__
82 
Reducer_ptr makeDataReducer(std::string type)
Definition: MPIDataReducer.cpp:46
int MPI_Op
Definition: EsysMPI.h:43
bool had_an_export_this_round
Definition: MPIDataReducer.h:74
boost::shared_ptr< AbstractDomain > Domain_ptr
Definition: AbstractDomain.h:36
void copyValueFrom(boost::shared_ptr< AbstractReducer > &src)
Definition: MPIDataReducer.cpp:572
bool canClash()
Definition: MPIDataReducer.cpp:591
escript::const_Domain_ptr dom
Definition: MPIDataReducer.h:72
std::string description()
Definition: MPIDataReducer.cpp:89
Definition: AbstractContinuousDomain.cpp:22
void newRunJobs()
Definition: MPIDataReducer.cpp:79
Definition: AbstractReducer.h:41
boost::shared_ptr< JMPI_ > JMPI
Definition: EsysMPI.h:71
virtual boost::python::object getPyObj()
Definition: MPIDataReducer.cpp:413
bool recvFrom(int localid, int source, JMPI &mpiinfo)
Definition: MPIDataReducer.cpp:298
void reset()
Definition: MPIDataReducer.cpp:173
MPI_Op reduceop
Definition: MPIDataReducer.h:73
boost::shared_ptr< AbstractReducer > Reducer_ptr
Definition: AbstractReducer.h:117
void getCompatibilityInfo(std::vector< unsigned > &params)
Definition: MPIDataReducer.cpp:256
bool groupReduce(MPI_Comm &com, char mystate)
Definition: MPIDataReducer.cpp:567
~MPIDataReducer()
Definition: MPIDataReducer.h:30
void setDomain(escript::Domain_ptr d)
Definition: MPIDataReducer.cpp:84
Data represents a collection of datapoints.
Definition: Data.h:63
bool reduceRemoteValues(MPI_Comm &com)
Definition: MPIDataReducer.cpp:226
int MPI_Comm
Definition: EsysMPI.h:41
Definition: MPIDataReducer.h:26
bool reduceLocalValue(boost::python::object v, std::string &errstring)
Definition: MPIDataReducer.cpp:118
MPIDataReducer(MPI_Op op)
Definition: MPIDataReducer.cpp:65
bool valueCompatible(boost::python::object v)
Definition: MPIDataReducer.cpp:99
escript::Data value
Definition: MPIDataReducer.h:71
bool checkRemoteCompatibility(JMPI &mpi_info, std::string &errstring)
Definition: MPIDataReducer.cpp:179
boost::shared_ptr< const AbstractDomain > const_Domain_ptr
Definition: AbstractDomain.h:39
bool groupSend(MPI_Comm &com, bool imsending)
Definition: MPIDataReducer.cpp:422
bool sendTo(int localid, int target, JMPI &mpiinfo)
Definition: MPIDataReducer.cpp:347