commit 0e7bf16d5b891fd43e91b9d496c18229913228c3 parent 2125a45c2cd1a06fdc5574ad5e27e3e04eaac6e0 Author: Vincent Forest <vincent.forest@meso-star.com> Date: Mon, 6 Apr 2020 15:00:48 +0200 Fix a deadlock when htrdr is with MPI Diffstat:
| M | src/htrdr_draw_radiance.c | | | 16 | ++++++++++++---- |
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/src/htrdr_draw_radiance.c b/src/htrdr_draw_radiance.c @@ -898,10 +898,18 @@ draw_image if(ATOMIC_GET(&res) != RES_OK) goto error; - /* Synchronize the process */ - mutex_lock(htrdr->mpi_mutex); - MPI(Barrier(MPI_COMM_WORLD)); - mutex_unlock(htrdr->mpi_mutex); + /* Asynchronously wait for processes completion. Use an asynchronous barrier to + * avoid a dead lock with the `mpi_probe_thieves' thread that requires also + * the `mpi_mutex'. */ + { + MPI_Request req; + + mutex_lock(htrdr->mpi_mutex); + MPI(Ibarrier(MPI_COMM_WORLD, &req)); + mutex_unlock(htrdr->mpi_mutex); + + mpi_wait_for_request(htrdr, &req); + } exit: if(rng_proc) SSP(rng_ref_put(rng_proc));