PetaVision  Alpha
PV::PoolingDelivery Class Reference

#include <PoolingDelivery.hpp>

Inheritance diagram for PV::PoolingDelivery:
PV::BaseDelivery PV::BaseObject PV::CheckpointerDataInterface PV::Observer

BaseDelivery Parameters

List of parameters needed from the BaseDelivery class

virtual void ioParam_channelCode (enum ParamsIOFlag ioFlag)
 channelCode: Specifies which channel in the post layer this connection is attached to More...
 
virtual void ioParam_receiveGpu (enum ParamsIOFlag ioFlag)
 receiveGpu: If PetaVision was compiled with GPU acceleration and this flag is set to true, the connection uses the GPU to update the postsynaptic layer's GSyn. If compiled without GPU acceleration, it is an error to set this flag to true.
 

PoolingDelivery Parameters

List of parameters needed from the PoolingDelivery class

virtual void ioParam_pvpatchAccumulateType (enum ParamsIOFlag ioFlag)
 pvpatchAccumulateType: Specifies the method to accumulate synaptic input More...
 
virtual void ioParam_updateGSynFromPostPerspective (enum ParamsIOFlag ioFlag)
 updateGSynFromPostPerspective: Specifies if the connection should push from pre or pull from post. This parameter is read if receiveGpu is false. More...
 
void ioParam_needPostIndexLayer (enum ParamsIOFlag ioFlag)
 
void ioParam_postIndexLayerName (enum ParamsIOFlag ioFlag)
 

Public Types

enum  AccumulateType { UNDEFINED, MAXPOOLING, SUMPOOLING, AVGPOOLING }
 

Public Member Functions

 PoolingDelivery (char const *name, HyPerCol *hc)
 
virtual void deliver () override
 
virtual void deliverUnitInput (float *recvBuffer)
 
AccumulateType getAccumulateType () const
 
ChannelType getChannelCode () const
 
bool getDataStructuresAllocatedFlag () const
 
std::string const & getDescription () const
 
char const * getDescription_c () const
 
bool getInitialValuesSetFlag () const
 
bool getInitInfoCommunicatedFlag () const
 
MPIBlock const * getMPIBlock ()
 
char const * getName () const
 
std::string const & getObjectType () const
 
PoolingIndexLayergetPostIndexLayer () const
 
HyPerLayergetPostLayer () const
 
HyPerLayergetPreLayer () const
 
bool getReceiveGpu () const
 
void ioParams (enum ParamsIOFlag ioFlag, bool printHeader, bool printFooter)
 
virtual bool isAllInputReady () override
 
bool isUsingGPU () const
 
char const * lookupKeyword () const
 
void readParams ()
 
virtual Response::Status registerData (Checkpointer *checkpointer)
 
virtual Response::Status respond (std::shared_ptr< BaseMessage const > message) override
 
void setConnectionData (ConnectionData *connectionData)
 
void writeParams ()
 

Static Public Member Functions

static AccumulateType parseAccumulateTypeString (char const *typestring)
 

Protected Member Functions

virtual Response::Status allocateDataStructures () override
 
void allocateThreadGSyn ()
 
virtual Response::Status cleanup ()
 
void clearGateIdxBuffer ()
 
virtual Response::Status communicateInitInfo (std::shared_ptr< CommunicateInitInfoMessage const > message) override
 
virtual Response::Status copyInitialStateToGPU ()
 
void deliverGPU ()
 
void deliverPostsynapticPerspective ()
 
void deliverPresynapticPerspective ()
 
int initialize (char const *name, HyPerCol *hc)
 
void initializeDeliverKernelArgs ()
 
virtual Response::Status initializeState ()
 
virtual int ioParamsFillGroup (enum ParamsIOFlag ioFlag) override
 
virtual Response::Status prepareCheckpointWrite ()
 
virtual Response::Status processCheckpointRead ()
 
virtual Response::Status readStateFromCheckpoint (Checkpointer *checkpointer) override
 
Response::Status respondAllocateData (std::shared_ptr< AllocateDataMessage const > message)
 
Response::Status respondCleanup (std::shared_ptr< CleanupMessage 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) override
 
void setDataStructuresAllocatedFlag ()
 
void setDescription ()
 
void setInitialValuesSetFlag ()
 
void setInitInfoCommunicatedFlag ()
 
int setName (char const *name)
 
virtual void setObjectType () override
 
int setParent (HyPerCol *hc)
 

Protected Attributes

std::string description
 
AccumulateType mAccumulateType = UNDEFINED
 
ChannelType mChannelCode = CHANNEL_EXC
 
ConnectionDatamConnectionData = nullptr
 
PVCuda::CudaDevice * mCudaDevice = nullptr
 
bool mDataStructuresAllocatedFlag = false
 
bool mInitialValuesSetFlag = false
 
