| 1 |
# The following include is needed to define a missing type MPI_Message |
| 2 |
# which is lacking for a certain combination of MPI and mpi4py versions |
| 3 |
cdef extern from "mpi_compat.h": |
| 4 |
pass |
| 5 |
|
| 6 |
include "pyconfig.pxi" |
| 7 |
cimport mpi4py.MPI as MPI |
| 8 |
IF MPI4V2: |
| 9 |
from mpi4py.libmpi cimport * |
| 10 |
ELSE: |
| 11 |
from mpi4py.mpi_c cimport * |
| 12 |
|
| 13 |
cdef extern from "music/pymusic_c.h": |
| 14 |
object PyUnicodeString_FromString(const char*) |
| 15 |
|
| 16 |
from cpython.ref cimport PyObject |
| 17 |
|
| 18 |
# Python 3 buffer interface (PEP 3118) |
| 19 |
cdef extern from "Python.h": |
| 20 |
ctypedef struct Py_buffer: |
| 21 |
void* buf |
| 22 |
PyObject* obj # owned reference |
| 23 |
Py_ssize_t len |
| 24 |
Py_ssize_t itemsize # This is Py_ssize_t so it can be |
| 25 |
# pointed to by strides in simple case.*/ |
| 26 |
bint readonly |
| 27 |
int ndim |
| 28 |
char* format |
| 29 |
Py_ssize_t *shape |
| 30 |
Py_ssize_t *strides |
| 31 |
Py_ssize_t *suboffsets |
| 32 |
Py_ssize_t smalltable[2] # static store for shape and strides of |
| 33 |
# mono-dimensional buffers. |
| 34 |
void *internal |
| 35 |
|
| 36 |
cdef enum: |
| 37 |
PyBUF_SIMPLE |
| 38 |
PyBUF_WRITABLE |
| 39 |
PyBUF_FORMAT |
| 40 |
PyBUF_ANY_CONTIGUOUS |
| 41 |
PyBUF_ND |
| 42 |
PyBUF_STRIDES |
| 43 |
|
| 44 |
int PyObject_CheckBuffer(object) |
| 45 |
int PyObject_GetBuffer(object, Py_buffer *, int) except -1 |
| 46 |
void PyBuffer_Release(Py_buffer *) |
| 47 |
int PyBuffer_FillInfo(Py_buffer*, object, void*, Py_ssize_t, bint, int) except -1 |
| 48 |
|
| 49 |
cdef class Buffer(object): |
| 50 |
cdef Py_buffer pybuf |
| 51 |
cdef MPI.Datatype dtype |
| 52 |
cdef Py_ssize_t items |