# maybempi

*module*

Use MPI only when the process was launched under MPI, and a serial stand-in otherwise.

Importing ``mpi4py.MPI`` starts MPI, which costs close to a second and makes every
collective cost something, even on one process. maybempi decides from the
environment the launcher sets up, without importing mpi4py, and returns either
``mpi4py.MPI`` or a serial stand-in with the same interface::

    import maybempi

    MPI = maybempi.get_mpi()  # mpi4py.MPI under mpirun/srun, else the stand-in
    comm = MPI.COMM_WORLD
    total = comm.allreduce(local_total, op=MPI.SUM)

``from maybempi import MPI`` is the drop-in replacement for ``from mpi4py import
MPI``: the name resolves to ``get_mpi()`` when it is first imported.

:mod:`maybempi.launch` holds the detection, :mod:`maybempi.serial` the stand-in.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/__init__.py#L1-L1)

## maybempi.LAUNCHER_VARIABLES

*attribute* · *module attribute*

```python
LAUNCHER_VARIABLES = ('OMPI_COMM_WORLD_RANK', 'PMI_RANK', 'PMIX_RANK', 'MV2_COMM_WORLD_RANK', 'MPI_LOCALRANKID', 'ALPS_APP_PE', 'PALS_RANKID')
```

Re-exported from: `maybempi.launch`

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/launch.py#L43-L51)

## maybempi.LOCAL_RANK_VARIABLES

*attribute* · *module attribute*

```python
LOCAL_RANK_VARIABLES = ('OMPI_COMM_WORLD_LOCAL_RANK', 'MV2_COMM_WORLD_LOCAL_RANK', 'MPI_LOCALRANKID', 'PMI_LOCAL_RANK', 'PALS_LOCAL_RANKID', 'SLURM_LOCALID', 'LOCAL_RANK')
```

Re-exported from: `maybempi.launch`

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/launch.py#L55-L63)

## maybempi.OVERRIDE_VARIABLE

*attribute* · *module attribute*

```python
OVERRIDE_VARIABLE = 'MAYBEMPI'
```

Re-exported from: `maybempi.launch`

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/launch.py#L67-L67)

## maybempi.__version__

*attribute* · *module attribute*

```python
__version__ = version('maybempi')
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/__init__.py#L46-L46)

## maybempi.SerialCartcomm

*class*

```python
class SerialCartcomm(SerialComm)
```

Bases: `maybempi.serial.SerialComm`

Re-exported from: `maybempi.serial`

Stand-in for ``MPI.Cartcomm``: a Cartesian grid of one process.

Every dimension has length 1. Along a periodic dimension rank 0 is its own
neighbour; along the others ``Shift`` gives ``PROC_NULL``.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1064-L1166)

### maybempi.SerialCartcomm.Clone

*attribute* · *class attribute* · *instance attribute*

```python
Clone = Dup
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1092-L1092)

### maybempi.SerialCartcomm.Bsend

*attribute* · *class attribute* · *instance attribute*

```python
Bsend = Send
```

Inherited from: `maybempi.serial.SerialComm`

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L794-L794)

### maybempi.SerialCartcomm.Bsend_init

*attribute* · *class attribute* · *instance attribute*

```python
Bsend_init = Send_init
```

Inherited from: `maybempi.serial.SerialComm`

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L916-L916)

### maybempi.SerialCartcomm.Ibsend

*attribute* · *class attribute* · *instance attribute*

```python
Ibsend = Isend
```

Inherited from: `maybempi.serial.SerialComm`

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L819-L819)

### maybempi.SerialCartcomm.Irsend

*attribute* · *class attribute* · *instance attribute*

```python
Irsend = Isend
```

Inherited from: `maybempi.serial.SerialComm`

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L819-L819)

### maybempi.SerialCartcomm.Rsend

*attribute* · *class attribute* · *instance attribute*

```python
Rsend = Send
```

Inherited from: `maybempi.serial.SerialComm`

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L794-L794)

### maybempi.SerialCartcomm.Rsend_init

*attribute* · *class attribute* · *instance attribute*

```python
Rsend_init = Send_init
```

Inherited from: `maybempi.serial.SerialComm`

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L916-L916)

### maybempi.SerialCartcomm.barrier

*attribute* · *class attribute* · *instance attribute*

```python
barrier = Barrier
```

Inherited from: `maybempi.serial.SerialComm`

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L545-L545)

### maybempi.SerialCartcomm.bsend

*attribute* · *class attribute* · *instance attribute*

```python
bsend = send
```

Inherited from: `maybempi.serial.SerialComm`

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L849-L849)

### maybempi.SerialCartcomm.ibsend

*attribute* · *class attribute* · *instance attribute*

```python
ibsend = isend
```

Inherited from: `maybempi.serial.SerialComm`

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L860-L860)

### maybempi.SerialCartcomm.iprobe

*attribute* · *class attribute* · *instance attribute*

```python
iprobe = Iprobe
```

Inherited from: `maybempi.serial.SerialComm`

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L898-L898)

### maybempi.SerialCartcomm.probe

*attribute* · *class attribute* · *instance attribute*

```python
probe = Probe
```

Inherited from: `maybempi.serial.SerialComm`

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L910-L910)

### maybempi.SerialCartcomm.rank

*attribute* · *class attribute* · *instance attribute*

```python
rank = 0
```

Inherited from: `maybempi.serial.SerialComm`

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L436-L436)

### maybempi.SerialCartcomm.size

*attribute* · *class attribute* · *instance attribute*

```python
size = 1
```

Inherited from: `maybempi.serial.SerialComm`

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L437-L437)

### maybempi.SerialCartcomm.coords

*property*

```python
coords: list[int]
```

The coordinates of this process (all 0).

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1118-L1120)

### maybempi.SerialCartcomm.dims

*property*

```python
dims: list[int]
```

The processes along each dimension (all 1).

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1108-L1110)

### maybempi.SerialCartcomm.ndim

*property*

```python
ndim: int
```

The number of dimensions.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1103-L1105)

### maybempi.SerialCartcomm.periods

*property*

```python
periods: list[int]
```

Whether each dimension is periodic, as 0 or 1.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1113-L1115)

### maybempi.SerialCartcomm.topo

*property*

```python
topo: tuple[list[int], list[int], list[int]]
```

``(dims, periods, coords)``.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1127-L1129)

### maybempi.SerialCartcomm.group

*property*

```python
group: SerialGroup
```

Inherited from: `maybempi.serial.SerialComm`

The group of the communicator.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L475-L477)

### maybempi.SerialCartcomm.topology

*property*

```python
topology: int
```

Inherited from: `maybempi.serial.SerialComm`

The topology: ``UNDEFINED``.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L484-L486)

### maybempi.SerialCartcomm.Dup

*method*

```python
def Dup(info: Any = None) -> SerialCartcomm
```

Return a new Cartesian communicator with the same grid.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1088-L1090)

### maybempi.SerialCartcomm.Get_cart_rank

*method*

```python
def Get_cart_rank(coords: Sequence[int]) -> int
```

Return 0 for coordinates on the grid (any along periodic dimensions).

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1137-L1147)

### maybempi.SerialCartcomm.Get_coords

*method*

```python
def Get_coords(rank: int) -> list[int]
```

Return the coordinates of `rank` (only 0 exists).

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1131-L1135)

### maybempi.SerialCartcomm.Get_dim

*method*

```python
def Get_dim() -> int
```

Return the number of dimensions.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1098-L1100)

### maybempi.SerialCartcomm.Get_topo

*method*

```python
def Get_topo() -> tuple[list[int], list[int], list[int]]
```

Return ``(dims, periods, coords)``.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1122-L1124)

### maybempi.SerialCartcomm.Get_topology

*method*

```python
def Get_topology() -> int
```

Return ``CART``.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1094-L1096)

### maybempi.SerialCartcomm.Shift

*method*

```python
def Shift(direction: int, disp: int) -> tuple[int, int]
```

Return ``(source, dest)``: 0 along periodic dimensions, else ``PROC_NULL``.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1149-L1155)

### maybempi.SerialCartcomm.Sub

*method*

```python
def Sub(remain_dims: Sequence[bool]) -> SerialCartcomm
```

Return the grid of the dimensions in `remain_dims`.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1157-L1166)

### maybempi.SerialCartcomm.Abort

*method*

```python
def Abort(errorcode: int = 0) -> None
```

Inherited from: `maybempi.serial.SerialComm`

Exit the process with `errorcode` (``SystemExit``).

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L536-L538)

### maybempi.SerialCartcomm.Allgather

*method*

```python
def Allgather(sendbuf: Any, recvbuf: Any) -> None
```

Inherited from: `maybempi.serial.SerialComm`

Copy `sendbuf` into `recvbuf`.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L656-L658)

### maybempi.SerialCartcomm.Allgatherv

*method*

```python
def Allgatherv(sendbuf: Any, recvbuf: Any) -> None
```

Inherited from: `maybempi.serial.SerialComm`

Copy `sendbuf` into `recvbuf`, at the displacement of rank 0.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L660-L662)

### maybempi.SerialCartcomm.Allreduce

*method*

```python
def Allreduce(sendbuf: Any, recvbuf: Any, op: Any = None) -> None
```

Inherited from: `maybempi.serial.SerialComm`

Copy `sendbuf` into `recvbuf` (nothing with ``IN_PLACE``).

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L634-L636)

### maybempi.SerialCartcomm.Alltoall

*method*

```python
def Alltoall(sendbuf: Any, recvbuf: Any) -> None
```

Inherited from: `maybempi.serial.SerialComm`

Copy `sendbuf` into `recvbuf`.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L680-L682)

### maybempi.SerialCartcomm.Alltoallv

*method*

```python
def Alltoallv(sendbuf: Any, recvbuf: Any) -> None
```

Inherited from: `maybempi.serial.SerialComm`

Copy the part of `sendbuf` for rank 0 into `recvbuf`, at the displacement of rank 0.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L684-L692)

### maybempi.SerialCartcomm.Barrier

*method*

```python
def Barrier() -> None
```

Inherited from: `maybempi.serial.SerialComm`

Return at once.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L541-L543)

### maybempi.SerialCartcomm.Bcast

*method*

```python
def Bcast(buf: Any, root: int = 0) -> None
```

Inherited from: `maybempi.serial.SerialComm`

Do nothing: rank 0 already has the data.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L625-L627)

### maybempi.SerialCartcomm.Create

*method*

```python
def Create(group: SerialGroup) -> Any
```

Inherited from: `maybempi.serial.SerialComm`

