Hitmap 1.3
 All Data Structures Namespaces Files Functions Variables Typedefs Friends Macros Groups Pages
Data Structures | Macros | Typedefs | Functions | Variables
hit_topology.h File Reference
#include <stdio.h>
#include "hit_shape.h"
#include "hit_error.h"
#include "hit_mpi.h"
Include dependency graph for hit_topology.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  HitRanks
 
struct  HitTopology
 

Macros

#define HIT_RANK_NULL_STATIC   -1
 
#define HIT_RANKS_NULL_STATIC   { { HIT_RANK_NULL_STATIC, HIT_RANK_NULL_STATIC, HIT_RANK_NULL_STATIC, HIT_RANK_NULL_STATIC } }
 
#define hit_ranks(numDims,...)   hit_ranks##numDims( __VA_ARGS__ )
 
#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])
 
#define hit_ranksDim(ranks, dim)   (ranks.rank[dim])
 
#define HIT_TOPOLOGY_PLAIN   1
 
#define HIT_TOPOLOGY_SQUARE   2
 
#define HIT_TOPOLOGY_ARRAY2DCOMP   3
 
#define HIT_TOPOLOGY_ARRAYDIMS   4
 
#define HIT_TOPOLOGY_DUMMYDIMS   5
 
#define HIT_TOPOLOGY_PLAIN_POWER2   10
 
#define HIT_TOPOLOGY_NULL_STATIC   {0, 0, { 0, 0, 0, 0 }, { { -1, -1, -1, -1} }, 0, NULL }
 
#define hit_topology(name,...)   hit_topology_##name(HIT_TOPOLOGY_INFO, ##__VA_ARGS__ )
 
#define hit_topology_plug_topArray2D(topo)   hit_topology_plug_topArrayDims(topo, 2);
 
#define hit_topology_plug_topArray3D(topo)   hit_topology_plug_topArrayDims(topo, 3);
 
#define hit_topology_plug_topArray4D(topo)   hit_topology_plug_topArrayDims(topo, 4);
 
#define hit_topSelfActive(topo)   (topo.active)
 
#define hit_topDims(topo)   (topo.numDims)
 
#define hit_topDimCard(topo, i)   (topo.card[i])
 
#define hit_topRanks(topo)   (topo.self)
 
#define hit_topDimRank(topo, i)   (topo.self.rank[i])
 
#define hit_topSelfRankInternal(topo)   ( (topo).pTopology->selfRank )
 
#define hit_topDimForeach(topo, dim, index)   for( index=0; index<topo.card[dim]; index++)
 
#define hit_topImActive(topo)   ((topo).active)
 
#define hit_topImLeader(topo)   ((topo).pTopology->selfRank == 0 )
 
#define hit_topInactiveWarning(topo)
 

Typedefs

typedef struct HitRanks HitRanks
 
typedef struct HitTopology HitTopology
 

Functions

HitTopology hit_topology_plug_topPlain (HitPTopology *topo)
 
HitTopology hit_topology_plug_topPlainPower2 (HitPTopology *topo)
 
HitTopology hit_topology_plug_topSquare (HitPTopology *topo)
 
HitTopology hit_topology_plug_topArray2DComplete (HitPTopology *topo)
 
HitTopology hit_topology_plug_topArrayDims (HitPTopology *topo, int dims)
 
HitTopology hit_topology_plug_topDummyDims (HitPTopology *topo, int dims, int *virprocelems)
 
int hit_topCard (HitTopology topo)
 
void hit_topFree (HitTopology topo)
 
int hit_topDimNeighbor (HitTopology topo, int dim, int shift)
 
int hit_topRankInternal (HitTopology topo, HitRanks ranks)
 
HitRanks hit_topRanksInternal (HitTopology topo, int linealRank)
 

Variables

int HIT_RANK_NULL
 
HitRanks HIT_RANKS_NULL
 
HitRanks HIT_RANKS_LEADER
 
HitTopology HIT_TOPOLOGY_NULL
 

Detailed Description

Physical and virtual topologies of processes.

Plug-in system to introduce virtual topology generation policies, that defines groups of processes and neighbor relations among them. Support for virtual multidimensional grid topologies.

Version
1.3
Author
Arturo Gonzalez-Escribano
Javier Fresno Bausela
Date
Ene 2015

Definition in file hit_topology.h.

Macro Definition Documentation

#define HIT_RANK_NULL_STATIC   -1

Value for null static rank

Definition at line 144 of file hit_topology.h.

#define hit_ranks (   numDims,
  ... 
)    hit_ranks##numDims( __VA_ARGS__ )

HitRanks constructor function. The first argument is the dimension number, the following arguments are the value of the ranks.

