From 9208cd184ad283603aa15c2661e43995cbab0ca8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Simonis?= Date: Fri, 10 Apr 2026 13:35:56 +0200 Subject: [PATCH 1/3] Fix passing MPI communicators Participant --- cyprecice/cyprecice.pyx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cyprecice/cyprecice.pyx b/cyprecice/cyprecice.pyx index db014b19..cd58f469 100644 --- a/cyprecice/cyprecice.pyx +++ b/cyprecice/cyprecice.pyx @@ -9,6 +9,7 @@ cimport cyprecice cimport numpy import numpy as np from mpi4py import MPI + import warnings from libcpp.string cimport string from libcpp.vector cimport vector @@ -63,7 +64,7 @@ cdef class Participant: Rank of the process solver_process_size : int Size of the process - communicator: mpi4py.MPI.Intracomm, optional + communicator: mpi4py.MPI.Comm, optional Custom MPI communicator to use Returns @@ -82,10 +83,10 @@ cdef class Participant: pass def __cinit__ (self, solver_name, configuration_file_name, solver_process_index, solver_process_size, communicator=None): - cdef void* communicator_ptr + cdef size_t c_comm_addr; if communicator: - communicator_ptr = communicator - self.thisptr = new CppParticipant.Participant (convert(solver_name), convert(configuration_file_name), solver_process_index, solver_process_size, communicator_ptr) + c_comm_addr = MPI._addressof(communicator) + self.thisptr = new CppParticipant.Participant (convert(solver_name), convert(configuration_file_name), solver_process_index, solver_process_size, c_comm_addr) else: self.thisptr = new CppParticipant.Participant (convert(solver_name), convert(configuration_file_name), solver_process_index, solver_process_size) pass From 73eca76355918c660418135104002c1970e26b2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Simonis?= Date: Fri, 10 Apr 2026 14:47:44 +0200 Subject: [PATCH 2/3] Added changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fcb0ccbc..1c58f717 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to this project will be documented in this file. +## latest + +* Fixed passing custom MPI communicators to the Participant https://github.com/precice/python-bindings/pull/256 + ## 3.4.0 * Added support for documentation rendering https://github.com/precice/python-bindings/pull/250 From 67c017bc5ba7e4d6d0f511d52cf219536353263c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Simonis?= Date: Fri, 10 Apr 2026 15:11:32 +0200 Subject: [PATCH 3/3] Update cyprecice/cyprecice.pyx Co-authored-by: Ishaan Desai --- cyprecice/cyprecice.pyx | 1 - 1 file changed, 1 deletion(-) diff --git a/cyprecice/cyprecice.pyx b/cyprecice/cyprecice.pyx index cd58f469..22159c84 100644 --- a/cyprecice/cyprecice.pyx +++ b/cyprecice/cyprecice.pyx @@ -9,7 +9,6 @@ cimport cyprecice cimport numpy import numpy as np from mpi4py import MPI - import warnings from libcpp.string cimport string from libcpp.vector cimport vector