PetaVision  Alpha
PV::LogTimeScaleProbe Class Reference
Inheritance diagram for PV::LogTimeScaleProbe:
PV::AdaptiveTimeScaleProbe PV::ColProbe PV::BaseProbe PV::BaseObject PV::CheckpointerDataInterface PV::Observer

AdaptiveTimeScaleProbe Parameters

List of parameters needed from the AdaptiveTimeScaleProbe class

virtual void ioParam_targetName (enum ParamsIOFlag ioFlag) override
 targetName: the name of the probe that this probe attaches to. The target probe's values are used as the input to compute the adaptive timesteps.
 
virtual void ioParam_baseMax (enum ParamsIOFlag ioFlag)
 baseMax: Specifies the initial maximum timescale allowed. The maximum timescale is allowed to increase at a rate specified by the growthFactor parameter.
 
virtual void ioParam_baseMin (enum ParamsIOFlag ioFlag)
 baseMin: Specifies the minimum timescale allowed.
 
virtual void ioParam_tauFactor (enum ParamsIOFlag ioFlag)
 tauFactor: If Specifies the coefficient on the effective decay rate used to compute the timescale.
 
virtual void ioParam_growthFactor (enum ParamsIOFlag ioFlag)
 dtChangeMin: Specifies the percentage by which the maximum timescale increases when the timescale reaches the maximum.
 
virtual void ioParam_writeTimeScales (enum ParamsIOFlag ioFlag)
 writeTimeScales is obsolete, as it is redundant with textOutputFlag.
 
virtual void ioParam_writeTimeScaleFieldnames (enum ParamsIOFlag ioFlag)
 writeTimeScaleFieldnames: A flag to determine if fieldnames are written to the HyPerCol_timescales file. If false, file is written as comma separated list
 

BaseProbe Parameters

List of parameters for the BaseProbe class

virtual void ioParam_message (enum ParamsIOFlag ioFlag)
 message: A string parameter that is typically included in the lines output by the outputState method
 
virtual void ioParam_textOutputFlag (enum ParamsIOFlag ioFlag)
 textOutputFlag: A boolean parameter that sets whether to generate an output file. Defaults to true.
 
virtual void ioParam_probeOutputFile (enum ParamsIOFlag ioFlag)
 probeOutputFile: If textOutputFlag is true, probeOutputFile specifies the name of the file that the outputState method writes to. If blank, the output is sent to the output stream.
 
virtual void ioParam_triggerFlag (enum ParamsIOFlag ioFlag)
 triggerFlag: If false, the needUpdate method always returns true, so that outputState is called every timestep. If true, the needUpdate method uses triggerLayerName and triggerOffset to determine if the probe should be triggered.
 
virtual void ioParam_triggerLayerName (enum ParamsIOFlag ioFlag)
 triggerLayerName: If triggerFlag is true, triggerLayerName specifies the layer to check for triggering.
 
virtual void ioParam_triggerOffset (enum ParamsIOFlag ioFlag)
 triggerOffset: If triggerFlag is true, triggerOffset specifies the time interval before the triggerLayer's nextUpdate time that needUpdate() returns true.
 
virtual void ioParam_energyProbe (enum ParamsIOFlag ioFlag)
 energyProbe: If nonblank, specifies the name of a ColumnEnergyProbe that this probe contributes an energy term to.
 
virtual void ioParam_coefficient (enum ParamsIOFlag ioFlag)
 coefficient: If energyProbe is set, the coefficient parameter specifies that ColumnEnergyProbe multiplies the result of this probe's getValues() method by coefficient when computing the error. More...
 

Public Member Functions

 LogTimeScaleProbe (char const *name, HyPerCol *hc)
 
virtual Response::Status allocateDataStructures () override
 
virtual Response::Status communicateInitInfo (std::shared_ptr< CommunicateInitInfoMessage const > message) override
 
double getCoefficient ()
 
bool getDataStructuresAllocatedFlag () const
 
std::string const & getDescription () const
 