Return a communicator for `group`: a new one, or ``COMM_NULL`` if empty.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L505-L507)

### maybempi.SerialCartcomm.Create_cart

*method*

```python
def Create_cart(dims: Sequence[int], periods: Sequence[bool] | None = None, reorder: bool = False) -> SerialCartcomm
```

Inherited from: `maybempi.serial.SerialComm`

Return a Cartesian communicator; the dimensions must multiply to 1.

**Raises**

- `ValueError` — If the grid needs more than one process.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L513-L530)

### maybempi.SerialCartcomm.Create_group

*method*

```python
def Create_group(group: SerialGroup, tag: int = 0) -> Any
```

Inherited from: `maybempi.serial.SerialComm`

Return a communicator for `group`: a new one, or ``COMM_NULL`` if empty.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L509-L511)

### maybempi.SerialCartcomm.Exscan

*method*

```python
def Exscan(sendbuf: Any, recvbuf: Any, op: Any = None) -> None
```

Inherited from: `maybempi.serial.SerialComm`

Do nothing: the receive buffer of rank 0 is undefined.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L642-L644)

### maybempi.SerialCartcomm.Free

*method*

```python
def Free() -> None
```

Inherited from: `maybempi.serial.SerialComm`

Do nothing.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L532-L534)

### maybempi.SerialCartcomm.Gather

*method*

```python
def Gather(sendbuf: Any, recvbuf: Any, root: int = 0) -> None
```

Inherited from: `maybempi.serial.SerialComm`

Copy `sendbuf` into `recvbuf`.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L646-L649)

### maybempi.SerialCartcomm.Gatherv

*method*

```python
def Gatherv(sendbuf: Any, recvbuf: Any, root: int = 0) -> None
```

Inherited from: `maybempi.serial.SerialComm`

Copy `sendbuf` into `recvbuf`, at the displacement of rank 0.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L651-L654)

### maybempi.SerialCartcomm.Get_group

*method*

```python
def Get_group() -> SerialGroup
```

Inherited from: `maybempi.serial.SerialComm`

Return the group of the communicator: rank 0 only.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L470-L472)

### maybempi.SerialCartcomm.Get_name

*method*

```python
def Get_name() -> str
```

Inherited from: `maybempi.serial.SerialComm`

Return the name of the communicator, e.g. ``"COMM_WORLD"``.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L458-L460)

### maybempi.SerialCartcomm.Get_rank

*method*

```python
def Get_rank() -> int
```

Inherited from: `maybempi.serial.SerialComm`

Return 0.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L450-L452)

### maybempi.SerialCartcomm.Get_size

*method*

```python
def Get_size() -> int
```

Inherited from: `maybempi.serial.SerialComm`

Return 1.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L454-L456)

### maybempi.SerialCartcomm.Iallgather

*method*

```python
def Iallgather(sendbuf: Any, recvbuf: Any) -> SerialRequest
```

Inherited from: `maybempi.serial.SerialComm`

Copy like ``Allgather`` and return a completed request.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L938-L941)

### maybempi.SerialCartcomm.Iallreduce

*method*

```python
def Iallreduce(sendbuf: Any, recvbuf: Any, op: Any = None) -> SerialRequest
```

Inherited from: `maybempi.serial.SerialComm`

Copy like ``Allreduce`` and return a completed request.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L933-L936)

### maybempi.SerialCartcomm.Ibarrier

*method*

```python
def Ibarrier() -> SerialRequest
```

Inherited from: `maybempi.serial.SerialComm`

Return a completed request.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L547-L549)

### maybempi.SerialCartcomm.Ibcast

*method*

```python
def Ibcast(buf: Any, root: int = 0) -> SerialRequest
```

Inherited from: `maybempi.serial.SerialComm`

Return a completed request (``Bcast`` does nothing).

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L928-L931)

### maybempi.SerialCartcomm.Iprobe

*method*

```python
def Iprobe(source: int = _ANY_SOURCE, tag: int = _ANY_TAG, status: Any = None) -> bool
```

Inherited from: `maybempi.serial.SerialComm`

Return whether a matching message is waiting, without receiving it.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L884-L896)

### maybempi.SerialCartcomm.Irecv

*method*

```python
def Irecv(buf: Any, source: int = _ANY_SOURCE, tag: int = _ANY_TAG) -> SerialRequest
```

Inherited from: `maybempi.serial.SerialComm`

Post a receive into `buf`; complete once a matching message is sent.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L837-L843)

### maybempi.SerialCartcomm.Is_inter

*method*

```python
def Is_inter() -> bool
```

Inherited from: `maybempi.serial.SerialComm`

Return False.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L462-L464)

### maybempi.SerialCartcomm.Is_intra

*method*

```python
def Is_intra() -> bool
```

Inherited from: `maybempi.serial.SerialComm`

Return True.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L466-L468)

### maybempi.SerialCartcomm.Isend

*method*

```python
def Isend(buf: Any, dest: int, tag: int = 0) -> SerialRequest
```

Inherited from: `maybempi.serial.SerialComm`

Send `buf` and return a completed request (the data are copied).

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L813-L817)

### maybempi.SerialCartcomm.Issend

*method*

```python
def Issend(buf: Any, dest: int, tag: int = 0) -> SerialRequest
```

Inherited from: `maybempi.serial.SerialComm`

Send synchronously: the request completes when a receive takes it.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L821-L825)

### maybempi.SerialCartcomm.Probe

*method*

```python
def Probe(source: int = _ANY_SOURCE, tag: int = _ANY_TAG, status: Any = None) -> bool
```

Inherited from: `maybempi.serial.SerialComm`

Return True for a waiting message (``RuntimeError`` if none was sent).

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L900-L908)

### maybempi.SerialCartcomm.Recv

*method*

```python
def Recv(buf: Any, source: int = _ANY_SOURCE, tag: int = _ANY_TAG, status: Any = None) -> None
```

Inherited from: `maybempi.serial.SerialComm`

Receive into `buf` (``RuntimeError`` if no matching message was sent).

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L827-L835)

### maybempi.SerialCartcomm.Recv_init

*method*

```python
def Recv_init(buf: Any, source: int = _ANY_SOURCE, tag: int = _ANY_TAG) -> SerialPrequest
```

Inherited from: `maybempi.serial.SerialComm`

Return a persistent receive: each ``Start`` posts a receive into `buf`.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L922-L926)

### maybempi.SerialCartcomm.Reduce

*method*

```python
def Reduce(sendbuf: Any, recvbuf: Any, op: Any = None, root: int = 0) -> None
```

Inherited from: `maybempi.serial.SerialComm`

Copy `sendbuf` into `recvbuf` (nothing with ``IN_PLACE``).

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L629-L632)

### maybempi.SerialCartcomm.Scan

*method*

```python
def Scan(sendbuf: Any, recvbuf: Any, op: Any = None) -> None
```

Inherited from: `maybempi.serial.SerialComm`

Copy `sendbuf` into `recvbuf` (nothing with ``IN_PLACE``).

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L638-L640)

### maybempi.SerialCartcomm.Scatter

*method*

```python
def Scatter(sendbuf: Any, recvbuf: Any, root: int = 0) -> None
```

Inherited from: `maybempi.serial.SerialComm`

Copy `sendbuf` into `recvbuf` (nothing with ``IN_PLACE``).

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L664-L668)

### maybempi.SerialCartcomm.Scatterv

*method*

```python
def Scatterv(sendbuf: Any, recvbuf: Any, root: int = 0) -> None
```

Inherited from: `maybempi.serial.SerialComm`

Copy the part of `sendbuf` at the displacement of rank 0 into `recvbuf`.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L670-L678)

### maybempi.SerialCartcomm.Send

*method*

```python
def Send(buf: Any, dest: int, tag: int = 0) -> None
```

Inherited from: `maybempi.serial.SerialComm`

Send `buf` to `dest` (0, or ``PROC_NULL``); kept until received.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L790-L792)

### maybempi.SerialCartcomm.Send_init

*method*

```python
def Send_init(buf: Any, dest: int, tag: int = 0) -> SerialPrequest
```

Inherited from: `maybempi.serial.SerialComm`

Return a persistent send: each ``Start`` sends `buf`.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L912-L914)

### maybempi.SerialCartcomm.Sendrecv

*method*

```python
def Sendrecv(sendbuf: Any, dest: int, sendtag: int = 0, recvbuf: Any = None, source: int = _ANY_SOURCE, recvtag: int = _ANY_TAG, status: Any = None) -> None
```

Inherited from: `maybempi.serial.SerialComm`

Send `sendbuf` to `dest` and receive into `recvbuf` from `source`.

With ``dest=0, source=0`` that copies `sendbuf` into `recvbuf`; with
``PROC_NULL`` the send or the receive does nothing.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L694-L710)

### maybempi.SerialCartcomm.Sendrecv_replace

*method*

```python
def Sendrecv_replace(buf: Any, dest: int, sendtag: int = 0, source: int = _ANY_SOURCE, recvtag: int = _ANY_TAG, status: Any = None) -> None
```

Inherited from: `maybempi.serial.SerialComm`

Send `buf` to `dest`, then receive into `buf` from `source`.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L712-L722)

### maybempi.SerialCartcomm.Split

*method*

```python
def Split(color: int = 0, key: int = 0) -> Any
```

Inherited from: `maybempi.serial.SerialComm`

Return a new serial communicator, or ``COMM_NULL`` for ``color=UNDEFINED``.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L495-L499)

### maybempi.SerialCartcomm.Split_type

*method*

```python
def Split_type(split_type: int, key: int = 0, info: Any = None) -> Any
```

Inherited from: `maybempi.serial.SerialComm`

Return a new serial communicator, or ``COMM_NULL`` for ``UNDEFINED``.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L501-L503)

### maybempi.SerialCartcomm.Ssend

*method*

```python
def Ssend(buf: Any, dest: int, tag: int = 0) -> None
```

Inherited from: `maybempi.serial.SerialComm`

Send synchronously: a matching receive must already be posted.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L808-L811)

### maybempi.SerialCartcomm.Ssend_init

*method*

```python
def Ssend_init(buf: Any, dest: int, tag: int = 0) -> SerialPrequest
```

Inherited from: `maybempi.serial.SerialComm`

Return a persistent synchronous send.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L918-L920)

### maybempi.SerialCartcomm.allgather

*method*

```python
def allgather(sendobj: Any) -> list[Any]
```

Inherited from: `maybempi.serial.SerialComm`

Return ``[sendobj]``.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L579-L581)

