escript  Revision_
MPIDataReducer.h
Go to the documentation of this file.
1 /*****************************************************************************
2 *
3 * Copyright (c) 2014-2018 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-2017 by Centre for Geoscience Computing (GeoComp)
13 * Development from 2019 by School of Earth and Environmental Sciences
14 **
15 *****************************************************************************/
16 
17 #ifndef __ESCRIPT_MPIDATAREDUCER_H__
18 #define __ESCRIPT_MPIDATAREDUCER_H__
19 
20 #include "AbstractReducer.h"
21 #include "Data.h"
22 
23 namespace escript
24 {
25 
26 // Reduces using pointwise MPI operations
28 {
29 public:
32 
33  // This is not a constructor parameter because
34  // if these are created outside the subworld, they won't have
35  // access to a domain yet.
36  // I also want SplitWorld to be able to set this
38  bool valueCompatible(boost::python::object v);
39  bool reduceLocalValue(boost::python::object v, std::string& errstring);
40  void reset();
41  bool checkRemoteCompatibility(JMPI& mpi_info, std::string& errstring);
42 
43  void getCompatibilityInfo(std::vector<unsigned>& params);
44 
45  // talk to corresponding processes in other subworlds
46  bool reduceRemoteValues(MPI_Comm& com);
47 
48  // human readable description
49  std::string description();
50 
51  // Get a value for this variable from another process
52  // This is not a reduction and will replace any existing value
53  bool recvFrom(int localid, int source, JMPI& mpiinfo);
54 
55  // Send a value to this variable to another process
56  // This is not a reduction and will replace any existing value
57  bool sendTo(int localid, int target, JMPI& mpiinfo);
58  virtual boost::python::object getPyObj();
59 
60  // send from proc 0 in the communicator to all others
61  bool groupSend(MPI_Comm& com, bool imsending);
62 
63  bool canClash();
64 
65  // reduction with some procs submitting identity values
66  bool groupReduce(MPI_Comm& com, char mystate);
67 
68 
69  void newRunJobs();
70  void copyValueFrom(boost::shared_ptr<AbstractReducer>& src);
71 private:
76 };
77 
79 Reducer_ptr makeDataReducer(std::string type);
80 
81 }
82 
83 #endif // __ESCRIPT_MPIDATAREDUCER_H__
84 
int MPI_Op
Definition: EsysMPI.h:46
int MPI_Comm
Definition: EsysMPI.h:44
Definition: AbstractReducer.h:44
Data represents a collection of datapoints.
Definition: Data.h:64
Definition: MPIDataReducer.h:28
escript::Data value
Definition: MPIDataReducer.h:72
bool sendTo(int localid, int target, JMPI &mpiinfo)
Definition: MPIDataReducer.cpp:348
void copyValueFrom(boost::shared_ptr< AbstractReducer > &src)
Definition: MPIDataReducer.cpp:573
escript::const_Domain_ptr dom
Definition: MPIDataReducer.h:73
bool canClash()
Definition: MPIDataReducer.cpp:592
bool groupReduce(MPI_Comm &com, char mystate)
Definition: MPIDataReducer.cpp:568
virtual boost::python::object getPyObj()
Definition: MPIDataReducer.cpp:414
bool reduceLocalValue(boost::python::object v, std::string &errstring)
Definition: MPIDataReducer.cpp:119
bool checkRemoteCompatibility(JMPI &mpi_info, std::string &errstring)
Definition: MPIDataReducer.cpp:180
std::string description()
Definition: MPIDataReducer.cpp:90
bool groupSend(MPI_Comm &com, bool imsending)
Definition: MPIDataReducer.cpp:423
bool had_an_export_this_round
Definition: MPIDataReducer.h:75
void reset()
Definition: MPIDataReducer.cpp:174
void setDomain(escript::Domain_ptr d)
Definition: MPIDataReducer.cpp:85
void newRunJobs()
Definition: MPIDataReducer.cpp:80
bool reduceRemoteValues(MPI_Comm &com)
Definition: MPIDataReducer.cpp:227
bool recvFrom(int localid, int source, JMPI &mpiinfo)
Definition: MPIDataReducer.cpp:299
bool valueCompatible(boost::python::object v)
Definition: MPIDataReducer.cpp:100
MPI_Op reduceop
Definition: MPIDataReducer.h:74
MPIDataReducer(MPI_Op op)
Definition: MPIDataReducer.cpp:66
void getCompatibilityInfo(std::vector< unsigned > &params)
Definition: MPIDataReducer.cpp:257
~MPIDataReducer()
Definition: MPIDataReducer.h:31
#define ESCRIPT_DLL_API
Definition: escriptcore/src/system_dep.h:30
Definition: AbstractContinuousDomain.cpp:23
boost::shared_ptr< AbstractReducer > Reducer_ptr
Definition: AbstractReducer.h:119
boost::shared_ptr< const AbstractDomain > const_Domain_ptr
Definition: AbstractDomain.h:44
Reducer_ptr makeDataReducer(std::string type)
Definition: MPIDataReducer.cpp:47
boost::shared_ptr< AbstractDomain > Domain_ptr
Definition: AbstractDomain.h:41
boost::shared_ptr< JMPI_ > JMPI
Definition: EsysMPI.h:74