escript::SubWorld Class Reference

`#include <SubWorld.h>`

Inheritance diagram for escript::SubWorld:

## Public Member Functions

| SubWorld (JMPI &globalcom, JMPI &comm, JMPI &corr, unsigned int subworldcount, unsigned int local_id, bool manualimport)
| ~SubWorld ()
void | setDomain (Domain_ptr d)
Domain_ptr | getDomain ()
JMPI & | getMPI ()
JMPI & | getCorrMPI ()
void | addJob (boost::python::object j)
char | runJobs (std::string &errmsg)
void | clearJobs ()
void | addVariable (std::string &, Reducer_ptr &red)
void | removeVariable (std::string &name)
void | clearVariable (std::string &name)
std::list< std::pair< std::string, bool > > | getVarList ()
std::list< std::pair< std::string, std::string > > | getVarInfo ()
size_t | getNumVars ()
bool | localTransport (std::string &errmsg)
bool | checkRemoteCompatibility (std::string &errmsg)
bool | deliverImports (std::string &errmsg)
bool | amLeader ()
DataTypes::real_t | getScalarVariable (const std::string &name)
boost::python::object | getLocalObjectVariable (const std::string &name)
void | debug ()
bool | synchVariableInfo (std::string &err)
bool | synchVariableValues (std::string &err)
void | resetInterest ()
void | copyVariable (const std::string &src, const std::string &dest)
void | newRunJobs ()

## Private Types

typedef std::map< std::string, Reducer_ptr > | str2reduce
typedef std::map< std::string, unsigned char > | str2char

## Private Member Functions

void | setMyVarState (const std::string &vname, char state)
void | setVarState (const std::string &vname, char state, int swid)
void | setAllVarsState (const std::string &name, char state)

## Private Attributes

JMPI | everyone
JMPI | swmpi
JMPI | corrmpi
escript::Domain_ptr | domain
std::vector< boost::python::object > | jobvec
unsigned int | swcount
unsigned int | localid
str2reduce | reducemap
str2char | varstate
bool | manualimports

## Detailed Description

This class represents a collection of MPI processes which will execute a number of Jobs (in series). There could be a number of SubWorlds (executing jobs in parallel) in the overall system. All jobs running in a SubWorld will use a common domain object. After each job runs, any values it exports will be merged into local reducer objects. Global (ie with the participation of other SubWorlds) reductions and interworld transfers are handled after the current batch of jobs have completed. That is, variable values should not be considered up to date until the whole batch is complete. Further, after a batch has completed, multiple subworlds may have copies of the variable, if the variable is modified in a later batch, this may result in unwanted double counting. eg: v (reduce:+) Batch 1: world 1: v+=1,2,3 — local v=6 world 2: v+=1,2 — local v=3 What is the value of v in this split world? v=9

Batch 2: world 1: v+=1 — local v=1+9 world 2: v+=1 — local v=1+9 What is the value of v? 20, not 11

## Member Typedef Documentation

## str2char

typedef std::map<std::string, unsigned char> escript::SubWorld::str2char

private

## str2reduce

typedef std::map<std::string, Reducer_ptr> escript::SubWorld::str2reduce

private

## Constructor & Destructor Documentation

## SubWorld()

SubWorld::SubWorld | ( | JMPI & | globalcom,
|  | JMPI & | comm,
|  | JMPI & | corr,
|  | unsigned int | subworldcount,
|  | unsigned int | local_id,
|  | bool | manualimport
| ) |  |

References swcount.

## ~SubWorld()

SubWorld::~SubWorld | ( |  | ) |

## Member Function Documentation

## addJob()

void SubWorld::addJob | ( | boost::python::object | j | ) |

References jobvec.

## addVariable()

void SubWorld::addVariable | ( | std::string & | name,
|  | Reducer_ptr & | red
| ) |  |

References domain, jobvec, manualimports, escript::reducerstatus::NONE, reducemap, and varstate.

## amLeader()

bool SubWorld::amLeader | ( |  | ) |

References swmpi.

Referenced by synchVariableInfo().

## checkRemoteCompatibility()

bool SubWorld::checkRemoteCompatibility | ( | std::string & | errmsg | ) |

References corrmpi, and reducemap.

## clearJobs()

void SubWorld::clearJobs | ( |  | ) |

References jobvec.

## clearVariable()

void SubWorld::clearVariable | ( | std::string & | name | ) |

References escript::reducerstatus::NONE, reducemap, and setAllVarsState().

## copyVariable()

void SubWorld::copyVariable | ( | const std::string & | src,
|  | const std::string & | dest
| ) |  |

References reducemap.

## debug()

void SubWorld::debug | ( |  | ) |

References getNumVars(), escript::reducerstatus::INTERESTED, escript::reducerstatus::NEW, escript::reducerstatus::NONE, escript::reducerstatus::OLD, escript::reducerstatus::OLDINTERESTED, reducemap, and varstate.

## deliverImports()

bool SubWorld::deliverImports | ( | std::string & | errmsg | ) |

References escript::getStringFromPyException(), jobvec, manualimports, and reducemap.

## getCorrMPI()

JMPI & SubWorld::getCorrMPI | ( |  | ) |

References corrmpi.

Referenced by synchVariableInfo().

## getDomain()

Domain_ptr SubWorld::getDomain | ( |  | ) |

References domain.

## getLocalObjectVariable()

bp::object SubWorld::getLocalObjectVariable | ( | const std::string & | name | ) |

References escript::reducerstatus::INTERESTED, escript::reducerstatus::NONE, escript::reducerstatus::OLD, escript::reducerstatus::OLDINTERESTED, reducemap, setMyVarState(), synchVariableInfo(), synchVariableValues(), and varstate.

