Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
381 changes: 125 additions & 256 deletions Partitioner.cpp

Large diffs are not rendered by default.

34 changes: 0 additions & 34 deletions Partitioner.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,23 +74,6 @@ class LIB_EXPORT Partitioner {
std::array<std::vector<int>, N_EDGE>& haloRecv,
std::array<std::vector<int>, N_CORNER>& cornerIds,
std::array<std::vector<int>, N_CORNER>& cornerSend) const;
/*!
* @brief Returns vectors containing the MPI ranks, halo sizes and halo starting indices of
* the neighbours of this process across periodic boundaries after partitioning. The
* neighbours are ordered left, right, bottom, top.
*
* @param ids MPI ranks of the periodic neighbours for each direction
* @param haloSizes Halo sizes of the periodic neighbours for each direction
* @param haloSend index in send buffer to get halo data
* @param haloRecv index in recv buffer to put halo data
*/
void getNeighbourInfoPeriodic(std::array<std::vector<int>, N_EDGE>& ids,
std::array<std::vector<int>, N_EDGE>& haloSizes,
std::array<std::vector<int>, N_EDGE>& haloSend,
std::array<std::vector<int>, N_EDGE>& haloRecv,
std::array<std::vector<int>, N_CORNER>& cornerIds,
std::array<std::vector<int>, N_CORNER>& cornerSend) const;

