PetaVision  Alpha
 All Data Structures Namespaces Functions Variables
PV::Segmentify Class Reference
Inheritance diagram for PV::Segmentify:
PV::HyPerLayer PV::BaseLayer PV::BaseObject

HyPerLayer Parameters

List of parameters needed from the HyPerLayer class

virtual void ioParam_dataType (enum ParamsIOFlag ioFlag)
 
virtual void ioParam_updateGpu (enum ParamsIOFlag ioFlag)
 updateGpu: When compiled using CUDA or OpenCL GPU acceleration, this flag tells whether this layer's updateState method should use the GPU. If PetaVision was compiled without GPU acceleration, it is an error to set this flag to true.
 
virtual void ioParam_nxScale (enum ParamsIOFlag ioFlag)
 nxScale: Defines the relationship between the x column size and the layer size. More...
 
virtual void ioParam_nyScale (enum ParamsIOFlag ioFlag)
 nyScale: Defines the relationship between the y column size and the layer size. More...
 
virtual void ioParam_nf (enum ParamsIOFlag ioFlag)
 nf: Defines how many features this layer has
 
virtual void ioParam_phase (enum ParamsIOFlag ioFlag)
 phase: Defines the ordering in which each layer is updated
 
virtual void ioParam_mirrorBCflag (enum ParamsIOFlag ioFlag)
 mirrorBCflag: If set to true, the margin will mirror the data
 
virtual void ioParam_valueBC (enum ParamsIOFlag ioFlag)
 valueBC: If mirrorBC is set to true, Uses the specified value for the margin area
 
virtual void ioParam_initializeFromCheckpointFlag (enum ParamsIOFlag ioFlag)
 initializeFromCheckpointFlag: If set to true, initialize using checkpoint direcgtory set in HyPerCol. More...
 
virtual void ioParam_InitVType (enum ParamsIOFlag ioFlag)
 initVType: Specifies how to initialize the V buffer. More...
 
virtual void ioParam_triggerFlag (enum ParamsIOFlag ioFlag)
 triggerFlag: (Deprecated) Specifies if this layer is being triggered More...
 
virtual void ioParam_triggerLayerName (enum ParamsIOFlag ioFlag)
 triggerLayerName: Specifies the name of the layer that this layer triggers off of. If set to NULL or the empty string, the layer does not trigger but updates its state on every timestep.
 
virtual void ioParam_triggerOffset (enum ParamsIOFlag ioFlag)
 triggerOffset: If triggerLayer is set, triggers <triggerOffset> timesteps before target trigger More...
 
virtual void ioParam_triggerBehavior (enum ParamsIOFlag ioFlag)
 triggerBehavior: If triggerLayerName is set, this parameter specifies how the trigger is handled. More...
 
virtual void ioParam_triggerResetLayerName (enum ParamsIOFlag ioFlag)
 triggerResetLayerName: If triggerLayerName is set, this parameter specifies the layer to use for updating the state when the trigger happens. If set to NULL or the empty string, use triggerLayerName.
 
virtual void ioParam_writeStep (enum ParamsIOFlag ioFlag)
 writeStep: Specifies how often to output a pvp file for this layer More...
 
virtual void ioParam_initialWriteTime (enum ParamsIOFlag ioFlag)
 initialWriteTime: Specifies the first timestep to start outputing pvp files
 
virtual void ioParam_sparseLayer (enum ParamsIOFlag ioFlag)
 sparseLayer: Specifies if the layer should be considered sparese for optimization and output
 
virtual void ioParam_writeSparseValues (enum ParamsIOFlag ioFlag)
 writeSparseValues: If sparseLayer is set, specifies if the pvp file should write sparse value file
 

Public Member Functions

 Segmentify (const char *name, HyPerCol *hc)
 
virtual bool activityIsSpiking ()
 
virtual float addGpuTimers ()
 
virtual int allocateDataStructures ()
 
virtual double calcTimeScale (int batchIdx)
 
virtual int checkpointRead (const char *cpDir, double *timeptr)
 
virtual int checkpointWrite (const char *cpDir)
 
virtual int communicateInitInfo ()
 
void copyAllActivityFromDevice ()
 
void copyAllGSynFromDevice ()
 
void copyAllGSynToDevice ()
 