## getMPI()

JMPI & SubWorld::getMPI | ( |  | ) |

References swmpi.

## getNumVars()

size_t SubWorld::getNumVars | ( |  | ) |

References reducemap.

Referenced by debug(), setAllVarsState(), setVarState(), and synchVariableInfo().

## getScalarVariable()

DataTypes::real_t SubWorld::getScalarVariable | ( | const std::string & | name | ) |

References escript::reducerstatus::INTERESTED, escript::reducerstatus::NONE, escript::reducerstatus::OLD, escript::reducerstatus::OLDINTERESTED, reducemap, setMyVarState(), synchVariableInfo(), synchVariableValues(), and varstate.

## getVarInfo()

std::list< std::pair< std::string, std::string > > SubWorld::getVarInfo | ( |  | ) |

References reducemap.

## getVarList()

std::list< std::pair< std::string, bool > > SubWorld::getVarList | ( |  | ) |

References reducemap.

## localTransport()

bool SubWorld::localTransport | ( | std::string & | errmsg | ) |

References jobvec, escript::reducerstatus::NEW, reducemap, and setMyVarState().

## newRunJobs()

void SubWorld::newRunJobs | ( |  | ) |

References reducemap.

## removeVariable()

void SubWorld::removeVariable | ( | std::string & | name | ) |

References reducemap, and varstate.

## resetInterest()

void SubWorld::resetInterest | ( |  | ) |

References escript::reducerstatus::INTERESTED, escript::reducerstatus::NONE, escript::reducerstatus::OLD, escript::reducerstatus::OLDINTERESTED, and varstate.

## runJobs()

char SubWorld::runJobs | ( | std::string & | errmsg | ) |

References escript::getStringFromPyException(), and jobvec.

## setAllVarsState()

void SubWorld::setAllVarsState | ( | const std::string & | name,
|  | char | state
| ) |  |

private

References getNumVars(), escript::reducerstatus::NEW, escript::reducerstatus::NONE, swcount, and varstate.

Referenced by clearVariable(), and synchVariableValues().

## setDomain()

void SubWorld::setDomain | ( | Domain_ptr | d | ) |

References domain.

## setMyVarState()

void SubWorld::setMyVarState | ( | const std::string & | vname,
|  | char | state
| ) |  |

private

References localid, and setVarState().

Referenced by getLocalObjectVariable(), getScalarVariable(), localTransport(), and synchVariableValues().

## setVarState()

void SubWorld::setVarState | ( | const std::string & | vname,
|  | char | state,
|  | int | swid
| ) |  |

private

References getNumVars(), localid, and varstate.

Referenced by setMyVarState().

## synchVariableInfo()

bool SubWorld::synchVariableInfo | ( | std::string & | err | ) |

References amLeader(), ERROR, everyone, getCorrMPI(), getNumVars(), escript::reducerstatus::INTERESTED, jobvec, manualimports, escript::reducerstatus::NEW, escript::reducerstatus::NONE, escript::reducerstatus::OLD, escript::reducerstatus::OLDINTERESTED, reducemap, swcount, and varstate.

Referenced by getLocalObjectVariable(), and getScalarVariable().

## synchVariableValues()

bool SubWorld::synchVariableValues | ( | std::string & | err | ) |

References corrmpi, escript::reducerstatus::INTERESTED, MPI_MAX, escript::reducerstatus::NEW, escript::reducerstatus::NONE, escript::reducerstatus::OLD, escript::reducerstatus::OLDINTERESTED, reducemap, setAllVarsState(), setMyVarState(), swcount, and varstate.

Referenced by getLocalObjectVariable(), and getScalarVariable().

## Member Data Documentation

## corrmpi

JMPI escript::SubWorld::corrmpi

private

Referenced by checkRemoteCompatibility(), getCorrMPI(), and synchVariableValues().

## domain

escript::Domain_ptr escript::SubWorld::domain

private

Referenced by addVariable(), getDomain(), and setDomain().

## everyone

JMPI escript::SubWorld::everyone

private

Referenced by synchVariableInfo().

## jobvec

std::vector<boost::python::object> escript::SubWorld::jobvec

private

Referenced by addJob(), addVariable(), clearJobs(), deliverImports(), localTransport(), runJobs(), and synchVariableInfo().

## localid

unsigned int escript::SubWorld::localid

private

Referenced by setMyVarState(), and setVarState().

## manualimports

bool escript::SubWorld::manualimports

private

Referenced by addVariable(), deliverImports(), and synchVariableInfo().

## reducemap

str2reduce escript::SubWorld::reducemap

private

Referenced by addVariable(), checkRemoteCompatibility(), clearVariable(), copyVariable(), debug(), deliverImports(), getLocalObjectVariable(), getNumVars(), getScalarVariable(), getVarInfo(), getVarList(), localTransport(), newRunJobs(), removeVariable(), synchVariableInfo(), and synchVariableValues().

## swcount

unsigned int escript::SubWorld::swcount

private

Referenced by setAllVarsState(), SubWorld(), synchVariableInfo(), and synchVariableValues().

## swmpi

JMPI escript::SubWorld::swmpi

private

Referenced by amLeader(), and getMPI().

## varstate

str2char escript::SubWorld::varstate

private

Referenced by addVariable(), debug(), getLocalObjectVariable(), getScalarVariable(), removeVariable(), resetInterest(), setAllVarsState(), setVarState(), synchVariableInfo(), and synchVariableValues().

The documentation for this class was generated from the following files:

- SubWorld.h
- SubWorld.cpp