escript Revision_
SplitWorld.h
Go to the documentation of this file.
1
2/*****************************************************************************
3*
4* Copyright (c) 2014-2018 by The University of Queensland
5* http://www.uq.edu.au
6*
7* Primary Business: Queensland, Australia
8* Licensed under the Apache License, version 2.0
9* http://www.apache.org/licenses/LICENSE-2.0
10*
11* Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12* Development 2012-2013 by School of Earth Sciences
13* Development from 2014-2017 by Centre for Geoscience Computing (GeoComp)
14* Development from 2019 by School of Earth and Environmental Sciences
15**
16*****************************************************************************/
17
18#ifndef escript_SplitWorld_H
19#define escript_SplitWorld_H
20
21#include "AbstractReducer.h"
22#include "SubWorld.h"
23
24#include <boost/python.hpp>
25#include <boost/smart_ptr.hpp>
26
27namespace escript
28{
29
40{
41public:
42 SplitWorld(unsigned int numgroups, MPI_Comm global=MPI_COMM_WORLD);
44 boost::python::object buildDomains(boost::python::tuple t, boost::python::dict kwargs);
45
46 void runJobs();
47
48 void addJob(boost::python::object creator, boost::python::tuple tup, boost::python::dict kw);
49 void addJobPerWorld(boost::python::object creator, boost::python::tuple tup, boost::python::dict kw);
50
51 void addVariable(std::string name, boost::python::object creator, boost::python::tuple ntup, boost::python::dict kwargs);
52 void removeVariable(std::string name);
53 void clearVariable(std::string name);
54 std::list<std::pair<std::string, bool> > getVarList();
55 boost::python::object getVarPyList();
56 boost::python::object getVarPyInfo();
57
58 void clearAllJobs();
59
60 DataTypes::real_t getScalarVariable(const std::string& name);
61 boost::python::object getLocalObjectVariable(const std::string& name);
62
63 int getSubWorldCount();
64 int getSubWorldID();
65
66 void copyVariable(const std::string& src, const std::string& dest);
67
68
69private:
70 JMPI globalcom; // communicator linking all procs used in this splitworld
71 JMPI leadercom; // communicator linking the first proc in each subworld
72 escript::SubWorld_ptr localworld; // subworld which this process belongs to
73 unsigned int swcount; // number of subwords
74 unsigned int localid; // position of localworld in overall world sequence
75
76 // details of jobs to be created
77 std::vector<boost::python::object> create;
78 std::vector<boost::python::tuple> tupargs;
79 std::vector<boost::python::dict> kwargs;
80
81 unsigned int jobcounter; // note that the id of the first job is 1 not 0.
82 bool manualimport; // if false, all reduced vars will be shipped to all subworlds
83 void clearPendingJobs();
84 void distributeJobs();
85
86};
87
88
93boost::python::object raw_buildDomains(boost::python::tuple t, boost::python::dict kwargs);
94
99boost::python::object raw_addJob(boost::python::tuple t, boost::python::dict kwargs);
100
105boost::python::object raw_addJobPerWorld(boost::python::tuple t, boost::python::dict kwargs);
106
111boost::python::object raw_addVariable(boost::python::tuple t, boost::python::dict kwargs);
112}
113#endif
114
#define MPI_COMM_WORLD
Definition EsysMPI.h:50
int MPI_Comm
Definition EsysMPI.h:44
Definition SplitWorld.h:40
unsigned int jobcounter
Definition SplitWorld.h:81
unsigned int localid
Definition SplitWorld.h:74
std::vector< boost::python::object > create
Definition SplitWorld.h:77
unsigned int swcount
Definition SplitWorld.h:73
bool manualimport
Definition SplitWorld.h:82
JMPI leadercom
Definition SplitWorld.h:71
escript::SubWorld_ptr localworld
Definition SplitWorld.h:72
std::vector< boost::python::dict > kwargs
Definition SplitWorld.h:79
std::vector< boost::python::tuple > tupargs
Definition SplitWorld.h:78
JMPI globalcom
Definition SplitWorld.h:70
#define ESCRIPT_DLL_API
Definition escriptcore/src/system_dep.h:30
double real_t
type of all real-valued scalars in escript
Definition DataTypes.h:52
Definition AbstractContinuousDomain.cpp:23
boost::python::object raw_addJobPerWorld(boost::python::tuple t, boost::python::dict kwargs)
Definition SplitWorld.cpp:492
boost::shared_ptr< SubWorld > SubWorld_ptr
Definition SubWorld.h:147
boost::python::object raw_buildDomains(boost::python::tuple t, boost::python::dict kwargs)
Definition SplitWorld.cpp:456
boost::python::object raw_addVariable(boost::python::tuple t, boost::python::dict kwargs)
Definition SplitWorld.cpp:513
boost::python::object raw_addJob(boost::python::tuple t, boost::python::dict kwargs)
Definition SplitWorld.cpp:473
boost::shared_ptr< JMPI_ > JMPI
Definition EsysMPI.h:76