PetaVision  Alpha
PV::HyPerCol Class Reference
Inheritance diagram for PV::HyPerCol:
PV::Subject PV::Observer

HyPerCol Parameters

List of parameters needed from the HyPerCol class

ObserverTable mObjectHierarchy
 
bool mErrorOnNotANumber
 
bool mCheckpointReadFlag
 
bool mReadyFlag
 
bool mParamsProcessedFlag
 
bool mWriteTimeScaleFieldnames
 
bool mWriteProgressToErr
 
bool mOwnsCommunicator
 
bool mWriteTimescales
 
char * mName
 
char * mPrintParamsFilename
 
double mSimTime
 
double mStopTime
 
double mDeltaTime
 
double mProgressInterval
 
double mNextProgressTime
 
int mNumPhases
 
int mNumXGlobal
 
int mNumYGlobal
 
int mNumBatch
 
int mNumBatchGlobal
 
int mOrigStdOut
 
int mOrigStdErr
 
int mNumThreads
 
int * mLayerStatus
 
int * mConnectionStatus
 
CommunicatormCommunicator
 
CheckpointermCheckpointer = nullptr
 
long int mCurrentStep
 
long int mFinalStep
 
PV_InitmPVInitObj
 
FileStreammPrintParamsStream
 
FileStreammLuaPrintParamsStream
 
PVParamsmParams
 
size_t mLayerArraySize
 
size_t mConnectionArraySize
 
std::ofstream mTimeScaleStream
 
TimermRunTimer
 
std::vector< Timer * > mPhaseRecvTimers
 
unsigned int mRandomSeed
 
PVCuda::CudaDevice * mCudaDevice
 
virtual void ioParam_stopTime (enum ParamsIOFlag ioFlag)
 mStopTime: The set stopping time for the run
 
virtual void ioParam_dt (enum ParamsIOFlag ioFlag)
 dt: The default delta time to use. More...
 
virtual void ioParam_progressInterval (enum ParamsIOFlag ioFlag)
 mProgressInterval: Specifies how often a progress report prints out More...
 
virtual void ioParam_writeProgressToErr (enum ParamsIOFlag ioFlag)
 writeProgressToErr: Whether to print timestep progress to the error stream instead of the output stream
 
virtual void ioParam_printParamsFilename (enum ParamsIOFlag ioFlag)
 mPrintParamsFilename: Specifies the output mParams filename. More...
 
virtual void ioParam_randomSeed (enum ParamsIOFlag ioFlag)
 randomSeed: The seed for the random number generator for reproducability
 
virtual void ioParam_nx (enum ParamsIOFlag ioFlag)
 nx: Specifies the size of the column
 
virtual void ioParam_ny (enum ParamsIOFlag ioFlag)
 ny: Specifies the size of the column
 
virtual void ioParam_nBatch (enum ParamsIOFlag ioFlag)
 ny: Specifies the batch size of the column
 
virtual void ioParam_errorOnNotANumber (enum ParamsIOFlag ioFlag)
 errorOnNotANumber: Specifies if the run should check on each timestep for nans in activity.
 
int getAutoGPUDevice ()
 
void setDescription ()
 
int initialize_base ()
 
int initialize (PV_Init *initObj)
 
void ioParams (enum ParamsIOFlag ioFlag)
 
int ioParamsFillGroup (enum ParamsIOFlag ioFlag)
 
void addObject (BaseObject *obj)
 
int checkDirExists (const char *dirname, struct stat *pathstat)
 
void notifyLoop (std::vector< std::shared_ptr< BaseMessage const >> messages)
 
void notifyLoop (std::shared_ptr< BaseMessage const > message)
 
Response::Status respondPrepareCheckpointWrite (std::shared_ptr< PrepareCheckpointWriteMessage const > message)
 
void initializeCUDA (std::string const &in_device)
 
int finalizeCUDA ()
 
void outputParams (char const *path)
 
void outputParamsHeadComments (FileStream *fileStream, char const *commentToken)
 
int setNumThreads (bool printMessagesFlag)
 
 HyPerCol (PV_Init *initObj)
 
virtual ~HyPerCol ()
 
virtual Response::Status respond (std::shared_ptr< BaseMessage const > message) override
 
ObservergetObjectFromName (std::string const &objectName) const
 
ObservergetNextObject (Observer const *currentObject) const
 