void copyAllVFromDevice ()
 
int flushOutputStateStream ()
 
pvdata_t * getActivity ()
 
pvdata_t * getChannel (ChannelType ch)
 
virtual float getChannelTimeConst (enum ChannelType channel_type)
 
PVLayergetCLayer ()
 
bool getDataStructuresAllocatedFlag ()
 
PVDataType getDataType ()
 
virtual double getDeltaTriggerTime ()
 
virtual double getDeltaUpdateTime ()
 
PVCuda::CudaBuffer * getDeviceActiveIndices ()
 
PVCuda::CudaBuffer * getDeviceActivity ()
 
PVCuda::CudaBuffer * getDeviceDatastore ()
 
PVCuda::CudaBuffer * getDeviceGSyn ()
 
PVCuda::CudaBuffer * getDeviceNumActive ()
 
PVCuda::CudaBuffer * getDeviceV ()
 
bool getInitialValuesSetFlag ()
 
bool getInitInfoCommunicatedFlag ()
 
char const * getKeyword () const
 
double getLastUpdateTime ()
 
const pvdata_t * getLayerData (int delay=0)
 
int getLayerId ()
 
const PVLayerLocgetLayerLoc ()
 
float getMaxRate ()
 
char const * getName () const
 
double getNextUpdateTime ()
 
int getNumChannels ()
 
int getNumDelayLevels ()
 
int getNumExtended ()
 
int getNumExtendedAllBatches ()
 
int getNumGlobalExtended ()
 
int getNumGlobalNeurons ()
 
int getNumNeurons ()
 
int getNumNeuronsAllBatches ()
 
int getNumProbes ()
 
char const * getOutputStatePath ()
 
HyPerColgetParent () const
 
int getPhase ()
 
LayerProbegetProbe (int n)
 
bool getRecvGpu ()
 
bool getSparseFlag ()
 
virtual double getTimeScale (int batchIdx)
 
bool getUpdatedDeviceActivityFlag ()
 
bool getUpdatedDeviceDatastoreFlag ()
 
bool getUpdatedDeviceGSynFlag ()
 
bool getUpdateGpu ()
 
pvdata_t * getV ()
 
pvdata_t getValueBC ()
 
int getXScale ()
 
int getYScale ()
 
int increaseDelayLevels (int neededDelay)
 
int initializeState ()
 
virtual int insertProbe (LayerProbe *probe)
 
int ioParams (enum ParamsIOFlag ioFlag)
 
bool isExtended ()
 
int mirrorInteriorToBorder (int whichBorder, PVLayerCube *cube, PVLayerCube *borderCube)
 
int mirrorInteriorToBorder (PVLayerCube *cube, PVLayerCube *borderCube)
 
virtual int mirrorToEast (PVLayerCube *dest, PVLayerCube *src)
 
virtual int mirrorToNorth (PVLayerCube *dest, PVLayerCube *src)
 
virtual int mirrorToNorthEast (PVLayerCube *dest, PVLayerCube *src)
 
virtual int mirrorToNorthWest (PVLayerCube *dest, PVLayerCube *src)
 
virtual int mirrorToSouth (PVLayerCube *dest, PVLayerCube *src)
 
virtual int mirrorToSouthEast (PVLayerCube *dest, PVLayerCube *src)
 
virtual int mirrorToSouthWest (PVLayerCube *dest, PVLayerCube *src)
 
virtual int mirrorToWest (PVLayerCube *dest, PVLayerCube *src)
 
virtual bool needUpdate (double time, double dt)
 
int outputProbeParams ()
 
virtual int outputState (double timef, bool last=false)
 
virtual int publish (InterColComm *comm, double time)
 
virtual int recvAllSynapticInput ()
 
virtual int requireChannel (int channelNeeded, int *numChannelsResult)
 
virtual int requireMarginWidth (int marginWidthNeeded, int *marginWidthResult, char axis)
 
int resetBuffer (pvdata_t *buf, int numItems)
 
virtual int resetGSynBuffers (double timef, double dt)
 
void setAllocDeviceActiveIndices ()
 
void setAllocDeviceActivity ()
 
void setAllocDeviceDatastore ()
 
void setAllocDeviceGSyn ()
 
