Skip to content

Commit 76cd36e

Browse files
committed
Merge branch 'GhostNodesNamingConv' into 'master'
Renamed halo buffers and 2D halo bug fix See merge request ExaAM/exaca!48 Former-commit-id: ae4b99c5be4a8b66e3eb993408012fcd86ede381
2 parents 6568f40 + e5c95ff commit 76cd36e

File tree

9 files changed

+1016
-907
lines changed

9 files changed

+1016
-907
lines changed

src/CAfunctions.cpp

Lines changed: 74 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -233,37 +233,38 @@ double MaxVal(double TestVec3[6], int NVals) {
233233
//*****************************************************************************/
234234
// Determine the mapping of processors to grid data
235235
void InitialDecomposition(int &DecompositionStrategy, int nx, int ny, int &ProcessorsInXDirection,
236-
int &ProcessorsInYDirection, int id, int np, int &MyLeft, int &MyRight, int &MyIn, int &MyOut,
237-
int &MyLeftIn, int &MyLeftOut, int &MyRightIn, int &MyRightOut) {
236+
int &ProcessorsInYDirection, int id, int np, int &NeighborRank_North, int &NeighborRank_South,
237+
int &NeighborRank_East, int &NeighborRank_West, int &NeighborRank_NorthEast,
238+
int &NeighborRank_NorthWest, int &NeighborRank_SouthEast, int &NeighborRank_SouthWest) {
238239

239240
if (DecompositionStrategy == 1) {
240241
OneDim:
241242
ProcessorsInXDirection = 1;
242243
ProcessorsInYDirection = np;
243244
if (np > 1) {
244-
MyLeft = id - 1;
245-
MyRight = id + 1;
245+
NeighborRank_South = id - 1;
246+
NeighborRank_North = id + 1;
246247
if (id == 0)
247-
MyLeft = MPI_PROC_NULL;
248+
NeighborRank_South = MPI_PROC_NULL;
248249
if (id == np - 1)
249-
MyRight = MPI_PROC_NULL;
250-
MyIn = MPI_PROC_NULL;
251-
MyRightIn = MPI_PROC_NULL;
252-
MyOut = MPI_PROC_NULL;
253-
MyRightOut = MPI_PROC_NULL;
254-
MyLeftIn = MPI_PROC_NULL;
255-
MyLeftOut = MPI_PROC_NULL;
250+
NeighborRank_North = MPI_PROC_NULL;
251+
NeighborRank_West = MPI_PROC_NULL;
252+
NeighborRank_NorthWest = MPI_PROC_NULL;
253+
NeighborRank_NorthEast = MPI_PROC_NULL;
254+
NeighborRank_East = MPI_PROC_NULL;
255+
NeighborRank_SouthWest = MPI_PROC_NULL;
256+
NeighborRank_SouthEast = MPI_PROC_NULL;
256257
}
257258
else {
258259
// No MPI communication
259-
MyLeft = MPI_PROC_NULL;
260-
MyRight = MPI_PROC_NULL;
261-
MyIn = MPI_PROC_NULL;
262-
MyRightIn = MPI_PROC_NULL;
263-
MyOut = MPI_PROC_NULL;
264-
MyRightOut = MPI_PROC_NULL;
265-
MyLeftIn = MPI_PROC_NULL;
266-
MyLeftOut = MPI_PROC_NULL;
260+
NeighborRank_West = MPI_PROC_NULL;
261+
NeighborRank_East = MPI_PROC_NULL;
262+
NeighborRank_North = MPI_PROC_NULL;
263+
NeighborRank_NorthWest = MPI_PROC_NULL;
264+
NeighborRank_NorthEast = MPI_PROC_NULL;
265+
NeighborRank_South = MPI_PROC_NULL;
266+
NeighborRank_SouthWest = MPI_PROC_NULL;
267+
NeighborRank_SouthEast = MPI_PROC_NULL;
267268
}
268269
}
269270
else if (DecompositionStrategy == 2) {
@@ -276,31 +277,30 @@ void InitialDecomposition(int &DecompositionStrategy, int nx, int ny, int &Proce
276277
}
277278
ProcessorsInXDirection = 2;
278279
ProcessorsInYDirection = np / 2;
279-
MyLeft = id - 1;
280-
MyRight = id + 1;
281-
MyIn = id + ProcessorsInYDirection;
282-
MyOut = id - ProcessorsInYDirection;
283-
MyLeftIn = MyIn - 1;
284-
MyRightIn = MyIn + 1;
285-
;
286-
MyLeftOut = MyOut - 1;
287-
MyRightOut = MyOut + 1;
280+
NeighborRank_South = id - 1;
281+
NeighborRank_North = id + 1;
282+
NeighborRank_East = id + ProcessorsInYDirection;
283+
NeighborRank_West = id - ProcessorsInYDirection;
284+
NeighborRank_SouthEast = NeighborRank_East - 1;
285+
NeighborRank_NorthEast = NeighborRank_East + 1;
286+
NeighborRank_SouthWest = NeighborRank_West - 1;
287+
NeighborRank_NorthWest = NeighborRank_West + 1;
288288
if (id % ProcessorsInYDirection == 0)
289-
MyLeft = MPI_PROC_NULL;
289+
NeighborRank_South = MPI_PROC_NULL;
290290
if (id % ProcessorsInYDirection == ProcessorsInYDirection - 1)
291-
MyRight = MPI_PROC_NULL;
291+
NeighborRank_North = MPI_PROC_NULL;
292292
if (id < ProcessorsInYDirection)
293-
MyOut = MPI_PROC_NULL;
293+
NeighborRank_West = MPI_PROC_NULL;
294294
if (id >= (np - ProcessorsInYDirection))
295-
MyIn = MPI_PROC_NULL;
296-
if ((MyLeft == MPI_PROC_NULL) || (MyIn == MPI_PROC_NULL))
297-
MyLeftIn = MPI_PROC_NULL;
298-
if ((MyRight == MPI_PROC_NULL) || (MyIn == MPI_PROC_NULL))
299-
MyRightIn = MPI_PROC_NULL;
300-
if ((MyLeft == MPI_PROC_NULL) || (MyOut == MPI_PROC_NULL))
301-
MyLeftOut = MPI_PROC_NULL;
302-
if ((MyRight == MPI_PROC_NULL) || (MyOut == MPI_PROC_NULL))
303-
MyRightOut = MPI_PROC_NULL;
295+
NeighborRank_East = MPI_PROC_NULL;
296+
if ((NeighborRank_South == MPI_PROC_NULL) || (NeighborRank_East == MPI_PROC_NULL))
297+
NeighborRank_SouthEast = MPI_PROC_NULL;
298+
if ((NeighborRank_North == MPI_PROC_NULL) || (NeighborRank_East == MPI_PROC_NULL))
299+
NeighborRank_NorthEast = MPI_PROC_NULL;
300+
if ((NeighborRank_South == MPI_PROC_NULL) || (NeighborRank_West == MPI_PROC_NULL))
301+
NeighborRank_SouthWest = MPI_PROC_NULL;
302+
if ((NeighborRank_North == MPI_PROC_NULL) || (NeighborRank_West == MPI_PROC_NULL))
303+
NeighborRank_NorthWest = MPI_PROC_NULL;
304304
}
305305
else if (DecompositionStrategy == 3) {
306306

@@ -362,48 +362,54 @@ void InitialDecomposition(int &DecompositionStrategy, int nx, int ny, int &Proce
362362
if (id == 0)
363363
std::cout << " Processors in X: " << ProcessorsInXDirection
364364
<< " Processors in Y: " << ProcessorsInYDirection << std::endl;
365-
MyLeft = id - 1;
366-
MyRight = id + 1;
367-
MyIn = id + ProcessorsInYDirection;
368-
MyOut = id - ProcessorsInYDirection;
369-
MyLeftIn = MyIn - 1;
370-
MyRightIn = MyIn + 1;
371-
;
372-
MyLeftOut = MyOut - 1;
373-
MyRightOut = MyOut + 1;
365+
NeighborRank_South = id - 1;
366+
NeighborRank_North = id + 1;
367+
NeighborRank_East = id + ProcessorsInYDirection;
368+
NeighborRank_West = id - ProcessorsInYDirection;
374369
if (id % ProcessorsInYDirection == 0)
375-
MyLeft = MPI_PROC_NULL;
370+
NeighborRank_South = MPI_PROC_NULL;
376371
if (id % ProcessorsInYDirection == ProcessorsInYDirection - 1)
377-
MyRight = MPI_PROC_NULL;
372+
NeighborRank_North = MPI_PROC_NULL;
378373
if (id < ProcessorsInYDirection)
379-
MyOut = MPI_PROC_NULL;
374+
NeighborRank_West = MPI_PROC_NULL;
380375
if (id >= (np - ProcessorsInYDirection))
381-
MyIn = MPI_PROC_NULL;
382-
if ((MyLeft == MPI_PROC_NULL) || (MyIn == MPI_PROC_NULL))
383-
MyLeftIn = MPI_PROC_NULL;
384-
if ((MyRight == MPI_PROC_NULL) || (MyIn == MPI_PROC_NULL))
385-
MyRightIn = MPI_PROC_NULL;
386-
if ((MyLeft == MPI_PROC_NULL) || (MyOut == MPI_PROC_NULL))
387-
MyLeftOut = MPI_PROC_NULL;
388-
if ((MyRight == MPI_PROC_NULL) || (MyOut == MPI_PROC_NULL))
389-
MyRightOut = MPI_PROC_NULL;
376+
NeighborRank_East = MPI_PROC_NULL;
377+
if ((NeighborRank_South == MPI_PROC_NULL) || (NeighborRank_East == MPI_PROC_NULL))
378+
NeighborRank_SouthEast = MPI_PROC_NULL;
379+
else
380+
NeighborRank_SouthEast = NeighborRank_East - 1;
381+
382+
if ((NeighborRank_North == MPI_PROC_NULL) || (NeighborRank_East == MPI_PROC_NULL))
383+
NeighborRank_NorthEast = MPI_PROC_NULL;
384+
else
385+
NeighborRank_NorthEast = NeighborRank_East + 1;
386+
387+
if ((NeighborRank_South == MPI_PROC_NULL) || (NeighborRank_West == MPI_PROC_NULL))
388+
NeighborRank_SouthWest = MPI_PROC_NULL;
389+
else
390+
NeighborRank_SouthWest = NeighborRank_West - 1;
391+
392+
if ((NeighborRank_North == MPI_PROC_NULL) || (NeighborRank_West == MPI_PROC_NULL))
393+
NeighborRank_NorthWest = MPI_PROC_NULL;
394+
else
395+
NeighborRank_NorthWest = NeighborRank_West + 1;
390396
}
391397
}
392398

393399
//*****************************************************************************/
394400
// Determine the scan limits for each rank in X and Y directions
395-
void XYLimitCalc(int &LLX, int &LLY, int &ULX, int &ULY, int MyXSlices, int MyYSlices, int MyLeft, int MyRight,
396-
int MyIn, int MyOut) {
401+
void XYLimitCalc(int &LLX, int &LLY, int &ULX, int &ULY, int MyXSlices, int MyYSlices, int NeighborRank_South,
402+
int NeighborRank_North, int NeighborRank_East, int NeighborRank_West) {
397403
LLX = 0;
398404
LLY = 0;
399405
ULX = MyXSlices - 1;
400406
ULY = MyYSlices - 1;
401-
if (MyLeft == MPI_PROC_NULL)
407+
if (NeighborRank_South == MPI_PROC_NULL)
402408
LLY = 1;
403-
if (MyRight == MPI_PROC_NULL)
409+
if (NeighborRank_North == MPI_PROC_NULL)
404410
ULY = MyYSlices - 2;
405-
if (MyIn == MPI_PROC_NULL)
411+
if (NeighborRank_East == MPI_PROC_NULL)
406412
ULX = MyXSlices - 2;
407-
if (MyOut == MPI_PROC_NULL)
413+
if (NeighborRank_West == MPI_PROC_NULL)
408414
LLX = 1;
409415
}

src/CAfunctions.hpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ int YMPSlicesCalc(int p, int ny, int ProcessorsInYDirection, int np, int Decompo
1212
int YOffsetCalc(int p, int ny, int ProcessorsInYDirection, int np, int DecompositionStrategy);
1313
double MaxVal(double TestVec3[6], int NVals);
1414
void InitialDecomposition(int &DecompositionStrategy, int nx, int ny, int &ProcessorsInXDirection,
15-
int &ProcessorsInYDirection, int id, int np, int &MyLeft, int &MyRight, int &MyIn, int &MyOut,
16-
int &MyLeftIn, int &MyLeftOut, int &MyRightIn, int &MyRightOut);
17-
void XYLimitCalc(int &LLX, int &LLY, int &ULX, int &ULY, int MyXSlices, int MyYSlices, int MyLeft, int MyRight,
18-
int MyIn, int MyOut);
15+
int &ProcessorsInYDirection, int id, int np, int &NeighborRank_North, int &NeighborRank_South,
16+
int &NeighborRank_East, int &NeighborRank_West, int &NeighborRank_NorthEast,
17+
int &NeighborRank_NorthWest, int &NeighborRank_SouthEast, int &NeighborRank_SouthWest);
18+
void XYLimitCalc(int &LLX, int &LLY, int &ULX, int &ULY, int MyXSlices, int MyYSlices, int NeighborRank_South,
19+
int NeighborRank_North, int NeighborRank_East, int NeighborRank_West);
1920

2021
#endif

0 commit comments

Comments
 (0)