void advanceTimeLoop (Clock &runClock, int const runClockStartingStep)
 
int advanceTime (double time)
 
void nonblockingLayerUpdate (std::shared_ptr< LayerUpdateStateMessage const > updateMessage)
 
void nonblockingLayerUpdate (std::shared_ptr< LayerRecvSynapticInputMessage const > recvMessage, std::shared_ptr< LayerUpdateStateMessage const > updateMessage)
 
int processParams (char const *path)
 
int ioParamsFinishGroup (enum ParamsIOFlag)
 
int ioParamsStartGroup (enum ParamsIOFlag ioFlag, const char *group_name)
 
void allocateColumn ()
 
int run ()
 
int run (double stopTime, double dt)
 
bool getVerifyWrites ()
 
bool getCheckpointWriteFlag () const
 
char const * getLastCheckpointDir () const
 
bool getWriteTimescales () const
 
const char * getName ()
 
const char * getOutputPath ()
 
const char * getPrintParamsFilename () const
 
double getDeltaTime () const
 
double simulationTime () const
 
double getStopTime () const
 
int globalRank ()
 
int columnId ()
 
int getNxGlobal ()
 
int getNyGlobal ()
 
int getNBatch ()
 
int getNBatchGlobal ()
 
int getNumThreads () const
 
int numberOfBorderRegions () const
 
int numberOfColumns ()
 
int numberOfGlobalColumns ()
 
int commColumn ()
 
int commRow ()
 
int commBatch ()
 
int numCommColumns ()
 
int numCommRows ()
 
int numCommBatches ()
 
CommunicatorgetCommunicator () const
 
PV_InitgetPV_InitObj () const
 
FileStreamgetPrintParamsStream () const
 
PVParamsparameters () const
 
long int getFinalStep () const
 
unsigned int getRandomSeed ()
 
unsigned int seedRandomFromWallClock ()
 
std::map< std::string, Observer * > * copyObjectMap ()
 
PVCuda::CudaDevice * getDevice ()
 

Public Member Functions

virtual void addObserver (Observer *observer)
 
std::string const & getDescription () const
 
char const * getDescription_c () const
 

Protected Member Functions

Response::Status notify (ObserverTable const &table, std::vector< std::shared_ptr< BaseMessage const >> messages, bool printFlag)
 
Response::Status notify (ObserverTable const &table, std::shared_ptr< BaseMessage const > message, bool printFlag)
 
void notifyLoop (ObserverTable const &table, std::vector< std::shared_ptr< BaseMessage const >> messages, bool printFlag, std::string const &description)
 
void notifyLoop (ObserverTable const &table, std::shared_ptr< BaseMessage const > message, bool printFlag, std::string const &description)
 

Protected Attributes

std::string description
 

Detailed Description

Definition at line 41 of file HyPerCol.hpp.

Member Function Documentation

virtual void PV::Subject::addObserver ( Observer observer)
inlinevirtualinherited

The virtual method for adding an Observer-derived object. Derived classes must override this method to add the object to their hierarchy.

Reimplemented in PV::Checkpointer, and PV::BaseConnection.

Definition at line 37 of file Subject.hpp.

void PV::HyPerCol::allocateColumn ( )

This function tells each added object to perform the tasks necessary before calling advanceTimeLoop. Specifically, if mReadyFlag is not set, performs the CommunicateInitInfo, AllocateDataStructures, and RegisterData stages, and outputs the generated params file, and sets the mReadyFlag If mReadyFlag is set, does nothing, so that the above stages are not performed more than once. This method is called by the run() method.

Definition at line 361 of file HyPerCol.cpp.

Observer * PV::HyPerCol::getNextObject ( Observer const *  currentObject) const

Returns the object in the object hierarchy vector immediately following the object passed as an argument. To get the first object, pass the null pointer. If the last object is passed, the null pointer is returned. If a non-null pointer is passed but is not in the object hierarchy vector, an exception is thrown.

Definition at line 1259 of file HyPerCol.cpp.

Observer * PV::HyPerCol::getObjectFromName ( std::string const &  objectName) const

Returns the object in the hierarchy with the given name, if any exists. Returns the null pointer if the string does not match any object. It is up to the calling function to determine if the returned object has the appropriate type.

Definition at line 1253 of file HyPerCol.cpp.