Parameters
numDimsDimension number for the ranks
Returns
A HitRank object.

Definition at line 169 of file hit_topology.h.

HitRanks null static value

Definition at line 154 of file hit_topology.h.

#define hit_ranksCmp (   a,
 
)    ((a).rank[0] == (b).rank[0] && (a).rank[1] == (b).rank[1] && (a).rank[2] == (b).rank[2] && (a).rank[3] == (b).rank[3])

hit_ranks: Compare two HitRanks

Parameters
aA HitRanks
bA HitRanks

Definition at line 220 of file hit_topology.h.

#define hit_ranksDim (   ranks,
  dim 
)    (ranks.rank[dim])

hit_ranksDim: Returns the coordinate of a HitRanks object in a given dimension

Parameters
ranksHitRanks object
dimThe number of a dimension

Definition at line 228 of file hit_topology.h.

#define hit_topDimCard (   topo,
 
)    (topo.card[i])

Cardinality of a topology dimension

Definition at line 413 of file hit_topology.h.

#define hit_topDimForeach (   topo,
  dim,
  index 
)    for( index=0; index<topo.card[dim]; index++)

Perform a loop across virtual processors of the given dimension

Definition at line 471 of file hit_topology.h.

#define hit_topDimRank (   topo,
 
)    (topo.self.rank[i])

Self topology coordinate in a given dimension

Definition at line 431 of file hit_topology.h.

#define hit_topDims (   topo)    (topo.numDims)

Number of dimensions of the topology

Definition at line 407 of file hit_topology.h.

#define hit_topImActive (   topo)    ((topo).active)

Check if the processor is active in the topology

Definition at line 478 of file hit_topology.h.

#define hit_topImLeader (   topo)    ((topo).pTopology->selfRank == 0 )

Check if the processor is the leader (rank 0) in the topology

Definition at line 486 of file hit_topology.h.

#define hit_topInactiveWarning (   topo)
Value:
if ( hit_topImLeader(topo) ) { \
int numInactive = HIT_TOPOLOGY_INFO.numProcs - hit_topCard( topo ); \
if ( numInactive > 0 ) { \
char message[256]; \
sprintf( message, "%d Processors inactive in topology \"%s\"", numInactive, #topo); \
hit_warning( message, __FILE__, __LINE__ ); \
} \
}
#define hit_warning(name, file, numLine)
Definition: hit_error.h:82
HitPTopology * HIT_TOPOLOGY_INFO
Definition: hit_topology.c:60
#define hit_topImLeader(topo)
Definition: hit_topology.h:486
int hit_topCard(HitTopology topo)
Definition: hit_topology.c:361

Issue a warning in case of inactive processors in a topology

Definition at line 492 of file hit_topology.h.

#define hit_topology (   name,
  ... 
)    hit_topology_##name(HIT_TOPOLOGY_INFO, ##__VA_ARGS__ )

Topology constructor Hitmap provides this function to create some of the most used topologies. This predefined topologies are: plain, square, array2D, array2DComplete, array3D and array4D.

Parameters
nameThe name of the topology.
Returns
A new HitTopology

Definition at line 308 of file hit_topology.h.

#define HIT_TOPOLOGY_ARRAY2DCOMP   3

Array 2D complete topology type constant.

Definition at line 271 of file hit_topology.h.

#define HIT_TOPOLOGY_ARRAYDIMS   4

Array dims topology type constant.

Definition at line 276 of file hit_topology.h.

#define HIT_TOPOLOGY_DUMMYDIMS   5

Multidimensional dummy topology type constant.

Definition at line 281 of file hit_topology.h.

#define HIT_TOPOLOGY_NULL_STATIC   {0, 0, { 0, 0, 0, 0 }, { { -1, -1, -1, -1} }, 0, NULL }

HitTopology null static value.

Definition at line 298 of file hit_topology.h.

#define HIT_TOPOLOGY_PLAIN   1

Plain topology type constant.

Definition at line 261 of file hit_topology.h.

#define HIT_TOPOLOGY_PLAIN_POWER2   10

Plain topology with restrictions: Number of active procs is a power of 2

Definition at line 287 of file hit_topology.h.

#define hit_topology_plug_topArray2D (   topo)    hit_topology_plug_topArrayDims(topo, 2);

2D Array topology generator

The processors are arranged in a 2-dimensional topology Some processor may be inactive. If the input is power of two the result cardinalities keep this property First dimensions are bigger

Definition at line 374 of file hit_topology.h.

#define hit_topology_plug_topArray3D (   topo)    hit_topology_plug_topArrayDims(topo, 3);

