PetaVision  Alpha
PV::BorderExchange Class Reference

Public Member Functions

 BorderExchange (MPIBlock const &mpiBlock, PVLayerLoc const &loc)
 
void exchange (float *data, std::vector< MPI_Request > &req)
 
MPIBlock const * getMPIBlock () const
 
int getNumNeighbors () const
 
int getRank () const
 

Static Public Member Functions

static int east (int row, int column, int numRows, int numColumns)
 
static bool hasEasternNeighbor (int row, int column, int numRows, int numColumns)
 
static bool hasNortheasternNeighbor (int row, int column, int numRows, int numColumns)
 
static bool hasNorthernNeighbor (int row, int column, int numRows, int numColumns)
 
static bool hasNorthwesternNeighbor (int row, int column, int numRows, int numColumns)
 
static bool hasSoutheasternNeighbor (int row, int column, int numRows, int numColumns)
 
static bool hasSouthernNeighbor (int row, int column, int numRows, int numColumns)
 
static bool hasSouthwesternNeighbor (int row, int column, int numRows, int numColumns)
 
static bool hasWesternNeighbor (int row, int column, int numRows, int numColumns)
 
static int north (int row, int column, int numRows, int numColumns)
 
static int northeast (int row, int column, int numRows, int numColumns)
 
static int northwest (int row, int column, int numRows, int numColumns)
 
static int south (int row, int column, int numRows, int numColumns)
 
static int southeast (int row, int column, int numRows, int numColumns)
 
static int southwest (int row, int column, int numRows, int numColumns)
 
static int wait (std::vector< MPI_Request > &req)
 
static int west (int row, int column, int numRows, int numColumns)
 

Private Member Functions

void freeDatatypes ()
 
void initNeighbors ()
 
int neighborIndex (int commId, int direction)
 
void newDatatypes ()
 
std::size_t recvOffset (int direction)
 
int reverseDirection (int commId, int direction)
 
std::size_t sendOffset (int direction)
 

Private Attributes

std::vector< MPI_Datatype > mDatatypes
 
PVLayerLoc mLayerLoc
 
MPIBlock const * mMPIBlock = nullptr
 
unsigned int mNumNeighbors
 
std::vector< int > neighbors
 

Static Private Attributes

static int const EAST = 5
 
static int exchangeCounter = 1024
 
static int const LOCAL = 0
 
static std::vector< int > const mTags = {0, 33, 34, 35, 34, 34, 35, 34, 33}
 
static int const NORTH = 2
 
static int const NORTHEAST = 3
 
static int const NORTHWEST = 1
 
static int const SOUTH = 7
 
static int const SOUTHEAST = 8
 
static int const SOUTHWEST = 6
 
static int const WEST = 4
 

Detailed Description

Definition at line 15 of file BorderExchange.hpp.

Member Function Documentation

int PV::BorderExchange::neighborIndex ( int  commId,
int  direction 
)
private

Returns the rank of the neighbor in the given direction If there is no neighbor, returns a negative value

Returns the intercolumn rank of the neighbor in the given direction If there is no neighbor, returns a negative value

Definition at line 177 of file BorderExchange.cpp.

std::size_t PV::BorderExchange::recvOffset ( int  direction)
private

Returns the recv data offset for the given neighbor

  • recv into borders

Definition at line 398 of file BorderExchange.cpp.

int PV::BorderExchange::reverseDirection ( int  commId,
int  direction 
)
private

In a send/receive exchange, when rank A makes an MPI send to its neighbor in direction x, that neighbor must make a complementary MPI receive call. To get the tags correct, the receiver needs to know the direction that the sender was using in determining which process to send to.

Thus, if every process does an MPI send in each direction, to the process of rank neighborIndex(icRank,direction) with mTags[direction], every process must also do an MPI receive in each direction, to the process of rank neighborIndex(icRank,direction) with tag[reverseDirection(icRank,direction)].

Definition at line 324 of file BorderExchange.cpp.

std::size_t PV::BorderExchange::sendOffset ( int  direction)
private

returns the send data offset for the given neighbor

  • send from interior

Returns the send data offset for the given neighbor

  • send from interior

Definition at line 431 of file BorderExchange.cpp.


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