Skip to content

Commit 9208cd1

Browse files
committed
Fix passing MPI communicators Participant
1 parent 1a46978 commit 9208cd1

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

cyprecice/cyprecice.pyx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ cimport cyprecice
99
cimport numpy
1010
import numpy as np
1111
from mpi4py import MPI
12+
1213
import warnings
1314
from libcpp.string cimport string
1415
from libcpp.vector cimport vector
@@ -63,7 +64,7 @@ cdef class Participant:
6364
Rank of the process
6465
solver_process_size : int
6566
Size of the process
66-
communicator: mpi4py.MPI.Intracomm, optional
67+
communicator: mpi4py.MPI.Comm, optional
6768
Custom MPI communicator to use
6869
6970
Returns
@@ -82,10 +83,10 @@ cdef class Participant:
8283
pass
8384

8485
def __cinit__ (self, solver_name, configuration_file_name, solver_process_index, solver_process_size, communicator=None):
85-
cdef void* communicator_ptr
86+
cdef size_t c_comm_addr;
8687
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)
88+
c_comm_addr = MPI._addressof(communicator)
89+
self.thisptr = new CppParticipant.Participant (convert(solver_name), convert(configuration_file_name), solver_process_index, solver_process_size, <void*>c_comm_addr)
8990
else:
9091
self.thisptr = new CppParticipant.Participant (convert(solver_name), convert(configuration_file_name), solver_process_index, solver_process_size)
9192
pass

0 commit comments

Comments
 (0)