### maybempi.SerialCartcomm.allreduce

*method*

```python
def allreduce(sendobj: Any, op: Any = None) -> Any
```

Inherited from: `maybempi.serial.SerialComm`

Return `sendobj`.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L562-L564)

### maybempi.SerialCartcomm.alltoall

*method*

```python
def alltoall(sendobj: Any) -> list[Any]
```

Inherited from: `maybempi.serial.SerialComm`

Return `sendobj` as a list (``ValueError`` unless it has one item).

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L591-L596)

### maybempi.SerialCartcomm.bcast

*method*

```python
def bcast(obj: Any, root: int = 0) -> Any
```

Inherited from: `maybempi.serial.SerialComm`

Return `obj`.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L552-L555)

### maybempi.SerialCartcomm.exscan

*method*

```python
def exscan(sendobj: Any, op: Any = None) -> None
```

Inherited from: `maybempi.serial.SerialComm`

Return None: the result is undefined on rank 0 (``None`` in mpi4py).

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L570-L572)

### maybempi.SerialCartcomm.gather

*method*

```python
def gather(sendobj: Any, root: int = 0) -> list[Any]
```

Inherited from: `maybempi.serial.SerialComm`

Return ``[sendobj]``.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L574-L577)

### maybempi.SerialCartcomm.iallreduce

*method*

```python
def iallreduce(sendobj: Any, op: Any = None) -> SerialRequest
```

Inherited from: `maybempi.serial.SerialComm`

Return a completed request whose ``wait()`` returns `sendobj`.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L620-L622)

### maybempi.SerialCartcomm.ibcast

*method*

```python
def ibcast(obj: Any, root: int = 0) -> SerialRequest
```

Inherited from: `maybempi.serial.SerialComm`

Return a completed request whose ``wait()`` returns `obj`.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L616-L618)

### maybempi.SerialCartcomm.irecv

*method*

```python
def irecv(buf: Any = None, source: int = _ANY_SOURCE, tag: int = _ANY_TAG) -> SerialRequest
```

Inherited from: `maybempi.serial.SerialComm`

Post an object receive; ``wait()`` returns the object.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L876-L882)

### maybempi.SerialCartcomm.isend

*method*

```python
def isend(obj: Any, dest: int, tag: int = 0) -> SerialRequest
```

Inherited from: `maybempi.serial.SerialComm`

Send a (pickled) object and return a completed request.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L856-L858)

### maybempi.SerialCartcomm.issend

*method*

```python
def issend(obj: Any, dest: int, tag: int = 0) -> SerialRequest
```

Inherited from: `maybempi.serial.SerialComm`

Send an object synchronously: complete when a receive takes it.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L862-L864)

### maybempi.SerialCartcomm.recv

*method*

```python
def recv(buf: Any = None, source: int = _ANY_SOURCE, tag: int = _ANY_TAG, status: Any = None) -> Any
```

Inherited from: `maybempi.serial.SerialComm`

Return a received object (``None`` from ``PROC_NULL``).

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L866-L874)

### maybempi.SerialCartcomm.reduce

*method*

```python
def reduce(sendobj: Any, op: Any = None, root: int = 0) -> Any
```

Inherited from: `maybempi.serial.SerialComm`

Return `sendobj`.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L557-L560)

### maybempi.SerialCartcomm.scan

*method*

```python
def scan(sendobj: Any, op: Any = None) -> Any
```

Inherited from: `maybempi.serial.SerialComm`

Return `sendobj`.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L566-L568)

### maybempi.SerialCartcomm.scatter

*method*

```python
def scatter(sendobj: Any, root: int = 0) -> Any
```

Inherited from: `maybempi.serial.SerialComm`

Return the only item of `sendobj` (``ValueError`` unless it has one).

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L583-L589)

### maybempi.SerialCartcomm.send

*method*

```python
def send(obj: Any, dest: int, tag: int = 0) -> None
```

Inherited from: `maybempi.serial.SerialComm`

Send a (pickled) object to `dest`.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L845-L847)

### maybempi.SerialCartcomm.sendrecv

*method*

```python
def sendrecv(sendobj: Any, dest: int, sendtag: int = 0, recvbuf: Any = None, source: int = _ANY_SOURCE, recvtag: int = _ANY_TAG, status: Any = None) -> Any
```

Inherited from: `maybempi.serial.SerialComm`

Send `sendobj` to `dest` and return the object received from `source`.

With ``dest=0, source=0`` that is a copy of `sendobj` (unless an earlier
message matches first); ``None`` with ``source=PROC_NULL``.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L598-L614)

### maybempi.SerialCartcomm.ssend

*method*

```python
def ssend(obj: Any, dest: int, tag: int = 0) -> None
```

Inherited from: `maybempi.serial.SerialComm`

Send an object synchronously: a matching receive must be posted.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L851-L854)

## maybempi.SerialComm

*class*

```python
class SerialComm
```

Re-exported from: `maybempi.serial`

A communicator of size 1, with the mpi4py ``Comm`` methods a serial run needs.

Collectives return (object methods) or copy (buffer methods) what they would
on one rank: ``allreduce(x)`` is ``x``, ``gather(x)`` is ``[x]``,
``Allreduce(send, recv)`` copies `send` into `recv` (nothing with
``IN_PLACE``), ``Bcast`` does nothing. Point-to-point messages go to and
come from rank 0 itself or ``PROC_NULL``: a send is kept, per
communicator, until a receive with a matching tag takes it, in the order
sent. A blocking receive with no matching message raises ``RuntimeError``
(MPI would wait forever). Other methods raise ``AttributeError``.

**Attributes**

- `rank` — Always 0.
- `size` — Always 1.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L419-L941)

### maybempi.SerialComm.Bsend

*attribute* · *class attribute* · *instance attribute*

```python
Bsend = Send
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L794-L794)

### maybempi.SerialComm.Bsend_init

*attribute* · *class attribute* · *instance attribute*

```python
Bsend_init = Send_init
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L916-L916)

### maybempi.SerialComm.Clone

*attribute* · *class attribute* · *instance attribute*

```python
Clone = Dup
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L493-L493)

### maybempi.SerialComm.Ibsend

*attribute* · *class attribute* · *instance attribute*

```python
Ibsend = Isend
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L819-L819)

### maybempi.SerialComm.Irsend

*attribute* · *class attribute* · *instance attribute*

```python
Irsend = Isend
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L819-L819)

### maybempi.SerialComm.Rsend

*attribute* · *class attribute* · *instance attribute*

```python
Rsend = Send
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L794-L794)

### maybempi.SerialComm.Rsend_init

*attribute* · *class attribute* · *instance attribute*

```python
Rsend_init = Send_init
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L916-L916)

### maybempi.SerialComm.barrier

*attribute* · *class attribute* · *instance attribute*

```python
barrier = Barrier
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L545-L545)

### maybempi.SerialComm.bsend

*attribute* · *class attribute* · *instance attribute*

```python
bsend = send
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L849-L849)

### maybempi.SerialComm.ibsend

*attribute* · *class attribute* · *instance attribute*

```python
ibsend = isend
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L860-L860)

### maybempi.SerialComm.iprobe

*attribute* · *class attribute* · *instance attribute*

```python
iprobe = Iprobe
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L898-L898)

### maybempi.SerialComm.probe

*attribute* · *class attribute* · *instance attribute*

```python
probe = Probe
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L910-L910)

### maybempi.SerialComm.rank

*attribute* · *class attribute* · *instance attribute*

```python
rank = 0
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L436-L436)

### maybempi.SerialComm.size

*attribute* · *class attribute* · *instance attribute*

```python
size = 1
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L437-L437)

### maybempi.SerialComm.group

*property*

```python
group: SerialGroup
```

The group of the communicator.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L475-L477)

### maybempi.SerialComm.topology

*property*

```python
topology: int
```

The topology: ``UNDEFINED``.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L484-L486)

### maybempi.SerialComm.Abort

*method*

```python
def Abort(errorcode: int = 0) -> None
```

Exit the process with `errorcode` (``SystemExit``).

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L536-L538)

### maybempi.SerialComm.Allgather

*method*

```python
def Allgather(sendbuf: Any, recvbuf: Any) -> None
```

Copy `sendbuf` into `recvbuf`.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L656-L658)

### maybempi.SerialComm.Allgatherv

*method*

```python
def Allgatherv(sendbuf: Any, recvbuf: Any) -> None
```

Copy `sendbuf` into `recvbuf`, at the displacement of rank 0.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L660-L662)

### maybempi.SerialComm.Allreduce

*method*

```python
def Allreduce(sendbuf: Any, recvbuf: Any, op: Any = None) -> None
```

Copy `sendbuf` into `recvbuf` (nothing with ``IN_PLACE``).

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L634-L636)

### maybempi.SerialComm.Alltoall

*method*

```python
def Alltoall(sendbuf: Any, recvbuf: Any) -> None
```

Copy `sendbuf` into `recvbuf`.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L680-L682)

### maybempi.SerialComm.Alltoallv

*method*

```python
def Alltoallv(sendbuf: Any, recvbuf: Any) -> None
```

Copy the part of `sendbuf` for rank 0 into `recvbuf`, at the displacement of rank 0.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L684-L692)

### maybempi.SerialComm.Barrier

*method*

```python
def Barrier() -> None
```

Return at once.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L541-L543)

### maybempi.SerialComm.Bcast

*method*

```python
def Bcast(buf: Any, root: int = 0) -> None
```

Do nothing: rank 0 already has the data.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L625-L627)

### maybempi.SerialComm.Create

*method*

```python
def Create(group: SerialGroup) -> Any
```

Return a communicator for `group`: a new one, or ``COMM_NULL`` if empty.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L505-L507)

### maybempi.SerialComm.Create_cart

*method*

```python
def Create_cart(dims: Sequence[int], periods: Sequence[bool] | None = None, reorder: bool = False) -> SerialCartcomm
```

Return a Cartesian communicator; the dimensions must multiply to 1.

**Raises**

- `ValueError` — If the grid needs more than one process.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L513-L530)

### maybempi.SerialComm.Create_group

*method*

```python
def Create_group(group: SerialGroup, tag: int = 0) -> Any
```

Return a communicator for `group`: a new one, or ``COMM_NULL`` if empty.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L509-L511)

### maybempi.SerialComm.Dup

*method*

```python
def Dup(info: Any = None) -> SerialComm
```

Return a new serial communicator with the same name.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L489-L491)

### maybempi.SerialComm.Exscan

*method*

