Skip to content

Commit

Permalink
[dist-rg] review update:
Browse files Browse the repository at this point in the history
- only allocate if necessary
- synchronize correct executor

Co-authored-by: Pratik Nayak <pratik.nayak@kit.edu>
  • Loading branch information
MarcelKoch and pratikvn committed Aug 9, 2024
1 parent 6809c73 commit bfc5233
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions core/distributed/row_gatherer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,13 @@ mpi::request RowGatherer<LocalIndexType>::apply_async(

dim<2> send_size(coll_comm_->get_send_size(),
b_local->get_size()[1]);
auto send_size_in_bytes =
sizeof(ValueType) * send_size[0] * send_size[1];
workspace.set_executor(mpi_exec);
workspace.resize_and_reset(sizeof(ValueType) *
send_size[0] * send_size[1]);
if (send_size_in_bytes > workspace.get_size()) {
workspace.resize_and_reset(sizeof(ValueType) *
send_size[0] * send_size[1]);
}
auto send_buffer = matrix::Dense<ValueType>::create(
mpi_exec, send_size,
make_array_view(
Expand All @@ -107,7 +111,7 @@ mpi::request RowGatherer<LocalIndexType>::apply_async(
auto recv_ptr = x_local->get_values();
auto send_ptr = send_buffer->get_values();

mpi_exec->synchronize();
b_local->get_executor()->synchronize();
mpi::contiguous_type type(
b_local->get_size()[1],
mpi::type_impl<ValueType>::get_type());
Expand Down

0 comments on commit bfc5233

Please sign in to comment.