Skip to content

Commit 2ad9757

Browse files
author
Dag Sverre Seljebotn
committed
Work around a bug in Cython with using my mpi4py
1 parent f8e6119 commit 2ad9757

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

python/libsharp/libsharp_mpi.pyx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
1-
from mpi4py.MPI cimport Comm
1+
cdef extern from "mpi.h":
2+
ctypedef void *MPI_Comm
3+
24
cdef extern from "Python.h":
35
object PyLong_FromVoidPtr(void*)
46

7+
cdef extern:
8+
ctypedef class mpi4py.MPI.Comm [object PyMPICommObject]:
9+
cdef MPI_Comm ob_mpi
10+
cdef unsigned flags
11+
512
# For compatibility with mpi4py <= 1.3.1
613
# Newer versions could use the MPI._addressof function
7-
def _addressof(comm):
14+
def _addressof(Comm comm):
815
cdef void *ptr = NULL
9-
ptr = <void*>&(<Comm>comm).ob_mpi
16+
ptr = <void*>&comm.ob_mpi
1017
return PyLong_FromVoidPtr(ptr)

0 commit comments

Comments
 (0)