```python
def Exscan(sendbuf: Any, recvbuf: Any, op: Any = None) -> None
```

Do nothing: the receive buffer of rank 0 is undefined.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L642-L644)

### maybempi.SerialComm.Free

*method*

```python
def Free() -> None
```

Do nothing.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L532-L534)

### maybempi.SerialComm.Gather

*method*

```python
def Gather(sendbuf: Any, recvbuf: Any, root: int = 0) -> None
```

Copy `sendbuf` into `recvbuf`.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L646-L649)

### maybempi.SerialComm.Gatherv

*method*

```python
def Gatherv(sendbuf: Any, recvbuf: Any, root: int = 0) -> None
```

Copy `sendbuf` into `recvbuf`, at the displacement of rank 0.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L651-L654)

### maybempi.SerialComm.Get_group

*method*

```python
def Get_group() -> SerialGroup
```

Return the group of the communicator: rank 0 only.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L470-L472)

### maybempi.SerialComm.Get_name

*method*

```python
def Get_name() -> str
```

Return the name of the communicator, e.g. ``"COMM_WORLD"``.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L458-L460)

### maybempi.SerialComm.Get_rank

*method*

```python
def Get_rank() -> int
```

Return 0.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L450-L452)

### maybempi.SerialComm.Get_size

*method*

```python
def Get_size() -> int
```

Return 1.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L454-L456)

### maybempi.SerialComm.Get_topology

*method*

```python
def Get_topology() -> int
```

Return ``UNDEFINED``: no topology.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L479-L481)

### maybempi.SerialComm.Iallgather

*method*

```python
def Iallgather(sendbuf: Any, recvbuf: Any) -> SerialRequest
```

Copy like ``Allgather`` and return a completed request.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L938-L941)

### maybempi.SerialComm.Iallreduce

*method*

```python
def Iallreduce(sendbuf: Any, recvbuf: Any, op: Any = None) -> SerialRequest
```

Copy like ``Allreduce`` and return a completed request.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L933-L936)

### maybempi.SerialComm.Ibarrier

*method*

```python
def Ibarrier() -> SerialRequest
```

Return a completed request.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L547-L549)

### maybempi.SerialComm.Ibcast

*method*

```python
def Ibcast(buf: Any, root: int = 0) -> SerialRequest
```

Return a completed request (``Bcast`` does nothing).

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L928-L931)

### maybempi.SerialComm.Iprobe

*method*

```python
def Iprobe(source: int = _ANY_SOURCE, tag: int = _ANY_TAG, status: Any = None) -> bool
```

Return whether a matching message is waiting, without receiving it.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L884-L896)

### maybempi.SerialComm.Irecv

*method*

```python
def Irecv(buf: Any, source: int = _ANY_SOURCE, tag: int = _ANY_TAG) -> SerialRequest
```

Post a receive into `buf`; complete once a matching message is sent.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L837-L843)

### maybempi.SerialComm.Is_inter

*method*

```python
def Is_inter() -> bool
```

Return False.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L462-L464)

### maybempi.SerialComm.Is_intra

*method*

```python
def Is_intra() -> bool
```

Return True.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L466-L468)

### maybempi.SerialComm.Isend

*method*

```python
def Isend(buf: Any, dest: int, tag: int = 0) -> SerialRequest
```

Send `buf` and return a completed request (the data are copied).

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L813-L817)

### maybempi.SerialComm.Issend

*method*

```python
def Issend(buf: Any, dest: int, tag: int = 0) -> SerialRequest
```

Send synchronously: the request completes when a receive takes it.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L821-L825)

### maybempi.SerialComm.Probe

*method*

```python
def Probe(source: int = _ANY_SOURCE, tag: int = _ANY_TAG, status: Any = None) -> bool
```

Return True for a waiting message (``RuntimeError`` if none was sent).

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L900-L908)

### maybempi.SerialComm.Recv

*method*

```python
def Recv(buf: Any, source: int = _ANY_SOURCE, tag: int = _ANY_TAG, status: Any = None) -> None
```

Receive into `buf` (``RuntimeError`` if no matching message was sent).

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L827-L835)

### maybempi.SerialComm.Recv_init

*method*

```python
def Recv_init(buf: Any, source: int = _ANY_SOURCE, tag: int = _ANY_TAG) -> SerialPrequest
```

Return a persistent receive: each ``Start`` posts a receive into `buf`.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L922-L926)

### maybempi.SerialComm.Reduce

*method*

```python
def Reduce(sendbuf: Any, recvbuf: Any, op: Any = None, root: int = 0) -> None
```

Copy `sendbuf` into `recvbuf` (nothing with ``IN_PLACE``).

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L629-L632)

### maybempi.SerialComm.Scan

*method*

```python
def Scan(sendbuf: Any, recvbuf: Any, op: Any = None) -> None
```

Copy `sendbuf` into `recvbuf` (nothing with ``IN_PLACE``).

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L638-L640)

### maybempi.SerialComm.Scatter

*method*

```python
def Scatter(sendbuf: Any, recvbuf: Any, root: int = 0) -> None
```

Copy `sendbuf` into `recvbuf` (nothing with ``IN_PLACE``).

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L664-L668)

### maybempi.SerialComm.Scatterv

*method*

```python
def Scatterv(sendbuf: Any, recvbuf: Any, root: int = 0) -> None
```

Copy the part of `sendbuf` at the displacement of rank 0 into `recvbuf`.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L670-L678)

### maybempi.SerialComm.Send

*method*

```python
def Send(buf: Any, dest: int, tag: int = 0) -> None
```

Send `buf` to `dest` (0, or ``PROC_NULL``); kept until received.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L790-L792)

### maybempi.SerialComm.Send_init

*method*

```python
def Send_init(buf: Any, dest: int, tag: int = 0) -> SerialPrequest
```

Return a persistent send: each ``Start`` sends `buf`.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L912-L914)

### maybempi.SerialComm.Sendrecv

*method*

```python
def Sendrecv(sendbuf: Any, dest: int, sendtag: int = 0, recvbuf: Any = None, source: int = _ANY_SOURCE, recvtag: int = _ANY_TAG, status: Any = None) -> None
```

Send `sendbuf` to `dest` and receive into `recvbuf` from `source`.

With ``dest=0, source=0`` that copies `sendbuf` into `recvbuf`; with
``PROC_NULL`` the send or the receive does nothing.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L694-L710)

### maybempi.SerialComm.Sendrecv_replace

*method*

```python
def Sendrecv_replace(buf: Any, dest: int, sendtag: int = 0, source: int = _ANY_SOURCE, recvtag: int = _ANY_TAG, status: Any = None) -> None
```

Send `buf` to `dest`, then receive into `buf` from `source`.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L712-L722)

### maybempi.SerialComm.Split

*method*

```python
def Split(color: int = 0, key: int = 0) -> Any
```

Return a new serial communicator, or ``COMM_NULL`` for ``color=UNDEFINED``.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L495-L499)

### maybempi.SerialComm.Split_type

*method*

```python
def Split_type(split_type: int, key: int = 0, info: Any = None) -> Any
```

Return a new serial communicator, or ``COMM_NULL`` for ``UNDEFINED``.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L501-L503)

### maybempi.SerialComm.Ssend

*method*

```python
def Ssend(buf: Any, dest: int, tag: int = 0) -> None
```

Send synchronously: a matching receive must already be posted.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L808-L811)

### maybempi.SerialComm.Ssend_init

*method*

```python
def Ssend_init(buf: Any, dest: int, tag: int = 0) -> SerialPrequest
```

Return a persistent synchronous send.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L918-L920)

### maybempi.SerialComm.allgather

*method*

```python
def allgather(sendobj: Any) -> list[Any]
```

Return ``[sendobj]``.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L579-L581)

### maybempi.SerialComm.allreduce

*method*

```python
def allreduce(sendobj: Any, op: Any = None) -> Any
```

Return `sendobj`.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L562-L564)

### maybempi.SerialComm.alltoall

*method*

```python
def alltoall(sendobj: Any) -> list[Any]
```

Return `sendobj` as a list (``ValueError`` unless it has one item).

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L591-L596)

### maybempi.SerialComm.bcast

*method*

```python
def bcast(obj: Any, root: int = 0) -> Any
```

Return `obj`.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L552-L555)

### maybempi.SerialComm.exscan

*method*

```python
def exscan(sendobj: Any, op: Any = None) -> None
```

Return None: the result is undefined on rank 0 (``None`` in mpi4py).

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L570-L572)

### maybempi.SerialComm.gather

*method*

```python
def gather(sendobj: Any, root: int = 0) -> list[Any]
```

Return ``[sendobj]``.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L574-L577)

### maybempi.SerialComm.iallreduce

*method*

```python
def iallreduce(sendobj: Any, op: Any = None) -> SerialRequest
```

Return a completed request whose ``wait()`` returns `sendobj`.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L620-L622)

### maybempi.SerialComm.ibcast

*method*

```python
def ibcast(obj: Any, root: int = 0) -> SerialRequest
```

Return a completed request whose ``wait()`` returns `obj`.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L616-L618)

### maybempi.SerialComm.irecv

*method*

```python
def irecv(buf: Any = None, source: int = _ANY_SOURCE, tag: int = _ANY_TAG) -> SerialRequest
```

Post an object receive; ``wait()`` returns the object.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L876-L882)

### maybempi.SerialComm.isend

*method*

```python
def isend(obj: Any, dest: int, tag: int = 0) -> SerialRequest
```

Send a (pickled) object and return a completed request.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L856-L858)

### maybempi.SerialComm.issend

*method*

```python
def issend(obj: Any, dest: int, tag: int = 0) -> SerialRequest
```

Send an object synchronously: complete when a receive takes it.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L862-L864)

### maybempi.SerialComm.recv

*method*

```python
def recv(buf: Any = None, source: int = _ANY_SOURCE, tag: int = _ANY_TAG, status: Any = None) -> Any
```

Return a received object (``None`` from ``PROC_NULL``).

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L866-L874)

### maybempi.SerialComm.reduce

*method*

```python
def reduce(sendobj: Any, op: Any = None, root: int = 0) -> Any
```

Return `sendobj`.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L557-L560)

### maybempi.SerialComm.scan

*method*

```python
def scan(sendobj: Any, op: Any = None) -> Any
```

Return `sendobj`.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L566-L568)

### maybempi.SerialComm.scatter

*method*

```python
def scatter(sendobj: Any, root: int = 0) -> Any
```

Return the only item of `sendobj` (``ValueError`` unless it has one).

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L583-L589)

