Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor ghosts.cpp #3216

Merged
merged 40 commits into from
Oct 18, 2019
Merged
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
85f235d
ghosts.cpp: Make predicates return bool
hirschsn Sep 26, 2019
b2444d6
ghosts.cpp: Remove unused MPI_Status variable
hirschsn Sep 26, 2019
3bb4449
ghosts.cpp: Use clear() instead of resize(0)
hirschsn Sep 26, 2019
aaab228
ghosts: Remove unused mpi_comm field
hirschsn Sep 26, 2019
ffe7113
Remove left-over typedefs from C days
hirschsn Sep 26, 2019
09f5140
ghosts: Make part_lists a std::vector
hirschsn Sep 26, 2019
eab1470
ghosts: Make s_buffer and r_buffer std::vectors
hirschsn Sep 26, 2019
03708a2
ghosts: Factor out memory handling
hirschsn Sep 26, 2019
5d77262
ghosts: Use boost::mpi for recv, send and bcst
hirschsn Sep 26, 2019
a5b811d
Explicitly cast length to int
hirschsn Sep 26, 2019
56e4572
ghost_rdce: Use boost::mpi
hirschsn Sep 26, 2019
2b910e8
ghosts: Remove n_bonds from payload
hirschsn Sep 26, 2019
c507697
ghosts: Use range-based for loops
hirschsn Sep 26, 2019
646d468
ghosts: Reformat
hirschsn Sep 26, 2019
a847b1c
More reformats
hirschsn Sep 27, 2019
8e8c581
Update comment
hirschsn Sep 27, 2019
b20fe3d
ghosts: Change two more instances of n_X_buffer
hirschsn Sep 27, 2019
b872b68
ghosts: Remove else. Check must always hold.
hirschsn Sep 27, 2019
0408706
ghosts: Early exit on GHOST_LOCL
hirschsn Sep 27, 2019
70f5a60
ghosts: Remove prefetch loop
hirschsn Sep 27, 2019
8097ec3
ghosts: else+if -> else if
hirschsn Sep 27, 2019
8a6ca56
ghosts: More else if
hirschsn Sep 27, 2019
f60d634
ghosts: Change friend decl to struct
hirschsn Sep 27, 2019
71de951
ghosts: Remove poststore loop
hirschsn Sep 27, 2019
551699d
ghosts: Make helper functions take references
hirschsn Sep 27, 2019
0d7aa14
ghosts: Make helper functions static
hirschsn Sep 27, 2019
84bea92
add_forces: range based for loop
hirschsn Sep 27, 2019
16ae7a9
mpi::reduce: Correct size of data
hirschsn Sep 27, 2019
50f789a
Merge branch 'python' of https://github.com/espressomd/espresso into …
fweik Oct 1, 2019
b5bd6e8
Merge branch 'python' of https://github.com/espressomd/espresso into …
fweik Oct 1, 2019
f060558
ghosts: cleanup
fweik Oct 1, 2019
d021d80
utils: make_span overload from container
fweik Oct 1, 2019
1ab35ff
ghosts: Decouple Archiver and BondArchiver
fweik Oct 1, 2019
513a8d5
Make CommBuf a class and add documentation
hirschsn Oct 2, 2019
8df0132
cell_cell_transfer: Remove pointers
hirschsn Oct 2, 2019
23007cb
ghosts: Rename variables
hirschsn Oct 2, 2019
0b50cb2
Make GhostCommunicator variables always "gcr".
hirschsn Oct 2, 2019
aef12a5
ghosts: Convert "additional checks" into asserts
hirschsn Oct 2, 2019
c62e278
ghosts: Another pointer->reference conversion
hirschsn Oct 2, 2019
f21d717
Merge branch 'python' into ghost-cleanup
hirschsn Oct 15, 2019
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
22 changes: 9 additions & 13 deletions src/core/domain_decomposition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,7 @@ void dd_prepare_comm(GhostCommunicator *comm, int data_parts,
comm->comm[cnt].node = this_node;

/* Buffer has to contain Send and Recv cells -> factor 2 */
comm->comm[cnt].part_lists =
(Cell **)Utils::malloc(2 * n_comm_cells[dir] * sizeof(Cell *));
comm->comm[cnt].n_part_lists = 2 * n_comm_cells[dir];
comm->comm[cnt].part_lists.resize(2 * n_comm_cells[dir]);
/* prepare folding of ghost positions */
if ((data_parts & GHOSTTRANS_POSSHFTD) &&
local_geo.boundary()[2 * dir + lr] != 0) {
Expand All @@ -293,7 +291,7 @@ void dd_prepare_comm(GhostCommunicator *comm, int data_parts,
/* fill send comm cells */
lc[dir] = hc[dir] = 1 + lr * (dd.cell_grid[dir] - 1);

dd_fill_comm_cell_lists(comm->comm[cnt].part_lists, lc, hc);
dd_fill_comm_cell_lists(comm->comm[cnt].part_lists.data(), lc, hc);

/* fill recv comm cells */
lc[dir] = hc[dir] = 0 + (1 - lr) * (dd.cell_grid[dir] + 1);
Expand All @@ -312,9 +310,7 @@ void dd_prepare_comm(GhostCommunicator *comm, int data_parts,
if ((node_pos[dir] + i) % 2 == 0) {
comm->comm[cnt].type = GHOST_SEND;
comm->comm[cnt].node = node_neighbors[2 * dir + lr];
comm->comm[cnt].part_lists =
(Cell **)Utils::malloc(n_comm_cells[dir] * sizeof(Cell *));
comm->comm[cnt].n_part_lists = n_comm_cells[dir];
comm->comm[cnt].part_lists.resize(n_comm_cells[dir]);
/* prepare folding of ghost positions */
if ((data_parts & GHOSTTRANS_POSSHFTD) &&
local_geo.boundary()[2 * dir + lr] != 0) {
Expand All @@ -324,21 +320,21 @@ void dd_prepare_comm(GhostCommunicator *comm, int data_parts,

lc[dir] = hc[dir] = 1 + lr * (dd.cell_grid[dir] - 1);

dd_fill_comm_cell_lists(comm->comm[cnt].part_lists, lc, hc);
dd_fill_comm_cell_lists(comm->comm[cnt].part_lists.data(), lc,
hc);
cnt++;
}
if (box_geo.periodic(dir) ||
(local_geo.boundary()[2 * dir + (1 - lr)] == 0))
if ((node_pos[dir] + (1 - i)) % 2 == 0) {
comm->comm[cnt].type = GHOST_RECV;
comm->comm[cnt].node = node_neighbors[2 * dir + (1 - lr)];
comm->comm[cnt].part_lists =
(Cell **)Utils::malloc(n_comm_cells[dir] * sizeof(Cell *));
comm->comm[cnt].n_part_lists = n_comm_cells[dir];
comm->comm[cnt].part_lists.resize(n_comm_cells[dir]);

lc[dir] = hc[dir] = (1 - lr) * (dd.cell_grid[dir] + 1);

dd_fill_comm_cell_lists(comm->comm[cnt].part_lists, lc, hc);
dd_fill_comm_cell_lists(comm->comm[cnt].part_lists.data(), lc,
hc);
cnt++;
}
}
Expand Down Expand Up @@ -369,7 +365,7 @@ void dd_revert_comm_order(GhostCommunicator *comm) {
else if (comm->comm[i].type == GHOST_RECV)
comm->comm[i].type = GHOST_SEND;
else if (comm->comm[i].type == GHOST_LOCL) {
nlist2 = comm->comm[i].n_part_lists / 2;
nlist2 = comm->comm[i].part_lists.size() / 2;
for (j = 0; j < nlist2; j++) {
auto tmplist = comm->comm[i].part_lists[j];
comm->comm[i].part_lists[j] = comm->comm[i].part_lists[j + nlist2];
Expand Down
Loading