17 Dim = (
int *)calloc(NDim,
sizeof(
int));
18 Period = (
int *)calloc(NDim,
sizeof(
int));
19 Remain = (
int *)calloc(NDim,
sizeof(
int));
20 PCoord = (
int *)calloc(NDim,
sizeof(
int));
23 MPI_Cart_create(MPI_COMM_WORLD, NDim, Dim, Period, 1, &CommGrid);
25 MPI_Cart_sub(CommGrid,Remain,&CommRow);
27 MPI_Cart_sub(CommGrid,Remain,&CommCol);
28 MPI_Cart_coords(CommGrid,Rank,NDim,PCoord);
33 SingProc(
int ExtSize,
int ExtRank,
int ExtNRow,
int ExtNCol){
37 Dim = (
int *)calloc(NDim,
sizeof(
int));
38 Period = (
int *)calloc(NDim,
sizeof(
int));
39 Remain = (
int *)calloc(NDim,
sizeof(
int));
40 PCoord = (
int *)calloc(NDim,
sizeof(
int));
41 Dim[0] = ExtNRow; Dim[1] = ExtNCol;
42 Period[0] = 0;Period[0] = 0;
44 MPI_Cart_create(MPI_COMM_WORLD, NDim, Dim, Period, 1, &CommGrid);
45 Remain[0] = 1;Remain[1] = 0;
46 MPI_Cart_sub(CommGrid,Remain,&CommRow);
47 Remain[0] = 0;Remain[1] = 1;
48 MPI_Cart_sub(CommGrid,Remain,&CommCol);
49 MPI_Cart_coords(CommGrid,Rank,NDim,PCoord);
Basics class to start a MPI grid.