### maybempi.SerialComm.send

*method*

```python
def send(obj: Any, dest: int, tag: int = 0) -> None
```

Send a (pickled) object to `dest`.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L845-L847)

### maybempi.SerialComm.sendrecv

*method*

```python
def sendrecv(sendobj: Any, dest: int, sendtag: int = 0, recvbuf: Any = None, source: int = _ANY_SOURCE, recvtag: int = _ANY_TAG, status: Any = None) -> Any
```

Send `sendobj` to `dest` and return the object received from `source`.

With ``dest=0, source=0`` that is a copy of `sendobj` (unless an earlier
message matches first); ``None`` with ``source=PROC_NULL``.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L598-L614)

### maybempi.SerialComm.ssend

*method*

```python
def ssend(obj: Any, dest: int, tag: int = 0) -> None
```

Send an object synchronously: a matching receive must be posted.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L851-L854)

## maybempi.SerialFile

*class*

```python
class SerialFile
```

Re-exported from: `maybempi._file`

Stand-in for ``mpi4py.MPI.File``: a file opened by the only process.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/_file.py#L48-L351)

### maybempi.SerialFile.Read_all

*attribute* · *class attribute* · *instance attribute*

```python
Read_all = Read
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/_file.py#L295-L295)

### maybempi.SerialFile.Read_at_all

*attribute* · *class attribute* · *instance attribute*

```python
Read_at_all = Read_at
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/_file.py#L283-L283)

### maybempi.SerialFile.Write_all

*attribute* · *class attribute* · *instance attribute*

```python
Write_all = Write
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/_file.py#L289-L289)

### maybempi.SerialFile.Write_at_all

*attribute* · *class attribute* · *instance attribute*

```python
Write_at_all = Write_at
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/_file.py#L277-L277)

### maybempi.SerialFile.Close

*method*

```python
def Close() -> None
```

Close the file (and delete it with ``MODE_DELETE_ON_CLOSE``).

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/_file.py#L110-L114)

### maybempi.SerialFile.Delete

*method* · *staticmethod*

```python
def Delete(filename: str | os.PathLike[str], info: Any = None) -> None
```

Delete a file.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/_file.py#L116-L119)

### maybempi.SerialFile.Get_amode

*method*

```python
def Get_amode() -> int
```

Return the access mode the file was opened with.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/_file.py#L122-L124)

### maybempi.SerialFile.Get_atomicity

*method*

```python
def Get_atomicity() -> bool
```

Return the atomicity flag.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/_file.py#L148-L150)

### maybempi.SerialFile.Get_byte_offset

*method*

```python
def Get_byte_offset(offset: int) -> int
```

Return the byte position of the elementary type at `offset` in the view.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/_file.py#L197-L201)

### maybempi.SerialFile.Get_position

*method*

```python
def Get_position() -> int
```

Return the file pointer, in etypes of the view.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/_file.py#L349-L351)

### maybempi.SerialFile.Get_size

*method*

```python
def Get_size() -> int
```

Return the size of the file in bytes.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/_file.py#L126-L128)

### maybempi.SerialFile.Get_view

*method*

```python
def Get_view() -> tuple[int, _Datatype, _Datatype, str]
```

Return ``(disp, etype, filetype, datarep)``.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/_file.py#L193-L195)

### maybempi.SerialFile.Iread

*method*

```python
def Iread(buf: Any) -> Any
```

Read like ``Read`` and return a completed request.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/_file.py#L318-L323)

### maybempi.SerialFile.Iread_at

*method*

```python
def Iread_at(offset: int, buf: Any) -> Any
```

Read like ``Read_at`` and return a completed request.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/_file.py#L304-L309)

### maybempi.SerialFile.Iwrite

*method*

```python
def Iwrite(buf: Any) -> Any
```

Write like ``Write`` and return a completed request.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/_file.py#L311-L316)

### maybempi.SerialFile.Iwrite_at

*method*

```python
def Iwrite_at(offset: int, buf: Any) -> Any
```

Write like ``Write_at`` and return a completed request.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/_file.py#L297-L302)

### maybempi.SerialFile.Open

*method* · *classmethod*

```python
def Open(comm: Any, filename: str | os.PathLike[str], amode: int = MODE_RDONLY, info: Any = None) -> SerialFile
```

Open `filename` with the MPI access mode `amode` (``MODE_RDONLY``, ...).

**Raises**

- `ValueError` — For an invalid combination of modes.
- `OSError` — If the file cannot be opened (e.g. ``FileNotFoundError``).

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/_file.py#L74-L108)

### maybempi.SerialFile.Preallocate

*method*

```python
def Preallocate(size: int) -> None
```

Extend the file to at least `size` bytes.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/_file.py#L134-L137)

### maybempi.SerialFile.Read

*method*

```python
def Read(buf: Any, status: Any = None) -> None
```

Read into `buf` from the file pointer and advance it.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/_file.py#L291-L293)

### maybempi.SerialFile.Read_at

*method*

```python
def Read_at(offset: int, buf: Any, status: Any = None) -> None
```

Read into `buf` from the explicit offset `offset` (in etypes of the view).

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/_file.py#L279-L281)

### maybempi.SerialFile.Seek

*method*

```python
def Seek(offset: int, whence: int = SEEK_SET) -> None
```

Move the file pointer (in etypes of the view).

**Raises**

- `ValueError` — For ``SEEK_END`` in a view with gaps, or a negative position.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/_file.py#L326-L347)

### maybempi.SerialFile.Set_atomicity

*method*

```python
def Set_atomicity(flag: bool) -> None
```

Record the atomicity flag (one process is always atomic).

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/_file.py#L144-L146)

### maybempi.SerialFile.Set_size

*method*

```python
def Set_size(size: int) -> None
```

Truncate or extend the file to `size` bytes.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/_file.py#L130-L132)

### maybempi.SerialFile.Set_view

*method*

```python
def Set_view(disp: int = 0, etype: _Datatype | None = None, filetype: _Datatype | None = None, datarep: str = 'native', info: Any = None) -> None
```

Set the view: data from byte `disp` on, where `filetype` places it.

Resets the file pointer to 0.

**Raises**

- `ValueError` — For a data representation other than ``"native"``, or
a file type not built from the elementary type.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/_file.py#L153-L191)

### maybempi.SerialFile.Sync

*method*

```python
def Sync() -> None
```

Write the file to the storage device.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/_file.py#L139-L142)

### maybempi.SerialFile.Write

*method*

```python
def Write(buf: Any, status: Any = None) -> None
```

Write `buf` at the file pointer and advance it.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/_file.py#L285-L287)

### maybempi.SerialFile.Write_at

*method*

```python
def Write_at(offset: int, buf: Any, status: Any = None) -> None
```

Write `buf` at the explicit offset `offset` (in etypes of the view).

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/_file.py#L273-L275)

## maybempi.SerialGroup

*class*

```python
class SerialGroup
```

Re-exported from: `maybempi.serial`

Stand-in for ``MPI.Group``: rank 0 alone, or the empty group.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L981-L1061)

### maybempi.SerialGroup.rank

*property*

```python
rank: int
```

The rank of this process in the group.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1006-L1008)

### maybempi.SerialGroup.size

*property*

```python
size: int
```

The number of ranks.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1001-L1003)

### maybempi.SerialGroup.Compare

*method*

```python
def Compare(group: SerialGroup) -> int
```

Return ``IDENT`` for groups of the same size, else ``UNEQUAL``.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1026-L1028)

### maybempi.SerialGroup.Difference

*method* · *staticmethod*

```python
def Difference(group1: SerialGroup, group2: SerialGroup) -> SerialGroup
```

Return the ranks of `group1` that are not in `group2`.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1050-L1053)

### maybempi.SerialGroup.Dup

*method*

```python
def Dup() -> SerialGroup
```

Return a copy.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1055-L1057)

### maybempi.SerialGroup.Excl

*method*

```python
def Excl(ranks: Sequence[int]) -> SerialGroup
```

Return the group without `ranks`.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1035-L1038)

### maybempi.SerialGroup.Free

*method*

```python
def Free() -> None
```

Do nothing.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1059-L1061)

### maybempi.SerialGroup.Get_rank

*method*

```python
def Get_rank() -> int
```

Return 0, or ``UNDEFINED`` for the empty group.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L996-L998)

### maybempi.SerialGroup.Get_size

*method*

```python
def Get_size() -> int
```

Return 1, or 0 for the empty group.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L992-L994)

### maybempi.SerialGroup.Incl

*method*

```python
def Incl(ranks: Sequence[int]) -> SerialGroup
```

Return the group of `ranks`: ``[0]`` or ``[]``.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1030-L1033)

### maybempi.SerialGroup.Intersection

*method* · *staticmethod*

```python
def Intersection(group1: SerialGroup, group2: SerialGroup) -> SerialGroup
```

Return the intersection of two groups.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1045-L1048)

### maybempi.SerialGroup.Translate_ranks

*method*

```python
def Translate_ranks(ranks: Sequence[int] | None = None, group: SerialGroup | None = None) -> list[int]
```

Return the ranks in `group` of `ranks` of this group (0 stays 0).

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1010-L1024)

### maybempi.SerialGroup.Union

*method* · *staticmethod*

```python
def Union(group1: SerialGroup, group2: SerialGroup) -> SerialGroup
```

Return the union of two groups.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1040-L1043)

## maybempi.SerialMPI

*class*

```python
class SerialMPI
```

Re-exported from: `maybempi.serial`

Stand-in for the ``mpi4py.MPI`` module in a serial run.

:func:`~maybempi.launch.get_mpi` returns one instance, and
:func:`~maybempi.launch.is_serial` tells it from ``mpi4py.MPI``.
``COMM_WORLD`` and ``COMM_SELF`` are :class:`SerialComm` objects; the reduction
operations, datatypes and other constants are placeholders that
:class:`SerialComm` accepts. ``Is_initialized()`` is False: MPI itself is
never started.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1169-L1357)

### maybempi.SerialMPI.ANY_SOURCE

*attribute* · *class attribute* · *instance attribute*

```python
ANY_SOURCE = _ANY_SOURCE
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1240-L1240)

### maybempi.SerialMPI.ANY_TAG

*attribute* · *class attribute* · *instance attribute*

```python
ANY_TAG = _ANY_TAG
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1241-L1241)

### maybempi.SerialMPI.BAND

*attribute* · *class attribute* · *instance attribute*