bool mInitInfoCommunicatedFlag = false
 
bool mNeedPostIndexLayer = false
 
std::string mObjectType
 
PatchSizemPatchSize = nullptr
 
PoolingIndexLayermPostIndexLayer = nullptr
 
char * mPostIndexLayerName = nullptr
 
HyPerLayermPostLayer = nullptr
 
HyPerLayermPreLayer = nullptr
 
char * mPvpatchAccumulateTypeString = nullptr
 
bool mReceiveGpu = false
 
PVCuda::CudaPoolingDeliverKernelmRecvKernel = nullptr
 
std::vector< std::vector< float > > mThreadGateIdxBuffer
 
std::vector< std::vector< float > > mThreadGSyn
 
bool mUpdateGSynFromPostPerspective = false
 
bool mUsingGPUFlag = false
 
ImpliedWeightsPairmWeightsPair = nullptr
 
char * name = nullptr
 
HyPerColparent = nullptr
 

Detailed Description

The delivery component for PoolingConns.

Definition at line 24 of file PoolingDelivery.hpp.

Member Function Documentation

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.

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.

void PV::BaseDelivery::ioParam_channelCode ( enum ParamsIOFlag  ioFlag)
protectedvirtualinherited

channelCode: Specifies which channel in the post layer this connection is attached to

Channels can be -1 for no update, or >= 0 for channel number.
0 is excitatory, 1 is inhibitory

Definition at line 29 of file BaseDelivery.cpp.

void PV::PoolingDelivery::ioParam_needPostIndexLayer ( enum ParamsIOFlag  ioFlag)
protected

needPostIndexLayer: Set to true if a PostIndexLayer is needed; false otherwise.

Definition at line 101 of file PoolingDelivery.cpp.

void PV::PoolingDelivery::ioParam_postIndexLayerName ( enum ParamsIOFlag  ioFlag)
protected

If needPostIndexLayer is set, this parameter specifies the name of the PostIndexLayer.

Definition at line 106 of file PoolingDelivery.cpp.

void PV::PoolingDelivery::ioParam_pvpatchAccumulateType ( enum ParamsIOFlag  ioFlag)
protectedvirtual

pvpatchAccumulateType: Specifies the method to accumulate synaptic input

Possible choices are

  • maxpooling: Takes the maximum value in the receptive field
  • sumpooling: Takes the sum of all input values in the receptive field (equivalent to convolution where all weights are equal to one).
  • avgpooling: Takes the average of all input values in the receptive field.

This parameter is required.

Definition at line 37 of file PoolingDelivery.cpp.

void PV::PoolingDelivery::ioParam_updateGSynFromPostPerspective ( enum ParamsIOFlag  ioFlag)
protectedvirtual

updateGSynFromPostPerspective: Specifies if the connection should push from pre or pull from post. This parameter is read if receiveGpu is false.

: If set to true, the connection loops over postsynaptic neurons, and each post-neuron pulls from its receptive field. This avoids issues of collisions when parallelizing, but is not able to take advantage of a sparse pre-layer.

If false, the connection loops over presynaptic neurons, and each pre-neuron pushes to its region of influence. This allows efficiency for sparse pre-layers, but requires extra memory to manage potential collisions as multiple pre-neurons write to the same post-neuron.

If the receiveGpu flag is set, the updateGSynFromPostPerspective is ignored, and the cuDNN pooling routines are used.

Definition at line 84 of file PoolingDelivery.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::PoolingDelivery::ioParamsFillGroup ( enum ParamsIOFlag  ioFlag)
overrideprotectedvirtual

The virtual method for reading parameters from the parent HyPerCol's parameters, and writing to the output params file.

Derived classes with additional parameters typically override ioParamsFillGroup to call the base class's ioParamsFillGroup method and then call ioParam_[parametername] for each of their parameters. The ioParam_[parametername] methods should call the parent HyPerCol's ioParamValue() and related methods, to ensure that all parameters that get read also get written to the outputParams-generated file.

Reimplemented from PV::BaseDelivery.

Definition at line 28 of file PoolingDelivery.cpp.

bool PV::PoolingDelivery::isAllInputReady ( )
overridevirtual

A virtual method to indicate whether the presynaptic layer's input is ready to be delivered.

Reimplemented from PV::BaseDelivery.

Definition at line 687 of file PoolingDelivery.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.

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.

PoolingDelivery::AccumulateType PV::PoolingDelivery::parseAccumulateTypeString ( char const *  typestring)
static

Translates the input string into an accumulated type. The parsing is case-insensitive, and the strings "max pooling", "max_pooling", and "maxpooling" all translate to MAXPOOLING. Sumpooling and avgpooling behave the same way. If the string does not match any of the accumulation type, the method returns UNDEFINED.

Definition at line 53 of file PoolingDelivery.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.

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::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: