SplitWorld.h
Go to the documentation of this file.
/*****************************************************************************
*
* Copyright (c) 2014-2017 by The University of Queensland
* http://www.uq.edu.au
*
* Primary Business: Queensland, Australia
* Licensed under the Apache License, version 2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Development until 2012 by Earth Systems Science Computational Center (ESSCC)
* Development 2012-2013 by School of Earth Sciences
* Development from 2014 by Centre for Geoscience Computing (GeoComp)
*
*****************************************************************************/
#ifndef escript_SplitWorld_H
#define escript_SplitWorld_H
#include "AbstractReducer.h"
#include "SubWorld.h"
#include <boost/python.hpp>
#include <boost/smart_ptr.hpp>
namespace escript
{
class SplitWorld
{
public:
SplitWorld(unsigned int numgroups, MPI_Comm global=MPI_COMM_WORLD);
~SplitWorld();
boost::python::object buildDomains(boost::python::tuple t, boost::python::dict kwargs);
void runJobs();
void addJob(boost::python::object creator, boost::python::tuple tup, boost::python::dict kw);
void addJobPerWorld(boost::python::object creator, boost::python::tuple tup, boost::python::dict kw);
void addVariable(std::string name, boost::python::object creator, boost::python::tuple ntup, boost::python::dict kwargs);
void removeVariable(std::string name);
void clearVariable(std::string name);
std::list<std::pair<std::string, bool> > getVarList();
boost::python::object getVarPyList();
boost::python::object getVarPyInfo();
void clearAllJobs();
DataTypes::real_t getScalarVariable(const std::string& name);
boost::python::object getLocalObjectVariable(const std::string& name);
int getSubWorldCount();
int getSubWorldID();
void copyVariable(const std::string& src, const std::string& dest);
private:
JMPI globalcom; // communicator linking all procs used in this splitworld
JMPI leadercom; // communicator linking the first proc in each subworld
escript::SubWorld_ptr localworld; // subworld which this process belongs to
unsigned int swcount; // number of subwords
unsigned int localid; // position of localworld in overall world sequence
// details of jobs to be created
std::vector<boost::python::object> create;
std::vector<boost::python::tuple> tupargs;
std::vector<boost::python::dict> kwargs;
unsigned int jobcounter; // note that the id of the first job is 1 not 0.
bool manualimport; // if false, all reduced vars will be shipped to all subworlds
void clearPendingJobs();
void distributeJobs();
};
boost::python::object raw_buildDomains(boost::python::tuple t, boost::python::dict kwargs);
boost::python::object raw_addJob(boost::python::tuple t, boost::python::dict kwargs);
boost::python::object raw_addJobPerWorld(boost::python::tuple t, boost::python::dict kwargs);
boost::python::object raw_addVariable(boost::python::tuple t, boost::python::dict kwargs);
}
#endif
escript::raw_addVariable
boost::python::object raw_addVariable(boost::python::tuple t, boost::python::dict kwargs)
Definition: SplitWorld.cpp:512
escript::SplitWorld::addJobPerWorld
void addJobPerWorld(boost::python::object creator, boost::python::tuple tup, boost::python::dict kw)
Definition: SplitWorld.cpp:234
escript::raw_addJob
boost::python::object raw_addJob(boost::python::tuple t, boost::python::dict kwargs)
Definition: SplitWorld.cpp:472
escript::raw_buildDomains
boost::python::object raw_buildDomains(boost::python::tuple t, boost::python::dict kwargs)
Definition: SplitWorld.cpp:455
escript::SplitWorld::buildDomains
boost::python::object buildDomains(boost::python::tuple t, boost::python::dict kwargs)
Definition: SplitWorld.cpp:97
escript::SplitWorld::runJobs
void runJobs()
Definition: SplitWorld.cpp:123
escript
Definition: AbstractContinuousDomain.cpp:22
escript::SplitWorld::create
std::vector< boost::python::object > create
Definition: SplitWorld.h:76
escript::SplitWorld::getVarPyInfo
boost::python::object getVarPyInfo()
Definition: SplitWorld.cpp:331
escript::JMPI
boost::shared_ptr< JMPI_ > JMPI
Definition: EsysMPI.h:71
escript::SplitWorld::kwargs
std::vector< boost::python::dict > kwargs
Definition: SplitWorld.h:78
escript::SplitWorld::getVarList
std::list< std::pair< std::string, bool > > getVarList()
Definition: SplitWorld.cpp:310
MPI_COMM_WORLD
#define MPI_COMM_WORLD
Definition: EsysMPI.h:47
escript::SplitWorld::manualimport
bool manualimport
Definition: SplitWorld.h:81
escript::SplitWorld::clearPendingJobs
void clearPendingJobs()
Definition: SplitWorld.cpp:353
escript::SubWorld_ptr
boost::shared_ptr< SubWorld > SubWorld_ptr
Definition: SubWorld.h:146
escript::SplitWorld::addJob
void addJob(boost::python::object creator, boost::python::tuple tup, boost::python::dict kw)
Definition: SplitWorld.cpp:223
escript::SplitWorld::getVarPyList
boost::python::object getVarPyList()
Definition: SplitWorld.cpp:316
SubWorld.h
escript::SplitWorld
Definition: SplitWorld.h:38
escript::SplitWorld::getSubWorldID
int getSubWorldID()
Definition: SplitWorld.cpp:432
escript::SplitWorld::clearVariable
void clearVariable(std::string name)
Definition: SplitWorld.cpp:305
escript::SplitWorld::clearAllJobs
void clearAllJobs()
Definition: SplitWorld.cpp:347
escript::SplitWorld::~SplitWorld
~SplitWorld()
Definition: SplitWorld.cpp:90
MPI_Comm
int MPI_Comm
Definition: EsysMPI.h:41
escript::raw_addJobPerWorld
boost::python::object raw_addJobPerWorld(boost::python::tuple t, boost::python::dict kwargs)
Definition: SplitWorld.cpp:491
escript::SplitWorld::removeVariable
void removeVariable(std::string name)
Definition: SplitWorld.cpp:299
escript::SplitWorld::addVariable
void addVariable(std::string name, boost::python::object creator, boost::python::tuple ntup, boost::python::dict kwargs)
Definition: SplitWorld.cpp:286
escript::SplitWorld::globalcom
JMPI globalcom
Definition: SplitWorld.h:69
escript::SplitWorld::localid
unsigned int localid
Definition: SplitWorld.h:73
escript::SplitWorld::getScalarVariable
DataTypes::real_t getScalarVariable(const std::string &name)
Definition: SplitWorld.cpp:29
escript::SplitWorld::swcount
unsigned int swcount
Definition: SplitWorld.h:72
escript::SplitWorld::distributeJobs
void distributeJobs()
Definition: SplitWorld.cpp:362
escript::SplitWorld::leadercom
JMPI leadercom
Definition: SplitWorld.h:70
escript::SplitWorld::jobcounter
unsigned int jobcounter
Definition: SplitWorld.h:80
escript::SplitWorld::getSubWorldCount
int getSubWorldCount()
Definition: SplitWorld.cpp:427
escript::SplitWorld::tupargs
std::vector< boost::python::tuple > tupargs
Definition: SplitWorld.h:77
AbstractReducer.h
escript::DataTypes::real_t
double real_t
type of all real-valued scalars in escript
Definition: DataTypes.h:50
escript::SplitWorld::copyVariable
void copyVariable(const std::string &src, const std::string &dest)
Definition: SplitWorld.cpp:437
escript::SplitWorld::localworld
escript::SubWorld_ptr localworld
Definition: SplitWorld.h:71
escript::SplitWorld::SplitWorld
SplitWorld(unsigned int numgroups, MPI_Comm global=91)
Definition: SplitWorld.cpp:42
escript::SplitWorld::getLocalObjectVariable
boost::python::object getLocalObjectVariable(const std::string &name)
Definition: SplitWorld.cpp:35