void setAllocDeviceV ()
 
void setDataStructuresAllocatedFlag ()
 
void setInitialValuesSetFlag ()
 
void setInitInfoCommunicatedFlag ()
 
void setLayerId (int id)
 
virtual void setNextUpdateTime (double in)
 
void setUpdatedDeviceActivityFlag (bool in)
 
void setUpdatedDeviceDatastoreFlag (bool in)
 
void setUpdatedDeviceGSynFlag (bool in)
 
virtual void syncGpu ()
 
void synchronizeMarginWidth (HyPerLayer *layer)
 
virtual int updateActiveIndices ()
 
virtual int updateAllActiveIndices ()
 
virtual int updateBorder (double time, double dt)
 
virtual int updateNextTriggerTime ()
 
virtual int updateNextUpdateTime ()
 
virtual int updateStateGpu (double time, double dt)
 
virtual int updateStateWrapper (double time, double dt)
 
bool useMirrorBCs ()
 
virtual int waitOnPublish (InterColComm *comm)
 
virtual int writeActivity (double timed)
 
virtual int writeActivitySparse (double timed, bool includeValues)
 
virtual int writeTimers (std::ostream &stream)
 

Static Public Member Functions

static bool localDimensionsEqual (PVLayerLoc const *loc1, PVLayerLoc const *loc2)
 
template<typename T >
static int readBufferFile (const char *filename, InterColComm *comm, double *timed, T **buffers, int numbands, bool extended, const PVLayerLoc *loc)
 
template<typename T >
static int writeBufferFile (const char *filename, InterColComm *comm, double dtime, T **buffers, int numbands, bool extended, const PVLayerLoc *loc)
 

Data Fields

PVLayerclayer
 

Protected Member Functions

virtual int allocateActivity ()
 
template<typename T >
int allocateBuffer (T **buf, int bufsize, const char *bufname)
 
virtual int allocateBuffers ()
 
virtual int allocateClayerBuffers ()
 
int allocateCube ()
 
virtual int allocateDeviceBuffers ()
 
int allocateExtendedBuffer (pvdata_t **buf, const char *bufname)
 
virtual int allocateGSyn ()
 
virtual int allocatePrevActivity ()
 
int allocateRestrictedBuffer (pvdata_t **buf, const char *bufname)
 
virtual int allocateUpdateKernel ()
 
int allocateV ()
 
int buildLabelToIdx (int batchIdx)
 
float calcNormDist (float xVal, float mean, float binSigma)
 
void calcNumExtended ()
 
int calculateLabelVals (int batchIdx)
 
virtual int callUpdateState (double timed, double dt)
 
int checkLabelValBuf (int newSize)
 
virtual int copyInitialStateToGPU ()
 
virtual int doUpdateState (double timef, double dt, const PVLayerLoc *loc, pvdata_t *A, pvdata_t *V, int num_channels, pvdata_t *GSynHead)
 
virtual int doUpdateStateGpu (double timef, double dt, const PVLayerLoc *loc, pvdata_t *A, pvdata_t *V, int num_channels, pvdata_t *GSynHead)
 
template<typename T >
int freeBuffer (T **buf)
 
void freeChannels ()
 
int freeClayer ()
 
int freeExtendedBuffer (pvdata_t **buf)
 
int freeRestrictedBuffer (pvdata_t **buf)
 
int incrementNBands (int *numCalls)
 
virtual int initClayer ()
 
int initialize (const char *name, HyPerCol *hc)
 
virtual int initializeActivity ()
 
int initializeV ()
 
void ioParam_inputMethod (enum ParamsIOFlag ioFlag)
 
void ioParam_originalLayerName (enum ParamsIOFlag ioFlag)
 
void ioParam_outputMethod (enum ParamsIOFlag ioFlag)
 
void ioParam_segmentLayerName (enum ParamsIOFlag ioFlag)
 
int ioParamsFillGroup (enum ParamsIOFlag ioFlag)
 
virtual bool needReset (double timed, double dt)
 
int openOutputStateFile ()
 
char * pathInCheckpoint (const char *cpDir, const char *suffix)
 
virtual int readActivityFromCheckpoint (const char *cpDir, double *timeptr)
 
int readDataStoreFromFile (const char *filename, InterColComm *comm, double *timed)
 