char const * getDescription_c () const
 
char const * getEnergyProbe ()
 
bool getInitialValuesSetFlag () const
 
bool getInitInfoCommunicatedFlag () const
 
double getLastUpdateTime ()
 
MPIBlock const * getMPIBlock ()
 
char const * getName () const
 
int getNumValues ()
 
std::string const & getObjectType () const
 
const char * getTargetName ()
 
double getValue (double timevalue, int index)
 
void getValues (double timevalue, double *valuesVector)
 
void getValues (double timevalue, std::vector< double > *valuesVector)
 
virtual void ioParam_logSlope (enum ParamsIOFlag ioFlag)
 
virtual void ioParam_logThresh (enum ParamsIOFlag ioFlag)
 
void ioParams (enum ParamsIOFlag ioFlag, bool printHeader, bool printFooter)
 
bool isUsingGPU () const
 
char const * lookupKeyword () const
 
virtual Response::Status outputState (double timeValue) override
 
virtual Response::Status outputStateWrapper (double timef, double dt)
 
void readParams ()
 
virtual Response::Status respond (std::shared_ptr< BaseMessage const > message) override
 
void writeParams ()
 
virtual int writeTimer (PrintStream &stream)
 

Protected Member Functions

virtual void allocateTimeScaleController () override
 
virtual void calcValues (double timeValue) override
 
virtual Response::Status cleanup ()
 
virtual Response::Status copyInitialStateToGPU ()
 
const char * getMessage ()
 
char const * getProbeOutputFilename ()
 
bool getTextOutputFlag () const
 
void getValues (double timevalue)
 
double * getValuesBuffer ()
 
int initialize (char const *name, HyPerCol *hc)
 
virtual Response::Status initializeState ()
 
virtual int initMessage (const char *msg)
 
virtual void initNumValues ()
 
virtual void initOutputStreams (const char *filename, Checkpointer *checkpointer) override
 
int ioParamsFillGroup (enum ParamsIOFlag ioFlag) override
 
bool isWritingToFile () const
 
bool needRecalc (double timeValue) override
 
virtual bool needUpdate (double timeValue, double dt) override
 
PrintStreamoutput (int b)
 
virtual void outputHeader ()
 
virtual Response::Status prepareCheckpointWrite ()
 
virtual Response::Status processCheckpointRead ()
 
virtual Response::Status readStateFromCheckpoint (Checkpointer *checkpointer) override
 
double referenceUpdateTime () const override
 
virtual Response::Status registerData (Checkpointer *checkpointer) override
 
Response::Status respondAdaptTimestep (std::shared_ptr< AdaptTimestepMessage const > message)
 
Response::Status respondAllocateData (std::shared_ptr< AllocateDataMessage const > message)
 
Response::Status respondCleanup (std::shared_ptr< CleanupMessage const > message)
 
Response::Status respondColProbeOutputState (std::shared_ptr< ColProbeOutputStateMessage const >(message))
 
Response::Status respondColProbeWriteParams (std::shared_ptr< ColProbeWriteParamsMessage const >(message))
 
Response::Status respondCommunicateInitInfo (std::shared_ptr< CommunicateInitInfoMessage const > message)
 
Response::Status respondCopyInitialStateToGPU (std::shared_ptr< CopyInitialStateToGPUMessage const > message)
 
Response::Status respondInitializeState (std::shared_ptr< InitializeStateMessage const > message)
 
Response::Status respondPrepareCheckpointWrite (std::shared_ptr< PrepareCheckpointWriteMessage const > message)
 
Response::Status respondProcessCheckpointRead (std::shared_ptr< ProcessCheckpointReadMessage const > message)
 
Response::Status respondReadStateFromCheckpoint (std::shared_ptr< ReadStateFromCheckpointMessage< Checkpointer > const > message)
 
Response::Status respondRegisterData (std::shared_ptr< RegisterDataMessage< Checkpointer > const > message)
 
Response::Status respondSetCudaDevice (std::shared_ptr< SetCudaDeviceMessage const > message)
 