```python
BAND = _Op('BAND')
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1254-L1254)

### maybempi.SerialMPI.BOOL

*attribute* · *class attribute* · *instance attribute*

```python
BOOL = _Datatype('BOOL', 1)
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1264-L1264)

### maybempi.SerialMPI.BOR

*attribute* · *class attribute* · *instance attribute*

```python
BOR = _Op('BOR')
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1255-L1255)

### maybempi.SerialMPI.BOTTOM

*attribute* · *class attribute* · *instance attribute*

```python
BOTTOM = _Constant('BOTTOM')
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1235-L1235)

### maybempi.SerialMPI.BXOR

*attribute* · *class attribute* · *instance attribute*

```python
BXOR = _Op('BXOR')
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1256-L1256)

### maybempi.SerialMPI.BYTE

*attribute* · *class attribute* · *instance attribute*

```python
BYTE = _Datatype('BYTE', 1)
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1262-L1262)

### maybempi.SerialMPI.CART

*attribute* · *class attribute* · *instance attribute*

```python
CART = _CART
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1206-L1206)

### maybempi.SerialMPI.CHAR

*attribute* · *class attribute* · *instance attribute*

```python
CHAR = _Datatype('CHAR', 1)
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1263-L1263)

### maybempi.SerialMPI.COMM_NULL

*attribute* · *class attribute* · *instance attribute*

```python
COMM_NULL = _COMM_NULL
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1182-L1182)

### maybempi.SerialMPI.COMM_SELF

*attribute* · *class attribute* · *instance attribute*

```python
COMM_SELF = SerialComm('COMM_SELF')
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1181-L1181)

### maybempi.SerialMPI.COMM_TYPE_SHARED

*attribute* · *class attribute* · *instance attribute*

```python
COMM_TYPE_SHARED = 0
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1209-L1209)

### maybempi.SerialMPI.COMM_WORLD

*attribute* · *class attribute* · *instance attribute*

```python
COMM_WORLD = SerialComm('COMM_WORLD')
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1180-L1180)

### maybempi.SerialMPI.COMPLEX

*attribute* · *class attribute* · *instance attribute*

```python
COMPLEX = _Datatype('COMPLEX', 8)
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1284-L1284)

### maybempi.SerialMPI.CONGRUENT

*attribute* · *class attribute* · *instance attribute*

```python
CONGRUENT = 1
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1201-L1201)

### maybempi.SerialMPI.C_BOOL

*attribute* · *class attribute* · *instance attribute*

```python
C_BOOL = _Datatype('C_BOOL', 1)
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1265-L1265)

### maybempi.SerialMPI.C_DOUBLE_COMPLEX

*attribute* · *class attribute* · *instance attribute*

```python
C_DOUBLE_COMPLEX = _Datatype('C_DOUBLE_COMPLEX', 16)
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1283-L1283)

### maybempi.SerialMPI.C_FLOAT_COMPLEX

*attribute* · *class attribute* · *instance attribute*

```python
C_FLOAT_COMPLEX = _Datatype('C_FLOAT_COMPLEX', 8)
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1282-L1282)

### maybempi.SerialMPI.Cartcomm

*attribute* · *class attribute* · *instance attribute*

```python
Cartcomm = SerialCartcomm
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1184-L1184)

### maybempi.SerialMPI.Comm

*attribute* · *class attribute* · *instance attribute*

```python
Comm = SerialComm
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1183-L1183)

### maybempi.SerialMPI.DATATYPE_NULL

*attribute* · *class attribute* · *instance attribute*

```python
DATATYPE_NULL = _Null('DATATYPE_NULL')
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1236-L1236)

### maybempi.SerialMPI.DIST_GRAPH

*attribute* · *class attribute* · *instance attribute*

```python
DIST_GRAPH = _DIST_GRAPH
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1208-L1208)

### maybempi.SerialMPI.DOUBLE

*attribute* · *class attribute* · *instance attribute*

```python
DOUBLE = _Datatype('DOUBLE', 8)
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1280-L1280)

### maybempi.SerialMPI.DOUBLE_COMPLEX

*attribute* · *class attribute* · *instance attribute*

```python
DOUBLE_COMPLEX = _Datatype('DOUBLE_COMPLEX', 16)
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1285-L1285)

### maybempi.SerialMPI.Datatype

*attribute* · *class attribute* · *instance attribute*

```python
Datatype = _Datatype
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1189-L1189)

### maybempi.SerialMPI.FILE_NULL

*attribute* · *class attribute* · *instance attribute*

```python
FILE_NULL = _file.FILE_NULL
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1195-L1195)

### maybempi.SerialMPI.FLOAT

*attribute* · *class attribute* · *instance attribute*

```python
FLOAT = _Datatype('FLOAT', 4)
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1279-L1279)

### maybempi.SerialMPI.File

*attribute* · *class attribute* · *instance attribute*

```python
File = SerialFile
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1191-L1191)

### maybempi.SerialMPI.GRAPH

*attribute* · *class attribute* · *instance attribute*

```python
GRAPH = _GRAPH
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1207-L1207)

### maybempi.SerialMPI.GROUP_EMPTY

*attribute* · *class attribute* · *instance attribute*

```python
GROUP_EMPTY = SerialGroup(0)
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1193-L1193)

### maybempi.SerialMPI.GROUP_NULL

*attribute* · *class attribute* · *instance attribute*

```python
GROUP_NULL = _Null('GROUP_NULL')
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1194-L1194)

### maybempi.SerialMPI.Group

*attribute* · *class attribute* · *instance attribute*

```python
Group = SerialGroup
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1185-L1185)

### maybempi.SerialMPI.IDENT

*attribute* · *class attribute* · *instance attribute*

```python
IDENT = 0
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1200-L1200)

### maybempi.SerialMPI.INFO_ENV

*attribute* · *class attribute* · *instance attribute*

```python
INFO_ENV = _Constant('INFO_ENV')
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1197-L1197)

### maybempi.SerialMPI.INFO_NULL

*attribute* · *class attribute* · *instance attribute*

```python
INFO_NULL = _Null('INFO_NULL')
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1196-L1196)

### maybempi.SerialMPI.INT

*attribute* · *class attribute* · *instance attribute*

```python
INT = _Datatype('INT', ctypes.sizeof(ctypes.c_int))
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1266-L1266)

### maybempi.SerialMPI.INT16_T

*attribute* · *class attribute* · *instance attribute*

```python
INT16_T = _Datatype('INT16_T', 2)
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1272-L1272)

### maybempi.SerialMPI.INT32_T

*attribute* · *class attribute* · *instance attribute*

```python
INT32_T = _Datatype('INT32_T', 4)
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1273-L1273)

### maybempi.SerialMPI.INT64_T

*attribute* · *class attribute* · *instance attribute*

```python
INT64_T = _Datatype('INT64_T', 8)
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1274-L1274)

### maybempi.SerialMPI.INT8_T

*attribute* · *class attribute* · *instance attribute*

```python
INT8_T = _Datatype('INT8_T', 1)
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1271-L1271)

### maybempi.SerialMPI.IN_PLACE

*attribute* · *class attribute* · *instance attribute*

```python
IN_PLACE = _IN_PLACE
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1234-L1234)

### maybempi.SerialMPI.Intracomm

*attribute* · *class attribute* · *instance attribute*

```python
Intracomm = SerialComm
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1183-L1183)

### maybempi.SerialMPI.LAND

*attribute* · *class attribute* · *instance attribute*

```python
LAND = _Op('LAND')
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1251-L1251)

### maybempi.SerialMPI.LONG

*attribute* · *class attribute* · *instance attribute*

```python
LONG = _Datatype('LONG', ctypes.sizeof(ctypes.c_long))
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1267-L1267)

### maybempi.SerialMPI.LONG_DOUBLE

*attribute* · *class attribute* · *instance attribute*

```python
LONG_DOUBLE = _Datatype('LONG_DOUBLE', ctypes.sizeof(ctypes.c_longdouble))
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1281-L1281)

### maybempi.SerialMPI.LONG_LONG

*attribute* · *class attribute* · *instance attribute*

```python
LONG_LONG = _Datatype('LONG_LONG', 8)
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1268-L1268)

### maybempi.SerialMPI.LOR

*attribute* · *class attribute* · *instance attribute*

```python
LOR = _Op('LOR')
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1252-L1252)

### maybempi.SerialMPI.LXOR

*attribute* · *class attribute* · *instance attribute*

```python
LXOR = _Op('LXOR')
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1253-L1253)

### maybempi.SerialMPI.MAX

*attribute* · *class attribute* · *instance attribute*

```python
MAX = _Op('MAX')
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1249-L1249)

### maybempi.SerialMPI.MAXLOC

*attribute* · *class attribute* · *instance attribute*

```python
MAXLOC = _Op('MAXLOC')
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1257-L1257)

### maybempi.SerialMPI.MIN

*attribute* · *class attribute* · *instance attribute*

```python
MIN = _Op('MIN')
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1250-L1250)

### maybempi.SerialMPI.MINLOC

*attribute* · *class attribute* · *instance attribute*

```python
MINLOC = _Op('MINLOC')
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1258-L1258)

### maybempi.SerialMPI.MODE_APPEND

*attribute* · *class attribute* · *instance attribute*

```python
MODE_APPEND = _file.MODE_APPEND
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1228-L1228)

### maybempi.SerialMPI.MODE_CREATE

*attribute* · *class attribute* · *instance attribute*

```python
MODE_CREATE = _file.MODE_CREATE
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1221-L1221)

### maybempi.SerialMPI.MODE_DELETE_ON_CLOSE

*attribute* · *class attribute* · *instance attribute*

```python
MODE_DELETE_ON_CLOSE = _file.MODE_DELETE_ON_CLOSE
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1225-L1225)

### maybempi.SerialMPI.MODE_EXCL

*attribute* · *class attribute* · *instance attribute*

```python
MODE_EXCL = _file.MODE_EXCL
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1227-L1227)

### maybempi.SerialMPI.MODE_RDONLY

*attribute* · *class attribute* · *instance attribute*

```python
MODE_RDONLY = _file.MODE_RDONLY
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1222-L1222)

### maybempi.SerialMPI.MODE_RDWR

*attribute* · *class attribute* · *instance attribute*

```python
MODE_RDWR = _file.MODE_RDWR
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1224-L1224)

### maybempi.SerialMPI.MODE_SEQUENTIAL

*attribute* · *class attribute* · *instance attribute*

```python
MODE_SEQUENTIAL = _file.MODE_SEQUENTIAL
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1229-L1229)

### maybempi.SerialMPI.MODE_UNIQUE_OPEN

