Fix indices. Introduce cdim index for data types
This commit is contained in:
parent
3e020396c5
commit
5d33bb9d57
@ -2,7 +2,7 @@
|
||||
TAG ?= CLANG
|
||||
ENABLE_MPI ?= true
|
||||
ENABLE_OPENMP ?= false
|
||||
COMM_TYPE ?= v2
|
||||
COMM_TYPE ?= v3
|
||||
|
||||
#Feature options
|
||||
OPTIONS += -DARRAY_ALIGNMENT=64
|
||||
|
@ -42,18 +42,18 @@ static void assembleResult(Comm* c, double* src, double* dst, int imax, int jmax
|
||||
int starts[NDIMS] = { 1, 1 };
|
||||
|
||||
if (commIsBoundary(c, LEFT)) {
|
||||
newSizes[IDIM] += 1;
|
||||
starts[IDIM] = 0;
|
||||
newSizes[CIDIM] += 1;
|
||||
starts[CIDIM] = 0;
|
||||
}
|
||||
if (commIsBoundary(c, RIGHT)) {
|
||||
newSizes[IDIM] += 1;
|
||||
newSizes[CIDIM] += 1;
|
||||
}
|
||||
if (commIsBoundary(c, BOTTOM)) {
|
||||
newSizes[JDIM] += 1;
|
||||
starts[JDIM] = 0;
|
||||
newSizes[CJDIM] += 1;
|
||||
starts[CJDIM] = 0;
|
||||
}
|
||||
if (commIsBoundary(c, TOP)) {
|
||||
newSizes[JDIM] += 1;
|
||||
newSizes[CJDIM] += 1;
|
||||
}
|
||||
|
||||
MPI_Type_create_subarray(NDIMS,
|
||||
@ -68,8 +68,8 @@ static void assembleResult(Comm* c, double* src, double* dst, int imax, int jmax
|
||||
|
||||
int newSizesI[c->size];
|
||||
int newSizesJ[c->size];
|
||||
MPI_Gather(&newSizes[IDIM], 1, MPI_INT, newSizesI, 1, MPI_INT, 0, MPI_COMM_WORLD);
|
||||
MPI_Gather(&newSizes[JDIM], 1, MPI_INT, newSizesJ, 1, MPI_INT, 0, MPI_COMM_WORLD);
|
||||
MPI_Gather(&newSizes[CIDIM], 1, MPI_INT, newSizesI, 1, MPI_INT, 0, MPI_COMM_WORLD);
|
||||
MPI_Gather(&newSizes[CJDIM], 1, MPI_INT, newSizesJ, 1, MPI_INT, 0, MPI_COMM_WORLD);
|
||||
|
||||
/* rank 0 assembles the subdomains */
|
||||
if (c->rank == 0) {
|
||||
@ -87,12 +87,12 @@ static void assembleResult(Comm* c, double* src, double* dst, int imax, int jmax
|
||||
i,
|
||||
coords[IDIM],
|
||||
coords[JDIM],
|
||||
oldSizes[IDIM],
|
||||
oldSizes[JDIM],
|
||||
newSizes[IDIM],
|
||||
newSizes[JDIM],
|
||||
starts[IDIM],
|
||||
starts[JDIM]);
|
||||
oldSizes[CIDIM],
|
||||
oldSizes[CJDIM],
|
||||
newSizes[CIDIM],
|
||||
newSizes[CJDIM],
|
||||
starts[CIDIM],
|
||||
starts[CJDIM]);
|
||||
|
||||
MPI_Type_create_subarray(NDIMS,
|
||||
oldSizes,
|
||||
|
@ -42,18 +42,18 @@ static void assembleResult(Comm* c, double* src, double* dst, int imax, int jmax
|
||||
int starts[NDIMS] = { 1, 1 };
|
||||
|
||||
if (commIsBoundary(c, LEFT)) {
|
||||
newSizes[IDIM] += 1;
|
||||
starts[IDIM] = 0;
|
||||
newSizes[CIDIM] += 1;
|
||||
starts[CIDIM] = 0;
|
||||
}
|
||||
if (commIsBoundary(c, RIGHT)) {
|
||||
newSizes[IDIM] += 1;
|
||||
newSizes[CIDIM] += 1;
|
||||
}
|
||||
if (commIsBoundary(c, BOTTOM)) {
|
||||
newSizes[JDIM] += 1;
|
||||
starts[JDIM] = 0;
|
||||
newSizes[CJDIM] += 1;
|
||||
starts[CJDIM] = 0;
|
||||
}
|
||||
if (commIsBoundary(c, TOP)) {
|
||||
newSizes[JDIM] += 1;
|
||||
newSizes[CJDIM] += 1;
|
||||
}
|
||||
|
||||
MPI_Type_create_subarray(NDIMS,
|
||||
@ -68,8 +68,8 @@ static void assembleResult(Comm* c, double* src, double* dst, int imax, int jmax
|
||||
|
||||
int newSizesI[c->size];
|
||||
int newSizesJ[c->size];
|
||||
MPI_Gather(&newSizes[IDIM], 1, MPI_INT, newSizesI, 1, MPI_INT, 0, MPI_COMM_WORLD);
|
||||
MPI_Gather(&newSizes[JDIM], 1, MPI_INT, newSizesJ, 1, MPI_INT, 0, MPI_COMM_WORLD);
|
||||
MPI_Gather(&newSizes[CIDIM], 1, MPI_INT, newSizesI, 1, MPI_INT, 0, MPI_COMM_WORLD);
|
||||
MPI_Gather(&newSizes[CJDIM], 1, MPI_INT, newSizesJ, 1, MPI_INT, 0, MPI_COMM_WORLD);
|
||||
|
||||
/* rank 0 assembles the subdomains */
|
||||
if (c->rank == 0) {
|
||||
@ -87,12 +87,12 @@ static void assembleResult(Comm* c, double* src, double* dst, int imax, int jmax
|
||||
i,
|
||||
coords[IDIM],
|
||||
coords[JDIM],
|
||||
oldSizes[IDIM],
|
||||
oldSizes[JDIM],
|
||||
newSizes[IDIM],
|
||||
newSizes[JDIM],
|
||||
starts[IDIM],
|
||||
starts[JDIM]);
|
||||
oldSizes[CIDIM],
|
||||
oldSizes[CJDIM],
|
||||
newSizes[CIDIM],
|
||||
newSizes[CJDIM],
|
||||
starts[CIDIM],
|
||||
starts[CJDIM]);
|
||||
|
||||
MPI_Type_create_subarray(NDIMS,
|
||||
oldSizes,
|
||||
@ -253,15 +253,15 @@ void commPartition(Comm* c, int jmax, int imax)
|
||||
c->bufferTypes[TOP] = jBufferType;
|
||||
|
||||
size_t dblsize = sizeof(double);
|
||||
c->sdispls[LEFT] = ((imaxLocal + 2) + 1) * dblsize; // send left
|
||||
c->sdispls[RIGHT] = ((imaxLocal + 2) + imaxLocal) * dblsize; // send right
|
||||
c->sdispls[BOTTOM] = ((imaxLocal + 2) + 1) * dblsize; // send bottom
|
||||
c->sdispls[TOP] = (jmaxLocal * (imaxLocal + 2) + 1) * dblsize; // send top
|
||||
c->sdispls[LEFT] = ((imaxLocal + 2) + 1) * dblsize;
|
||||
c->sdispls[RIGHT] = ((imaxLocal + 2) + imaxLocal) * dblsize;
|
||||
c->sdispls[BOTTOM] = ((imaxLocal + 2) + 1) * dblsize;
|
||||
c->sdispls[TOP] = (jmaxLocal * (imaxLocal + 2) + 1) * dblsize;
|
||||
|
||||
c->rdispls[LEFT] = (imaxLocal + 2) * dblsize; // recv left
|
||||
c->rdispls[RIGHT] = ((imaxLocal + 2) + (imaxLocal + 1)) * dblsize; // recv right
|
||||
c->rdispls[BOTTOM] = 1 * dblsize; // recv bottom
|
||||
c->rdispls[TOP] = ((jmaxLocal + 1) * (imaxLocal + 2) + 1) * dblsize; // recv top
|
||||
c->rdispls[LEFT] = (imaxLocal + 2) * dblsize;
|
||||
c->rdispls[RIGHT] = ((imaxLocal + 2) + (imaxLocal + 1)) * dblsize;
|
||||
c->rdispls[BOTTOM] = 1 * dblsize;
|
||||
c->rdispls[TOP] = ((jmaxLocal + 1) * (imaxLocal + 2) + 1) * dblsize;
|
||||
#else
|
||||
c->imaxLocal = imax;
|
||||
c->jmaxLocal = jmax;
|
||||
|
@ -11,7 +11,8 @@
|
||||
#endif
|
||||
|
||||
enum direction { LEFT = 0, RIGHT, BOTTOM, TOP, NDIRS };
|
||||
enum dimension { JDIM = 0, IDIM, NDIMS };
|
||||
enum dimension { IDIM = 0, JDIM, NDIMS };
|
||||
enum cdimension { CJDIM = 0, CIDIM };
|
||||
enum layer { HALO = 0, BULK };
|
||||
enum op { MAX = 0, SUM };
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user