/*!
* @brief Saves the partition IDs of the latest 2D domain decomposition in a
* NetCDF file.
Expand Down Expand Up @@ -199,23 +182,6 @@ class LIB_EXPORT Partitioner {
// Vector of maps of "corner" neighbours to their halo start indices after partitioning
std::vector<std::map<int, int>> _cornerSendPos = std::vector<std::map<int, int>>(NNBRS);

// Vector of maps of periodic neighbours to their halo sizes after partitioning
std::vector<std::map<int, int>> _neighbours_p = std::vector<std::map<int, int>>(NNBRS);

// Vector of maps of periodic neighbours to their send buffer indices - index of data to fetch
// from send buffer
std::vector<std::map<int, int>> _sendPos_p = std::vector<std::map<int, int>>(NNBRS);

// Vector of maps of periodic neighbours to their recv (receive) buffer indices - index where
// data will be stored in the recv buffer
std::vector<std::map<int, int>> _recvPos_p = std::vector<std::map<int, int>>(NNBRS);

// Vector of maps of "corner" neighbours to their halo sizes after partitioning
std::vector<std::map<int, int>> _cornerNeighbours_p = std::vector<std::map<int, int>>(NNBRS);

// Vector of maps of "corner" neighbours to their halo start indices after partitioning
std::vector<std::map<int, int>> _cornerSendPos_p = std::vector<std::map<int, int>>(NNBRS);

public:
struct LIB_EXPORT Factory {
/*!
Expand Down
56 changes: 0 additions & 56 deletions test/test_1/ref_partition_metadata_3.cdl
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,6 @@ dimensions:
TR = 1 ;
BR = 1 ;
BL = UNLIMITED ; // (0 currently)
L_periodic = UNLIMITED ; // (0 currently)
R_periodic = UNLIMITED ; // (0 currently)
B_periodic = UNLIMITED ; // (0 currently)
T_periodic = UNLIMITED ; // (0 currently)
TL_periodic = UNLIMITED ; // (0 currently)
TR_periodic = UNLIMITED ; // (0 currently)
BR_periodic = UNLIMITED ; // (0 currently)
BL_periodic = UNLIMITED ; // (0 currently)

group: bounding_boxes {
variables:
Expand Down Expand Up @@ -71,38 +63,6 @@ group: connectivity {
int bottom_left_neighbours(P) ;
int bottom_left_neighbour_ids(BL) ;
int bottom_left_neighbour_send(BL) ;
int left_neighbours_periodic(P) ;
int left_neighbour_ids_periodic(L_periodic) ;
int left_neighbour_halos_periodic(L_periodic) ;
int left_neighbour_halo_send_periodic(L_periodic) ;
int left_neighbour_halo_recv_periodic(L_periodic) ;
int right_neighbours_periodic(P) ;
int right_neighbour_ids_periodic(R_periodic) ;
int right_neighbour_halos_periodic(R_periodic) ;
int right_neighbour_halo_send_periodic(R_periodic) ;
int right_neighbour_halo_recv_periodic(R_periodic) ;
int bottom_neighbours_periodic(P) ;
int bottom_neighbour_ids_periodic(B_periodic) ;
int bottom_neighbour_halos_periodic(B_periodic) ;
int bottom_neighbour_halo_send_periodic(B_periodic) ;
int bottom_neighbour_halo_recv_periodic(B_periodic) ;
int top_neighbours_periodic(P) ;
int top_neighbour_ids_periodic(T_periodic) ;
int top_neighbour_halos_periodic(T_periodic) ;
int top_neighbour_halo_send_periodic(T_periodic) ;
int top_neighbour_halo_recv_periodic(T_periodic) ;
int top_left_neighbours_periodic(P) ;
int top_left_neighbour_ids_periodic(TL_periodic) ;
int top_left_neighbour_send_periodic(TL_periodic) ;
int top_right_neighbours_periodic(P) ;
int top_right_neighbour_ids_periodic(TR_periodic) ;
int top_right_neighbour_send_periodic(TR_periodic) ;
int bottom_right_neighbours_periodic(P) ;
int bottom_right_neighbour_ids_periodic(BR_periodic) ;
int bottom_right_neighbour_send_periodic(BR_periodic) ;
int bottom_left_neighbours_periodic(P) ;
int bottom_left_neighbour_ids_periodic(BL_periodic) ;
int bottom_left_neighbour_send_periodic(BL_periodic) ;
data:

left_neighbours = 0, 0, 2 ;
Expand Down Expand Up @@ -160,21 +120,5 @@ group: connectivity {
bottom_right_neighbour_send = 9 ;

bottom_left_neighbours = 0, 0, 0 ;

left_neighbours_periodic = 0, 0, 0 ;

right_neighbours_periodic = 0, 0, 0 ;

bottom_neighbours_periodic = 0, 0, 0 ;

top_neighbours_periodic = 0, 0, 0 ;

top_left_neighbours_periodic = 0, 0, 0 ;

top_right_neighbours_periodic = 0, 0, 0 ;

bottom_right_neighbours_periodic = 0, 0, 0 ;

bottom_left_neighbours_periodic = 0, 0, 0 ;
} // group connectivity
}
116 changes: 22 additions & 94 deletions test/test_1_px/ref_partition_metadata_3.cdl
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,14 @@ dimensions:
NX = 6 ;
NY = 4 ;
P = 3 ;
L = 2 ;
R = 2 ;
L = 4 ;
R = 4 ;
B = 1 ;
T = 1 ;
TL = UNLIMITED ; // (0 currently)
TL = 1 ;
TR = 1 ;
BR = 1 ;
BL = UNLIMITED ; // (0 currently)
L_periodic = 2 ;
R_periodic = 2 ;
B_periodic = UNLIMITED ; // (0 currently)
T_periodic = UNLIMITED ; // (0 currently)
TL_periodic = 1 ;
TR_periodic = UNLIMITED ; // (0 currently)
BR_periodic = UNLIMITED ; // (0 currently)
BL_periodic = 1 ;
BL = 1 ;

group: bounding_boxes {
variables:
Expand Down Expand Up @@ -71,59 +63,27 @@ group: connectivity {
int bottom_left_neighbours(P) ;
int bottom_left_neighbour_ids(BL) ;
int bottom_left_neighbour_send(BL) ;
int left_neighbours_periodic(P) ;
int left_neighbour_ids_periodic(L_periodic) ;
int left_neighbour_halos_periodic(L_periodic) ;
int left_neighbour_halo_send_periodic(L_periodic) ;
int left_neighbour_halo_recv_periodic(L_periodic) ;
int right_neighbours_periodic(P) ;
int right_neighbour_ids_periodic(R_periodic) ;
int right_neighbour_halos_periodic(R_periodic) ;
int right_neighbour_halo_send_periodic(R_periodic) ;
int right_neighbour_halo_recv_periodic(R_periodic) ;
int bottom_neighbours_periodic(P) ;
int bottom_neighbour_ids_periodic(B_periodic) ;
int bottom_neighbour_halos_periodic(B_periodic) ;
int bottom_neighbour_halo_send_periodic(B_periodic) ;
int bottom_neighbour_halo_recv_periodic(B_periodic) ;
int top_neighbours_periodic(P) ;
int top_neighbour_ids_periodic(T_periodic) ;
int top_neighbour_halos_periodic(T_periodic) ;
int top_neighbour_halo_send_periodic(T_periodic) ;
int top_neighbour_halo_recv_periodic(T_periodic) ;
int top_left_neighbours_periodic(P) ;
int top_left_neighbour_ids_periodic(TL_periodic) ;
int top_left_neighbour_send_periodic(TL_periodic) ;
int top_right_neighbours_periodic(P) ;
int top_right_neighbour_ids_periodic(TR_periodic) ;
int top_right_neighbour_send_periodic(TR_periodic) ;
int bottom_right_neighbours_periodic(P) ;
int bottom_right_neighbour_ids_periodic(BR_periodic) ;
int bottom_right_neighbour_send_periodic(BR_periodic) ;
int bottom_left_neighbours_periodic(P) ;
int bottom_left_neighbour_ids_periodic(BL_periodic) ;
int bottom_left_neighbour_send_periodic(BL_periodic) ;
data:

left_neighbours = 0, 0, 2 ;
left_neighbours = 1, 1, 2 ;

left_neighbour_ids = 0, 1 ;
left_neighbour_ids = 2, 2, 0, 1 ;

left_neighbour_halos = 2, 2 ;
left_neighbour_halos = 2, 2, 2, 2 ;

left_neighbour_halo_send = 4, 4 ;
left_neighbour_halo_send = 2, 4, 4, 4 ;

left_neighbour_halo_recv = 8, 10 ;
left_neighbour_halo_recv = 10, 10, 8, 10 ;

right_neighbours = 1, 1, 0 ;
right_neighbours = 1, 1, 2 ;

right_neighbour_ids = 2, 2 ;
right_neighbour_ids = 2, 2, 0, 1 ;

right_neighbour_halos = 2, 2 ;
right_neighbour_halos = 2, 2, 2, 2 ;

right_neighbour_halo_send = 8, 10 ;
right_neighbour_halo_send = 8, 10, 10, 10 ;

right_neighbour_halo_recv = 4, 4 ;
right_neighbour_halo_recv = 4, 4, 2, 4 ;

bottom_neighbours = 0, 1, 0 ;

Expand All @@ -145,7 +105,11 @@ group: connectivity {

top_neighbour_halo_recv = 6 ;

top_left_neighbours = 0, 0, 0 ;
top_left_neighbours = 1, 0, 0 ;

top_left_neighbour_ids = 2 ;

top_left_neighbour_send = 4 ;

top_right_neighbours = 1, 0, 0 ;

Expand All @@ -159,46 +123,10 @@ group: connectivity {

bottom_right_neighbour_send = 9 ;

bottom_left_neighbours = 0, 0, 0 ;

left_neighbours_periodic = 1, 1, 0 ;

left_neighbour_ids_periodic = 2, 2 ;

left_neighbour_halos_periodic = 2, 2 ;

left_neighbour_halo_send_periodic = 2, 4 ;

left_neighbour_halo_recv_periodic = 10, 10 ;

right_neighbours_periodic = 0, 0, 2 ;

right_neighbour_ids_periodic = 0, 1 ;

right_neighbour_halos_periodic = 2, 2 ;

right_neighbour_halo_send_periodic = 10, 10 ;

right_neighbour_halo_recv_periodic = 2, 4 ;

bottom_neighbours_periodic = 0, 0, 0 ;

top_neighbours_periodic = 0, 0, 0 ;

top_left_neighbours_periodic = 1, 0, 0 ;

top_left_neighbour_ids_periodic = 2 ;

top_left_neighbour_send_periodic = 4 ;

top_right_neighbours_periodic = 0, 0, 0 ;

bottom_right_neighbours_periodic = 0, 0, 0 ;

bottom_left_neighbours_periodic = 0, 1, 0 ;
bottom_left_neighbours = 0, 1, 0 ;

bottom_left_neighbour_ids_periodic = 2 ;
bottom_left_neighbour_ids = 2 ;

bottom_left_neighbour_send_periodic = 3 ;
bottom_left_neighbour_send = 3 ;
} // group connectivity
}
Loading
Loading