virtual Response::Status setCudaDevice (std::shared_ptr< SetCudaDeviceMessage const > message)
 
void setDataStructuresAllocatedFlag ()
 
void setDescription ()
 
void setInitialValuesSetFlag ()
 
void setInitInfoCommunicatedFlag ()
 
int setName (char const *name)
 
void setNumValues (int n)
 
virtual void setObjectType () override
 
int setParent (HyPerCol *hc)
 

Protected Attributes

double coefficient
 
std::string description
 
char * energyProbe
 
AdaptiveTimeScaleControllermAdaptiveTimeScaleController = nullptr
 
double mBaseMax = 1.0
 
double mBaseMin = 1.0
 
PVCuda::CudaDevice * mCudaDevice = nullptr
 
double mGrowthFactor = 1.0
 
bool mInitialValuesSetFlag = false
 
double mLogSlope = 1.0
 
double mLogThresh = DBL_MAX_EXP
 
std::string mObjectType
 
std::vector< PrintStream * > mOutputStreams
 
BaseProbemTargetProbe = nullptr
 
bool mUsingGPUFlag = false
 
bool mWriteTimeScaleFieldnames = true
 
char * name = nullptr
 
HyPerColparent = nullptr
 
char * targetName
 
double tauFactor = 1.0
 
bool triggerFlag
 
HyPerLayertriggerLayer
 
char * triggerLayerName
 
double triggerOffset
 

Detailed Description

Definition at line 9 of file LogTimeScaleProbe.hpp.

Member Function Documentation

void PV::AdaptiveTimeScaleProbe::calcValues ( double  timevalue)
overrideprotectedvirtualinherited

A pure virtual method to calculate the values of the probe. calcValues() can assume that needRecalc() has been called and returned true. It should write the computed values into the buffer of member variable 'probeValues'.

Implements PV::BaseProbe.

Definition at line 178 of file AdaptiveTimeScaleProbe.cpp.

Response::Status PV::AdaptiveTimeScaleProbe::communicateInitInfo ( std::shared_ptr< CommunicateInitInfoMessage const >  message)
overridevirtualinherited

Calls BaseProbe::communicateInitInfo (which sets up any triggering or attaching to an energy probe)

Reimplemented from PV::ColProbe.

Definition at line 96 of file AdaptiveTimeScaleProbe.cpp.

double PV::BaseProbe::getCoefficient ( )
inlineinherited

Returns the coefficient if the energy probe is set.

Definition at line 95 of file BaseProbe.hpp.

bool PV::BaseObject::getDataStructuresAllocatedFlag ( ) const
inlineinherited

Get-method for mDataStructuresAllocatedFlag, which is false on initialization and then becomes true once setDataStructuresAllocatedFlag() is called.

Definition at line 102 of file BaseObject.hpp.

char const* PV::BaseProbe::getEnergyProbe ( )
inlineinherited

Returns the name of the energy probe the probe is attached to (null if not attached to an energy probe)

Definition at line 90 of file BaseProbe.hpp.

bool PV::BaseObject::getInitialValuesSetFlag ( ) const
inlineinherited

Get-method for mInitialValuesSetFlag, which is false on initialization and then becomes true once setInitialValuesSetFlag() is called.

Definition at line 108 of file BaseObject.hpp.

bool PV::BaseObject::getInitInfoCommunicatedFlag ( ) const
inlineinherited

Get-method for mInitInfoCommunicatedFlag, which is false on initialization and then becomes true once setInitInfoCommunicatedFlag() is called.

Definition at line 95 of file BaseObject.hpp.

double PV::BaseProbe::getLastUpdateTime ( )
inlineinherited

Returns the time that calcValues was last called. BaseProbe updates the last update time in getValues() and getValue(), based on the result of needRecalc.

Definition at line 102 of file BaseProbe.hpp.

const char* PV::BaseProbe::getMessage ( )
inlineprotectedinherited

Returns a pointer to the message parameter.

Definition at line 280 of file BaseProbe.hpp.