3D Array topology generator

The processors are arranged in a 3-dimensional topology Some processor may be inactive. If the input is power of two the result cardinalities keep this property First dimensions are bigger

Definition at line 384 of file hit_topology.h.

#define hit_topology_plug_topArray4D (   topo)    hit_topology_plug_topArrayDims(topo, 4);

4D Array topology generator

The processors are arranged in a 4-dimensional topology Some processor may be inactive. If the input is power of two the result cardinalities keep this property First dimensions are bigger

Definition at line 394 of file hit_topology.h.

#define HIT_TOPOLOGY_SQUARE   2

Square topology type constant.

Definition at line 266 of file hit_topology.h.

#define hit_topRanks (   topo)    (topo.self)

Self rank of the current processor in the topology

Definition at line 425 of file hit_topology.h.

#define hit_topSelfActive (   topo)    (topo.active)

Active state of the processor in the topology

Definition at line 401 of file hit_topology.h.

#define hit_topSelfRankInternal (   topo)    ( (topo).pTopology->selfRank )

Self topology linear rank

Definition at line 439 of file hit_topology.h.

Typedef Documentation

typedef struct HitRanks HitRanks

/* 2. RANKS IN MULTIDIMENSIONAL GRID ADT for ranks in a multidimensional domain.

typedef struct HitTopology HitTopology

ADT for topologies A topology is a representation of a set of processor ordered in a number of dimensions. This structure also define the position of the actual processor in the topology.

Function Documentation

int hit_topCard ( HitTopology  topo)

Topology cardinality: number of active processors in the topology.

Definition at line 361 of file hit_topology.c.

Here is the caller graph for this function:

int hit_topDimNeighbor ( HitTopology  topo,
int  dim,
int  shift 
)

Return the neighbor index in the selected dimension with a shift.

Definition at line 376 of file hit_topology.c.

void hit_topFree ( HitTopology  topo)

Free the resources used by a topology

Definition at line 129 of file hit_topology.c.

Here is the call graph for this function:

Here is the caller graph for this function:

HitTopology hit_topology_plug_topArray2DComplete ( HitPTopology *  topo)

Complete 2D Array topology generator

First dimension bigger. All processors are arranged in a two-dimensional topology or in a one-dimensional topology if some of then can't active. All of them are active.

Definition at line 207 of file hit_topology.c.

Here is the call graph for this function:

HitTopology hit_topology_plug_topArrayDims ( HitPTopology *  topo,
int  dims 
)

X-D Array topology generator

The processors are arranged in a X-dimensional topology Some processor may be inactive. If the input is power of two the result cardinalities keep this property First dimensions are bigger

This function is meant to be used thought the macros below.

Definition at line 249 of file hit_topology.c.

Here is the call graph for this function:

HitTopology hit_topology_plug_topDummyDims ( HitPTopology *  topo,
int  dims,
int *  virprocelems 
)

Definition at line 319 of file hit_topology.c.

HitTopology hit_topology_plug_topPlain ( HitPTopology *  topo)

Plain topology generator

All the processor are arranged in one dimension. All of them are active.

Definition at line 139 of file hit_topology.c.

Here is the call graph for this function:

HitTopology hit_topology_plug_topPlainPower2 ( HitPTopology *  topo)

Plain topology generator, which restricts the number of active processors to a power of 2

All the processor are arranged in one dimension. Only a power of 2 number of processors are active

Definition at line 156 of file hit_topology.c.

Here is the call graph for this function:

HitTopology hit_topology_plug_topSquare ( HitPTopology *  topo)

Square topology generator

The processors are arranged in a perfect square two-dimensional topology Uneven processors are inactive

Definition at line 176 of file hit_topology.c.

Here is the call graph for this function:

int hit_topRankInternal ( HitTopology  topo,
HitRanks  ranks 
)

Converts a multidimensional HitRanks in a linear value

Definition at line 415 of file hit_topology.c.

Here is the caller graph for this function:

HitRanks hit_topRanksInternal ( HitTopology  topo,
int  linealRank 
)

Converts a linear value in a HitRanks

Definition at line 438 of file hit_topology.c.

Here is the caller graph for this function:

Variable Documentation

int HIT_RANK_NULL

Value for null rank

Definition at line 67 of file hit_topology.c.

HitRanks HIT_RANKS_LEADER

Rank of a group leader

HitRanks HIT_RANKS_NULL

HitRanks null value

Is a HitRanks structure with all the ranks set to HIT_RANK_NULL

Definition at line 68 of file hit_topology.c.

HitTopology HIT_TOPOLOGY_NULL

HitTopology null value.

Definition at line 64 of file hit_topology.c.