MOOSE - Multiscale Object Oriented Simulation Environment
|
#include <Shell.h>
Public Member Functions | |
void | addClockMsgs (const vector< ObjId > &list, const string &field, unsigned int tick, unsigned int msgIndex) |
void | destroy (const Eref &e, ObjId oid) |
ObjId | doAddMsg (const string &msgType, ObjId src, const string &srcField, ObjId dest, const string &destField) |
Id | doCopy (Id orig, ObjId newParent, string newName, unsigned int n, bool toGlobal, bool copyExtMsgs) |
Returns the Id of the root of the copied tree upon success. More... | |
Id | doCreate (string type, ObjId parent, string name, unsigned int numData, NodePolicy nodePolicy=MooseBlockBalance, unsigned int preferredNode=1) |
bool | doDelete (ObjId oid) |
ObjId | doFind (const string &path) const |
Id | doLoadModel (const string &fname, const string &modelpath, const string &solverClass="") |
Returns the Id of the loaded model. More... | |
void | doMove (Id orig, ObjId newParent) |
void | doNonBlockingStart (double runtime) |
void | doQuit () |
void | doReacDiffMesh (Id baseCompartment) |
void | doReinit () |
void | doSaveModel (Id model, const string &fileName, bool qflag=0) const |
void | doSetClock (unsigned int tickNum, double dt) |
void | doSetParserIdleFlag (bool isParserIdle) |
void | doStart (double runtime, bool notify=false) |
void | doStop () |
void | doSyncDataHandler (Id tgt) |
void | doTerminate () |
void | doUseClock (string path, string field, unsigned int tick) |
string | doVersion () |
void | error (const string &text) |
void | expectVector (bool flag) |
ObjId | getCwe () const |
const ProcInfo * | getProcInfo (unsigned int index) const |
void | handleAck (unsigned int ackNode, unsigned int status) |
void | handleAddMsg (const Eref &e, string msgType, ObjId src, string srcField, ObjId dest, string destField, unsigned int msgIndex) |
void | handleCopy (const Eref &e, vector< ObjId > args, string newName, unsigned int n, bool toGlobal, bool copyExtMsgs) |
void | handleCreate (const Eref &e, string type, ObjId parent, Id newElm, string name, NodeBalance nb, unsigned int parentMsgIndex) |
void | handleMove (const Eref &e, Id orig, ObjId newParent) |
void | handleQuit () |
This function is NOT called when simulation ends normally. More... | |
void | handleSync (const Eref &e, Id elm, FuncId fid) |
void | handleUseClock (const Eref &e, string path, string field, unsigned int tick, unsigned int msgIndex) |
void | initAck () |
const Msg * | innerAddMsg (string msgType, ObjId src, string srcField, ObjId dest, string destField, unsigned int msgIndex) |
bool | innerCopy (const vector< ObjId > &args, const string &newName, unsigned int n, bool toGlobal, bool copyExtMsgs) |
Does actual work of copying. Returns true on success. More... | |
void | innerCreate (string type, ObjId parent, Id newElm, string name, const NodeBalance &nb, unsigned int parentMsgIndex) |
bool | innerMove (Id orig, ObjId newParent) |
bool | innerUseClock (string path, string field, unsigned int tick, unsigned int msgIndex) |
bool | isAckPending () const |
bool | isRunning () const |
void | setCwe (ObjId cwe) |
void | setShellElement (Element *shelle) |
Shell () | |
void | start (double runTime) |
void | waitForAck () |
void | warning (const string &text) |
~Shell () | |
Static Public Member Functions | |
static bool | adopt (ObjId parent, Id child, unsigned int msgIndex) |
static bool | adopt (Id parent, Id child, unsigned int msgIndex) |
Adaptor for above function. Also static function. More... | |
static bool | chopPath (const string &path, vector< string > &ret, vector< unsigned int > &index) |
static bool | chopString (const string &path, vector< string > &ret, char separator= '/') |
static void | cleanSimulation () |
Clean-up MOOSE before shutting down. This function is called whenever keyboard interrupt terminates the simulation. More... | |
static void | clearRestructuringQ () |
static void | dropClockMsgs (const vector< ObjId > &list, const string &field) |
static bool | inBlockingParserCall () |
static const Cinfo * | initCinfo () |
static bool | isNameValid (const string &name) |
static bool | isParserIdle () |
static bool | isSingleThreaded () |
static bool | keepLooping () |
static void | launchParser () |
static void | launchThreads () |
static void | loadBalance () |
static unsigned int | myNode () |
static unsigned int | numCores () |
static unsigned int | numNodes () |
static unsigned int | numProcessThreads () |
static const ProcInfo * | procInfo () |
Static func for returning the ProcInfo of the shell. More... | |
static unsigned int | reduceInt (unsigned int val) |
static void | setHardware (unsigned int numCores, unsigned int numNodes, unsigned int myNode) |
Static Public Attributes | |
static const unsigned int | ErrorStatus = ~1 |
static const unsigned int | OkStatus = ~0 |
Private Attributes | |
ObjId | cwe_ |
Current working Element. More... | |
vector< double * > | getBuf_ |
bool | gettingVector_ |
unsigned int | numGetVecReturns_ |
Element * | shelle_ |
Static Private Attributes | |
static vector< unsigned int > | acked_ |
static bool | doReinit_ |
static bool | isBlockedOnParser_ = 0 |
static bool | isParserIdle_ |
static bool | keepLooping_ = 1 |
static unsigned int | myNode_ |
static unsigned int | numAcks_ = 0 |
static unsigned int | numCores_ |
static unsigned int | numNodes_ |
static unsigned int | numProcessThreads_ |
static ProcInfo | p_ |
static double | runtime_ |
static vector< ProcInfo > | threadProcs_ |
Shell::Shell | ( | ) |
void Shell::addClockMsgs | ( | const vector< ObjId > & | list, |
const string & | field, | ||
unsigned int | tick, | ||
unsigned int | msgIndex | ||
) |
Utility function to set up messages to schedule a list of Ids using the specified field and tick
Definition at line 924 of file Shell.cpp.
References dropClockMsgs(), and innerAddMsg().
Referenced by innerUseClock().
Static utility function. Attaches child element to parent element. Must only be called from functions executing in parallel on all nodes, as it does a local message addition MsgIndex is needed to be sure that the same msg identifies parent-child connection on all nodes.
Definition at line 654 of file Shell.cpp.
References Finfo::addMsg(), ObjId::element(), Id::element(), ObjId::eref(), Cinfo::findFinfo(), Element::getName(), Neutral::initCinfo(), and Msg::mid().
Referenced by adopt(), buildFinfoElement(), init(), Msg::initMsgManagers(), innerCopyElements(), innerCreate(), Cinfo::makeCinfoElements(), testSetGetExtField(), and testStrSet().
Adaptor for above function. Also static function.
Definition at line 681 of file Shell.cpp.
References adopt().
|
static |
Chop up the path into a vector of Element names, and also fills out a matching vector of indices. If at any level of the path there are no indices or the index is zero, the index entry * remains empty. Otherwise the entry contains a vector with index values for this level of the path. The zeroth position of this index vector is the slowest varying, i.e., most significant. Returns true if it starts at '/'.
Example: /foo/bar[10]/zod[3][4][5] would return: ret: {"foo", "bar", "zod" } index: { {}, {10}, {3,4,5} }
static func.
Example: /foo/bar[10]/zod[3] would return: ret: {"foo", "bar", "zod" } index: { 0, 10, 3 }
Definition at line 512 of file Shell.cpp.
References chopString(), and extractIndex().
Referenced by doFind(), and testChopPath().
|
static |
Chops up the names in the string into the vector of strings, using the specified separator. Returns true if it is an absolute path, that is, starts with the separator.
Static func to subdivide a string at the specified separator.
Definition at line 459 of file Shell.cpp.
References path.
Referenced by chopPath(), findBraceContent(), innerFind(), matchBeforeBrace(), simpleWildcardFind(), and testChopString().
|
static |
Clean-up MOOSE before shutting down. This function is called whenever keyboard interrupt terminates the simulation.
Cleans up all Elements except /root itself, /clock, /classes, and /Msgs. In due course will also do suitable reinitialization of tick and other values.
Definition at line 1015 of file Shell.cpp.
References Neutral::children(), Eref::data(), moose::debug, doDelete(), Id::eref(), moose::info, and LOG.
Referenced by handle_keyboard_interrupts().
|
static |
Works through internal queue of operations that modify the structure of the simulation. These operations have to be carefully separated from any other functions or messaging, so this happens while all other threads are blocked.
Definition at line 722 of file Shell.cpp.
References cwe_, Eref::data(), Neutral::destroy(), ObjId::eref(), and ObjId::id.
Referenced by initCinfo().
ObjId Shell::doAddMsg | ( | const string & | msgType, |
ObjId | src, | ||
const string & | srcField, | ||
ObjId | dest, | ||
const string & | destField | ||
) |
Sets up a Message of specified type. Later need to consider doing this through MsgSpecs only. Here the 'args' vector handles whatever arguments we may need to pass to the specified msgType.
Definition at line 269 of file Shell.cpp.
References BADINDEX, Finfo::checkTarget(), Element::cinfo(), ObjId::dataIndex, Id::element(), Cinfo::findFinfo(), Cinfo::finfoMap(), Element::getName(), ObjId::id, innerAddMsg(), Msg::mid(), myNode_, and SetGet6< A1, A2, A3, A4, A5, A6 >::set().
Referenced by ReadCell::addCanonicalChannel(), ReadKkit::addmsg(), ReadCell::addSpikeGen(), addSpine(), benchmarkMsg(), ReadSwc::build(), ReadCell::buildCompartment(), ReadKkit::buildEnz(), ReadKkit::buildSumTotal(), doClassSpecificMessaging(), ReadCspace::expandEnzyme(), ReadCspace::expandReaction(), ReadKkit::innerAddMsg(), makeCompt(), ReadCspace::makePlots(), makeReacTest(), Stoich::setElist(), testAssortedMsg(), testCalcJunction(), testClock(), testCopyMsgOps(), testGetMsg(), testGetMsgs(), testMMenzProcess(), testMpiFibonacci(), testMsgElementListing(), testPoolVolumeScaling(), testReacVolumeScaling(), testShellAddMsg(), testStats(), and testTwoReacGetNeighbors().
Id Shell::doCopy | ( | Id | orig, |
ObjId | newParent, | ||
string | newName, | ||
unsigned int | n, | ||
bool | toGlobal, | ||
bool | copyExtMsgs | ||
) |
Returns the Id of the root of the copied tree upon success.
Copies orig Element to newParent. n specifies how many copies are made. copyExtMsgs specifies whether to also copy messages from orig to objects outside the copy tree. Usually we don't do this.
Definition at line 16 of file ShellCopy.cpp.
References Neutral::child(), ObjId::eref(), Neutral::isDescendant(), isNameValid(), Id::nextId(), ObjId::path(), Id::path(), and shelle_.
Referenced by ReadCell::addChannel(), addSpine(), ReadCell::buildCompartment(), buildFromProto(), testCopy(), testCopyFieldElement(), testCopyMsgOps(), and testGetMsg().
Id Shell::doCreate | ( | string | type, |
ObjId | parent, | ||
string | name, | ||
unsigned int | numData, | ||
NodePolicy | nodePolicy = MooseBlockBalance , |
||
unsigned int | preferredNode = 1 |
||
) |
Create an Element. Returns its id. type: Specifies classname of Objects in Element. parent: Id of parent element name: Name to be used for identifying Element. numData: Size of array.
This is the version used by the parser. Acts as a blocking, serial-like interface to a potentially multithread, multinode call. Returns the new Id index upon success, otherwise returns Id(). The data of the new Element is not necessarily allocated at this point, that can be deferred till the global Instantiate or Reset calls. Idea is that the model should be fully defined before load balancing.
Definition at line 181 of file Shell.cpp.
References Cinfo::banCreation(), Neutral::child(), ObjId::element(), ObjId::eref(), Cinfo::find(), isNameValid(), name, Id::nextId(), OneToAllMsg::numMsg(), ObjId::path(), SetGet6< A1, A2, A3, A4, A5, A6 >::set(), moose::showWarn(), and warning().
Referenced by ReadKkit::assignPoolCompartments(), benchmarkMsg(), ReadKkit::buildChan(), ReadCell::buildCompartment(), ReadKkit::buildEnz(), ReadKkit::buildGraph(), ReadKkit::buildGroup(), ReadKkit::buildInfo(), ReadKkit::buildPlot(), ReadKkit::buildPool(), ReadKkit::buildReac(), ReadKkit::buildStim(), ReadKkit::buildSumTotal(), ReadKkit::buildTable(), doLoadModel(), ReadCspace::expandEnzyme(), ReadCspace::expandReaction(), makeCompt(), ReadCspace::makeMolecule(), ReadCspace::makePlots(), makeReacTest(), makeStandardElements(), ReadCell::read(), ReadKkit::read(), ReadCell::startGraftCell(), test_to_py(), testAssortedMsg(), testBuildStoich(), testCalcJunction(), testCellDiffn(), testChildren(), testClockMessaging(), testCopy(), testCopyFieldElement(), testCopyMsgOps(), testCylDiffn(), testCylDiffnWithStoich(), testDescendant(), testFilterOffNodeTargets(), testFindModelParent(), testGetMsg(), testGetMsgs(), testInterNodeOps(), testMMenz(), testMMenzProcess(), testMove(), testMpiFibonacci(), testMsgElementListing(), testObjIdToAndFromPath(), testPoolVolumeScaling(), testReacVolumeScaling(), testReMesh(), testRunGsolve(), testRunKsolve(), testShellAddMsg(), testShellParserCreateDelete(), testShellParserStart(), testShellSetGet(), testSmallCellDiffn(), testStats(), testSyncSynapseSize(), testTable(), testTaperingCylDiffn(), testTreeTraversal(), testTwoReacGetNeighbors(), testVolScaling(), and testWildcard().
bool Shell::doDelete | ( | ObjId | oid | ) |
Delete specified Element and all its children and all Msgs connected to it. This also works for Msgs, which are also identified by an ObjId. Unlike regular objects, only the one Msg entry specified by the DataIndex part of the ObjId argument is deleted.
Definition at line 259 of file Shell.cpp.
References SetGet1< A >::set().
Referenced by addSpine(), benchmarkMsg(), cleanSimulation(), test_to_py(), testAssortedMsg(), testBuildStoich(), testCalcJunction(), testCellDiffn(), testChildren(), testClockMessaging(), testCopy(), testCopyFieldElement(), testCopyMsgOps(), testCylDiffn(), testCylDiffnWithStoich(), testDescendant(), testFilterOffNodeTargets(), testFindModelParent(), testGetMsg(), testGetMsgs(), testInterNodeOps(), testMMenz(), testMMenzProcess(), testMove(), testMsgElementListing(), testObjIdToAndFromPath(), testPoolVolumeScaling(), testReacVolumeScaling(), testReadKkit(), ReadCspace::testReadModel(), testReMesh(), testRunGsolve(), testRunKsolve(), testSetupReac(), testShellAddMsg(), testShellParserCreateDelete(), testShellSetGet(), testSmallCellDiffn(), testStats(), testSyncSynapseSize(), testTable(), testTaperingCylDiffn(), testTreeTraversal(), testTwoReacGetNeighbors(), testVolScaling(), and testWildcard().
ObjId Shell::doFind | ( | const string & | path | ) | const |
Looks up the Id specified by the given path. May include relative references and the internal cwe (current working Element) on the shell
Definition at line 549 of file Shell.cpp.
References BADINDEX, Neutral::child(), chopPath(), cwe_, ObjId::dataIndex, ObjId::element(), ObjId::eref(), ObjId::fieldIndex, Element::hasFields(), Element::numData(), and Neutral::parent().
Referenced by ReadKkit::buildChan(), ReadKkit::buildEnz(), ReadKkit::buildGraph(), ReadKkit::buildGroup(), ReadKkit::buildPlot(), ReadKkit::buildPool(), ReadKkit::buildReac(), ReadKkit::buildStim(), ReadKkit::buildTable(), Id::Id(), and testTreeTraversal().
Id Shell::doLoadModel | ( | const string & | fname, |
const string & | modelpath, | ||
const string & | solverClass = "" |
||
) |
Returns the Id of the loaded model.
Loads in a model to a specified path. Tries to figure out model type from fname or contents of file. Currently knows about kkit, cspace. Soon to learn .p, SBML, NeuroML. Later to learn NineML
Definition at line 132 of file LoadModels.cpp.
References ReadSwc::build(), Element::cinfo(), CSPACE, cwe_, doCreate(), DOTP, Id::element(), moose::failed, findModelParent(), findModelType(), moose::info, Cinfo::isA(), KKIT, LOG, ReadCspace::makePlots(), ReadCell::read(), ReadKkit::read(), ReadCspace::readModelString(), SWC, and UNKNOWN.
shifts orig Element (including offspring) to newParent. All old hierarchy, data, Msgs etc are preserved below the orig.
Definition at line 390 of file Shell.cpp.
References Neutral::child(), ObjId::element(), Id::element(), ObjId::eref(), Element::getName(), Neutral::isDescendant(), name, ObjId::path(), SetGet2< A1, A2 >::set(), and warning().
Referenced by addSpine(), ReadKkit::assignPoolCompartments(), ReadKkit::assignReacCompartments(), testMove(), and testObjIdToAndFromPath().
void Shell::doNonBlockingStart | ( | double | runtime | ) |
Starts off simulation, to run for 'runtime' more than current time. This version returns at once, and the parser can go on to do other things. It has to check with the Shell::isRunning function (accessible as a MOOSE field) to find out if it is finished. Can call 'doStop', 'doTerminate' or 'doReinit' at any time to stop the run with increasing levels of prejudice.
void Shell::doQuit | ( | ) |
Cleanly quits simulation, wrapping up all nodes and threads.
Definition at line 327 of file Shell.cpp.
References SetGet0::set().
Referenced by launchParser(), main(), and testShellParserQuit().
void Shell::doReacDiffMesh | ( | Id | baseCompartment | ) |
void Shell::doReinit | ( | ) |
Reinitializes simulation: time goes to zero, all scheduled objects are set to initial conditions. If simulation is already running, first stops it.
Definition at line 362 of file Shell.cpp.
References SetGet0::set().
Referenced by benchmarkMsg(), ReadKkit::read(), ReadKkit::run(), testCalcJunction(), testCellDiffn(), testCopyMsgOps(), testCylDiffn(), testCylDiffnWithStoich(), testGetMsg(), testMMenzProcess(), testRunGsolve(), testRunKsolve(), testSetupReac(), testSmallCellDiffn(), testStats(), and testTaperingCylDiffn().
void Shell::doSaveModel | ( | Id | model, |
const string & | fileName, | ||
bool | qFlag = 0 |
||
) | const |
Saves specified model to specified file, using filetype identified by filename extension. Currently known filetypes are: .g: Kkit model
Still to come: .p: GENESIS neuron morphology and channel spec file .sbml: SBML file .nml: NeuroML file .9ml: NineML file .snml: SigNeurML
Saves specified model to specified file, using filetype identified by filename extension. Currently known filetypes are: .g: Kkit model .cspace: cspace model
Still to come: .p: GENESIS neuron morphology and channel spec file .sbml: SBML file .nml: NeuroML file .9ml: NineML file .snml: SigNeurML
Definition at line 31 of file SaveModels.cpp.
References writeKkit().
void Shell::doSetClock | ( | unsigned int | tickNum, |
double | dt | ||
) |
Definition at line 377 of file Shell.cpp.
References LookupField< L, A >::set().
Referenced by benchmarkMsg(), getShell(), initCinfo(), main(), makeReacTest(), ReadKkit::run(), setMethod(), testCalcJunction(), testCellDiffn(), testCopyMsgOps(), testCylDiffn(), testCylDiffnWithStoich(), testFibonacci(), testGetMsg(), testMMenzProcess(), testMpiFibonacci(), testRunGsolve(), testRunKsolve(), testShellAddMsg(), testShellParserStart(), testSmallCellDiffn(), testStats(), and testTaperingCylDiffn().
void Shell::doSetParserIdleFlag | ( | bool | isParserIdle | ) |
This function is called by the parser to tell the ProcessLoop to wait a bit between cycles. Used when we are waiting for user input and there is no point in having the ProcessLoop go at full speed. When flag is true, then the ProcessLoop will sleep a bit, when false it will work at full speed.
void Shell::doStart | ( | double | runtime, |
bool | notify = false |
||
) |
Starts off simulation, to run for 'runtime' more than current time. This version is blocking, and returns only when the simulation is done. If `nofity = true' then also notify user whenever 10% of simulation is over.
Definition at line 332 of file Shell.cpp.
References Streamer::cleanUp(), SetGet2< A1, A2 >::set(), and wildcardFind().
Referenced by benchmarkMsg(), ReadKkit::run(), testCalcJunction(), testCellDiffn(), testCopyMsgOps(), testCylDiffn(), testCylDiffnWithStoich(), testFibonacci(), testGetMsg(), testMMenzProcess(), testMpiFibonacci(), testRunGsolve(), testRunKsolve(), testSetupReac(), testShellAddMsg(), testShellParserStart(), testSmallCellDiffn(), testStats(), and testTaperingCylDiffn().
void Shell::doStop | ( | ) |
Cleanly stops simulation, ready to take up again from where the stop occurred. Waits till current operations are done.
Definition at line 370 of file Shell.cpp.
References SetGet0::set().
void Shell::doSyncDataHandler | ( | Id | tgt | ) |
This function synchronizes fieldDimension on the DataHandler across nodes. Used after function calls that might alter the number of Field entries in the table.. The tgt is the FieldElement whose fieldDimension needs updating.
void Shell::doTerminate | ( | ) |
Terminate ongoing simulation, with prejudice. Uncleanly stops simulation. Things may be in a mess with different objects at different times, but it stops at once.
void Shell::doUseClock | ( | string | path, |
string | field, | ||
unsigned int | tick | ||
) |
Connects up process messages from the specified Tick to the targets on the path. Does so for whole Elements, not individual entries in the Element array. The target on the path usually has the 'process' field but other options are allowed, like 'init'
Definition at line 382 of file Shell.cpp.
References OneToAllMsg::numMsg(), and SetGet4< A1, A2, A3, A4 >::set().
Referenced by benchmarkMsg(), getShell(), main(), setMethod(), testCalcJunction(), testCellDiffn(), testCopyMsgOps(), testCylDiffn(), testCylDiffnWithStoich(), testGetMsg(), testMMenzProcess(), testMpiFibonacci(), testRunGsolve(), testRunKsolve(), testShellAddMsg(), testShellParserStart(), testSmallCellDiffn(), testStats(), and testTaperingCylDiffn().
string Shell::doVersion | ( | ) |
Returns version number of the software.
Definition at line 605 of file Shell.cpp.
References MOOSE_VERSION.
|
static |
Utility function to unschedule the specified elist operating on the specified field, typically 'process'
Definition at line 886 of file Shell.cpp.
References Msg::deleteMsg(), DestFinfo::getFid(), and insertSharedMsgs().
Referenced by addClockMsgs().
void Shell::error | ( | const string & | text | ) |
void Shell::expectVector | ( | bool | flag | ) |
set the gettingVector_ flag
ObjId Shell::getCwe | ( | ) | const |
Returns the current working Element of the Shell
Definition at line 615 of file Shell.cpp.
References cwe_.
Referenced by Neuron::buildElist(), Neuron::getExprElist(), Neuron::getExprVal(), initCinfo(), and innerFind().
const ProcInfo* Shell::getProcInfo | ( | unsigned int | index | ) | const |
void Shell::handleAck | ( | unsigned int | ackNode, |
unsigned int | status | ||
) |
Generic handler for ack msgs from various nodes. Keeps track of which nodes have responded.
void Shell::handleAddMsg | ( | const Eref & | e, |
string | msgType, | ||
ObjId | src, | ||
string | srcField, | ||
ObjId | dest, | ||
string | destField, | ||
unsigned int | msgIndex | ||
) |
Connects src to dest on appropriate fields, with specified msgType. This wrapper function sends the ack back to the master node.
Wrapper function, that does the ack. Other functions also use the inner function to build message trees, so we don't want it to emit multiple acks.
Definition at line 738 of file Shell.cpp.
References innerAddMsg(), and myNode().
Referenced by initCinfo().
void Shell::handleCopy | ( | const Eref & | e, |
vector< ObjId > | args, | ||
string | newName, | ||
unsigned int | n, | ||
bool | toGlobal, | ||
bool | copyExtMsgs | ||
) |
Deep copy of source element to target, renaming it to newName. The Args are orig, newParent, newElm where the newElm is the Id passed in for the root of the copy. All subsequent created Elements should have successive Ids. The copy may generate an array with n entries. Normally only copies msgs within the tree, but if the flag copyExtMsgs is true then it copies external Msgs too.
Definition at line 162 of file ShellCopy.cpp.
References innerCopy().
Referenced by initCinfo().
void Shell::handleCreate | ( | const Eref & | e, |
string | type, | ||
ObjId | parent, | ||
Id | newElm, | ||
string | name, | ||
NodeBalance | nb, | ||
unsigned int | parentMsgIndex | ||
) |
This function handles the message request to create an Element. This request specifies the Id of the new Element and is handled on all nodes.
In due course we also have to set up the node decomposition of the Element, but for now the num indicates the total # of array entries. This gets a bit complicated if the Element is a multidim array.
Definition at line 638 of file Shell.cpp.
References innerCreate().
Referenced by initCinfo().
Handler to move Element orig onto the newParent.
Definition at line 851 of file Shell.cpp.
References innerMove().
Referenced by initCinfo().
void Shell::handleQuit | ( | ) |
This function is NOT called when simulation ends normally.
Wraps up operations. Doesn't quit instantly, completes the current process cycle first.
Definition at line 990 of file Shell.cpp.
References keepLooping_.
Referenced by initCinfo().
Handles sync of DataHandler indexing across nodes
void Shell::handleUseClock | ( | const Eref & | e, |
string | path, | ||
string | field, | ||
unsigned int | tick, | ||
unsigned int | msgIndex | ||
) |
Definition at line 972 of file Shell.cpp.
References innerUseClock().
Referenced by initCinfo().
|
static |
True when the parser is in a call which is being blocked because it requires the event loop to complete some actions.
Definition at line 86 of file ShellThreads.cpp.
References isBlockedOnParser_.
void Shell::initAck | ( | ) |
Initialize acks. This call should be done before the 'send' goes out, because with the wonders of threading we might get a response to the 'send' before this call is executed. This MUST be followed by a waitForAck call.
|
static |
Definition at line 46 of file Shell.cpp.
References destroy(), doSetClock(), getCwe(), handleAddMsg(), handleCopy(), handleCreate(), handleMove(), handleQuit(), handleUseClock(), Neutral::initCinfo(), SimpleLogger::initializationTime, isRunning(), logger, setCwe(), and shellCinfo.
Referenced by init().
const Msg * Shell::innerAddMsg | ( | string | msgType, |
ObjId | src, | ||
string | srcField, | ||
ObjId | dest, | ||
string | destField, | ||
unsigned int | msgIndex | ||
) |
Connects src to dest on appropriate fields, with specified msgType. This inner function does NOT send an ack. Returns true on success
The actual function that adds messages. Does NOT send an ack. The msgIndex specifies the index on which to place this message. If the value is zero it does an automatic placement. Returns zero on failure.
Definition at line 759 of file Shell.cpp.
References Finfo::addMsg(), Finfo::checkTarget(), Element::cinfo(), Id::element(), ObjId::eref(), Cinfo::findFinfo(), Element::getName(), ObjId::id, and myNode_.
Referenced by addClockMsgs(), doAddMsg(), and handleAddMsg().
bool Shell::innerCopy | ( | const vector< ObjId > & | args, |
const string & | newName, | ||
unsigned int | n, | ||
bool | toGlobal, | ||
bool | copyExtMsgs | ||
) |
Does actual work of copying. Returns true on success.
Definition at line 144 of file ShellCopy.cpp.
References innerCopyElements(), and innerCopyMsgs().
Referenced by handleCopy().
void Shell::innerCreate | ( | string | type, |
ObjId | parent, | ||
Id | newElm, | ||
string | name, | ||
const NodeBalance & | nb, | ||
unsigned int | msgIndex | ||
) |
Function that does the actual work of creating a new Element. The Class of the Moose objects formed is specified by type. The NodeBalance specifies how many entries and how they are distributed across nodes. The parentMsgIndex specifies the index for the parent-child message.
This function actually creates the object. Runs on all nodes. Assumes we've already done all the argument checking.
Definition at line 690 of file Shell.cpp.
References adopt(), Cinfo::find(), Clock::lookupDefaultTick(), MooseBlockBalance, MooseGlobal, MooseSingleNode, Cinfo::name(), NodeBalance::numData, NodeBalance::policy, and Element::setTick().
Referenced by handleCreate(), and Cell::setupSolver().
Moves Element orig onto the newParent.
Definition at line 826 of file Shell.cpp.
References Finfo::addMsg(), Msg::deleteMsg(), ObjId::element(), Id::element(), ObjId::eref(), Element::findCaller(), Cinfo::findFinfo(), DestFinfo::getFid(), Element::getName(), Neutral::initCinfo(), and Msg::mid().
Referenced by handleMove().
bool Shell::innerUseClock | ( | string | path, |
string | field, | ||
unsigned int | tick, | ||
unsigned int | msgIndex | ||
) |
Sets up scheduling for elements on the path.
Definition at line 948 of file Shell.cpp.
References addClockMsgs(), and wildcardFind().
Referenced by handleUseClock().
bool Shell::isAckPending | ( | ) | const |
Test for receipt of acks from all nodes
|
static |
Checks that the provided name is valid for an object. This returns false if it finds the reserved path chars /#[]
Static func to check if an object name is legal. True if legal.
Definition at line 499 of file Shell.cpp.
Referenced by doCopy(), doCreate(), and Neutral::setName().
|
static |
Flag to indicate if the parser is idle. If so, the main ProcessLoop should also slow down to avoid pounding on the CPUs
bool Shell::isRunning | ( | ) | const |
Returns flag to indicate whether simulation is still running
Definition at line 620 of file Shell.cpp.
References Eref::data(), Id::element(), and Id::eref().
Referenced by initCinfo().
|
static |
True in single-threaded mode. This is a special mode of the system in which it does not start up the event loop at all, and the whole thing operates on one thread, which is ultimately under the control of the parser. Note that this is distinct from running on one core. It is possible, and even recommended, to run in multithread mode even when the system has just one core to run it on.
|
static |
True as long as the main process loop is looping
Definition at line 996 of file Shell.cpp.
References keepLooping_.
Referenced by main().
|
static |
Launches Parser. Blocking when the parser blocks.
Definition at line 28 of file ShellThreads.cpp.
References Eref::data(), doQuit(), and Id::eref().
Referenced by main().
|
static |
This function sets up the threading for the entire system. It creates all the worker threads and the threads for handling MPI and handling shell requests.
|
static |
Stub for eventual function to handle load balancing. This must be called to set up default groups.
Regular shell function that requires that the information about the hardware have been loaded in. For now the function just assigns SimGroups
Definition at line 60 of file ShellThreads.cpp.
Referenced by init().
|
static |
Definition at line 81 of file ShellThreads.cpp.
References myNode_.
Referenced by PostMaster::addToSendBuf(), PostMaster::addToSetBuf(), PostMaster::clearPendingRecv(), PostMaster::dispatchSetBuf(), PostMaster::getMyNode(), LocalDataElement::getNode(), GlobalDataElement::getNode(), MsgElement::getNode(), FieldElement::getNumOnNode(), getShell(), handleAddMsg(), ObjId::isDataHere(), Eref::isDataHere(), ObjId::isOffNode(), main(), mooseMyNode(), nonMpiTests(), PostMaster::PostMaster(), TestSched::process(), PostMaster::process(), Element::putTargetsInDigest(), PostMaster::reinit(), PostMaster::remoteFieldGetVec(), PostMaster::remoteGet(), PostMaster::remoteGetVec(), LocalDataElement::setDataSize(), setHardware(), SetGet::strGet(), SetGet::strSet(), testInterNodeOps(), and testShellParserStart().
|
static |
Definition at line 71 of file ShellThreads.cpp.
References numCores_.
Referenced by nonMpiTests(), and setHardware().
|
static |
Definition at line 76 of file ShellThreads.cpp.
References numNodes_.
Referenced by PostMaster::clearPending(), PostMaster::clearPendingRecv(), Element::digestMessages(), dispatchBuffers(), PostMaster::dispatchSetBuf(), filterOffNodeTargets(), PostMaster::finalizeSends(), PostMaster::getNumNodes(), getShell(), ObjId::isOffNode(), main(), mooseNumNodes(), nonMpiTests(), PostMaster::PostMaster(), PostMaster::process(), Element::putOffNodeTargetsInDigest(), Element::putTargetsInDigest(), PostMaster::reinit(), PostMaster::remoteGetVec(), LocalDataElement::setDataSize(), setHardware(), testFibonacci(), testFilterOffNodeTargets(), and testSyncSynapseSize().
|
static |
|
static |
Static func for returning the ProcInfo of the shell.
|
static |
Checks for highest 'val' on all nodes
void Shell::setCwe | ( | ObjId | cwe | ) |
Assigns the current working Element of the Shell
Definition at line 610 of file Shell.cpp.
References cwe_.
Referenced by Neuron::buildElist(), Neuron::getExprElist(), Neuron::getExprVal(), initCinfo(), and testTreeTraversal().
|
static |
Assigns the hardware availability. Assumes that each node will have the same number of cores available.
Definition at line 47 of file ShellThreads.cpp.
References acked_, myNode(), myNode_, numCores(), numCores_, numNodes(), and numNodes_.
Referenced by init(), and nonMpiTests().
void Shell::setShellElement | ( | Element * | shelle | ) |
void Shell::start | ( | double | runTime | ) |
Sets of a simulation for duration runTime. Handles cases including single-thread, multithread, and multinode
void Shell::waitForAck | ( | ) |
test for completion of request. This MUST be preceded by an initAck call.
void Shell::warning | ( | const string & | text | ) |
Definition at line 1001 of file Shell.cpp.
References moose::showWarn().
Referenced by doCreate(), and doMove().
|
staticprivate |
Definition at line 622 of file Shell.h.
Referenced by setHardware().
|
private |
|
staticprivate |
|
private |
|
private |
|
staticprivate |
Flag: True when the parser thread is blocked waiting for some system call to be handled by the threading and the MPI connected nodes.
Definition at line 577 of file Shell.h.
Referenced by inBlockingParserCall().
|
staticprivate |
Flag: Tells the ProcessLoop to keep on going. Should only be altered during a barrier.
Definition at line 583 of file Shell.h.
Referenced by handleQuit(), and keepLooping().
|
staticprivate |
Identifier for current node
Definition at line 606 of file Shell.h.
Referenced by doAddMsg(), innerAddMsg(), myNode(), and setHardware().
|
staticprivate |
|
staticprivate |
Number of CPU cores in system.
Definition at line 588 of file Shell.h.
Referenced by numCores(), and setHardware().
|
private |
|
staticprivate |
Number of nodes in MPI-based system. Each node may have many threads.
Definition at line 601 of file Shell.h.
Referenced by numNodes(), and setHardware().
|
staticprivate |
|
staticprivate |
|
private |
Definition at line 551 of file Shell.h.
Referenced by doCopy(), and setShellElement().