virtual int readDelaysFromCheckpoint (const char *cpDir, double *timeptr)
 
virtual int readStateFromCheckpoint (const char *cpDir, double *timeptr)
 
virtual int readVFromCheckpoint (const char *cpDir, double *timeptr)
 
virtual int resetStateOnTrigger ()
 
virtual int runUpdateKernel ()
 
virtual int setActivity ()
 
virtual int setInitialValues ()
 
int setLayerLoc (PVLayerLoc *layerLoc, float nxScale, float nyScale, int nf, int numBatches)
 
int setName (char const *name)
 
int setOutputVals (int batchIdx)
 
int setParent (HyPerCol *hc)
 
virtual int updateState (double timef, double dt)
 
int writeDataStoreToFile (const char *filename, InterColComm *comm, double dtime)
 

Static Protected Member Functions

static int equalizeMargins (HyPerLayer *layer1, HyPerLayer *layer2)
 

Protected Attributes

bool allocDeviceActiveIndices
 
bool allocDeviceActivity
 
bool allocDeviceDatastore
 
bool allocDeviceGSyn
 
bool allocDeviceV
 
PVCuda::CudaBuffer * d_ActiveIndices
 
PVCuda::CudaBuffer * d_Activity
 
PVCuda::CudaBuffer * d_Datastore
 
PVCuda::CudaBuffer * d_GSyn
 
PVCuda::CudaBuffer * d_numActive
 
PVCuda::CudaBuffer * d_V
 
bool dataStructuresAllocatedFlag
 
PVDataType dataType
 
char * dataTypeString
 
PVCuda::CudaTimer * gpu_recvsyn_timer
 
PVCuda::CudaTimer * gpu_update_timer
 
pvdata_t ** GSyn
 
bool initializeFromCheckpointFlag
 
bool initialValuesSetFlag
 
double initialWriteTime
 
bool initInfoCommunicatedFlag
 
InitVinitVObject
 
char * inputMethod
 
Timerio_timer
 
int ioAppend
 
PVCuda::CudaKernel * krUpdate
 
int ** labelCount
 
int * labelIdxBuf
 
std::map< int, int > labelToIdx
 
float ** labelVals
 
double lastUpdateTime
 
int layerId
 
int * marginIndices
 
float maxRate
 
bool mirrorBCflag
 
char * name
 
double nextTriggerTime
 
double nextUpdateTime
 
int numChannels
 
int numDelayLevels
 
int numFeatures
 
int numLabelVals
 
int numMargin
 
int numProbes
 
int numSynchronizedMarginWidthLayers
 
float nxScale
 
float nyScale
 
HyPerLayeroriginalLayer
 
char * originalLayerName
 
char * outputMethod
 
PV_StreamoutputStateStream
 
HyPerColparent
 
int phase
 
LayerProbe ** probes
 
Timerpublish_timer
 
std::vector< BaseConnection * > recvConns
 
bool recvGpu
 
Timerrecvsyn_calc_timer
 
Timerrecvsyn_timer
 
bool restartFlag
 
unsigned int rngSeedBase
 
SegmentLayersegmentLayer
 
char * segmentLayerName
 
bool sparseLayer
 
HyPerLayer ** synchronizedMarginWidthLayers
 
pvdata_t ** thread_gSyn
 
Timertimescale_timer
 
char * triggerBehavior
 
TriggerBehaviorType triggerBehaviorType
 
bool triggerFlag
 
HyPerLayertriggerLayer
 
char * triggerLayerName
 
double triggerOffset
 
HyPerLayertriggerResetLayer
 
char * triggerResetLayerName
 
Timerupdate_timer
 
bool updatedDeviceActivity
 
bool updatedDeviceDatastore
 
bool updatedDeviceGSyn
 
bool updateGpu
 
pvdata_t valueBC
 
int writeActivityCalls
 
int writeActivitySparseCalls
 
bool writeSparseValues
 
double writeStep
 
double writeTime
 
int xmargin
 
int ymargin
 

Private Member Functions

int initialize_base ()
 

Detailed Description

Definition at line 9 of file Segmentify.hpp.

Member Function Documentation

int PV::HyPerLayer::allocateDeviceBuffers ( )
protectedvirtualinherited