*attribute* · *class attribute* · *instance attribute*

```python
MODE_UNIQUE_OPEN = _file.MODE_UNIQUE_OPEN
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1226-L1226)

### maybempi.SerialMPI.MODE_WRONLY

*attribute* · *class attribute* · *instance attribute*

```python
MODE_WRONLY = _file.MODE_WRONLY
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1223-L1223)

### maybempi.SerialMPI.OP_NULL

*attribute* · *class attribute* · *instance attribute*

```python
OP_NULL = _Null('OP_NULL')
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1238-L1238)

### maybempi.SerialMPI.ORDER_C

*attribute* · *class attribute* · *instance attribute*

```python
ORDER_C = ORDER_C
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1218-L1218)

### maybempi.SerialMPI.ORDER_F

*attribute* · *class attribute* · *instance attribute*

```python
ORDER_F = ORDER_F
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1219-L1219)

### maybempi.SerialMPI.ORDER_FORTRAN

*attribute* · *class attribute* · *instance attribute*

```python
ORDER_FORTRAN = ORDER_F
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1220-L1220)

### maybempi.SerialMPI.Op

*attribute* · *class attribute* · *instance attribute*

```python
Op = _Op
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1190-L1190)

### maybempi.SerialMPI.PROC_NULL

*attribute* · *class attribute* · *instance attribute*

```python
PROC_NULL = _PROC_NULL
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1239-L1239)

### maybempi.SerialMPI.PROD

*attribute* · *class attribute* · *instance attribute*

```python
PROD = _Op('PROD')
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1248-L1248)

### maybempi.SerialMPI.Prequest

*attribute* · *class attribute* · *instance attribute*

```python
Prequest = SerialPrequest
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1187-L1187)

### maybempi.SerialMPI.REPLACE

*attribute* · *class attribute* · *instance attribute*

```python
REPLACE = _Op('REPLACE')
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1259-L1259)

### maybempi.SerialMPI.REQUEST_NULL

*attribute* · *class attribute* · *instance attribute*

```python
REQUEST_NULL = _Null('REQUEST_NULL')
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1237-L1237)

### maybempi.SerialMPI.ROOT

*attribute* · *class attribute* · *instance attribute*

```python
ROOT = -3
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1242-L1242)

### maybempi.SerialMPI.Request

*attribute* · *class attribute* · *instance attribute*

```python
Request = SerialRequest
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1186-L1186)

### maybempi.SerialMPI.SEEK_CUR

*attribute* · *class attribute* · *instance attribute*

```python
SEEK_CUR = _file.SEEK_CUR
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1231-L1231)

### maybempi.SerialMPI.SEEK_END

*attribute* · *class attribute* · *instance attribute*

```python
SEEK_END = _file.SEEK_END
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1232-L1232)

### maybempi.SerialMPI.SEEK_SET

*attribute* · *class attribute* · *instance attribute*

```python
SEEK_SET = _file.SEEK_SET
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1230-L1230)

### maybempi.SerialMPI.SIMILAR

*attribute* · *class attribute* · *instance attribute*

```python
SIMILAR = 2
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1202-L1202)

### maybempi.SerialMPI.SUCCESS

*attribute* · *class attribute* · *instance attribute*

```python
SUCCESS = 0
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1244-L1244)

### maybempi.SerialMPI.SUM

*attribute* · *class attribute* · *instance attribute*

```python
SUM = _Op('SUM')
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1247-L1247)

### maybempi.SerialMPI.Status

*attribute* · *class attribute* · *instance attribute*

```python
Status = SerialStatus
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1188-L1188)

### maybempi.SerialMPI.THREAD_FUNNELED

*attribute* · *class attribute* · *instance attribute*

```python
THREAD_FUNNELED = 1
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1213-L1213)

### maybempi.SerialMPI.THREAD_MULTIPLE

*attribute* · *class attribute* · *instance attribute*

```python
THREAD_MULTIPLE = 3
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1215-L1215)

### maybempi.SerialMPI.THREAD_SERIALIZED

*attribute* · *class attribute* · *instance attribute*

```python
THREAD_SERIALIZED = 2
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1214-L1214)

### maybempi.SerialMPI.THREAD_SINGLE

*attribute* · *class attribute* · *instance attribute*

```python
THREAD_SINGLE = 0
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1212-L1212)

### maybempi.SerialMPI.UINT16_T

*attribute* · *class attribute* · *instance attribute*

```python
UINT16_T = _Datatype('UINT16_T', 2)
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1276-L1276)

### maybempi.SerialMPI.UINT32_T

*attribute* · *class attribute* · *instance attribute*

```python
UINT32_T = _Datatype('UINT32_T', 4)
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1277-L1277)

### maybempi.SerialMPI.UINT64_T

*attribute* · *class attribute* · *instance attribute*

```python
UINT64_T = _Datatype('UINT64_T', 8)
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1278-L1278)

### maybempi.SerialMPI.UINT8_T

*attribute* · *class attribute* · *instance attribute*

```python
UINT8_T = _Datatype('UINT8_T', 1)
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1275-L1275)

### maybempi.SerialMPI.UNDEFINED

*attribute* · *class attribute* · *instance attribute*

```python
UNDEFINED = _UNDEFINED
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1243-L1243)

### maybempi.SerialMPI.UNEQUAL

*attribute* · *class attribute* · *instance attribute*

```python
UNEQUAL = 3
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1203-L1203)

### maybempi.SerialMPI.UNSIGNED

*attribute* · *class attribute* · *instance attribute*

```python
UNSIGNED = _Datatype('UNSIGNED', ctypes.sizeof(ctypes.c_uint))
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1269-L1269)

### maybempi.SerialMPI.UNSIGNED_LONG

*attribute* · *class attribute* · *instance attribute*

