5 #ifndef COMMUNICATOR_HPP_ 6 #define COMMUNICATOR_HPP_ 8 #include "Arguments.hpp" 9 #include "include/pv_arch.h" 10 #include "include/pv_types.h" 11 #include "structures/MPIBlock.hpp" 15 #include "arch/mpi/mpi.h" 17 #define COMMNAME_MAXLENGTH 16 36 int commRank() {
return localRank; }
37 int globalCommRank() {
return globalRank; }
38 int commSize() {
return localSize; }
39 int globalCommSize() {
return globalSize; }
41 MPI_Comm communicator()
const {
return localMPIBlock->
getComm(); }
42 MPI_Comm batchCommunicator()
const {
return batchMPIBlock->
getComm(); }
43 MPI_Comm globalCommunicator()
const {
return globalMPIBlock->
getComm(); }
45 MPIBlock const *getLocalMPIBlock()
const {
return localMPIBlock; }
46 MPIBlock const *getBatchMPIBlock()
const {
return batchMPIBlock; }
47 MPIBlock const *getGlobalMPIBlock()
const {
return globalMPIBlock; }
53 int reverseDirection(
int commId,
int direction);
55 int commRow() {
return commRow(localRank); }
56 int commColumn() {
return commColumn(localRank); }
57 int commBatch() {
return commBatch(globalRank); }
58 int numCommRows() {
return numRows; }
59 int numCommColumns() {
return numCols; }
60 int numCommBatches() {
return batchWidth; }
62 int getTag(
int neighbor) {
return tags[neighbor]; }
63 int getReverseTag(
int neighbor) {
return tags[reverseDirection(localRank, neighbor)]; }
65 bool isExtraProc() {
return isExtra; }
67 static const int LOCAL = 0;
68 static const int NORTHWEST = 1;
69 static const int NORTH = 2;
70 static const int NORTHEAST = 3;
71 static const int WEST = 4;
72 static const int EAST = 5;
73 static const int SOUTHWEST = 6;
74 static const int SOUTH = 7;
75 static const int SOUTHEAST = 8;
78 int commRow(
int commId);
79 int commColumn(
int commId);
80 int commBatch(
int commId);
90 int neighbors[NUM_NEIGHBORHOOD];
91 int tags[NUM_NEIGHBORHOOD];
92 int exchangeCounter = 1024;
97 int gcd(
int a,
int b);
125 int northwest(
int commRow,
int commColumn);
126 int north(
int commRow,
int commColumn);
127 int northeast(
int commRow,
int commColumn);
128 int west(
int commRow,
int commColumn);
129 int east(
int commRow,
int commColumn);
130 int southwest(
int commRow,
int commColumn);
131 int south(
int commRow,
int commColumn);
132 int southeast(
int commRow,
int commColumn);
bool hasWesternNeighbor(int commRow, int commColumn)
bool hasSoutheasternNeighbor(int commRow, int commColumn)
bool hasNortheasternNeighbor(int commRow, int commColumn)
int west(int commRow, int commColumn)
int northeast(int commRow, int commColumn)
bool hasSouthwesternNeighbor(int commRow, int commColumn)
bool hasSouthernNeighbor(int commRow, int commColumn)
int east(int commRow, int commColumn)
int north(int commRow, int commColumn)
int southwest(int commRow, int commColumn)
int northwest(int commRow, int commColumn)
int south(int commRow, int commColumn)
bool hasNeighbor(int neighborId)
bool hasNorthernNeighbor(int commRow, int commColumn)
int neighborIndex(int commId, int index)
bool hasEasternNeighbor(int commRow, int commColumn)
int southeast(int commRow, int commColumn)
bool hasNorthwesternNeighbor(int commRow, int commColumn)
int commIdFromRowColumn(int commRow, int commColumn)