Skip to content

Commit f40889a

Browse files
Fix passing MPI communicators Participant (#256)
* Fix passing MPI communicators Participant * Added changelog * Update cyprecice/cyprecice.pyx Co-authored-by: Ishaan Desai <ishaandesai@gmail.com> --------- Co-authored-by: Ishaan Desai <ishaandesai@gmail.com>
1 parent 1a46978 commit f40889a

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## latest
6+
7+
* Fixed passing custom MPI communicators to the Participant https://github.com/precice/python-bindings/pull/256
8+
59
## 3.4.0
610

711
* Added support for documentation rendering https://github.com/precice/python-bindings/pull/250

cyprecice/cyprecice.pyx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ cdef class Participant:
6363
Rank of the process
6464
solver_process_size : int
6565
Size of the process
66-
communicator: mpi4py.MPI.Intracomm, optional
66+
communicator: mpi4py.MPI.Comm, optional
6767
Custom MPI communicator to use
6868
6969
Returns
@@ -82,10 +82,10 @@ cdef class Participant:
8282
pass
8383

8484
def __cinit__ (self, solver_name, configuration_file_name, solver_process_index, solver_process_size, communicator=None):
85-
cdef void* communicator_ptr
85+
cdef size_t c_comm_addr;
8686
if communicator:
87-
communicator_ptr = <void*> communicator
88-
self.thisptr = new CppParticipant.Participant (convert(solver_name), convert(configuration_file_name), solver_process_index, solver_process_size, communicator_ptr)
87+
c_comm_addr = MPI._addressof(communicator)
88+
self.thisptr = new CppParticipant.Participant (convert(solver_name), convert(configuration_file_name), solver_process_index, solver_process_size, <void*>c_comm_addr)
8989
else:
9090
self.thisptr = new CppParticipant.Participant (convert(solver_name), convert(configuration_file_name), solver_process_index, solver_process_size)
9191
pass

0 commit comments

Comments
 (0)