Allocate GPU buffers. This must be called after PVLayer data have been allocated.

Definition at line 1012 of file HyPerLayer.cpp.

int PV::HyPerLayer::allocateExtendedBuffer ( pvdata_t **  buf,
const char *  bufname 
)
protectedinherited

Allocates an extended buffer (that is, buffer's length is getNumExtendedAllBatches()).

Definition at line 529 of file HyPerLayer.cpp.

int PV::HyPerLayer::allocateRestrictedBuffer ( pvdata_t **  buf,
const char *  bufname 
)
protectedinherited

Allocates a restricted buffer (that is, buffer's length is getNumNeuronsAllBatches()).

Definition at line 525 of file HyPerLayer.cpp.

int PV::HyPerLayer::callUpdateState ( double  timed,
double  dt 
)
protectedvirtualinherited

Called by updateStateWrapper when updating the state in the usual way (as opposed to being triggered when triggerBehavior is resetStateOnTrigger). It calls either updateState or updateStateGPU. It also starts and stops the update timer.

Definition at line 1689 of file HyPerLayer.cpp.

int PV::HyPerLayer::freeExtendedBuffer ( pvdata_t **  buf)
protectedinherited

Frees a buffer created by allocateRestrictedBuffer(). Note that there is no checking whether the buffer was created by allocateExtendedBuffer(), or any other allocateBuffer()-related method.

Definition at line 448 of file HyPerLayer.cpp.

int PV::HyPerLayer::freeRestrictedBuffer ( pvdata_t **  buf)
protectedinherited

Frees a buffer created by allocateRestrictedBuffer(). Note that there is no checking whether the buffer was created by allocateRestrictedBuffer(), or any other allocateBuffer()-related method.

Definition at line 444 of file HyPerLayer.cpp.

double PV::HyPerLayer::getDeltaTriggerTime ( )
virtualinherited

A function to return the interval between triggering times. A negative value means that the layer never triggers (either there is no triggerLayer or the triggerLayer never updates).

Definition at line 1657 of file HyPerLayer.cpp.

double PV::HyPerLayer::getDeltaUpdateTime ( )
virtualinherited

A function to return the interval between times when updateState is needed.

Reimplemented in PV::Patterns, PV::ImageFromMemoryBuffer, PV::ImagePvp, PV::MoviePvp, PV::HyPerLCALayer, and PV::ISTALayer.

Definition at line 1637 of file HyPerLayer.cpp.

const pvdata_t * PV::HyPerLayer::getLayerData ( int  delay = 0)
inherited

Returns the activity data for the layer. This data is in the extended space (with margins).

Definition at line 1551 of file HyPerLayer.cpp.

void PV::HyPerLayer::ioParam_initializeFromCheckpointFlag ( enum ParamsIOFlag  ioFlag)
protectedvirtualinherited

initializeFromCheckpointFlag: If set to true, initialize using checkpoint direcgtory set in HyPerCol.

Checkpoint read directory must be set in HyPerCol to initialize from checkpoint.

Definition at line 835 of file HyPerLayer.cpp.

void PV::HyPerLayer::ioParam_InitVType ( enum ParamsIOFlag  ioFlag)
protectedvirtualinherited

initVType: Specifies how to initialize the V buffer.

Possible choices include

Further parameters are needed depending on initialization type.

Reimplemented in PV::BaseInput, PV::Retina, and PV::CloneVLayer.

Definition at line 842 of file HyPerLayer.cpp.

void PV::HyPerLayer::ioParam_nxScale ( enum ParamsIOFlag  ioFlag)
protectedvirtualinherited

nxScale: Defines the relationship between the x column size and the layer size.

Must be 2^n or 1/2^n

Definition at line 805 of file HyPerLayer.cpp.

void PV::HyPerLayer::ioParam_nyScale ( enum ParamsIOFlag  ioFlag)
protectedvirtualinherited

nyScale: Defines the relationship between the y column size and the layer size.

Must be 2^n or 1/2^n

Definition at line 809 of file HyPerLayer.cpp.

void PV::HyPerLayer::ioParam_triggerBehavior ( enum ParamsIOFlag  ioFlag)
protectedvirtualinherited

triggerBehavior: If triggerLayerName is set, this parameter specifies how the trigger is handled.

The possible values of triggerBehavior are:

  • "updateOnlyOnTrigger": updateState is called (computing activity buffer from GSyn) only on triggering timesteps. On other timesteps the layer's state remains unchanged.
  • "resetStateOnTrigger": On timesteps where the trigger occurs, the membrane potential is copied from the layer specified in triggerResetLayerName and setActivity is called. On nontriggering timesteps, updateState is called. For backward compatibility, this parameter defaults to updateOnlyOnTrigger.

Definition at line 912 of file HyPerLayer.cpp.

void PV::HyPerLayer::ioParam_triggerFlag ( enum ParamsIOFlag  ioFlag)
protectedvirtualinherited

triggerFlag: (Deprecated) Specifies if this layer is being triggered

Defaults to false. This flag is deprecated. To turn triggering off, set triggerLayer to NULL or the empty string. It is an error to set this flag to false and triggerLayer to a nonempty string.

Reimplemented in PV::ConstantLayer.

Definition at line 875 of file HyPerLayer.cpp.

void PV::HyPerLayer::ioParam_triggerOffset ( enum ParamsIOFlag  ioFlag)
protectedvirtualinherited

triggerOffset: If triggerLayer is set, triggers <triggerOffset> timesteps before target trigger

Defaults to 0

Definition at line 903 of file HyPerLayer.cpp.

void PV::HyPerLayer::ioParam_writeStep ( enum ParamsIOFlag  ioFlag)
protectedvirtualinherited

writeStep: Specifies how often to output a pvp file for this layer

Defaults to every timestep. -1 specifies not to write at all.

Definition at line 952 of file HyPerLayer.cpp.

int PV::Segmentify::ioParamsFillGroup ( enum ParamsIOFlag  ioFlag)
protectedvirtual

The function that calls all ioParam functions

Reimplemented from PV::HyPerLayer.

Definition at line 34 of file Segmentify.cpp.

int PV::HyPerLayer::mirrorInteriorToBorder ( int  whichBorder,
PVLayerCube cube,
PVLayerCube border 
)
inherited

Copy cube data to the border region while applying boundary conditions

  • this implements mirror boundary conditions
  • assumes both input PVLayerCubes are of identical size and shape, typically the same struct

Definition at line 1562 of file HyPerLayer.cpp.

bool PV::HyPerLayer::needReset ( double  timed,
double  dt 
)
protectedvirtualinherited

Returns true if the trigger behavior is resetStateOnTrigger and the layer was triggered.

Definition at line 1666 of file HyPerLayer.cpp.

bool PV::HyPerLayer::needUpdate ( double  time,
double  dt 
)
virtualinherited

A virtual function to determine if callUpdateState method needs to be called Default behavior is dependent on the triggering method. If there is no triggering, always returns true. If there is triggering and the trigger behavior is updateOnlyOnTrigger, returns true only when there is a triggering event. If there is triggering and the trigger behavior is resetStateOnTrigger, returns true only when there is not a trigger event.

Parameters
timeThe current timestep of the run
dtThe current non-adaptive dt of the run
Returns
Returns if the update needs to happen

Reimplemented in PV::ImageFromMemoryBuffer, and PV::ConstantLayer.

Definition at line 1608 of file HyPerLayer.cpp.

int PV::HyPerLayer::resetStateOnTrigger ( )
protectedvirtualinherited

Called instead of updateState when triggerBehavior is "resetStateOnTrigger" and a triggering event occurs. Copies the membrane potential V from triggerResetLayer and then calls setActivity to update A.

Definition at line 1747 of file HyPerLayer.cpp.

virtual void PV::HyPerLayer::setNextUpdateTime ( double  in)
inlinevirtualinherited

A function to set nextUpdateTime to a specific time

Definition at line 423 of file HyPerLayer.hpp.

int PV::HyPerLayer::updateNextTriggerTime ( )
virtualinherited

A function to update the time that the next trigger is expected to occur.

Definition at line 1646 of file HyPerLayer.cpp.

int PV::HyPerLayer::updateNextUpdateTime ( )
virtualinherited

A function to update nextUpdateTime of the layer based on trigger

Definition at line 1626 of file HyPerLayer.cpp.


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