```python
UNSIGNED_LONG = _Datatype('UNSIGNED_LONG', ctypes.sizeof(ctypes.c_ulong))
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1270-L1270)

### maybempi.SerialMPI.Compute_dims

*method* · *staticmethod*

```python
def Compute_dims(nnodes: int, dims: int | Sequence[int]) -> list[int]
```

Return a process grid for `nnodes` (1) processes: all ones.

**Raises**

- `ValueError` — For a number of processes other than 1.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1339-L1352)

### maybempi.SerialMPI.Finalize

*method* · *staticmethod*

```python
def Finalize() -> None
```

Do nothing.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1324-L1327)

### maybempi.SerialMPI.Get_processor_name

*method* · *staticmethod*

```python
def Get_processor_name() -> str
```

Return the host name.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1329-L1332)

### maybempi.SerialMPI.Get_version

*method* · *staticmethod*

```python
def Get_version() -> tuple[int, int]
```

Return ``(4, 0)``: the MPI standard the stand-in follows.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1334-L1337)

### maybempi.SerialMPI.Init

*method* · *staticmethod*

```python
def Init() -> None
```

Do nothing.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1319-L1322)

### maybempi.SerialMPI.Is_finalized

*method* · *staticmethod*

```python
def Is_finalized() -> bool
```

Return False.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1314-L1317)

### maybempi.SerialMPI.Is_initialized

*method* · *staticmethod*

```python
def Is_initialized() -> bool
```

Return False: MPI is never started.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1309-L1312)

### maybempi.SerialMPI.Query_thread

*method* · *staticmethod*

```python
def Query_thread() -> int
```

Return 0 (``THREAD_SINGLE``).

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1354-L1357)

### maybempi.SerialMPI.Wtick

*method* · *staticmethod*

```python
def Wtick() -> float
```

Return the resolution of :meth:`Wtime` in seconds.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1304-L1307)

### maybempi.SerialMPI.Wtime

*method* · *staticmethod*

```python
def Wtime() -> float
```

Return the wall-clock time in seconds (``time.time()``).

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L1299-L1302)

## maybempi.SerialPrequest

*class*

```python
class SerialPrequest(SerialRequest)
```

Bases: `maybempi.serial.SerialRequest`

Re-exported from: `maybempi.serial`

A persistent request (``Send_init``/``Recv_init``): each ``Start`` posts it again.

Before the first ``Start``, the request is inactive and complete.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L294-L329)

### maybempi.SerialPrequest.Cancel

*method*

```python
def Cancel() -> None
```

Cancel the started operation.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L326-L329)

### maybempi.SerialPrequest.Start

*method*

```python
def Start() -> None
```

Post the operation (a send or a receive).

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L306-L309)

### maybempi.SerialPrequest.Startall

*method* · *staticmethod*

```python
def Startall(requests: Sequence[Any]) -> None
```

Start every request.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L311-L315)

### maybempi.SerialPrequest.Test

*method*

```python
def Test(status: Any = None) -> bool
```

Return whether the started operation is complete (True if inactive).

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L322-L324)

### maybempi.SerialPrequest.Wait

*method*

```python
def Wait(status: Any = None) -> None
```

Wait for the started operation (at once if inactive).

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L317-L320)

### maybempi.SerialPrequest.Free

*method*

```python
def Free() -> None
```

Inherited from: `maybempi.serial.SerialRequest`

Do nothing.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L221-L223)

### maybempi.SerialPrequest.Testall

*method* · *staticmethod*

```python
def Testall(requests: Sequence[Any], statuses: Any = None) -> bool
```

Inherited from: `maybempi.serial.SerialRequest`

Return whether every request is complete.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L245-L248)

### maybempi.SerialPrequest.Testany

*method* · *staticmethod*

```python
def Testany(requests: Sequence[Any], status: Any = None) -> tuple[int, bool]
```

Inherited from: `maybempi.serial.SerialRequest`

Return ``(index, True)`` for a complete request, else ``(UNDEFINED, ...)``.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L268-L274)

### maybempi.SerialPrequest.Testsome

*method* · *staticmethod*

```python
def Testsome(requests: Sequence[Any], statuses: Any = None) -> list[int] | None
```

Inherited from: `maybempi.serial.SerialRequest`

Return the indices of the complete requests (``None`` for no requests).

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L286-L291)

### maybempi.SerialPrequest.Waitall

*method* · *staticmethod*

```python
def Waitall(requests: Sequence[Any], statuses: Any = None) -> None
```

Inherited from: `maybempi.serial.SerialRequest`

Wait for every request (``RuntimeError`` if one can never complete).

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L231-L235)

### maybempi.SerialPrequest.Waitany

*method* · *staticmethod*

```python
def Waitany(requests: Sequence[Any], status: Any = None) -> int
```

Inherited from: `maybempi.serial.SerialRequest`

Return the index of a complete request, or ``UNDEFINED`` for no requests.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L257-L266)

### maybempi.SerialPrequest.Waitsome

*method* · *staticmethod*

```python
def Waitsome(requests: Sequence[Any], statuses: Any = None) -> list[int] | None
```

Inherited from: `maybempi.serial.SerialRequest`

Return the indices of the complete requests (``None`` for no requests).

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L276-L284)

### maybempi.SerialPrequest.test

*method*

```python
def test(status: Any = None) -> tuple[bool, Any]
```

Inherited from: `maybempi.serial.SerialRequest`

Return ``(True, result)`` when complete, else ``(False, None)``.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L215-L219)

### maybempi.SerialPrequest.testall

*method* · *staticmethod*

```python
def testall(requests: Sequence[Any], statuses: Any = None) -> tuple[bool, Any]
```

Inherited from: `maybempi.serial.SerialRequest`

Return ``(True, results)`` when all are complete, else ``(False, None)``.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L250-L255)

### maybempi.SerialPrequest.wait

*method*

```python
def wait(status: Any = None) -> Any
```

Inherited from: `maybempi.serial.SerialRequest`

Return the result of the non-blocking object call (``RuntimeError`` if never).

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L209-L213)

### maybempi.SerialPrequest.waitall

*method* · *staticmethod*

```python
def waitall(requests: Sequence[Any], statuses: Any = None) -> list[Any]
```

Inherited from: `maybempi.serial.SerialRequest`

Return the results of the requests.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L237-L243)

## maybempi.SerialRequest

*class*

```python
class SerialRequest
```

Re-exported from: `maybempi.serial`

A request of a non-blocking call of :class:`SerialComm`.

Collectives and sends complete at once. A receive (``Irecv``, ``irecv``)
or a synchronous send (``Issend``) completes when its matching message (or
receive) is posted. Waiting for a request that can never complete raises
``RuntimeError``: on one process, MPI would wait forever.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L162-L291)

### maybempi.SerialRequest.Cancel

*method*

```python
def Cancel() -> None
```

Cancel a receive that has no message yet; nothing for a complete request.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L225-L229)

### maybempi.SerialRequest.Free

*method*

```python
def Free() -> None
```

Do nothing.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L221-L223)

### maybempi.SerialRequest.Test

*method*

```python
def Test(status: Any = None) -> bool
```

Return whether the operation is complete.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L203-L207)

### maybempi.SerialRequest.Testall

*method* · *staticmethod*

```python
def Testall(requests: Sequence[Any], statuses: Any = None) -> bool
```

Return whether every request is complete.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L245-L248)

### maybempi.SerialRequest.Testany

*method* · *staticmethod*

```python
def Testany(requests: Sequence[Any], status: Any = None) -> tuple[int, bool]
```

Return ``(index, True)`` for a complete request, else ``(UNDEFINED, ...)``.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L268-L274)

### maybempi.SerialRequest.Testsome

*method* · *staticmethod*

```python
def Testsome(requests: Sequence[Any], statuses: Any = None) -> list[int] | None
```

Return the indices of the complete requests (``None`` for no requests).

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L286-L291)

### maybempi.SerialRequest.Wait

*method*

```python
def Wait(status: Any = None) -> None
```

Return once the operation is complete (``RuntimeError`` if it never can).

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L198-L201)

### maybempi.SerialRequest.Waitall

*method* · *staticmethod*

```python
def Waitall(requests: Sequence[Any], statuses: Any = None) -> None
```

Wait for every request (``RuntimeError`` if one can never complete).

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L231-L235)

### maybempi.SerialRequest.Waitany

*method* · *staticmethod*

```python
def Waitany(requests: Sequence[Any], status: Any = None) -> int
```

Return the index of a complete request, or ``UNDEFINED`` for no requests.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L257-L266)

### maybempi.SerialRequest.Waitsome

*method* · *staticmethod*

```python
def Waitsome(requests: Sequence[Any], statuses: Any = None) -> list[int] | None
```

Return the indices of the complete requests (``None`` for no requests).

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L276-L284)

### maybempi.SerialRequest.test

*method*

```python
def test(status: Any = None) -> tuple[bool, Any]
```

Return ``(True, result)`` when complete, else ``(False, None)``.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L215-L219)

### maybempi.SerialRequest.testall

*method* · *staticmethod*

```python
def testall(requests: Sequence[Any], statuses: Any = None) -> tuple[bool, Any]
```

Return ``(True, results)`` when all are complete, else ``(False, None)``.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L250-L255)

### maybempi.SerialRequest.wait

*method*

```python
def wait(status: Any = None) -> Any
```

Return the result of the non-blocking object call (``RuntimeError`` if never).

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L209-L213)

### maybempi.SerialRequest.waitall

*method* · *staticmethod*

```python
def waitall(requests: Sequence[Any], statuses: Any = None) -> list[Any]
```

Return the results of the requests.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L237-L243)

## maybempi.SerialStatus

*class*

```python
class SerialStatus
```

Re-exported from: `maybempi.serial`

Stand-in for ``MPI.Status``: the source, tag and size of a received message.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L944-L978)

### maybempi.SerialStatus.Get_elements

*attribute* · *class attribute* · *instance attribute*

```python
Get_elements = Get_count
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L974-L974)

### maybempi.SerialStatus.count

*attribute* · *instance attribute*

```python
count = 0
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L952-L952)

### maybempi.SerialStatus.error

*attribute* · *instance attribute*

```python
error = 0
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L951-L951)

### maybempi.SerialStatus.source

*attribute* · *instance attribute*

```python
source = 0
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L949-L949)

### maybempi.SerialStatus.tag

*attribute* · *instance attribute*

```python
tag = 0
```

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L950-L950)

### maybempi.SerialStatus.Get_count

*method*

```python
def Get_count(datatype: Any = None) -> int
```

Return the number of `datatype` items received (bytes by default).

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L969-L972)

### maybempi.SerialStatus.Get_error

*method*

```python
def Get_error() -> int
```

Return 0 (``SUCCESS``).

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L965-L967)

### maybempi.SerialStatus.Get_source

*method*

```python
def Get_source() -> int
```

Return the source rank (0, or ``PROC_NULL``).

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L957-L959)

### maybempi.SerialStatus.Get_tag

*method*

```python
def Get_tag() -> int
```

Return the tag of the message.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L961-L963)

### maybempi.SerialStatus.Is_cancelled

*method*

```python
def Is_cancelled() -> bool
```

Return False.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L976-L978)

## maybempi.get_mpi

*function*

```python
def get_mpi(use_mpi: bool | None = None) -> Any
```

Re-exported from: `maybempi.launch`

Return ``mpi4py.MPI`` for an MPI run, else the serial stand-in.

**Parameters**

- `use_mpi` (`bool | None`) (default: `None`) — ``None`` (the default) decides with :func:`launched_under_mpi`, once per process. ``True`` imports mpi4py (``ImportError`` if it is not installed). ``False`` returns the stand-in without importing mpi4py.

**Returns**

- (`Any`) — ``mpi4py.MPI``, or the one :class:`~maybempi.serial.SerialMPI` object,
- (`Any`) — which has the attributes of the module that a serial run needs.
- (`Any`) — func:`is_serial` tells which one it is.

**Warns**

- `RuntimeWarning` — Launched under MPI, but mpi4py is not installed. Every
process then runs as if it were alone, as rank 0 of 1.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/launch.py#L150-L190)

## maybempi.is_serial

*function*

```python
def is_serial(obj: Any) -> bool
```

Re-exported from: `maybempi.launch`

Tell whether `obj` is the serial stand-in (the module or a communicator).

**Parameters**

- `obj` (`Any`) — What :func:`get_mpi` returned, or a communicator such as ``MPI.COMM_WORLD``.

**Returns**

- (`bool`) — True for :class:`~maybempi.serial.SerialMPI` and
- (`bool`) — class:`~maybempi.serial.SerialComm` objects, False for mpi4py's.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/launch.py#L193-L204)

## maybempi.launched_under_mpi

*function*

```python
def launched_under_mpi() -> bool
```

Re-exported from: `maybempi.launch`

Tell whether this process was started by an MPI launcher, without importing mpi4py.

True if a per-rank variable of a common launcher is set (Open MPI, MPICH,
Intel MPI, PMIx/``srun``, MVAPICH2, Hydra, Cray ALPS/PALS; see
:data:`LAUNCHER_VARIABLES`), or if mpi4py is already imported and MPI
initialized (using it then costs nothing more). ``MAYBEMPI=1``/``0``
overrides the detection, e.g. for a launcher whose variables are not known.

**Returns**

- (`bool`) — Whether the process belongs to an MPI job.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/launch.py#L122-L147)

## maybempi.launcher_variable

*function*

```python
def launcher_variable() -> str | None
```

Re-exported from: `maybempi.launch`

Return the first variable of :data:`LAUNCHER_VARIABLES` that is set, if any.

Useful to see why :func:`launched_under_mpi` decided as it did.

**Returns**

- (`str | None`) — The name of the variable, or None if none is set.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/launch.py#L111-L119)

## maybempi.local_rank

*function*

```python
def local_rank() -> int
```

Re-exported from: `maybempi.launch`

Return the rank of this process within its node, from the launcher's environment.

Reads the node-local rank that common launchers export (Open MPI, MVAPICH2,
Intel MPI/MPICH, PMI, Cray PALS, Slurm, ``LOCAL_RANK``, see
:data:`LOCAL_RANK_VARIABLES`). These are set before ``MPI_Init``, so this works
before MPI is initialized and without importing mpi4py.

**Returns**

- (`int`) — The node-local rank, or 0 if no launcher variable is set (a serial run).

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/launch.py#L89-L108)

## maybempi.set_copy_hook

*function*

```python
def set_copy_hook(hook: Callable[[str, Any], None] | None) -> None
```

Re-exported from: `maybempi.serial`

Report copies between device and host arrays in buffer collectives.

A receive into a host array from a device array (one with ``.get()``, e.g.
a CuPy array), or the other way round, is a transfer that an application
may want to count. The hook is called after each such copy.

**Parameters**

- `hook` (`Callable[[str, Any], None] | None`) — Called as ``hook(kind, array)`` with ``kind`` ``"to_host"`` or ``"to_device"`` and the host array that was copied. ``None`` removes the hook.

[View source](https://github.com/max-models/maybempi/blob/devel/src/maybempi/serial.py#L66-L79)

**Modules**

- `maybempi.cli`
- `maybempi.launch`
- `maybempi.serial`