void PV::HyPerCol::ioParam_dt ( enum ParamsIOFlag  ioFlag)
privatevirtual

dt: The default delta time to use.

This dt is used for advancing the run time.

Definition at line 279 of file HyPerCol.cpp.

void PV::HyPerCol::ioParam_printParamsFilename ( enum ParamsIOFlag  ioFlag)
privatevirtual

mPrintParamsFilename: Specifies the output mParams filename.

Defaults to pv.params. Relative paths are relative to the OutputPath.

Definition at line 297 of file HyPerCol.cpp.

void PV::HyPerCol::ioParam_progressInterval ( enum ParamsIOFlag  ioFlag)
privatevirtual

mProgressInterval: Specifies how often a progress report prints out

Units of dt

Definition at line 287 of file HyPerCol.cpp.

Response::Status PV::Subject::notify ( ObserverTable const &  table,
std::vector< std::shared_ptr< BaseMessage const >>  messages,
bool  printFlag 
)
protectedinherited

This method calls the respond() method of each object in the given table, using the given vector of messages. If the table consists of objects A, B, and C; and the messages vector consists of messages X and Y, the order is A->X, A->Y, B->X, B->Y, C->X, C->Y.

The objects' respond() method returns one of the Response::Status types: SUCCESS, NO_ACTION, PARTIAL, or PV_POSTPONE.

SUCCESS: the object completed the task requested by the messages. NO_ACTION: the object has nothing to do in response to the message, or had already done it. PARTIAL: the object has not yet completed but is making progress. It is expected that there are a small number of descrete tasks, so that an object will not return PARTIAL a large number of times in response to the same message. POSTPONE: the object needs to act but cannot do so until an event outside its control occurs.

If all objects return NO_ACTION, then notify() returns NO_ACTION. If all objects return either SUCCESS or NO_ACTION and there is at least one SUCCESS, then notify() returns SUCCESS. If all objects return either POSTPONE or NO_ACTION and there is at least one POSTPONE, then notify() returns POSTPONE. Otherwise, notify() returns PARTIAL.

Generally each message in the messages vector is sent to each object in the table. However, if an object returns POSTPONE in response to a message, the loop skips to the next object, and does not sent any remaining messages to the postponing object.

The rationale behind these rules is so that if the objects in the table are themselves derived from the Subject class, the messages can be passed down the tree and the return values passed up it, and the return value at the top can be interpreted as being over all the components at the bottom, without the topmost object needing to know details of the composition of the objects below it.

If printFlag is true, the method prints information regarding postponement to standard output.

Definition at line 15 of file Subject.cpp.

Response::Status PV::Subject::notify ( ObserverTable const &  table,
std::shared_ptr< BaseMessage const >  message,
bool  printFlag 
)
inlineprotectedinherited

A convenience overload of the basic notify method where there is only one message to send to the objects. This overloading handles enclosing the message in a vector of length one.

Definition at line 91 of file Subject.hpp.

void PV::Subject::notifyLoop ( ObserverTable const &  table,
std::vector< std::shared_ptr< BaseMessage const >>  messages,
bool  printFlag,
std::string const &  description 
)
protectedinherited

This method calls the notify() method in a loop until the result is not PARTIAL. If it is either POSTPONE, it exits with a fatal error. The description argument is used in the error message to report which message vector failed. If the result is PV_SUCCESS, notifyLoop() returns to the calling function.

notifyLoop should only be used if the objects that might cause a postponement are themselves in the table of objects; otherwise the routine will hang.

Definition at line 57 of file Subject.cpp.

void PV::Subject::notifyLoop ( ObserverTable const &  table,
std::shared_ptr< BaseMessage const >  message,
bool  printFlag,
std::string const &  description 
)
inlineprotectedinherited

A convenience overload of the basic notifyLoop method where there is only one message to send to the objects. This overloading handles enclosing the message in a vector of length one.

Definition at line 114 of file Subject.hpp.

int PV::HyPerCol::setNumThreads ( bool  printMessagesFlag)
private

Sets the mNumThreads member variable based on whether PV_USE_OPENMP is set and the NumThreads argument in the ConfigFile (-t option if using the command line). If printMessagesFlag is true, it may print to the output and/or error stream. If printMessagesFlag is false, these messages are suppressed.

Definition at line 516 of file HyPerCol.cpp.


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