COMBINATORIAL_BLAS
1.6
CCGrid.h
Go to the documentation of this file.
1
#ifndef _CC_GRID_
2
#define _CC_GRID_
3
4
namespace
combblas
{
5
6
class
CCGrid
7
{
8
public
:
9
CCGrid
(
int
c_factor,
int
gr_cols):
GridLayers
(c_factor),
GridCols
(gr_cols),
GridRows
(gr_cols)
10
{
11
MPI_Comm_rank(MPI_COMM_WORLD,&
myrank
);
12
MPI_Comm_size(MPI_COMM_WORLD,&
nprocs
);
13
14
layer_grid
=
myrank
% c_factor;
/* RankInFiber = layer_grid, indexed from 1 to c_factor */
15
RankInLayer
=
myrank
/ c_factor;
/* indexed from 1 to layer_length */
16
RankInCol
=
RankInLayer
/
GridCols
;
/* RankInCol = MYPROCROW */
17
RankInRow
=
RankInLayer
%
GridCols
;
/* RankInRow = MYPROCCOL */
18
19
// MPI_Comm_split(MPI_Comm comm, int color, int key, MPI_Comm *newcomm)
20
MPI_Comm_split(MPI_COMM_WORLD,
layer_grid
,
RankInLayer
, &
layerWorld
);
21
MPI_Comm_split(MPI_COMM_WORLD,
RankInLayer
,
layer_grid
, &
fiberWorld
);
22
23
MPI_Comm_split(MPI_COMM_WORLD,
layer_grid
*
GridRows
+
RankInLayer
/
GridRows
,
RankInRow
, &
rowWorld
);
24
MPI_Comm_split(MPI_COMM_WORLD,
layer_grid
*
GridCols
+
RankInLayer
%
GridRows
,
RankInCol
, &
colWorld
);
25
26
27
#ifdef DEBUG
28
printf(
"Rank %d maps to layer %d (rankinlayer: %d), row %d, and col %d\n"
,
myrank
,
layer_grid
,
RankInLayer
,
RankInCol
,
RankInRow
);
29
#endif
30
};
31
32
int
nprocs
;
33
int
myrank
;
34
int
GridRows
;
35
int
GridCols
;
36
int
GridLayers
;
// GridLayers = c_factor
37
int
RankInRow
;
38
int
RankInCol
;
39
int
RankInLayer
;
40
int
layer_grid
;
// layer_grid = RankInFiber
41
MPI_Comm
layerWorld
;
42
MPI_Comm
fiberWorld
;
43
MPI_Comm
rowWorld
;
44
MPI_Comm
colWorld
;
45
};
46
47
}
48
49
#endif
combblas::CCGrid::RankInLayer
int RankInLayer
Definition:
CCGrid.h:39
combblas::CCGrid::layer_grid
int layer_grid
Definition:
CCGrid.h:40
combblas::CCGrid::RankInCol
int RankInCol
Definition:
CCGrid.h:38
combblas::CCGrid::layerWorld
MPI_Comm layerWorld
Definition:
CCGrid.h:41
combblas::CCGrid::colWorld
MPI_Comm colWorld
Definition:
CCGrid.h:44
combblas::CCGrid
Definition:
CCGrid.h:6
combblas::CCGrid::nprocs
int nprocs
Definition:
CCGrid.h:30
combblas::CCGrid::CCGrid
CCGrid(int c_factor, int gr_cols)
Definition:
CCGrid.h:9
combblas::CCGrid::GridRows
int GridRows
Definition:
CCGrid.h:34
combblas
Definition:
CCGrid.h:4
combblas::CCGrid::fiberWorld
MPI_Comm fiberWorld
Definition:
CCGrid.h:42
combblas::CCGrid::RankInRow
int RankInRow
Definition:
CCGrid.h:37
combblas::CCGrid::rowWorld
MPI_Comm rowWorld
Definition:
CCGrid.h:43
combblas::CCGrid::GridCols
int GridCols
Definition:
CCGrid.h:35
combblas::CCGrid::myrank
int myrank
Definition:
CCGrid.h:33
combblas::CCGrid::GridLayers
int GridLayers
Definition:
CCGrid.h:36
3DSpGEMM
CCGrid.h
Generated by
1.8.13