69 typedef struct HitPTopology {
74 struct HitPTopology *next;
76 struct HitPTopology *global;
77 MPI_Group antiCommGroup;
95 #define HIT_PTOPOLOGY_NULL_STATIC { 0,0,0, MPI_COMM_NULL, NULL, NULL, MPI_GROUP_EMPTY }
102 #define hit_ptopoCmp(a,b) ((a)->comm == (b)->comm)
107 #define hit_ptopoIsNull(a) ((a)->comm == MPI_COMM_NULL)
144 #define HIT_RANK_NULL_STATIC -1
154 #define HIT_RANKS_NULL_STATIC { { HIT_RANK_NULL_STATIC, HIT_RANK_NULL_STATIC, HIT_RANK_NULL_STATIC, HIT_RANK_NULL_STATIC } }
169 #define hit_ranks( numDims, ... ) hit_ranks##numDims( __VA_ARGS__ )
176 static inline HitRanks hit_ranks1(
int r1 ) {
186 static inline HitRanks hit_ranks2(
int r1,
int r2 ) {
197 static inline HitRanks hit_ranks3(
int r1,
int r2,
int r3 ) {
209 static inline HitRanks hit_ranks4(
int r1,
int r2,
int r3,
int r4 ) {
210 HitRanks res = { { r1, r2, r3, r4 } };
220 #define hit_ranksCmp(a,b) ((a).rank[0] == (b).rank[0] && (a).rank[1] == (b).rank[1] && (a).rank[2] == (b).rank[2] && (a).rank[3] == (b).rank[3])
228 #define hit_ranksDim( ranks, dim ) (ranks.rank[dim])
261 #define HIT_TOPOLOGY_PLAIN 1
266 #define HIT_TOPOLOGY_SQUARE 2
271 #define HIT_TOPOLOGY_ARRAY2DCOMP 3
276 #define HIT_TOPOLOGY_ARRAYDIMS 4
281 #define HIT_TOPOLOGY_DUMMYDIMS 5
287 #define HIT_TOPOLOGY_PLAIN_POWER2 10
298 #define HIT_TOPOLOGY_NULL_STATIC {0, 0, { 0, 0, 0, 0 }, { { -1, -1, -1, -1} }, 0, NULL }
308 #define hit_topology( name, ... ) hit_topology_##name(HIT_TOPOLOGY_INFO, ##__VA_ARGS__ )
374 #define hit_topology_plug_topArray2D(topo) hit_topology_plug_topArrayDims(topo, 2);
384 #define hit_topology_plug_topArray3D(topo) hit_topology_plug_topArrayDims(topo, 3);
394 #define hit_topology_plug_topArray4D(topo) hit_topology_plug_topArrayDims(topo, 4);
401 #define hit_topSelfActive(topo) (topo.active)
407 #define hit_topDims(topo) (topo.numDims)
413 #define hit_topDimCard(topo, i) (topo.card[i])
425 #define hit_topRanks(topo) (topo.self)
431 #define hit_topDimRank(topo, i) (topo.self.rank[i])
439 #define hit_topSelfRankInternal(topo) ( (topo).pTopology->selfRank )
471 #define hit_topDimForeach(topo, dim, index) for( index=0; index<topo.card[dim]; index++)
478 #define hit_topImActive( topo ) ((topo).active)
486 #define hit_topImLeader( topo ) ((topo).pTopology->selfRank == 0 )
492 #define hit_topInactiveWarning( topo ) \
493 if ( hit_topImLeader(topo) ) { \
494 int numInactive = HIT_TOPOLOGY_INFO.numProcs - hit_topCard( topo ); \
495 if ( numInactive > 0 ) { \
497 sprintf( message, "%d Processors inactive in topology \"%s\"", numInactive, #topo); \
498 hit_warning( message, __FILE__, __LINE__ ); \
HitTopology hit_topology_plug_topSquare(HitPTopology *topo)
HitPTopology HIT_PTOPOLOGY_NULL
HitTopology hit_topology_plug_topPlainPower2(HitPTopology *topo)
HitRanks HIT_RANKS_LEADER
HitPTopology * hit_ptopSplit(HitPTopology *in, int group)
int hit_topRankInternal(HitTopology topo, HitRanks ranks)
HitPTopology * HIT_TOPOLOGY_INFO
HitTopology hit_topology_plug_topDummyDims(HitPTopology *topo, int dims, int *virprocelems)
#define HIT_RANK_NULL_STATIC
HitPTopology * hit_ptopDup(HitPTopology *in)
HitRanks hit_topRanksInternal(HitTopology topo, int linealRank)
void hit_topFree(HitTopology topo)
HitTopology hit_topology_plug_topPlain(HitPTopology *topo)
void hit_ptopFree(HitPTopology **in)
HitTopology hit_topology_plug_topArrayDims(HitPTopology *topo, int dims)
int hit_topDimNeighbor(HitTopology topo, int dim, int shift)
int hit_topCard(HitTopology topo)
struct HitTopology HitTopology
HitTopology hit_topology_plug_topArray2DComplete(HitPTopology *topo)
HitTopology HIT_TOPOLOGY_NULL