From b9d21e3cdbe80dc83767486a212d3b96b9f103fc Mon Sep 17 00:00:00 2001 From: Matthew Turk Date: Fri, 26 Apr 2024 12:39:43 -0500 Subject: [PATCH] Backport PR #4875: BUG: create duplicate of MPI communicator, to avoid double comm.Free --- yt/utilities/parallel_tools/parallel_analysis_interface.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/yt/utilities/parallel_tools/parallel_analysis_interface.py b/yt/utilities/parallel_tools/parallel_analysis_interface.py index 975ee9a6a93..d06e919ba1c 100644 --- a/yt/utilities/parallel_tools/parallel_analysis_interface.py +++ b/yt/utilities/parallel_tools/parallel_analysis_interface.py @@ -96,7 +96,9 @@ def enable_parallelism(suppress_logging=False, communicator=None): # if no communicator specified, set to COMM_WORLD if communicator is None: - communicator = MPI.COMM_WORLD + communicator = MPI.COMM_WORLD.Dup() + else: + communicator = communicator.Dup() parallel_capable = communicator.size > 1 if not parallel_capable: