Skip to content

Commit

Permalink
Small change to MPI_I(s)send buffer allocation (#3104)
Browse files Browse the repository at this point in the history
* Change MPI_Issend to MPI_Isend in NBX algorithm

* Small buffer improvement

* Revert to MPI_Issend

And explain why.

* Undo MPI change

* Change buffer

* Add comment back
  • Loading branch information
garth-wells authored Mar 14, 2024
1 parent 59bcec3 commit 387ff12
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cpp/dolfinx/common/MPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,10 @@ dolfinx::MPI::compute_graph_edges_pcx(MPI_Comm comm, std::span<const int> edges)
dolfinx::MPI::check_error(comm, err);

std::vector<MPI_Request> send_requests(edges.size());
std::byte send_buffer;
std::vector<std::byte> send_buffer(edges.size());
for (std::size_t e = 0; e < edges.size(); ++e)
{
int err = MPI_Isend(&send_buffer, 1, MPI_BYTE, edges[e],
int err = MPI_Isend(send_buffer.data() + e, 1, MPI_BYTE, edges[e],
static_cast<int>(tag::consensus_pcx), comm,
&send_requests[e]);
dolfinx::MPI::check_error(comm, err);
Expand Down Expand Up @@ -168,10 +168,10 @@ dolfinx::MPI::compute_graph_edges_nbx(MPI_Comm comm, std::span<const int> edges)

// Start non-blocking synchronised send
std::vector<MPI_Request> send_requests(edges.size());
std::byte send_buffer;
std::vector<std::byte> send_buffer(edges.size());
for (std::size_t e = 0; e < edges.size(); ++e)
{
int err = MPI_Issend(&send_buffer, 1, MPI_BYTE, edges[e],
int err = MPI_Issend(send_buffer.data() + e, 1, MPI_BYTE, edges[e],
static_cast<int>(tag::consensus_pex), comm,
&send_requests[e]);
dolfinx::MPI::check_error(comm, err);
Expand Down

0 comments on commit 387ff12

Please sign in to comment.