From eb8cd31240e09fe423fdf7d66458f27b790261ff Mon Sep 17 00:00:00 2001 From: Jules van der Toorn Date: Tue, 16 Sep 2025 17:00:18 +0200 Subject: [PATCH] fix(mpi_collectives): prevent potential deadlock in `MPI_Comm_dup` example --- notebooks/mpi_collectives.ipynb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/notebooks/mpi_collectives.ipynb b/notebooks/mpi_collectives.ipynb index c0785d1..1cdfd6b 100644 --- a/notebooks/mpi_collectives.ipynb +++ b/notebooks/mpi_collectives.ipynb @@ -771,9 +771,11 @@ " rank = MPI.Comm_rank(comm)\n", " if rank == 2\n", " sndbuf = [2]\n", - " MPI.Send(sndbuf, comm2; dest=3, tag=0)\n", + " req1 = MPI.Isend(sndbuf, comm2; dest=3, tag=0)\n", " sndbuf = [1]\n", - " MPI.Send(sndbuf, comm; dest=3, tag=0)\n", + " req2 = MPI.Isend(sndbuf, comm; dest=3, tag=0)\n", + " MPI.Wait(req2)\n", + " MPI.Wait(req1)\n", " end\n", " if rank == 3\n", " rcvbuf = zeros(Int,1)\n",