int PV::BaseProbe::getNumValues ( )
inlineinherited

Returns the number of value indices the probe can compute (typically the value of the parent HyPerCol's nBatch parameter). BaseProbe::getNumValues() returns the parent HyPerCol's getNBatch(), which can be overridden. Probes derived from BaseProbe can set numValues to zero or a negative number to indicate that getValues() and getNumValues() are not fully implemented for that probe.

Definition at line 61 of file BaseProbe.hpp.

char const* PV::BaseProbe::getProbeOutputFilename ( )
inlineprotectedinherited

Returns the probeOutputFilename parameter

Definition at line 314 of file BaseProbe.hpp.

const char* PV::BaseProbe::getTargetName ( )
inlineinherited

Returns the name of the targetName parameter for this probe. LayerProbe uses targetName to specify the layer to attach to; BaseConnectionProbe uses it to specify the connection to attach to.

Definition at line 83 of file BaseProbe.hpp.

bool PV::BaseProbe::getTextOutputFlag ( ) const
inlineprotectedinherited

Returns the value of the textOutputFlag parameter

Definition at line 324 of file BaseProbe.hpp.

double PV::BaseProbe::getValue ( double  timevalue,
int  index 
)
inherited

getValue() is meant for situations where the caller needs one value that would be returned by getValues(), not the whole buffer. getValue() returns a signaling NaN if index is out of bounds. If index is valid, getValue() calls calcValues() if needRecalc() returns true, and then returns probeValues[index]. Derived classes should not override or hide this method. Instead, they should override calcValues.

Definition at line 346 of file BaseProbe.cpp.

void PV::BaseProbe::getValues ( double  timevalue,
double *  valuesVector 
)
inherited

getValues(double timevalue, double * values) sets the buffer 'values' with the probe's calculated values. It assumes that the values buffer is large enough to hold getNumValues() double-precision values. If 'values' is NULL, the values are still updated internally if needed, but those values are not returned. Internally, getValues() calls calcValues() if needRecalc() is true. It then copies the probeValues buffer to the input argument buffer 'values'. Derived classes should not override or hide this method. Instead, they should override calcValues.

Definition at line 336 of file BaseProbe.cpp.

void PV::BaseProbe::getValues ( double  timevalue,
std::vector< double > *  valuesVector 
)
inherited

getValues(double timevalue, vector<double> * valuesVector) is a wrapper around getValues(double, double *) that uses C++ vectors. It resizes valuesVector to size getNumValues() and then fills the vector with the values returned by getValues.

Definition at line 341 of file BaseProbe.cpp.

void PV::BaseProbe::getValues ( double  timevalue)
protectedinherited

If needRecalc() returns true, getValues(double) updates the probeValues buffer (by calling calcValues) and sets lastUpdateTime to the timevalue input argument.

Definition at line 329 of file BaseProbe.cpp.

double* PV::BaseProbe::getValuesBuffer ( )
inlineprotectedinherited

Returns a pointer to the buffer containing the probeValues.

Definition at line 319 of file BaseProbe.hpp.

int PV::BaseProbe::initMessage ( const char *  msg)
protectedvirtualinherited

The method called by BaseProbe::initialize() to set the message used by the probe's outputState method.

Definition at line 282 of file BaseProbe.cpp.

void PV::BaseProbe::initNumValues ( )
protectedvirtualinherited

initNumValues is called by initialize. BaseProbe::initNumValues sets numValues to the parent HyPerCol's getNBatch(). Derived classes can override initNumValues to initialize numValues to a different value.

Reimplemented in PV::PointProbe, PV::StatsProbe, PV::KernelProbe, and PV::PointLIFProbe.

Definition at line 219 of file BaseProbe.cpp.

void PV::ColProbe::initOutputStreams ( const char *  filename,
Checkpointer checkpointer 
)
overrideprotectedvirtualinherited

Calls BaseProbe::initOutputStreams and then calls outputHeader()

Reimplemented from PV::BaseProbe.

Definition at line 47 of file ColProbe.cpp.

void PV::BaseProbe::ioParam_coefficient ( enum ParamsIOFlag  ioFlag)
protectedvirtualinherited

coefficient: If energyProbe is set, the coefficient parameter specifies that ColumnEnergyProbe multiplies the result of this probe's getValues() method by coefficient when computing the error.

Note that coefficient does not affect the value returned by the getValue() or getValues() method.

Reimplemented in PV::FirmThresholdCostFnLCAProbe, PV::L0NormLCAProbe, and PV::L1NormLCAProbe.

Definition at line 106 of file BaseProbe.cpp.

void PV::BaseObject::ioParams ( enum ParamsIOFlag  ioFlag,
bool  printHeader,
bool  printFooter 
)
inherited

Method for reading or writing the params from group in the parent HyPerCol's parameters. The group from params is selected using the name of the connection.

If ioFlag is set to write, the printHeader and printFooter flags control whether a header and footer for the parameter group is produces. These flags are set to true for layers, connections, and probes; and set to false for weight initializers and normalizers. If ioFlag is set to read, the printHeader and printFooter flags are ignored.

Note that ioParams is not virtual. To add parameters in a derived class, override ioParamFillGroup.

Definition at line 74 of file BaseObject.cpp.

int PV::LogTimeScaleProbe::ioParamsFillGroup ( enum ParamsIOFlag  ioFlag)
overrideprotectedvirtual

Reads parameters from the params file/writes parameters to the output params file. If a derived class introduces a new parameter, its ioParamsFillGroup method should call an ioParam_ method for that parameter. If a derived class eliminates a a parameter of the base class, or changes the dependencies of a parameter, it should override the ioParam_ method for that parameter. The derived class's ioParamsFillGroup method should call its base class's ioParamsFillGroup method.

Reimplemented from PV::AdaptiveTimeScaleProbe.

Definition at line 8 of file LogTimeScaleProbe.cpp.

bool PV::BaseObject::isUsingGPU ( ) const
inlineinherited

Returns true if the object requires the GPU; false otherwise. HyPerCol will not initialize the GPU unless one of the objects in its hierarchy returns true

Definition at line 116 of file BaseObject.hpp.

bool PV::BaseProbe::isWritingToFile ( ) const
inlineprotectedinherited

Returns true if a probeOutputFile is being used. Otherwise, returns false (indicating output is going to getOutputStream().

Definition at line 330 of file BaseProbe.hpp.

char const * PV::BaseObject::lookupKeyword ( ) const
inherited

Look up the keyword of the params group with the same name as the object.

Definition at line 42 of file BaseObject.cpp.

bool PV::AdaptiveTimeScaleProbe::needRecalc ( double  timevalue)
inlineoverrideprotectedvirtualinherited

A pure virtual method for that should return true if the quantities being measured by the probe have changed since the last time the quantities were calculated. Typically, an implementation of needRecalc() will check the lastUpdateTime of the object being probed, and return true if that value is greater than the lastUpdateTime member variable. needRecalc() is called by getValues(double) (and hence by getValue() and the other flavors of getValues). Note that there is a single needRecalc that applies to all getNumValues() quantities.

Implements PV::BaseProbe.

Definition at line 94 of file AdaptiveTimeScaleProbe.hpp.

virtual bool PV::AdaptiveTimeScaleProbe::needUpdate ( double  time,
double  dt 
)
inlineoverrideprotectedvirtualinherited

If there is a triggering layer, needUpdate returns true when the triggering layer's nextUpdateTime, modified by the probe's triggerOffset parameter, occurs; otherwise false. If there is not a triggering layer, needUpdate always returns true. This behavior can be overridden if a probe uses some criterion other than triggering to choose when output its state.

Reimplemented from PV::BaseProbe.

Definition at line 99 of file AdaptiveTimeScaleProbe.hpp.

PrintStream& PV::BaseProbe::output ( int  b)
inlineprotectedinherited

Returns a reference to the PrintStream for the given batch element

Definition at line 291 of file BaseProbe.hpp.

virtual void PV::ColProbe::outputHeader ( )
inlineprotectedvirtualinherited

Called by initialize_stream after opening the stream member variable. Derived classes can override this method to write header data to the output file.

Reimplemented in PV::QuotientColProbe, and PV::ColumnEnergyProbe.

Definition at line 118 of file ColProbe.hpp.

Response::Status PV::AdaptiveTimeScaleProbe::outputState ( double  timed)
overridevirtualinherited

The virtual method for outputting the quantities measured by the ColProbe. Derived classes should override this method. Typically, outputState will fprintf to outputstream->fp, where stream is the BaseProbe member variable.

Reimplemented from PV::ColProbe.

Definition at line 194 of file AdaptiveTimeScaleProbe.cpp.

Response::Status PV::BaseProbe::outputStateWrapper ( double  timef,
double  dt 
)
virtualinherited

The public interface for calling the outputState method. BaseConnection::outputStateWrapper calls outputState() if needUpdate() returns true. This behavior is intended to be general, but the method can be overridden if needed.

Definition at line 358 of file BaseProbe.cpp.

void PV::BaseObject::readParams ( )
inlineinherited

A method that reads the parameters for the group whose name matches the name of the object. It, along with writeParams(), is a wrapper around ioParams, so that readParams and writeParams automatically run through the same parameters in the same order.

Definition at line 62 of file BaseObject.hpp.

double PV::AdaptiveTimeScaleProbe::referenceUpdateTime ( ) const
inlineoverrideprotectedvirtualinherited

A pure virtual method that should return the simulation time for the values that calcValues() would compute if it were called instead. The reason that this time might be different from the simuluation time at which referenceUpdate was called, is that calcValues might be called either before or after the update of the object the probe is attached to.

The getValues() method calls this function after calling calcValues(), and stores the result in the lastUpdateTime member variable. Typically, the implementation of needRecalc() will return true if lastUpdateTime is less than the value returned by referenceUpdateTime, and false otherwise.

Implements PV::BaseProbe.

Definition at line 97 of file AdaptiveTimeScaleProbe.hpp.

Response::Status PV::AdaptiveTimeScaleProbe::registerData ( Checkpointer checkpointer)
overrideprotectedvirtualinherited

Called during HyPerCol::run, during the allocateDataStructures stage. BaseProbe::allocateDataStructures sets up the output stream. Derived classes that override this method should make sure to call this method in their own allocateDataStructures methods.

Reimplemented from PV::BaseProbe.

Definition at line 144 of file AdaptiveTimeScaleProbe.cpp.

void PV::BaseObject::setDataStructuresAllocatedFlag ( )
inlineprotectedinherited

This method sets mDataStructuresAllocatedFlag to true.

Definition at line 175 of file BaseObject.hpp.

void PV::BaseObject::setInitialValuesSetFlag ( )
inlineprotectedinherited

This method sets the flag returned by getInitialValuesSetFlag to true.

Definition at line 180 of file BaseObject.hpp.

void PV::BaseObject::setInitInfoCommunicatedFlag ( )
inlineprotectedinherited

This method sets mInitInfoCommunicatedFlag to true.

Definition at line 170 of file BaseObject.hpp.

void PV::BaseProbe::setNumValues ( int  n)
protectedinherited

Sets the numValues member variable (returned by getNumValues()) and reallocates the probeValues member variable to hold numValues double-precision values. If the reallocation fails, the probeValues buffer is left unchanged, errno is set (by a realloc() call), and PV_FAILURE is returned. Otherwise, PV_SUCCESS is returned.

Definition at line 221 of file BaseProbe.cpp.

void PV::BaseObject::writeParams ( )
inlineinherited

A method that writes the parameters for the group whose name matches the name of the object. It, along with readParams(), is a wrapper around ioParams, so that readParams and writeParams automatically run through the same parameters in the same order.

Definition at line 69 of file BaseObject.hpp.


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