MPI4PY(3)

๐Ÿ“ฆ
version 4.1.1 ยท 3 versions
, in ubuntu resolute, ubuntu stonking

๐Ÿ’– MPI4PY โ€” the manual, but make it make sense ๐Ÿ’–

okay bestie, welcome to the MPI for Python page, aka MPI4PY(3), sitting pretty in the MPI for Python corner of the manual. pull up a chair, grab a boba, we're doing this together ๐Ÿซถ

Author: Lisandro Dalcin Contact: <dalcinl@gmail.com> Date: March 20, 2026

๐ŸŽ€ Abstract ๐ŸŽ€

okay so real talk: MPI for Python gives you Python bindings for the Message Passing Interface (MPI) standard. the whole point? letting your Python apps go absolutely feral across multiple processors on workstations, clusters, and supercomputers. slay. ๐Ÿ‘‘

this package is built on top of the MPI specification and serves up an object oriented interface that's giving major MPI-2 C++ bindings energy. it handles:

  • point-to-point stuff (sends, receives) โœ‰๏ธ
  • collective stuff (broadcasts, scatters, gathers) ๐Ÿ“ข
  • communication of any picklable Python object
  • efficient communication of Python objects that expose the Python buffer interface โ€” think NumPy arrays, plus builtin bytes/array/memoryview objects ๐Ÿ’…

๐ŸŒˆ INTRODUCTION ๐ŸŒˆ

so over the last few years, high performance computing went from "only the cool kids with money" to actually affordable for way more researchers in the scientific community than ever before. the combo of quality open source software + commodity hardware is literally why Beowulf <https://www.beowulf.org/> class clusters and cluster of workstations are so popular now. iconic behavior fr fr.

out of all the parallel computational models out there, message-passing has proven itself to be a genuinely effective one. this paradigm is especially suited for (but not limited to!!) distributed memory architectures, and it's used in today's most demanding scientific and engineering applications โ€” modeling, simulation, design, signal processing, the whole vibe. but here's the tea: portable message-passing parallel programming used to be an actual nightmare because of all the incompatible options devs were stuck with. fortunately, that whole situation changed for good once the MPI Forum dropped its standard specification. โœจ

high performance computing is traditionally associated with software development using compiled languages. but bestie, in typical application programs, only a small part of the code is actually time-critical enough to need the efficiency of compiled languages. the rest is generally about memory management, error handling, input/output, and user interaction โ€” and those are usually the most error prone and time-consuming lines to write and debug in the entire development process. interpreted high-level languages can be really advantageous for this kind of task.

for implementing general-purpose numerical computations, MATLAB [1] is the dominant interpreted programming language. on the open source side, Octave and Scilab are well known, freely distributed packages providing compatibility with the MATLAB language. in this work, we present MPI for Python โ€” a new package enabling applications to exploit multiple processors using standard MPI "look and feel" in Python scripts. ๐Ÿ’…

[1] MATLAB is a registered trademark of The MathWorks, Inc.

๐Ÿฆ‹ What is MPI? ๐Ÿฆ‹

MPI <https://www.mpi-forum.org/>, [mpi-using] <#mpi-using> [mpi-ref] <#mpi-ref> โ€” the Message Passing Interface โ€” is a standardized and portable message-passing system designed to function on a wide variety of parallel computers. the standard defines the syntax and semantics of library routines and lets users write portable programs in the main scientific programming languages (Fortran, C, or C++).

since its release, the MPI specification [mpi-std1] <#mpi-std1> [mpi-std2] <#mpi-std2> has become the leading standard for message-passing libraries for parallel computers. implementations are available from vendors of high-performance computers and from well known open source projects like MPICH <https://www.mpich.org/> [mpi-mpich] <#mpi-mpich> and Open MPI <https://www.open-mpi.org/> [mpi-openmpi] <#mpi-openmpi>. ๐Ÿ‘‘

๐ŸŒธ What is Python? ๐ŸŒธ

Python <https://www.python.org/> is a modern, easy to learn, powerful programming language. it has efficient high-level data structures and a simple but effective approach to object-oriented programming with dynamic typing and dynamic binding. it supports modules and packages, which encourages program modularity and code reuse. Python's elegant syntax, together with its interpreted nature, make it an ideal language for scripting and rapid application development in many areas on most platforms.

the Python interpreter and the extensive standard library are available in source or binary form without charge for all major platforms, and can be freely distributed. it's easily extended with new functions and data types implemented in C or C++. Python is also suitable as an extension language for customizable applications.

Python is an ideal candidate for writing the higher-level parts of large-scale scientific applications [Hinsen97] <#hinsen97> and driving simulations in parallel architectures [Beazley97] <#beazley97> like clusters of PC's or SMP's. Python codes are quickly developed, easily maintained, and can achieve a high degree of integration with other libraries written in compiled languages. ๐Ÿโœจ

as this work started and evolved, some ideas were borrowed from well known MPI and Python related open source projects from the Internet. credit where credit is due, bestie ๐Ÿซถ

  • OOMPI <https://web.archive.org/web/20100614170656/http://www.osl.iu.edu/research/oompi/overview.php>
    • it has no relation with Python, but is an excellent object oriented approach to MPI.
    • it's a C++ class library specification layered on top of the C bindings that encapsulates MPI into a functional class hierarchy.
    • it provides a flexible and intuitive interface by adding some abstractions, like Ports and Messages, which enrich and simplify the syntax.
  • Pypar <https://github.com/daleroberts/pypar>
    • its interface is rather minimal. there is no support for communicators or process topologies.
    • it does not require the Python interpreter to be modified or recompiled, but does not permit interactive parallel runs.
    • general (picklable) Python objects of any type can be communicated. there is good support for numeric arrays, practically full MPI bandwidth can be achieved. ๐Ÿ”ฅ
  • pyMPI <https://sourceforge.net/projects/pympi/>
    • it rebuilds the Python interpreter providing a built-in module for message passing. it does permit interactive parallel runs, which are useful for learning and debugging.
    • it provides an interface suitable for basic parallel programming. there is not full support for defining new communicators or process topologies.
    • general (picklable) Python objects can be messaged between processors. there is native support for numeric arrays.
  • Scientific Python <http://dirac.cnrs-orleans.fr/ScientificPython.html>
    • it provides a collection of Python modules that are useful for scientific computing.
    • there is an interface to MPI and BSP (Bulk Synchronous Parallel programming).
    • the interface is simple but incomplete and does not resemble the MPI specification. there is support for numeric arrays.

additionally, we would like to mention some available tools for scientific computing and software development with Python. โœจ

  • NumPy <https://numpy.org/> is a package that provides array manipulation and computational capabilities similar to those found in IDL, MATLAB, or Octave. using NumPy, it is possible to write many efficient numerical data processing applications directly in Python without using any C, C++ or Fortran code.
  • SciPy <https://scipy.org/> is an open source library of scientific tools for Python, gathering a variety of high level science and engineering modules together as a single package. it includes modules for graphics and plotting, optimization, integration, special functions, signal and image processing, genetic algorithms, ODE solvers, and others.
  • Cython <https://cython.org/> is a language that makes writing C extensions for the Python language as easy as Python itself. the Cython language is very close to the Python language, but Cython additionally supports calling C functions and declaring C types on variables and class attributes. this allows the compiler to generate very efficient C code from Cython code. this makes Cython the ideal language for wrapping for external C libraries, and for fast C modules that speed up the execution of Python code.
  • SWIG <https://www.swig.org/> is a software development tool that connects programs written in C and C++ with a variety of high-level programming languages like Perl, Tcl/Tk, Ruby and Python. issuing header files to SWIG is the simplest approach to interfacing C/C++ libraries from a Python module.

๐Ÿ“š the references, aka the receipts ๐Ÿ“š

  • [mpi-std1] โ€” MPI Forum. MPI: A Message Passing Interface Standard. International Journal of Supercomputer Applications, volume 8, number 3-4, pages 159-416, 1994.
  • [mpi-std2] โ€” MPI Forum. MPI: A Message Passing Interface Standard. High Performance Computing Applications, volume 12, number 1-2, pages 1-299, 1998.
  • [mpi-using] โ€” William Gropp, Ewing Lusk, and Anthony Skjellum. Using MPI: portable parallel programming with the message-passing interface. MIT Press, 1994.
  • [mpi-ref] โ€” Mark Snir, Steve Otto, Steven Huss-Lederman, David Walker, and Jack Dongarra. MPI - The Complete Reference, volume 1, The MPI Core. MIT Press, 2nd. edition, 1998.
  • [mpi-mpich] โ€” W. Gropp, E. Lusk, N. Doss, and A. Skjellum. A high-performance, portable implementation of the MPI message passing interface standard. Parallel Computing, 22(6):789-828, September 1996.
  • [mpi-openmpi] โ€” Edgar Gabriel, Graham E. Fagg, George Bosilca, Thara Angskun, Jack J. Dongarra, Jeffrey M. Squyres, Vishal Sahay, Prabhanjan Kambadur, Brian Barrett, Andrew Lumsdaine, Ralph H. Castain, David J. Daniel, Richard L. Graham, and Timothy S. Woodall. Open MPI: Goals, Concept, and Design of a Next Generation MPI Implementation. In Proceedings, 11th European PVM/MPI Users' Group Meeting, Budapest, Hungary, September 2004.
  • [Hinsen97] โ€” Konrad Hinsen. The Molecular Modelling Toolkit: a case study of a large scientific application in Python. In Proceedings of the 6th International Python Conference, pages 29-35, San Jose, Ca., October 1997.
  • [Beazley97] โ€” David M. Beazley and Peter S. Lomdahl. Feeding a large-scale physics application to Python. In Proceedings of the 6th International Python Conference, pages 21-29, San Jose, Ca., October 1997.

๐ŸŒˆ OVERVIEW ๐ŸŒˆ

okay bestie, buckle UP โ€” MPI for Python gives you an object oriented way to do message passing, and it's built on top of the standard MPI-2 C++ bindings. The whole interface was designed with one mission: translating the syntax and semantics of those standard MPI-2 C++ bindings straight into Python. So if you already know the standard C/C++ MPI bindings, you can justโ€ฆ use this module. No new interface to learn, periodt. ๐Ÿ’…

๐Ÿ Communicating Python Objects and Array Data

The Python standard library has a bunch of different mechanisms for data persistence. A lot of them lean on disk storage, but pickling and marshaling can also work with memory buffers. โœจ

The pickle module gives you user-extensible facilities to serialize general Python objects using ASCII or binary formats. The marshal module gives you facilities to serialize built-in Python objects using a binary format that's specific to Python, but independent of machine architecture issues. ๐ŸŽ€

MPI for Python can communicate any built-in or user-defined Python object by taking advantage of the features the pickle module provides. These facilities get routinely used to build binary representations of objects to communicate (that's the sending process's job), and to restore them back (that's the receiving process's job). ๐Ÿ”„

Now โ€” as simple and general as that serialization approach (i.e. pickling and unpickling) is, it imposes important overheads in memory as well as processor usage, especially when the objects being communicated have large memory footprints. Pickling general Python objects โ€” anything from primitive or container built-in types up to user-defined classes โ€” necessarily eats computer resources. You also need processing power to dispatch the appropriate serialization method (which depends on the object's type) and to do the actual packing. Additional memory is always needed, and if its total amount isn't known a priori, you can get many reallocations. ๐Ÿ’€ And for large numeric arrays? Yeah, that's just straight-up unacceptable, and it precludes communication of objects occupying half or more of the available memory resources. Not the vibe. ๐Ÿ˜ญ

Here's the glow-up: MPI for Python supports direct communication of any object exporting the single-segment buffer interface. That interface is a standard Python mechanism provided by some types (e.g. strings and numeric arrays), and it lets the C side access a contiguous memory buffer (i.e. address and length) holding the relevant data. Combine that with the ability to construct user-defined MPI datatypes describing complicated memory layouts, and you can implement so many algorithms involving multidimensional numeric arrays โ€” image processing, fast Fourier transforms, finite difference schemes on structured Cartesian grids, the whole lineup โ€” directly in Python, with negligible overhead, and almost as fast as compiled Fortran, C, or C++ codes. ๐Ÿ”ฅ slay.

๐Ÿ‘‘ Communicators

In MPI for Python, Comm is the base class of communicators. The Intracomm and Intercomm classes are subclasses of the Comm class. The Comm.Is_inter method (and Comm.Is_intra, provided for convenience but not part of the MPI specification) is defined for communicator objects, and you can use it to figure out the particular communicator class. ๐Ÿ•ต๏ธโ€โ™€๏ธ

There are two predefined intracommunicator instances ready for you: COMM_SELF and COMM_WORLD. From those, you can create new communicators whenever you need them. ๐ŸŒฑ

Want the number of processes in a communicator, or the calling process rank? That's Comm.Get_size and Comm.Get_rank respectively. The associated process group comes from calling Comm.Get_group, which returns an instance of the Group class. Set operations with Group objects like Group.Union, Group.Intersection and Group.Difference are fully supported, and so is creating new communicators from those groups using Comm.Create and Intracomm.Create_group. ๐Ÿซถ

New communicator instances can come from the Comm.Clone, Comm.Dup and Comm.Split methods, plus the Intracomm.Create_intercomm and Intercomm.Merge methods. So many doors, bestie. ๐Ÿšชโœจ

Virtual topologies are fully supported too โ€” that's the Cartcomm, Graphcomm and Distgraphcomm classes, which are specializations of the Intracomm class. You get new instances from intracommunicator instances with the factory methods Intracomm.Create_cart and Intracomm.Create_graph. ๐Ÿ—บ๏ธ

๐Ÿ’Œ Point-to-Point Communications

Point to point communication is a fundamental capability of message passing systems. This mechanism enables the transmission of data between a pair of processes: one side sending, the other receiving. ๐Ÿ’Œ

MPI provides a set of send and receive functions that let you communicate typed data with an associated tag. The type information enables conversion of data representation from one architecture to another in heterogeneous computing environments โ€” and bonus, it allows the representation of non-contiguous data layouts and user-defined datatypes, so you skip the overhead of the (otherwise unavoidable) packing/unpacking operations. The tag information lets the receiving end be selective about which messages it picks up. ๐ŸŽฏ

๐Ÿ›‘ Blocking Communications

MPI provides basic send and receive functions that are blocking. These functions block the caller until the data buffers involved in the communication can be safely reused by the application program. Like, actually wait. โณ

In MPI for Python, the Comm.Send, Comm.Recv and Comm.Sendrecv methods of communicator objects provide support for blocking point-to-point communications within Intracomm and Intercomm instances. These methods can communicate memory buffers. The variants Comm.send, Comm.recv and Comm.sendrecv can communicate general Python objects. ๐Ÿงธ

โšก Nonblocking Communications

On many systems, performance can be significantly increased by overlapping communication and computation. This is especially true on systems where communication can be executed autonomously by an intelligent, dedicated communication controller. ๐Ÿค–

MPI provides nonblocking send and receive functions. They allow the possible overlap of communication and computation. Non-blocking communication always comes in two parts: posting functions, which begin the requested operation; and test-for-completion functions, which let you discover whether the requested operation has completed. ๐Ÿ

In MPI for Python, the Comm.Isend and Comm.Irecv methods initiate send and receive operations, respectively. These methods return a Request instance that uniquely identifies the started operation. Its completion can be managed using the Request.Test, Request.Wait, and Request.Cancel methods. But listen โ€” managing Request objects and the associated memory buffers involved in communication requires a careful, rather low-level coordination. Users must ensure that objects exposing their memory buffers are not accessed at the Python level while they're involved in nonblocking message-passing operations. ๐Ÿšจ

bestie this is the part where you actually pay attention: no touching the buffer while it's mid-flight, okay? ๐Ÿ™ˆ

๐Ÿ” Persistent Communications

Often a communication with the same argument list gets repeatedly executed inside an inner loop. In those cases, communication can be further optimized by using persistent communication โ€” a particular case of nonblocking communication that allows the reduction of the overhead between processes and communication controllers. And furthermore, this kind of optimization can also alleviate the extra call overheads associated with interpreted, dynamic languages like Python. ๐Ÿ๐Ÿ’จ

In MPI for Python, the Comm.Send_init and Comm.Recv_init methods create persistent requests for a send and receive operation, respectively. These methods return an instance of the Prequest class, a subclass of the Request class. The actual communication can be effectively started using the Prequest.Start method, and its completion can be managed as previously described. ๐Ÿ‘‘

๐ŸŽ‰ Collective Communications

Collective communications allow the transmittal of data between multiple processes of a group simultaneously. The syntax and semantics of collective functions is consistent with point-to-point communication. Collective functions communicate typed data, but messages are not paired with an associated tag; selectivity of messages is implied in the calling order. ๐Ÿ“ž

The more commonly used collective communication operations are the following.

  • Barrier synchronization across all group members. ๐Ÿงฑ
  • Global communication functions
    • Broadcast data from one member to all members of a group. ๐Ÿ“ข
    • Gather data from all members to one member of a group. ๐Ÿงบ
    • Scatter data from one member to all members of a group. ๐ŸŒธ
  • Global reduction operations such as sum, maximum, minimum, etc. โž•

Okay so let's talk collectives, because this is where mpi4py really ate ๐Ÿ’…. When you wanna sling memory buffers around the whole squad at once, Comm.Bcast, Comm.Scatter, Comm.Gather, Comm.Allgather, and Comm.Alltoall have you covered ๐Ÿ’–. And if your data isn't a plain buffer but a whole general Python object? The lower-case girlies Comm.bcast, Comm.scatter, Comm.gather, Comm.allgather, and Comm.alltoall handle that, no cap โœจ.

Then there's the vector variants โ€” these ones can send different amounts of data to each process, which is honestly so thoughtful of them ๐Ÿซถ โ€” and those are Comm.Scatterv, Comm.Gatherv, Comm.Allgatherv, Comm.Alltoallv, and Comm.Alltoallw. Small catch though: they can only communicate objects exposing memory buffers. No random Python objects, sorry bestie ๐Ÿ˜ญ.

Global reduction operations on memory buffers? Those come at you through Comm.Reduce, Comm.Reduce_scatter, Comm.Allreduce, Intracomm.Scan, and Intracomm.Exscan ๐Ÿ‘‘. And their lower-case twins Comm.reduce, Comm.allreduce, Intracomm.scan, and Intracomm.exscan can pass general Python objects around, but heads up โ€” the actual reduction computations required get performed sequentially at some process, so it's giving "convenient but not the scalability flex you were hoping for" ๐Ÿ’€. Also, every single predefined reduction operation (SUM, PROD, MAX, etc.) can be applied. Periodt ๐ŸŒŸ.


๐Ÿ’œ Support for GPU-aware MPI ๐Ÿ’œ

Several MPI implementations โ€” Open MPI and MVAPICH included โ€” support passing GPU pointers straight into MPI calls, which means you get to skip the whole explicit data movement between host and device thing entirely ๐Ÿฆ‹. On the Python side, support for handling GPU arrays has already been implemented in a bunch of GPU-computation libraries like CuPy, Numba, PyTorch, and PyArrow ๐ŸŒˆ.

And because interoperability across library boundaries is the moment, two kinds of zero-copy data exchange protocols have been defined and agreed upon: DLPack and CUDA Array Interface (CAI) โœจ.

MPI for Python provides an experimental support for GPU-aware MPI. This feature requires:

  1. mpi4py is built against a GPU-aware MPI library.
  2. The Python GPU arrays are compliant with either of the protocols.

See the Tutorial section for further information. We note that:

  • Whether or not a MPI call can work for GPU arrays depends on the underlying MPI implementation, not on mpi4py ๐Ÿ‘€.
  • This support is currently experimental and subject to change in the future.
So like... don't build your whole personality on it yet, bestie ๐Ÿ™ˆ.

๐ŸŒ€ Dynamic Process Management ๐ŸŒ€

In the context of the MPI-1 specification, a parallel application is static โ€” meaning no processes can be added to or deleted from a running application after it has been started ๐Ÿฅฒ. Fortunately, this limitation got addressed in MPI-2, and the new specification added a process management model providing a basic interface between an application and external resources and process managers ๐Ÿ’ซ.

This MPI-2 extension can be really useful, especially for sequential applications built on top of parallel modules, or parallel applications with a client/server model. The MPI-2 process model gives you a mechanism to create new processes and establish communication between them and the existing MPI application ๐Ÿ‘ฏ. It also provides mechanisms to establish communication between two existing MPI applications, even when one did not start the other. Iconic behaviour, honestly.

In MPI for Python, new independent process groups can be created by calling the Intracomm.Spawn method within an intracommunicator. This call returns a new intercommunicator (i.e., an Intercomm instance) at the parent process group ๐Ÿ’–. The child process group can retrieve the matching intercommunicator by calling the Comm.Get_parent class method. At each side, the new intercommunicator can be used to perform point to point and collective communications between the parent and child groups of processes ๐Ÿซถ.

Alternatively, disjoint groups of processes can establish communication using a client/server approach. Any server application must first call the Open_port function to open a port and the Publish_name function to publish a provided service, and next call the Intracomm.Accept method ๐Ÿ“ž. Any client applications can first find a published service by calling the Lookup_name function, which returns the port where a server can be contacted; and next call the Intracomm.Connect method. Both Intracomm.Accept and Intracomm.Connect methods return an Intercomm instance ๐ŸŒธ.

When connection between client/server processes is no longer needed, all of them must cooperatively call the Comm.Disconnect method โ€” it's a group project, you can't just ghost ๐Ÿ˜ค. Additionally, server applications should release resources by calling the Unpublish_name and Close_port functions ๐Ÿงน.


๐Ÿ”ฎ One-Sided Communications ๐Ÿ”ฎ

One-sided communications (also called Remote Memory Access, or RMA) supplements the traditional two-sided, send/receive based MPI communication model with a one-sided, put/get based interface ๐ŸŒˆ. One-sided communication that can take advantage of the capabilities of highly specialized network hardware. Additionally, this extension lowers latency and software overhead in applications written using a shared-memory-like paradigm โšก.

The MPI specification revolves around the use of objects called windows; they intuitively specify regions of a process's memory that have been made available for remote read and write operations ๐ŸชŸ. The published memory blocks can be accessed through three functions for put (remote send), get (remote write), and accumulate (remote update or reduction) data items. A much larger number of functions support different synchronization styles; the semantics of these synchronization operations are fairly complex, ngl ๐Ÿ’€.

In MPI for Python, one-sided operations are available by using instances of the Win class ๐Ÿ‘‘. New window objects are created by calling the Win.Create method at all processes within a communicator and specifying a memory buffer. When a window instance is no longer needed, the Win.Free method should be called ๐Ÿงน.

The three one-sided MPI operations for remote write, read and reduction are available through calling the methods Win.Put, Win.Get, and Win.Accumulate respectively within a Win instance โœจ. These methods need an integer rank identifying the target process and an integer offset relative the base address of the remote memory block being accessed ๐Ÿ“.

The one-sided operations read, write, and reduction are implicitly nonblocking, and must be synchronized by using two primary modes ๐Ÿ•ฐ๏ธ. Active target synchronization requires the origin process to call the Win.Start and Win.Complete methods at the origin process, and target process cooperates by calling the Win.Post and Win.Wait methods ๐Ÿค. There is also a collective variant provided by the Win.Fence method. Passive target synchronization is more lenient โ€” only the origin process calls the Win.Lock and Win.Unlock methods ๐Ÿ”’. Locks are used to protect remote accesses to the locked remote window and to protect local load/store accesses to a locked local window.


๐Ÿ“‚ Parallel Input/Output ๐Ÿ“‚

The POSIX standard provides a model of a widely portable file system ๐Ÿ—‚๏ธ. However, the optimization needed for parallel input/output cannot be achieved with this generic interface ๐Ÿ˜ญ. In order to ensure efficiency and scalability, the underlying parallel input/output system must provide a high-level interface supporting partitioning of file data among processes and a collective interface supporting complete transfers of global data structures between process memories and files ๐Ÿ’ซ. Additionally, further efficiencies can be gained via support for asynchronous input/output, strided accesses to data, and control over physical file layout on storage devices. This scenario motivated the inclusion in the MPI-2 standard of a custom interface in order to support more elaborated parallel input/output operations ๐ŸŒธ.

The MPI specification for parallel input/output revolves around the use objects called files. As defined by MPI, files are not just contiguous byte streams ๐Ÿšซ. Instead, they are regarded as ordered collections of typed data items. MPI supports sequential or random access to any integral set of these items. Furthermore, files are opened collectively by a group of processes ๐Ÿ‘ฏ.

The common patterns for accessing a shared file (broadcast, scatter, gather, reduction) is expressed by using user-defined datatypes ๐ŸŽ€. Compared to the communication patterns of point-to-point and collective communications, this approach has the advantage of added flexibility and expressiveness โœจ. Data access operations (read and write) are defined for different kinds of positioning (using explicit offsets, individual file pointers, and shared file pointers), coordination (non-collective and collective), and synchronism (blocking, nonblocking, and split collective with begin/end phases) ๐Ÿ“‹.

In MPI for Python, all MPI input/output operations are performed through instances of the File class ๐Ÿ“. File handles are obtained by calling the File.Open method at all processes within a communicator and providing a file name and the intended access mode ๐Ÿ”‘. After use, they must be closed by calling the File.Close method. Files even can be deleted by calling method File.Delete ๐Ÿ—‘๏ธ.

After creation, files are typically associated with a per-process view ๐Ÿ‘€. The view defines the current set of data visible and accessible from an open file as an ordered set of elementary datatypes. This data layout can be set and queried with the File.Set_view and File.Get_view methods respectively ๐Ÿฆ‹.

okay so the actual reading and writing?? that's done by a whole vibe of methods that mix read and write calls together, and they all behave differently depending on positioning, coordination, and synchronism. summing up the tea: MPI for Python hands you the thirty (30) methods defined in MPI-2 for reading from or writing to files, using either explicit offsets or file pointers (individual or shared), and in blocking or nonblocking and collective or noncollective versions. yes bestie, thirty. count them. ๐Ÿ’…


๐Ÿซถ ENVIRONMENTAL MANAGEMENT ๐Ÿซถ

โœจ Initialization and Exit โœจ

so the module functions Init and Init_thread and Finalize handle MPI initialization and finalization respectively โ€” like, they're the ones doing the setup and the shutdown. and the module functions Is_initialized and Is_finalized give you the respective tests for initialization and finalization. iykyk. ๐ŸŒธ

Note: MPI_Init() or MPI_Init_thread() is actually called when you import the MPI module from the mpi4py package, but only if MPI is not already initialized. In such case, calling Init or Init_thread from Python is expected to generate an MPI error, and in turn an exception will be raised. so like, don't double-init, bestie, she will yell at you. ๐Ÿ˜ญ
Note: MPI_Finalize() is registered (by using Python C/API function Py_AtExit()) for being automatically called when Python processes exit, but only if mpi4py actually initialized MPI. Therefore, there is no need to call Finalize from Python to ensure MPI finalization. she cleans up after herself, periodt. ๐Ÿงš

๐Ÿ’– Implementation Information ๐Ÿ’–

  • The MPI version number can be retrieved from module function Get_version. It returns a two-integer tuple (version, subversion). cute little pair fr fr.
  • The Get_processor_name function can be used to access the processor name. iconic.
  • The values of predefined attributes attached to the world communicator can be obtained by calling the Comm.Get_attr method within the COMM_WORLD instance. yes, the whole world, literally. ๐ŸŒˆ

โฐ Timers โฐ

MPI timer functionalities are available through the Wtime and Wtick functions. ticking away like a little clock emoji bestie ๐Ÿ•โœจ

๐Ÿšจ Error Handling ๐Ÿšจ

In order to facilitate handle sharing with other Python modules interfacing MPI-based parallel libraries, the predefined MPI error handlers ERRORS_RETURN and ERRORS_ARE_FATAL can be assigned to and retrieved from communicators using methods Comm.Set_errhandler and Comm.Get_errhandler, and similarly for windows and files. New custom error handlers can be created with Comm.Create_errhandler. like, you can literally make your own error handler. main character energy. ๐Ÿ‘‘

When the predefined error handler ERRORS_RETURN is set, errors returned from MPI calls within Python code will raise an instance of the exception class Exception, which is a subclass of the standard Python exception RuntimeError. so it comes back as a whole exception, not just silently vibing.

Note: After import, mpi4py overrides the default MPI rules governing inheritance of error handlers. The ERRORS_RETURN error handler is set in the predefined COMM_SELF and COMM_WORLD communicators, as well as any new Comm, Win, or File instance created through mpi4py. If you ever pass such handles to C/C++/Fortran library code, it is recommended to set the ERRORS_ARE_FATAL error handler on them to ensure MPI errors do not pass silently. ๐Ÿซถ so like, if you're handing your handles off to the C besties, switch to fatal so nothing gets swept under the rug, no cap.
Warning: Importing with from mpi4py.MPI import * will cause a name clashing with the standard Python Exception base class. so likeโ€ฆ don't do that unless you want chaos. ๐Ÿ’€๐Ÿ™ˆ

๐ŸŽ€ TUTORIAL ๐ŸŽ€

Warning: Under construction. Contributions very welcome! ๐Ÿšง bestie it's a work in progress, come help us build it.
Tip: Rolf Rabenseifner at HLRS developed a comprehensive MPI-3.1/4.0 course with slides and a large set of exercises including solutions. This material is available online for self-study. The slides and exercises show the C, Fortran, and Python (mpi4py) interfaces. For performance reasons, most Python exercises use NumPy arrays and communication routines involving buffer-like objects. go off king, the exercises are so good. ๐Ÿ“šโœจ
Tip: Victor Eijkhout at TACC authored the book Parallel Programming for Science and Engineering. This book is available online in PDF and HTML formats. The book covers parallel programming with MPI and OpenMP in C/C++ and Fortran, and MPI in Python using mpi4py. the way this book covers literally everything?? obsessed. ๐Ÿฆ‹

MPI for Python supports convenient, pickle-based communication of generic Python object as well as fast, near C-speed, direct array data communication of buffer-provider objects (e.g., NumPy arrays). like, both the cozy option AND the fast option. bestie you get to pick your vibe. ๐Ÿ’…

  • Communication of generic Python objects

You have to use methods with all-lowercase names, like Comm.send, Comm.recv, Comm.bcast, Comm.scatter, Comm.gather. An object to be sent is passed as a parameter to the communication call, and the received object is simply the return value. lowercase = the pickle-y object vibe, got it. ๐Ÿ“

The Comm.isend and Comm.irecv methods return Request instances; completion of these methods can be managed using the Request.test and Request.wait methods. non-blocking girlies rise. ๐Ÿงš

The Comm.recv and Comm.irecv methods may be passed a buffer object that can be repeatedly used to receive messages avoiding internal memory allocation. This buffer must be sufficiently large to accommodate the transmitted messages; hence, any buffer passed to Comm.recv or Comm.irecv must be at least as long as the pickled data transmitted to the receiver. so like, size your buffer right or it's gonna be a whole mess. ๐Ÿ˜ญ

Collective calls like Comm.scatter, Comm.gather, Comm.allgather, Comm.alltoall expect a single value or a sequence of Comm.size elements at the root or all process. They return a single value, a list of Comm.size elements, or None. yes bestie, sometimes she just returns None. that's the whole vibe. ๐Ÿ’€

Note: MPI for Python uses the highest protocol version available in the Python runtime (see the HIGHEST_PROTOCOL constant in the pickle module). The default protocol can be changed at import time by setting the MPI4PY_PICKLE_PROTOCOL environment variable, or at runtime by assigning a different value to the PROTOCOL attribute of the pickle object within the MPI module. so you got two levers to pull โ€” one at import, one at runtime. pick your fighter. ๐ŸŽ€
  • Communication of buffer-like objects

You have to use method names starting with an upper-case letter, like Comm.Send, Comm.Recv, Comm.Bcast, Comm.Scatter, Comm.Gather. capital letters = the fast buffer vibe. slay. ๐Ÿ”ฅ

In general, buffer arguments to these calls must be explicitly specified by using a 2/3-list/tuple like [data, MPI.DOUBLE], or [data, count, MPI.DOUBLE] (the former one uses the byte-size of data and the extent of the MPI datatype to define count). okay so 2-element or 3-element, and the short one does the count math for you. cute.

For vector collectives communication operations like Comm.Scatterv and Comm.Gatherv, buffer arguments are specified as [data, count, displ, datatype], where count and displ are sequences of integral values. four things, count and displ are sequences of ints. no cap. ๐Ÿซถ

Automatic MPI datatype discovery for NumPy/GPU arrays and PEP-3118 buffers is supported, but limited to basic C types (all C/C99-native signed/unsigned integral types and single/double precision real/complex floating types) and availability of matching datatypes in the underlying MPI implementation. In this case, the buffer-provider object can be passed directly as a buffer argument, the count and MPI datatype will be inferred. so she sniffs out the type for you, but only for the basics, and only if your MPI implementation actually has a matching datatype. ๐Ÿฆ‹

If mpi4py is built against a GPU-aware MPI implementation, GPU arrays can be passed to upper-case methods as long as they have either the __dlpack__ and __dlpack_device__ methods or the __cuda_array_interface__ attribute that are compliant with the respective standard specifications. Moreover, only C-contiguous or Fortran-contiguous GPU arrays are supported. It is important to note that GPU buffers must be fully ready before any MPI routines operate on them to avoid race conditions. This can be ensured by using the synchronization API of your array library. mpi4py does not have access to any GPU-specific functionality and thus cannot perform this operation automatically for users. ๐Ÿ’€ so like, YOU gotta sync your GPU buffers before MPI touches them, mpi4py literally cannot do it for you. do not skip this step bestie, race conditions are not the vibe.

๐Ÿƒ Running Python scripts with MPI ๐Ÿƒ

Most MPI programs can be run with the command mpiexec. In practice, running Python programs looks like:

$ mpiexec -n 4 python script.py

to run the program with 4 processors. four little workers, one little script. ๐Ÿซถ

๐Ÿ’Œ Point-to-Point Communication ๐Ÿ’Œ

  • Python objects (pickle under the hood):
from mpi4py import MPI

comm = MPI.COMM_WORLD
rank = comm.Get_rank()

if rank == 0:
    data = {'a': 7, 'b': 3.14}
    comm.send(data, dest=1, tag=11)
elif rank == 1:
    data = comm.recv(source=0, tag=11)
  • Python objects with non-blocking communication:
from mpi4py import MPI

comm = MPI.COMM_WORLD
rank = comm.Get_rank()

if rank == 0:
    data = {'a': 7, 'b': 3.14}
    req = comm.isend(data, dest=1, tag=11)
    req.wait()
elif rank == 1:
    req = comm.irecv(source=0, tag=11)
    data = req.wait()
  • NumPy arrays (the fast way!): โœจ

okay bestie we are STILL in point-to-point territory and the glow-up is real โ€” mpi4py will either hold your datatype's hand or just read your mind and figure it out itself. pick your fighter ๐Ÿ’…

from mpi4py import MPI
import numpy

comm = MPI.COMM_WORLD
rank = comm.Get_rank()

# passing MPI datatypes explicitly
if rank == 0:
    data = numpy.arange(1000, dtype='i')
    comm.Send([data, MPI.INT], dest=1, tag=77)
elif rank == 1:
    data = numpy.empty(1000, dtype='i')
    comm.Recv([data, MPI.INT], source=0, tag=77)

# automatic MPI datatype discovery
if rank == 0:
    data = numpy.arange(100, dtype=numpy.float64)
    comm.Send(data, dest=1, tag=13)
elif rank == 1:
    data = numpy.empty(100, dtype=numpy.float64)
    comm.Recv(data, source=0, tag=13)
ngl the second half is mpi4py doing automatic MPI datatype discovery โ€” you hand it the buffer and it just knows. no cap. ๐Ÿ”ฅ

๐Ÿซถ Collective Communication ๐Ÿซถ

okay so point-to-point is giving "just us two" energy, but collective ops are the group chat โ€” everybody eats at the same time. let's gooo:

  • Broadcasting a Python dictionary: rank 0 is holding the dict, and comm.bcast(data, root=0) beams it to literally everyone. the other ranks just sit there with data = None and wait for the serve. main character behavior fr fr.
from mpi4py import MPI

comm = MPI.COMM_WORLD
rank = comm.Get_rank()

if rank == 0:
    data = {'key1' : [7, 2.72, 2+3j],
            'key2' : ( 'abc', 'xyz')}
else:
    data = None
data = comm.bcast(data, root=0)
  • Scattering Python objects: root builds a whole list of squares [(i+1)**2 for i in range(size)], then comm.scatter(data, root=0) hands each rank its own lil slice, and the assert is there to make sure everybody got exactly what they were owed. vibe check passed โœจ
from mpi4py import MPI

comm = MPI.COMM_WORLD
size = comm.Get_size()
rank = comm.Get_rank()

if rank == 0:
    data = [(i+1)**2 for i in range(size)]
else:
    data = None
data = comm.scatter(data, root=0)
assert data == (rank+1)**2
  • Gathering Python objects: the reverse serve ๐Ÿ’ซ โ€” every rank computes its own (rank+1)**2 and hands it over, root collects the whole list with comm.gather(data, root=0), and the non-roots get None back. not me checking with assert data is None ๐Ÿ˜ญ
from mpi4py import MPI

comm = MPI.COMM_WORLD
size = comm.Get_size()
rank = comm.Get_rank()

data = (rank+1)**2
data = comm.gather(data, root=0)
if rank == 0:
    for i in range(size):
        assert data[i] == (i+1)**2
else:
    assert data is None
  • Broadcasting a NumPy array: root has np.arange(100, dtype='i'), everyone else pre-allocates np.empty(100, dtype='i'), then comm.Bcast(data, root=0) fills it in. lowercase bcast returns the object, uppercase Bcast fills your buffer โ€” the caps version is the buffer queen ๐Ÿ‘‘
from mpi4py import MPI
import numpy as np

comm = MPI.COMM_WORLD
rank = comm.Get_rank()

if rank == 0:
    data = np.arange(100, dtype='i')
else:
    data = np.empty(100, dtype='i')
comm.Bcast(data, root=0)
for i in range(100):
    assert data[i] == i
  • Scattering NumPy arrays: root makes a big [size, 100] sendbuf and does the lil sendbuf.T[:,:] = range(size) trick so every row is a rank number. then comm.Scatter(sendbuf, recvbuf, root=0) gives each rank its own recvbuf of 100, and np.allclose(recvbuf, rank) confirms it. obsessed with this one ๐Ÿ“
from mpi4py import MPI
import numpy as np

comm = MPI.COMM_WORLD
size = comm.Get_size()
rank = comm.Get_rank()

sendbuf = None
if rank == 0:
    sendbuf = np.empty([size, 100], dtype='i')
    sendbuf.T[:,:] = range(size)
recvbuf = np.empty(100, dtype='i')
comm.Scatter(sendbuf, recvbuf, root=0)
assert np.allclose(recvbuf, rank)
  • Gathering NumPy arrays: every rank fills a sendbuf of 100 with np.zeros(100, dtype='i') + rank, root pre-allocates [size, 100] for the recvbuf, and comm.Gather(sendbuf, recvbuf, root=0) stacks it all up. then root double-checks every row. it's giving meticulous ๐Ÿ’…
from mpi4py import MPI
import numpy as np

comm = MPI.COMM_WORLD
size = comm.Get_size()
rank = comm.Get_rank()

sendbuf = np.zeros(100, dtype='i') + rank
recvbuf = None
if rank == 0:
    recvbuf = np.empty([size, 100], dtype='i')
comm.Gather(sendbuf, recvbuf, root=0)
if rank == 0:
    for i in range(size):
        assert np.allclose(recvbuf[i,:], i)
  • Parallel matrix-vector product: the iconic matvec(comm, A, x) function โ€” m = A.shape[0] is your local row count, p = comm.Get_size() is how many of us there are, xg = numpy.zeros(m*p, dtype='d') is where the full x gets rebuilt, comm.Allgather([x, MPI.DOUBLE], [xg, MPI.DOUBLE]) does the sharing, and then y = numpy.dot(A, xg) is the actual math. the way that Allgather just makes the whole vector appear everywhereโ€ฆ ate. ๐Ÿ”ฅ
from mpi4py import MPI
import numpy

def matvec(comm, A, x):
    m = A.shape[0] # local rows
    p = comm.Get_size()
    xg = numpy.zeros(m*p, dtype='d')
    comm.Allgather([x,  MPI.DOUBLE],
                   [xg, MPI.DOUBLE])
    y = numpy.dot(A, xg)
    return y

๐ŸŒˆ Input/Output (MPI-IO) ๐ŸŒˆ

yes bestie, we're doing file I/O in parallel and honestly it's a whole vibe.

  • Collective I/O with NumPy arrays: you set amode = MPI.MODE_WRONLY|MPI.MODE_CREATE, open the file with MPI.File.Open(comm, "./datafile.contig", amode), fill a buffer of 10 ints with your rank, then compute offset = comm.Get_rank()*buffer.nbytes so nobody's stepping on anyone's toes. fh.Write_at_all(offset, buffer) drops it in, then fh.Close() closes it out. clean. periodt. ๐ŸŽ€
from mpi4py import MPI
import numpy as np

amode = MPI.MODE_WRONLY|MPI.MODE_CREATE
comm = MPI.COMM_WORLD
fh = MPI.File.Open(comm, "./datafile.contig", amode)

buffer = np.empty(10, dtype=np.int)
buffer[:] = comm.Get_rank()

offset = comm.Get_rank()*buffer.nbytes
fh.Write_at_all(offset, buffer)

fh.Close()
  • Non-contiguous Collective I/O with NumPy arrays and datatypes: the โœจfancyโœจ version. item_count = 10, buffer full of your rank, then filetype = MPI.INT.Create_vector(item_count, 1, size) makes a custom datatype and filetype.Commit() locks it in. displacement = MPI.INT.Get_size()*rank is where each rank starts, fh.Set_view(displacement, filetype=filetype) sets the view, fh.Write_all(buffer) writes it, and then filetype.Free() + fh.Close() clean everything up. iykyk ๐Ÿฆ‹
from mpi4py import MPI
import numpy as np

comm = MPI.COMM_WORLD
rank = comm.Get_rank()
size = comm.Get_size()

amode = MPI.MODE_WRONLY|MPI.MODE_CREATE
fh = MPI.File.Open(comm, "./datafile.noncontig", amode)

item_count = 10

buffer = np.empty(item_count, dtype='i')
buffer[:] = rank

filetype = MPI.INT.Create_vector(item_count, 1, size)
filetype.Commit()

displacement = MPI.INT.Get_size()*rank
fh.Set_view(displacement, filetype=filetype)

fh.Write_all(buffer)
filetype.Free()
fh.Close()

๐Ÿงš Dynamic Process Management ๐Ÿงš

this is the "we spawn our own friends" section and it's genuinely iconic.

  • Compute Pi - Master (or parent, or client) side: you MPI.COMM_SELF.Spawn(sys.executable, args=['cpi.py'], maxprocs=5) to boot up 5 lil workers, then comm.Bcast([N, MPI.INT], root=MPI.ROOT) sends N = numpy.array(100, 'i') out to them. comm.Reduce(None, [PI, MPI.DOUBLE], op=MPI.SUM, root=MPI.ROOT) collects the partial sums into PI = numpy.array(0.0, 'd'), print(PI) shows the tea, and comm.Disconnect() says bye. ๐Ÿ’œ
#!/usr/bin/env python
from mpi4py import MPI
import numpy
import sys

comm = MPI.COMM_SELF.Spawn(sys.executable,
                           args=['cpi.py'],
                           maxprocs=5)

N = numpy.array(100, 'i')
comm.Bcast([N, MPI.INT], root=MPI.ROOT)
PI = numpy.array(0.0, 'd')
comm.Reduce(None, [PI, MPI.DOUBLE],
            op=MPI.SUM, root=MPI.ROOT)
print(PI)

comm.Disconnect()
  • Compute Pi - Worker (or child, or server) side: the worker grabs its parent with comm = MPI.Comm.Get_parent(), checks size and rank, receives N = numpy.array(0, dtype='i') via comm.Bcast([N, MPI.INT], root=0), then does the classic h = 1.0 / N; s = 0.0 Riemann-sum loop over range(rank, N, size) computing x = h * (i + 0.5) and s += 4.0 / (1.0 + x**2). wraps it as PI = numpy.array(s * h, dtype='d'), sends it home with comm.Reduce([PI, MPI.DOUBLE], None, op=MPI.SUM, root=0), and dips with comm.Disconnect(). ๐Ÿ˜ญ so proud of them
#!/usr/bin/env python
from mpi4py import MPI
import numpy

comm = MPI.Comm.Get_parent()
size = comm.Get_size()
rank = comm.Get_rank()

N = numpy.array(0, dtype='i')
comm.Bcast([N, MPI.INT], root=0)
h = 1.0 / N; s = 0.0
for i in range(rank, N, size):
    x = h * (i + 0.5)
    s += 4.0 / (1.0 + x**2)
PI = numpy.array(s * h, dtype='d')
comm.Reduce([PI, MPI.DOUBLE], None,
            op=MPI.SUM, root=0)

comm.Disconnect()

โญ GPU-aware MPI + Python GPU arrays โญ

yes we're on the GPU now, put your seatbelt on bestie ๐Ÿ‘‘

  • Reduce-to-all CuPy arrays: import cupy as cp, make sendbuf = cp.arange(10, dtype='i') and recvbuf = cp.empty_like(sendbuf), then synchronize the stream with cp.cuda.get_current_stream().synchronize() before you do anything โ€” do not skip this, the sync is the whole point. comm.Allreduce(sendbuf, recvbuf) runs the reduce-to-all, and assert cp.allclose(recvbuf, sendbuf*size) confirms everyone's numbers added up right. ๐Ÿ”ฅ
from mpi4py import MPI
import cupy as cp

comm = MPI.COMM_WORLD
size = comm.Get_size()
rank = comm.Get_rank()

sendbuf = cp.arange(10, dtype='i')
recvbuf = cp.empty_like(sendbuf)
cp.cuda.get_current_stream().synchronize()
comm.Allreduce(sendbuf, recvbuf)

assert cp.allclose(recvbuf, sendbuf*size)

๐ŸŽ€ One-Sided Communication (RMA) ๐ŸŽ€

one-sided = you don't need the other guy to be "listening" in a matching call. it's giving independent woman energy ๐Ÿ’…

  • Read from (write to) the entire RMA window: set datatype = MPI.FLOAT, grab np_dtype = dtlib.to_numpy_dtype(datatype) and itemsize = datatype.Get_size(). with N = 10, only rank 0 allocates the window: win_size = N * itemsize if rank == 0 else 0, then win = MPI.Win.Allocate(win_size, comm=comm). rank 0 fills buf with 42, win.Lock(rank=0), win.Put(buf, target_rank=0), win.Unlock(rank=0), then comm.Barrier(). everybody else hits the comm.Barrier() first, then locks, win.Get(buf, target_rank=0), unlocks, and assert np.all(buf == 42). beautiful. no notes. ๐Ÿฆ‹
import numpy as np
from mpi4py import MPI
from mpi4py.util import dtlib

comm = MPI.COMM_WORLD
rank = comm.Get_rank()

datatype = MPI.FLOAT
np_dtype = dtlib.to_numpy_dtype(datatype)
itemsize = datatype.Get_size()

N = 10
win_size = N * itemsize if rank == 0 else 0
win = MPI.Win.Allocate(win_size, comm=comm)

buf = np.empty(N, dtype=np_dtype)
if rank == 0:
    buf.fill(42)
    win.Lock(rank=0)
    win.Put(buf, target_rank=0)
    win.Unlock(rank=0)
    comm.Barrier()
else:
    comm.Barrier()
    win.Lock(rank=0)
    win.Get(buf, target_rank=0)
    win.Unlock(rank=0)
    assert np.all(buf == 42)
  • Accessing a part of the RMA window using the target argument, which is defined as (offset, count, datatype) โ€” this is the "I only want a slice of the window" move. here N = comm.Get_size() + 1, and the window gets allocated with size=win_size, disp_unit=itemsize, comm=comm. rank 0 reaches in with mem = np.frombuffer(win, dtype=np_dtype) and fills it with mem[:] = np.arange(len(mem), dtype=np_dtype), then comm.Barrier(). everybody sets buf = np.zeros(3, dtype=np_dtype) and target = (rank, 2, datatype) โ€” that's offset, count, datatype โ€” then lock / win.Get(buf, target_rank=0, target=target) / unlock, and assert np.all(buf == [rank, rank+1, 0]). the 0 at the end is the untouched window cell. chef's kiss ๐Ÿ‘‘
import numpy as np
from mpi4py import MPI
from mpi4py.util import dtlib

comm = MPI.COMM_WORLD
rank = comm.Get_rank()

datatype = MPI.FLOAT
np_dtype = dtlib.to_numpy_dtype(datatype)
itemsize = datatype.Get_size()

N = comm.Get_size() + 1
win_size = N * itemsize if rank == 0 else 0
win = MPI.Win.Allocate(
    size=win_size,
    disp_unit=itemsize,
    comm=comm,
)
if rank == 0:
    mem = np.frombuffer(win, dtype=np_dtype)
    mem[:] = np.arange(len(mem), dtype=np_dtype)
comm.Barrier()

buf = np.zeros(3, dtype=np_dtype)
target = (rank, 2, datatype)
win.Lock(rank=0)
win.Get(buf, target_rank=0, target=target)
win.Unlock(rank=0)
assert np.all(buf == [rank, rank+1, 0])

๐ŸŒธ Wrapping with SWIG ๐ŸŒธ

you can wrap your own C code and let Python call it. it's giving "i made this" ๐Ÿซถ

  • C source:
/* file: helloworld.c */
void sayhello(MPI_Comm comm)
{
  int size, rank;
  MPI_Comm_size(comm, &size);
  MPI_Comm_rank(comm, &rank);
  printf("Hello, World! "
         "I am process %d of %d.\n",
         rank, size);
}
  • SWIG interface file:
// file: helloworld.i
%module helloworld
%{
#include <mpi.h>
#include "helloworld.c"
}%

%include mpi4py/mpi4py.i
%mpi4py_typemap(Comm, MPI_Comm);
void sayhello(MPI_Comm comm);
  • Try it in the Python prompt:
>>> from mpi4py import MPI
>>> import helloworld
>>> helloworld.sayhello(MPI.COMM_WORLD)
Hello, World! I am process 0 of 1.

๐Ÿ’– Wrapping with F2Py ๐Ÿ’–

same energy but Fortran. bestie we contain multitudes โœจ

  • Fortran 90 source:
! file: helloworld.f90
subroutine sayhello(comm)
  use mpi
  implicit none
  integer :: comm, rank, size, ierr
  call MPI_Comm_size(comm, size, ierr)
  call MPI_Comm_rank(comm, rank, ierr)
  print *, 'Hello, World! I am process ',rank,' of ',size,'.'
end subroutine sayhello
  • Compiling example using f2py:
$ f2py -c --f90exec=mpif90 helloworld.f90 -m helloworld
  • Try it in the Python prompt: notice the MPI.COMM_WORLD.py2f() move โ€” that's you converting the Python communicator into the Fortran handle the wrapped code expects ๐Ÿ‘‘
>>> from mpi4py import MPI
>>> import helloworld
>>> fcomm = MPI.COMM_WORLD.py2f()
>>> helloworld.sayhello(fcomm)
Hello, World! I am process 0 of 1.

๐Ÿ’œ MPI4PY ๐Ÿ’œ

The MPI for Python package.

okay so real talk, what even is this. let me put you on:

The Message Passing Interface (MPI) is a standardized and portable message-passing system designed to function on a wide variety of parallel computers. The MPI standard defines the syntax and semantics of library routines and allows users to write portable programs in the main scientific programming languages (Fortran, C, or C++). Since its release, the MPI specification has become the leading standard for message-passing libraries for parallel computers.

MPI for Python provides MPI bindings for the Python programming language, allowing any Python program to exploit multiple processors. This package build on the MPI specification and provides an object oriented interface which closely follows MPI-2 C++ bindings.


โš™๏ธ Runtime configuration options โš™๏ธ

  • mpi4py.rc โ€” This object has attributes exposing runtime configuration options that become effective at import time of the MPI module.
tl;dr: you tweak mpi4py.rc before you import MPI, and that's when the settings actually kick in. timing is everything bestie ๐Ÿ’œ

๐ŸŽ€ Attributes Summary ๐ŸŽ€

okay bestie, here's the whole squad at a glance, no scrolling required ๐Ÿ’…

  • initialize โ€” Automatic MPI initialization at import โœจ
  • threads โ€” Request initialization with thread support ๐Ÿงต
  • thread_level โ€” Level of thread support to request
  • finalize โ€” Automatic MPI finalization at exit
  • fast_reduce โ€” Use tree-based reductions for objects ๐ŸŒณ
  • recv_mprobe โ€” Use matched probes to receive objects ๐Ÿ”
  • irecv_bufsz โ€” Default buffer size in bytes for irecv() ๐Ÿ“ฆ
  • errors โ€” Error handling policy ๐Ÿšจ

๐Ÿ’– Attributes Documentation ๐Ÿ’–

mpi4py.rc.initialize

Automatic MPI initialization at import.

  • Type: bool
  • Default: True

See also: MPI4PY_RC_INITIALIZE

mpi4py.rc.threads

Request initialization with thread support.

  • Type: bool
  • Default: True

See also: MPI4PY_RC_THREADS

mpi4py.rc.thread_level

Level of thread support to request.

  • Type: str
  • Default: "multiple"
  • Choices: "multiple", "serialized", "funneled", "single"

See also: MPI4PY_RC_THREAD_LEVEL

mpi4py.rc.finalize

Automatic MPI finalization at exit.

If set to None, the value of mpi4py.rc.initialize is used.

  • Type: None or bool
  • Default: None

See also: MPI4PY_RC_FINALIZE

mpi4py.rc.fast_reduce

Use tree-based reductions for objects.

  • Type: bool
  • Default: True

See also: MPI4PY_RC_FAST_REDUCE

mpi4py.rc.recv_mprobe

Use matched probes to receive objects.

  • Type: bool
  • Default: True

See also: MPI4PY_RC_RECV_MPROBE

mpi4py.rc.irecv_bufsz

Default buffer size in bytes for irecv().

  • Type: int
  • Default: 32768

See also: MPI4PY_RC_IRECV_BUFSZ

Added in version 4.0.0.

mpi4py.rc.errors

Error handling policy.

  • Type: str
  • Default: "exception"
  • Choices: "exception", "default", "abort", "fatal"

See also: MPI4PY_RC_ERRORS


โœจ Example โœจ

MPI for Python features automatic initialization and finalization of the MPI execution environment โ€” iconic behaviour, honestly ๐Ÿ‘‘. But if you wanna be the main character and drive the wheel yourself, you can use the mpi4py.rc object to handle MPI initialization and finalization programmatically:

import mpi4py
mpi4py.rc.initialize = False  # do not initialize MPI automatically
mpi4py.rc.finalize = False    # do not finalize MPI automatically

from mpi4py import MPI # import the 'MPI' module

MPI.Init()      # manual initialization of the MPI environment
...             # your finest code here ...
MPI.Finalize()  # manual finalization of the MPI environment

๐ŸŒˆ Environment variables ๐ŸŒˆ

The following environment variables override the corresponding attributes of the mpi4py.rc and MPI.pickle objects at import time of the MPI module. fr fr, they get the final say ๐Ÿซถ

Note: For variables of boolean type, accepted values are 0 and 1 (interpreted as False and True, respectively), and strings specifying a YAML boolean value (case-insensitive). So y, yes, on, trueโ€ฆ all of that counts, lowercase or not ๐Ÿ’…

MPI4PY_RC_INITIALIZE

  • Type: bool
  • Default: True

Whether to automatically initialize MPI at import time of the mpi4py.MPI module.

See also: mpi4py.rc.initialize

Added in version 4.0.0.

MPI4PY_RC_FINALIZE

  • Type: None | bool
  • Default: None
  • Choices: None, True, False

Whether to automatically finalize MPI at exit time of the Python process.

See also: mpi4py.rc.finalize

Added in version 4.0.0.

MPI4PY_RC_THREADS

  • Type: bool
  • Default: True

Whether to initialize MPI with thread support.

See also: mpi4py.rc.threads

Added in version 3.1.0.

MPI4PY_RC_THREAD_LEVEL

  • Default: "multiple"
  • Choices: "single", "funneled", "serialized", "multiple"

The level of required thread support.

See also: mpi4py.rc.thread_level

Added in version 3.1.0.

MPI4PY_RC_FAST_REDUCE

  • Type: bool
  • Default: True

Whether to use tree-based reductions for objects. ๐ŸŒณ

See also: mpi4py.rc.fast_reduce

Added in version 3.1.0.

MPI4PY_RC_RECV_MPROBE

  • Type: bool
  • Default: True

Whether to use matched probes to receive objects.

See also: mpi4py.rc.recv_mprobe

MPI4PY_RC_IRECV_BUFSZ

  • Type: int
  • Default: 32768

Default buffer size in bytes for irecv().

See also: mpi4py.rc.irecv_bufsz

Added in version 4.0.0.

MPI4PY_RC_ERRORS

  • Default: "exception"
  • Choices: "exception", "default", "abort", "fatal"

Controls default MPI error handling policy.

See also: mpi4py.rc.errors

Added in version 3.1.0.

MPI4PY_PICKLE_PROTOCOL

  • Type: int
  • Default: pickle.HIGHEST_PROTOCOL

Controls the default pickle protocol to use when communicating Python objects.

See also: PROTOCOL attribute of the MPI.pickle object within the MPI module.

Added in version 3.1.0.

MPI4PY_PICKLE_THRESHOLD

  • Type: int
  • Default: 262144

Controls the default buffer size threshold for switching from in-band to out-of-band buffer handling when using pickle protocol version 5 or higher.

See also: THRESHOLD attribute of the MPI.pickle object within the MPI module.

Added in version 3.1.2.

๐Ÿ’… Miscellaneous functions ๐Ÿ’…

These are the lil' helper besties that don't fit anywhere else but still eat every time. ๐Ÿซถ

  • mpi4py.profile(name, *, path=None) โ€” support for the MPI profiling interface, iykyk.

Parameters

  • name (str) โ€” the name of the profiler library to load. Like, the actual thing you want loaded, bestie.
  • path (sequence of str, optional) โ€” extra paths to go searching through for the profiler. Give it a whole list if you want.

Return type: None โ€” she gives you nothing back, she just does the thing. ๐Ÿ’€


  • mpi4py.get_include() โ€” returns the directory inside the package that holds the header files. ๐ŸŽ€

Extension modules that need to compile against mpi4py should use this function to locate the appropriate include directory. So like, if your extension is trying to link up with mpi4py, this is the function that hands you the address. Using Python distutils (or maybe NumPy distutils):

import mpi4py
Extension('extension_name', ...
          include_dirs=[..., mpi4py.get_include()])

Return type: str โ€” a path string, bestie. โœจ


  • mpi4py.get_config() โ€” returns a dictionary stuffed with info about MPI.
Changed in version 4.0.0: By default, this function returns an empty dictionary. No cap. But downstream packagers and distributors may alter such behavior โ€” so if yours isn't empty, that's them, not her.

To that end, MPI information must be provided under an mpi section within a UTF-8 encoded INI-style configuration file named mpi.cfg located at the top-level package directory. The configuration file is read and parsed using the configparser module. ๐Ÿ“–

Return type: dict[str, str] โ€” keys are strings, values are strings, that's the whole vibe. ๐ŸŒธ


๐Ÿ’– MPI4PY.MPI ๐Ÿ’–

Okay bestie, this is the main event. The MPI subpackage. Everything you actually came for lives down here. ๐Ÿ‘‘

๐Ÿ‘‘ Classes ๐Ÿ‘‘

Ancillary

The supporting cast. They don't run the show but the show does not run without them. โœจ

  • Datatype โ€” Datatype object.
  • Status โ€” Status object.
  • Request โ€” Request handler.
  • Prequest โ€” Persistent request handler.
  • Grequest โ€” Generalized request handler.
  • Op โ€” Reduction operation.
  • Group โ€” Group of processes.
  • Info โ€” Info object.
  • Session โ€” Session context.

Communication

The talking-to-each-other girlies. This is where the whole "MPI" part actually happens. ๐Ÿ—ฃ๏ธ๐Ÿ’ฌ

  • Comm โ€” Communication context.
  • Intracomm โ€” Intracommunicator.
  • Topocomm โ€” Topology intracommunicator.
  • Cartcomm โ€” Cartesian topology intracommunicator.
  • Graphcomm โ€” General graph topology intracommunicator.
  • Distgraphcomm โ€” Distributed graph topology intracommunicator.
  • Intercomm โ€” Intercommunicator.
  • Message โ€” Matched message.

One-sided operations

She does things to your memory without asking you for a turn first. Iconic behavior, honestly. ๐Ÿ™ˆ

  • Win โ€” Remote memory access context.

Input/Output

Reading and writing, but make it parallel. ๐Ÿ“‚

  • File โ€” File I/O context.

Error handling

For when things go sideways โ€” and bestie, sometimes they do. ๐Ÿ˜ญ

  • Errhandler โ€” Error handler.
  • Exception โ€” Exception class.

Auxiliary

The lil' extras. The sprinkles on the cupcake. ๐Ÿง

  • Pickle โ€” Pickle/unpickle Python objects.
  • buffer โ€” Buffer.

๐ŸŒŸ Functions ๐ŸŒŸ

Version inquiry

Asking the library who she is and where she came from. Main character energy fr fr. ๐Ÿ’…

  • Get_version() โ€” Obtain the version number of the MPI standard.
  • Get_library_version() โ€” Obtain the version string of the MPI library.

๐ŸŒˆโญ๐Ÿ’œ

โœจ Initialization and finalization โœจ

Okay bestie, this is the get the party started section, and also the okay everybody go home section. Every MPI program has a whole lifecycle and these are the functions that run it. ๐Ÿ’–

  • Init() โ€” Initialize the MPI execution environment. This is the "lights on, everyone in the group chat" moment.
  • Init_thread([required]) โ€” Initialize the MPI execution environment. Same energy as Init(), but you get to ask for a level of thread support via required.
  • Finalize() โ€” Terminate the MPI execution environment. The "okay goodnight, love you, bye" of the whole program.
  • Is_initialized() โ€” Indicate whether Init() has been called.
  • Is_finalized() โ€” Indicate whether Finalize() has completed.
  • Query_thread() โ€” Return the level of thread support provided by the MPI library.
  • Is_thread_main() โ€” Indicate whether this thread called Init() or Init_thread(). Like, are you the one who started all this? ๐Ÿ‘‘

๐ŸŽ€ Memory allocation ๐ŸŽ€

For when you need memory that MPI itself is gonna care about โ€” message passing and remote memory access want their own special little space, not just whatever random buffer you had lying around. ๐Ÿซถ

  • Alloc_mem(size[, info]) โ€” Allocate memory for message passing and remote memory access.
  • Free_mem(mem) โ€” Free memory allocated with Alloc_mem(). And yes, you have to use this one to free it โ€” the matching energy is the whole point. ๐Ÿ’…

๐ŸŒธ Address manipulation ๐ŸŒธ

Memory addresses, but make it arithmetic you're not allowed to do by hand. MPI wants you to use its own helpers here because pointer math on these things is not a "just wing it" situation. ๐ŸŒˆ

  • Get_address(location) โ€” Get the address of a location in memory.
  • Aint_add(base, disp) โ€” Return the sum of base address and displacement.
  • Aint_diff(addr1, addr2) โ€” Return the difference between absolute addresses.

โฐ Timer โฐ

It's giving how long did that even take. Two functions, both absolute icons, both here so you can measure your own stuff instead of trusting time.time() on a cluster where the clocks are lowkey not your friend. ๐Ÿฆ‹

  • Wtick() โ€” Return the resolution of Wtime().
  • Wtime() โ€” Return an elapsed time on the calling processor.

๐Ÿ’€ Error handling ๐Ÿ’€

This whole section is the what went wrong and why department. Error codes, error classes, error strings โ€” it's a whole little ecosystem and ngl, most of the time you'll just read the string and move on. But if you're building something fancy, all of these are here for you. ๐Ÿ”ฅ

  • Get_error_class(errorcode) โ€” Convert an error code into an error class.
  • Get_error_string(errorcode) โ€” Return the error string for a given error class or error code. Yes, it takes either one. It's flexible like that. โœจ
  • Add_error_class() โ€” Add an error class to the known error classes.
  • Add_error_code(errorclass) โ€” Add an error code to an error class.
  • Add_error_string(errorcode, string) โ€” Associate an error string with an error class or error code.
  • Remove_error_class(errorclass) โ€” Remove an error class from the known error classes.
  • Remove_error_code(errorcode) โ€” Remove an error code from the known error codes.
  • Remove_error_string(errorcode) โ€” Remove error string association from error class or error code.
Okay so like โ€” add/remove pairs are a thing here. If you add a class, a code, or a string, there's a matching remove waiting for it. Keep track of what you registered bestie, because nobody else is gonna do it for you. ๐Ÿ“


๐Ÿ’ซ Dynamic process management ๐Ÿ’ซ

okay bestie, this is the whole "who even are my processes and how do we find each other" corner of the library. it's giving matchmaker energy fr fr ๐Ÿซถ

  • Open_port([info]) โ€” hands you back an address you can use to connect a whole lil group of processes together. the info is optional, no pressure ๐Ÿ’…
  • Close_port(port_name) โ€” shut that port down. bye bye ๐Ÿ‘‹
  • Publish_name(service_name, port_name[, info]) โ€” put a service name out into the world so other folks can find it. info is optional here too โœจ
  • Unpublish_name(service_name, port_name[, info]) โ€” take that published service name back down. info optional, as always ๐ŸŽ€
  • Lookup_name(service_name[, info]) โ€” got a service name and need the port name? this is the one that finds it for you. info optional, iykyk ๐Ÿ”

๐Ÿงš Miscellanea ๐Ÿงš

the grab-bag section!! random but iconic. every single one of these is a real one, no cap ๐Ÿ’–

  • Attach_buffer(buf) โ€” attach a buffer that you provided, for sending stuff in buffered mode. it's giving "i brought my own bag" ๐Ÿ‘œ
  • Detach_buffer() โ€” rip out a buffer that was already attached. no args, just vibes ๐Ÿ™ˆ
  • Flush_buffer() โ€” block right there until every single buffered message has actually been transmitted. patience, queen ๐Ÿ‘‘
  • Iflush_buffer() โ€” the nonblocking version of that flush, for your buffered messages. main character energy, doesn't wait around ๐Ÿ”ฅ
  • Compute_dims(nnodes, dims) โ€” returns a balanced distribution of processes per coordinate direction. math but make it fair โš–๏ธ
  • Get_processor_name() โ€” gets you the name of the processor that's calling. literally just a name tag ๐Ÿท๏ธ
  • Register_datarep(datarep, read_fn, write_fn, ...) โ€” register user-defined data representations. yes bestie, you bring the read_fn, the write_fn, and the rest โœจ
  • Pcontrol(level) โ€” controls profiling. that's it, that's the whole job ๐Ÿ’…

โญ Utilities โญ

  • get_vendor() โ€” info about the underlying MPI implementation. like a little "who made this" card for your MPI ๐ŸŒˆ

Attributes โœจ

okay so this is the little constants shelf of mpi4py.MPI โ€” all the magic values that the library hands you so you never have to hardcode a weird number yourself ๐Ÿ’… every single one of them lives right here on the module, and here's the whole roster, no skips, no cuts, fr fr:

  • UNDEFINED โ€” Constant UNDEFINED of type int. ๐Ÿซถ
  • ANY_SOURCE โ€” Constant ANY_SOURCE of type int.
  • ANY_TAG โ€” Constant ANY_TAG of type int.
  • PROC_NULL โ€” Constant PROC_NULL of type int.
  • ROOT โ€” Constant ROOT of type int.
  • BOTTOM โ€” Object BOTTOM of type BottomType. not an int bestie, it's got its own whole type ๐Ÿ’€
  • IN_PLACE โ€” Object IN_PLACE of type InPlaceType. again, its own type, iconic โœจ
  • BUFFER_AUTOMATIC โ€” Object BUFFER_AUTOMATIC of type BufferAutomaticType. yep, another one with a dedicated type ๐ŸŽ€
  • KEYVAL_INVALID โ€” Constant KEYVAL_INVALID of type int.
  • TAG_UB โ€” Constant TAG_UB of type int.
  • IO โ€” Constant IO of type int.
  • WTIME_IS_GLOBAL โ€” Constant WTIME_IS_GLOBAL of type int.
  • UNIVERSE_SIZE โ€” Constant UNIVERSE_SIZE of type int.
  • APPNUM โ€” Constant APPNUM of type int.
  • LASTUSEDCODE โ€” Constant LASTUSEDCODE of type int.
  • WIN_BASE โ€” Constant WIN_BASE of type int.
  • WIN_SIZE โ€” Constant WIN_SIZE of type int.
  • WIN_DISP_UNIT โ€” Constant WIN_DISP_UNIT of type int.
  • WIN_CREATE_FLAVOR โ€” Constant WIN_CREATE_FLAVOR of type int.
  • WIN_FLAVOR โ€” Constant WIN_FLAVOR of type int.
  • WIN_MODEL โ€” Constant WIN_MODEL of type int.
  • SUCCESS โ€” Constant SUCCESS of type int.
  • ERR_LASTCODE โ€” Constant ERR_LASTCODE of type int.
  • ERR_COMM โ€” Constant ERR_COMM of type int.

like, that's a lot of constants, and the vibe check says: most of them are just plain old int, a few of them got their own fancy type because they're built different ๐Ÿฆ‹ lowkey obsessed with how BOTTOM, IN_PLACE and BUFFER_AUTOMATIC refused to be basic ๐Ÿ’–

okay bestie, the constant parade continues ๐Ÿ’… and real talk? every single one of these is an int โ€” yes, that int, the Python built-in, the one whose docs live over at docs.python.org/3/library/functions.html#int. So I'm saying it once up here, and then we're just gonna vibe through the list together. no skipping, no "you get the idea", we list all of them. periodt. ๐ŸŽ€

  • ERR_SPAWN โ€” a constant, and its type is int.
  • ERR_BASE โ€” constant, type int, living its best life.
  • ERR_SIZE โ€” yep, another constant, and yes, it's an int.
  • ERR_DISP โ€” constant. type: int. moving on ๐Ÿฆ‹
  • ERR_ASSERT โ€” constant of type int, no cap.
  • ERR_LOCKTYPE โ€” constant, int, iconic.
  • ERR_RMA_CONFLICT โ€” constant, type int.
  • ERR_RMA_SYNC โ€” constant, type int.
  • ERR_RMA_RANGE โ€” constant, type int.
  • ERR_RMA_ATTACH โ€” constant, type int.
  • ERR_RMA_SHARED โ€” constant, type int.
  • ERR_RMA_FLAVOR โ€” constant, type int.
  • ORDER_C โ€” a constant, and it's an int.
  • ORDER_F โ€” constant, type int.
  • ORDER_FORTRAN โ€” constant, type int.
  • TYPECLASS_INTEGER โ€” constant, type int.
  • TYPECLASS_REAL โ€” constant, type int.
  • TYPECLASS_COMPLEX โ€” constant, type int.
  • DISTRIBUTE_NONE โ€” constant, type int.
  • DISTRIBUTE_BLOCK โ€” constant, type int.
  • DISTRIBUTE_CYCLIC โ€” constant, type int.
  • DISTRIBUTE_DFLT_DARG โ€” constant, type int.
  • COMBINER_NAMED โ€” constant, type int.
  • COMBINER_DUP โ€” constant, type int.

and the list keeps going, bestie, we're not done yet โ€” the next chunk is right behind this one ๐Ÿซถ


okay pausing the COMBINER marathon for a sec, new vibe category unlocked โœจ


okay continuing the constant lineup ๐Ÿ’… every single one of these is a constant of type int, and the Python docs link for int is literally the same every time, so here we go, one bullet per icon, nothing skipped, periodt โœจ


Like, more constants bestie, all of them int typed, all of them yours ๐Ÿ’– keep scrolling, the list does not stop:

  • MODE_DELETE_ON_CLOSE โ€” Constant MODE_DELETE_ON_CLOSE of type int. yes babe, another one ๐Ÿ’…
  • MODE_UNIQUE_OPEN โ€” Constant MODE_UNIQUE_OPEN of type int. โœจ
  • MODE_SEQUENTIAL โ€” Constant MODE_SEQUENTIAL of type int. ๐ŸŒธ
  • MODE_APPEND โ€” Constant MODE_APPEND of type int. ๐ŸŽ€
  • SEEK_SET โ€” Constant SEEK_SET of type int. the classic trio begins ๐Ÿฆ‹
  • SEEK_CUR โ€” Constant SEEK_CUR of type int. ๐Ÿ’œ
  • SEEK_END โ€” Constant SEEK_END of type int. ๐ŸŒˆ
  • DISPLACEMENT_CURRENT โ€” Constant DISPLACEMENT_CURRENT of type int. long name, tiny type ๐Ÿ“
  • DISP_CUR โ€” Constant DISP_CUR of type int. its little nickname fr fr โœจ
  • THREAD_SINGLE โ€” Constant THREAD_SINGLE of type int. threading era incoming ๐Ÿ‘‘
  • THREAD_FUNNELED โ€” Constant THREAD_FUNNELED of type int. ๐Ÿงš
  • THREAD_SERIALIZED โ€” Constant THREAD_SERIALIZED of type int. ๐Ÿ’–
  • THREAD_MULTIPLE โ€” Constant THREAD_MULTIPLE of type int. the most unhinged one, iconic ๐Ÿ”ฅ
  • VERSION โ€” Constant VERSION of type int. โญ
  • SUBVERSION โ€” Constant SUBVERSION of type int. โญ
  • MAX_PROCESSOR_NAME โ€” Constant MAX_PROCESSOR_NAME of type int. ๐ŸŒธ
  • MAX_ERROR_STRING โ€” Constant MAX_ERROR_STRING of type int. ๐Ÿ˜ญ
  • MAX_PORT_NAME โ€” Constant MAX_PORT_NAME of type int. ๐Ÿฆ‹
  • MAX_INFO_KEY โ€” Constant MAX_INFO_KEY of type int. ๐ŸŽ€
  • MAX_INFO_VAL โ€” Constant MAX_INFO_VAL of type int. ๐ŸŽ€
  • MAX_OBJECT_NAME โ€” Constant MAX_OBJECT_NAME of type int. ๐Ÿ’œ
  • MAX_DATAREP_STRING โ€” Constant MAX_DATAREP_STRING of type int. say that three times fast, I dare you ๐Ÿ™ˆ
  • MAX_LIBRARY_VERSION_STRING โ€” Constant MAX_LIBRARY_VERSION_STRING of type int. the longest name in the building and it ATE ๐Ÿ’…

ngl bestie, every single one of these is just an int constant. No cap. They live at <pink>mpi4py.MPI</pink>, and that's the whole vibe of this chunk ๐Ÿซถ

โ€ฆand the roster keeps going, bestie, because MPI has a datatype for everything ๐Ÿ’… here's the rest of the lineup, each one just vibing as an object of type Datatype:

  • DATATYPE_NULL โ€” Object DATATYPE_NULL of type Datatype ๐Ÿซฅ (yes she's here, yes she's still a Datatype)
  • PACKED โ€” Object PACKED of type Datatype ๐Ÿ“ฆ
  • BYTE โ€” Object BYTE of type Datatype ๐Ÿงฑ
  • AINT โ€” Object AINT of type Datatype โœจ
  • OFFSET โ€” Object OFFSET of type Datatype ๐Ÿ“
  • COUNT โ€” Object COUNT of type Datatype ๐Ÿ”ข
  • CHAR โ€” Object CHAR of type Datatype ๐Ÿ”ค
  • WCHAR โ€” Object WCHAR of type Datatype ๐Ÿˆถ
  • SIGNED_CHAR โ€” Object SIGNED_CHAR of type Datatype โœ๏ธ
  • SHORT โ€” Object SHORT of type Datatype ๐Ÿฃ
  • INT โ€” Object INT of type Datatype ๐Ÿ‘‘
  • LONG โ€” Object LONG of type Datatype ๐Ÿ“
  • LONG_LONG โ€” Object LONG_LONG of type Datatype ๐Ÿ“๐Ÿ“
  • UNSIGNED_CHAR โ€” Object UNSIGNED_CHAR of type Datatype ๐ŸŽ€
  • UNSIGNED_SHORT โ€” Object UNSIGNED_SHORT of type Datatype ๐Ÿ“
  • UNSIGNED โ€” Object UNSIGNED of type Datatype ๐ŸŒธ
  • UNSIGNED_LONG โ€” Object UNSIGNED_LONG of type Datatype ๐Ÿฆ‹
  • UNSIGNED_LONG_LONG โ€” Object UNSIGNED_LONG_LONG of type Datatype ๐Ÿฆ‹๐Ÿฆ‹
  • FLOAT โ€” Object FLOAT of type Datatype ๐ŸŽˆ
  • DOUBLE โ€” Object DOUBLE of type Datatype ๐ŸŽˆ๐ŸŽˆ
  • LONG_DOUBLE โ€” Object LONG_DOUBLE of type Datatype ๐ŸŽˆ๐ŸŽˆ๐ŸŽˆ
  • C_BOOL โ€” Object C_BOOL of type Datatype โœ…
  • INT8_T โ€” Object INT8_T of type Datatype ๐Ÿ’œ
  • INT16_T โ€” Object INT16_T of type Datatype ๐Ÿ’œ
  • INT32_T โ€” Object INT32_T of type Datatype ๐Ÿ’œ
  • INT64_T โ€” Object INT64_T of type Datatype ๐Ÿ’œ
  • UINT8_T โ€” Object UINT8_T of type Datatype ๐ŸŒˆ

Okay bestie the datatype menu continues and it is long โ€” every one of these is an object of type Datatype, and honestly they're all giving "same energy, different name". Here's the rest of the lineup: ๐Ÿ’–

  • UINT16_T โ€” the UINT16_T object, and yep, it's of type Datatype. โœจ
  • UINT32_T โ€” the UINT32_T object, type Datatype. ๐Ÿ’…
  • UINT64_T โ€” the UINT64_T object, type Datatype. ๐Ÿฆ‹
  • C_COMPLEX โ€” the C_COMPLEX object, of type Datatype. ๐ŸŽ€
  • C_FLOAT_COMPLEX โ€” the C_FLOAT_COMPLEX object, of type Datatype. ๐ŸŒธ
  • C_DOUBLE_COMPLEX โ€” the C_DOUBLE_COMPLEX object, of type Datatype. ๐Ÿ’œ
  • C_LONG_DOUBLE_COMPLEX โ€” the C_LONG_DOUBLE_COMPLEX object, of type Datatype. โญ
  • CXX_BOOL โ€” the CXX_BOOL object, of type Datatype. ๐Ÿ”ฅ
  • CXX_FLOAT_COMPLEX โ€” the CXX_FLOAT_COMPLEX object, of type Datatype. ๐ŸŒˆ
  • CXX_DOUBLE_COMPLEX โ€” the CXX_DOUBLE_COMPLEX object, of type Datatype. ๐Ÿ‘‘
  • CXX_LONG_DOUBLE_COMPLEX โ€” the CXX_LONG_DOUBLE_COMPLEX object, of type Datatype. ๐Ÿ’€
  • SHORT_INT โ€” the SHORT_INT object, of type Datatype. ๐Ÿ™ˆ
  • INT_INT โ€” the INT_INT object, of type Datatype. ๐Ÿ“
  • TWOINT โ€” the TWOINT object, of type Datatype. ๐Ÿงš
  • LONG_INT โ€” the LONG_INT object, of type Datatype. โœจ
  • FLOAT_INT โ€” the FLOAT_INT object, of type Datatype. ๐Ÿ’–
  • DOUBLE_INT โ€” the DOUBLE_INT object, of type Datatype. ๐Ÿซถ
  • LONG_DOUBLE_INT โ€” the LONG_DOUBLE_INT object, of type Datatype. ๐ŸŒธ
  • CHARACTER โ€” the CHARACTER object, of type Datatype. ๐ŸŽ€
  • LOGICAL โ€” the LOGICAL object, of type Datatype. ๐Ÿ’…
  • INTEGER โ€” the INTEGER object, of type Datatype. ๐Ÿฆ‹
  • REAL โ€” the REAL object, of type Datatype. ๐Ÿ’œ
  • DOUBLE_PRECISION โ€” the DOUBLE_PRECISION object, of type Datatype. โญ
  • COMPLEX โ€” the COMPLEX object, of type Datatype. ๐Ÿ”ฅ
  • DOUBLE_COMPLEX โ€” the DOUBLE_COMPLEX object, of type Datatype. ๐ŸŒˆ
  • LOGICAL1 โ€” the LOGICAL1 object, of type Datatype. ๐Ÿ‘‘
  • LOGICAL2 โ€” the LOGICAL2 object, of type Datatype. ๐Ÿ’€

Not me listing out the entire datatype alphabet like it's a stan list ๐Ÿ˜ญ every single one of these is an object of type <code>Datatype</code> and that's the whole vibe, no cap.

  • LOGICAL4 โ€” bestie, this is object LOGICAL4, and it's a Datatype ๐Ÿ’–
  • LOGICAL8 โ€” object LOGICAL8, type Datatype โœจ
  • INTEGER1 โ€” object INTEGER1, and yup, it's a Datatype ๐ŸŽ€
  • INTEGER2 โ€” object INTEGER2, type Datatype ๐ŸŒธ
  • INTEGER4 โ€” object INTEGER4, type Datatype ๐Ÿฆ‹
  • INTEGER8 โ€” object INTEGER8, type Datatype ๐Ÿ’œ
  • INTEGER16 โ€” object INTEGER16, type Datatype โญ
  • REAL2 โ€” object REAL2, type Datatype ๐ŸŒˆ
  • REAL4 โ€” object REAL4, type Datatype โœจ
  • REAL8 โ€” object REAL8, type Datatype ๐Ÿ“
  • REAL16 โ€” object REAL16, type Datatype ๐Ÿงš
  • COMPLEX4 โ€” object COMPLEX4, type Datatype ๐Ÿ’…
  • COMPLEX8 โ€” object COMPLEX8, type Datatype ๐Ÿซถ
  • COMPLEX16 โ€” object COMPLEX16, type Datatype ๐ŸŒธ
  • COMPLEX32 โ€” object COMPLEX32, type Datatype ๐Ÿ’–
  • UNSIGNED_INT โ€” object UNSIGNED_INT, type Datatype ๐Ÿ”ฅ
  • SIGNED_SHORT โ€” object SIGNED_SHORT, type Datatype โญ
  • SIGNED_INT โ€” object SIGNED_INT, type Datatype ๐Ÿ’œ
  • SIGNED_LONG โ€” object SIGNED_LONG, type Datatype ๐ŸŽ€
  • SIGNED_LONG_LONG โ€” object SIGNED_LONG_LONG, type Datatype ๐Ÿฆ‹
  • BOOL โ€” object BOOL, type Datatype โœจ
  • SINT8_T โ€” object SINT8_T, type Datatype ๐ŸŒˆ
  • SINT16_T โ€” object SINT16_T, type Datatype ๐Ÿ“
  • SINT32_T โ€” object SINT32_T, type Datatype ๐Ÿงš
  • SINT64_T โ€” object SINT64_T, type Datatype ๐Ÿ’…
  • F_BOOL โ€” object F_BOOL, type Datatype ๐Ÿซถ
  • F_INT โ€” object F_INT, type Datatype ๐Ÿ’–
  • F_FLOAT โ€” object F_FLOAT, type Datatype ๐Ÿ”ฅ

and the constant drop continues, bestie, no cap ๐Ÿ’…

  • F_DOUBLE โ€” Object F_DOUBLE of type Datatype ๐Ÿ’–
  • F_COMPLEX โ€” Object F_COMPLEX of type Datatype โœจ
  • F_FLOAT_COMPLEX โ€” Object F_FLOAT_COMPLEX of type Datatype ๐Ÿฆ‹
  • F_DOUBLE_COMPLEX โ€” Object F_DOUBLE_COMPLEX of type Datatype ๐ŸŒธ
  • REQUEST_NULL โ€” Object REQUEST_NULL of type Request ๐Ÿ’…
  • MESSAGE_NULL โ€” Object MESSAGE_NULL of type Message ๐Ÿซถ
  • MESSAGE_NO_PROC โ€” Object MESSAGE_NO_PROC of type Message ๐Ÿ˜ญ
  • OP_NULL โ€” Object OP_NULL of type Op ๐Ÿ”ฅ
  • MAX โ€” Object MAX of type Op ๐Ÿ‘‘
  • MIN โ€” Object MIN of type Op ๐ŸŒˆ
  • SUM โ€” Object SUM of type Op โญ
  • PROD โ€” Object PROD of type Op ๐Ÿ’€
  • LAND โ€” Object LAND of type Op ๐Ÿ™ˆ
  • BAND โ€” Object BAND of type Op ๐Ÿ“
  • LOR โ€” Object LOR of type Op ๐Ÿงš
  • BOR โ€” Object BOR of type Op ๐Ÿ’œ
  • LXOR โ€” Object LXOR of type Op ๐Ÿ’–
  • BXOR โ€” Object BXOR of type Op โœจ
  • MAXLOC โ€” Object MAXLOC of type Op ๐Ÿฆ‹
  • MINLOC โ€” Object MINLOC of type Op ๐ŸŒธ
  • REPLACE โ€” Object REPLACE of type Op ๐Ÿ’…
  • NO_OP โ€” Object NO_OP of type Op ๐Ÿซถ
  • GROUP_NULL โ€” Object GROUP_NULL of type Group ๐Ÿ˜ญ
  • GROUP_EMPTY โ€” Object GROUP_EMPTY of type Group ๐Ÿ”ฅ
  • INFO_NULL โ€” Object INFO_NULL of type Info ๐Ÿ‘‘
  • INFO_ENV โ€” Object INFO_ENV of type Info ๐ŸŒˆ
  • ERRHANDLER_NULL โ€” Object ERRHANDLER_NULL of type Errhandler โญ
  • ERRORS_RETURN โ€” Object ERRORS_RETURN of type Errhandler ๐Ÿ’€
  • ERRORS_ARE_FATAL โ€” Object ERRORS_ARE_FATAL of type Errhandler ๐Ÿ™ˆ
  • COMM_NULL โ€” Object COMM_NULL of type Comm ๐Ÿ“
  • COMM_SELF โ€” Object COMM_SELF of type Intracomm ๐Ÿงš

โ”‚ COMM_WORLD โ”‚ Object COMM_WORLD of type โ”‚ โ”‚ <#mpi4py.MPI.COMM_WORLD> โ”‚ Intracomm <#mpi4py.MPI โ”‚ โ”‚ โ”‚ .Intracomm> โ”‚ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ WIN_NULL <#mpi4py.MPI โ”‚ Object WIN_NULL of type โ”‚ โ”‚ .WIN_NULL> โ”‚ Win <#mpi4py.MPI.Win> โ”‚ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ FILE_NULL <#mpi4py.MPI โ”‚ Object FILE_NULL of type โ”‚ โ”‚ .FILE_NULL> โ”‚ File <#mpi4py.MPI.File> โ”‚ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ pickle <#mpi4py.MPI.pickle>โ”‚ Object pickle of type โ”‚ โ”‚ โ”‚ Pickle <#mpi4py.MPI โ”‚ โ”‚ โ”‚ .Pickle> โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜


โœจ MPI4PY.TYPING โœจ

Added in version 4.0.0. ๐ŸŽ€

Okay so bestie, this module is the one that hands out type aliases <https://docs.python.org/3/glossary.html#term-type-alias> that get used to add type hints <https://docs.python.org/3/glossary.html#term-type-hint> onto all the various functions and methods living inside the MPI <#module-mpi4py.MPI> module. It's giving โœจtype safety eraโœจ and we are obsessed. ๐Ÿ’…

See also:


๐ŸŒธ Types Summary ๐ŸŒธ

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ SupportsBuffer โ”‚ Python buffer protocol. โ”‚ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ SupportsDLPack โ”‚ DLPack data interchange โ”‚ โ”‚ โ”‚ protocol. โ”‚ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ SupportsCAI โ”‚ CUDA Array Interface (CAI) โ”‚ โ”‚ โ”‚ protocol. โ”‚ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ Buffer โ”‚ Buffer-like object. โ”‚ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ Bottom โ”‚ Start of the address โ”‚ โ”‚ โ”‚ range. โ”‚ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ InPlace โ”‚ In-place buffer argument. โ”‚ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ Aint โ”‚ Address-sized integral โ”‚ โ”‚ โ”‚ type. โ”‚ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ Count โ”‚ Integral type for counts. โ”‚ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ Displ โ”‚ Integral type for โ”‚ โ”‚ โ”‚ displacements. โ”‚ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ Offset โ”‚ Integral type for offsets. โ”‚ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ TypeSpec โ”‚ Datatype specification. โ”‚ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ BufSpec โ”‚ Buffer specification. โ”‚ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ BufSpecB โ”‚ Buffer specification โ”‚ โ”‚ โ”‚ (block). โ”‚ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ BufSpecV โ”‚ Buffer specification โ”‚ โ”‚ โ”‚ (vector). โ”‚ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ BufSpecW โ”‚ Buffer specification โ”‚ โ”‚ โ”‚ (generalized). โ”‚ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ TargetSpec โ”‚ Target specification. โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜


๐Ÿ’– Types Documentation ๐Ÿ’–

๐Ÿฆ‹ mpi4py.typing.SupportsBuffer = <class 'mpi4py.typing.SupportsBuffer'>

Python buffer protocol. ๐Ÿงš

See also:

๐Ÿฆ‹ mpi4py.typing.SupportsDLPack = <class 'mpi4py.typing.SupportsDLPack'>

DLPack data interchange protocol. ๐ŸŒˆ

See also:

  • dlpack:python-spec

๐Ÿฆ‹ mpi4py.typing.SupportsCAI = <class 'mpi4py.typing.SupportsCAI'>

CUDA Array Interface (CAI) protocol. โšก

See also:

  • numba:cuda-array-interface

๐Ÿฆ‹ mpi4py.typing.Buffer = mpi4py.typing.SupportsBuffer | mpi4py.typing.SupportsDLPack | mpi4py.typing.SupportsCAI

Buffer-like object. ๐Ÿซถ

๐Ÿฆ‹ mpi4py.typing.Bottom = mpi4py.MPI.BottomType | None

Start of the address range. ๐ŸŽ€

๐Ÿฆ‹ mpi4py.typing.InPlace = mpi4py.MPI.InPlaceType | None

In-place buffer argument. โœจ

๐Ÿฆ‹ mpi4py.typing.Aint = <class 'typing.SupportsIndex'>

Address-sized integral type. ๐Ÿ’œ

alias of SupportsIndex <https://docs.python.org/3/library/typing.html#typing.SupportsIndex>

๐Ÿฆ‹ mpi4py.typing.Count = <class 'typing.SupportsIndex'>

Integral type for counts. ๐Ÿ”ข

alias of SupportsIndex <https://docs.python.org/3/library/typing.html#typing.SupportsIndex>

๐Ÿฆ‹ mpi4py.typing.Displ = <class 'typing.SupportsIndex'>

Integral type for displacements. ๐Ÿ“

alias of SupportsIndex <https://docs.python.org/3/library/typing.html#typing.SupportsIndex>

๐Ÿฆ‹ mpi4py.typing.Offset = <class 'typing.SupportsIndex'>

Integral type for offsets. ๐Ÿงฎ

alias of SupportsIndex <https://docs.python.org/3/library/typing.html#typing.SupportsIndex>

๐Ÿฆ‹ mpi4py.typing.TypeSpec = mpi4py.MPI.Datatype | str

Datatype specification. ๐Ÿ’Ž

๐Ÿฆ‹ mpi4py.typing.BufSpec = mpi4py.typing.SupportsBuffer | mpi4py.typing.SupportsDLPack | mpi4py.typing.SupportsCAI | typing.Tuple[mpi4py.typing.SupportsBuffer | mpi4py.typing.SupportsDLPack | mpi4py.typing.SupportsCAI, typing.SupportsIndex] | typing.Tuple[mpi4py.typing.SupportsBuffer | mpi4py.typing.SupportsDLPack | mpi4py.typing.SupportsCAI, mpi4py.MPI.Datatype | str] | typing.Tuple[mpi4py.typing.SupportsBuffer | mpi4py.typing.SupportsDLPack | mpi4py.typing.SupportsCAI, typing.SupportsIndex, mpi4py.MPI.Datatype | str] | typing.Tuple[mpi4py.MPI.BottomType | None, typing.SupportsIndex, mpi4py.MPI.Datatype] | typing.List[typing.Any]

Buffer specification. ๐ŸŽ

  • Buffer
  • Tuple[Buffer, Count]
  • Tuple[Buffer, TypeSpec]
  • Tuple[Buffer, Count, TypeSpec]
  • Tuple[Bottom, Count, Datatype <#mpi4py.MPI.Datatype>]

๐Ÿฆ‹ mpi4py.typing.BufSpecB = mpi4py.typing.SupportsBuffer | mpi4py.typing.SupportsDLPack | mpi4py.typing.SupportsCAI | typing.Tuple[mpi4py.typing.SupportsBuffer | mpi4py.typing.SupportsDLPack | mpi4py.typing.SupportsCAI, typing.SupportsIndex] | typing.Tuple[mpi4py.typing.SupportsBuffer | mpi4py.typing.SupportsDLPack | mpi4py.typing.SupportsCAI, mpi4py.MPI.Datatype | str] | typing.Tuple[mpi4py.typing.SupportsBuffer | mpi4py.typing.SupportsDLPack | mpi4py.typing.SupportsCAI, typing.SupportsIndex, mpi4py.MPI.Datatype | str] | typing.List[typing.Any]

Buffer specification (block). ๐Ÿงฑ

  • Buffer
  • Tuple[Buffer, Count]
  • Tuple[Buffer, TypeSpec]
  • Tuple[Buffer, Count, TypeSpec]

mpi4py.typing.BufSpecV

okay bestie, this one is the buffer-spec-but-vectorized situation, and yes it's a whole paragraph of union types, but we do NOT skip it, we eat it ๐Ÿ’…

mpi4py.typing.BufSpecV = mpi4py.typing.SupportsBuffer |
mpi4py.typing.SupportsDLPack | mpi4py.typing.SupportsCAI |
typing.Tuple[mpi4py.typing.SupportsBuffer | mpi4py.typing.SupportsDLPack
| mpi4py.typing.SupportsCAI, typing.Sequence[typing.SupportsIndex]] |
typing.Tuple[mpi4py.typing.SupportsBuffer | mpi4py.typing.SupportsDLPack
| mpi4py.typing.SupportsCAI,
typing.Tuple[typing.Sequence[typing.SupportsIndex],
typing.Sequence[typing.SupportsIndex]]] |
typing.Tuple[mpi4py.typing.SupportsBuffer | mpi4py.typing.SupportsDLPack
| mpi4py.typing.SupportsCAI, mpi4py.MPI.Datatype | str] |
typing.Tuple[mpi4py.typing.SupportsBuffer | mpi4py.typing.SupportsDLPack
| mpi4py.typing.SupportsCAI, typing.Sequence[typing.SupportsIndex],
mpi4py.MPI.Datatype | str] | typing.Tuple[mpi4py.typing.SupportsBuffer |
mpi4py.typing.SupportsDLPack | mpi4py.typing.SupportsCAI,
typing.Tuple[typing.Sequence[typing.SupportsIndex],
typing.Sequence[typing.SupportsIndex]], mpi4py.MPI.Datatype | str] |
typing.Tuple[mpi4py.typing.SupportsBuffer | mpi4py.typing.SupportsDLPack
| mpi4py.typing.SupportsCAI, typing.Sequence[typing.SupportsIndex],
typing.Sequence[typing.SupportsIndex], mpi4py.MPI.Datatype | str] |
typing.Tuple[mpi4py.MPI.BottomType | None,
typing.Tuple[typing.Sequence[typing.SupportsIndex],
typing.Sequence[typing.SupportsIndex]], mpi4py.MPI.Datatype] |
typing.Tuple[mpi4py.MPI.BottomType | None,
typing.Sequence[typing.SupportsIndex],
typing.Sequence[typing.SupportsIndex], mpi4py.MPI.Datatype] |
typing.List[typing.Any]

Buffer specification (vector). periodt. And here's the whole roster of shapes it can take, no gatekeeping:

  • Buffer
  • Tuple[Buffer, Sequence[Count]]
  • Tuple[Buffer, Tuple[Sequence[Count], Sequence[Displ]]]
  • Tuple[Buffer, TypeSpec]
  • Tuple[Buffer, Sequence[Count], TypeSpec]
  • Tuple[Buffer, Tuple[Sequence[Count], Sequence[Displ]], TypeSpec]
  • Tuple[Buffer, Sequence[Count], Sequence[Displ], TypeSpec]
  • Tuple[Bottom, Tuple[Sequence[Count], Sequence[Displ]], Datatype <#mpi4py.MPI.Datatype>]
  • Tuple[Bottom, Sequence[Count], Sequence[Displ], Datatype <#mpi4py.MPI.Datatype>]

mpi4py.typing.BufSpecW

and THIS one is the generalized version, the glow-up, the โœจdeluxeโœจ buffer spec ๐ŸŽ€

mpi4py.typing.BufSpecW = typing.Tuple[mpi4py.typing.SupportsBuffer |
mpi4py.typing.SupportsDLPack | mpi4py.typing.SupportsCAI,
typing.Sequence[mpi4py.MPI.Datatype]] |
typing.Tuple[mpi4py.typing.SupportsBuffer | mpi4py.typing.SupportsDLPack
| mpi4py.typing.SupportsCAI,
typing.Tuple[typing.Sequence[typing.SupportsIndex],
typing.Sequence[typing.SupportsIndex]],
typing.Sequence[mpi4py.MPI.Datatype]] |
typing.Tuple[mpi4py.typing.SupportsBuffer | mpi4py.typing.SupportsDLPack
| mpi4py.typing.SupportsCAI, typing.Sequence[typing.SupportsIndex],
typing.Sequence[typing.SupportsIndex],
typing.Sequence[mpi4py.MPI.Datatype]] |
typing.Tuple[mpi4py.MPI.BottomType | None,
typing.Tuple[typing.Sequence[typing.SupportsIndex],
typing.Sequence[typing.SupportsIndex]],
typing.Sequence[mpi4py.MPI.Datatype]] |
typing.Tuple[mpi4py.MPI.BottomType | None,
typing.Sequence[typing.SupportsIndex],
typing.Sequence[typing.SupportsIndex],
typing.Sequence[mpi4py.MPI.Datatype]] | typing.List[typing.Any]

Buffer specification (generalized). And the shapes it accepts, bestie:

  • Tuple[Buffer, Sequence[Datatype <#mpi4py.MPI.Datatype>]]
  • Tuple[Buffer, Tuple[Sequence[Count], Sequence[Displ]], Sequence[Datatype <#mpi4py.MPI.Datatype>]]
  • Tuple[Buffer, Sequence[Count], Sequence[Displ], Sequence[Datatype <#mpi4py.MPI.Datatype>]]
  • Tuple[Bottom, Tuple[Sequence[Count], Sequence[Displ]], Sequence[Datatype <#mpi4py.MPI.Datatype>]]
  • Tuple[Bottom, Sequence[Count], Sequence[Displ], Sequence[Datatype <#mpi4py.MPI.Datatype>]]

mpi4py.typing.TargetSpec

the one that tells everyone where to aim, no cap ๐ŸŽฏ

mpi4py.typing.TargetSpec = typing.SupportsIndex | typing.Tuple[()] |
typing.Tuple[typing.SupportsIndex] | typing.Tuple[typing.SupportsIndex,
typing.SupportsIndex] | typing.Tuple[typing.SupportsIndex,
typing.SupportsIndex, mpi4py.MPI.Datatype | str] |
typing.List[typing.Any]

Target specification. And the vibes it comes in:

  • Displ
  • Tuple[()]
  • Tuple[Displ]
  • Tuple[Displ, Count]
  • Tuple[Displ, Count, TypeSpec]

mpi4py.typing.S

mpi4py.typing.S = TypeVar("S")

Invariant TypeVar <https://docs.python.org/3/library/typing.html#typing.TypeVar>. That's it, that's the whole thing ๐Ÿซถ

mpi4py.typing.T

mpi4py.typing.T = TypeVar("T")

Invariant TypeVar <https://docs.python.org/3/library/typing.html#typing.TypeVar>.

mpi4py.typing.U

mpi4py.typing.U = TypeVar("U")

Invariant TypeVar <https://docs.python.org/3/library/typing.html#typing.TypeVar>.

mpi4py.typing.V

mpi4py.typing.V = TypeVar("V")

Invariant TypeVar <https://docs.python.org/3/library/typing.html#typing.TypeVar>.


๐Ÿš€ MPI4PY.FUTURES ๐Ÿš€

Added in version 3.0.0.

okay so THIS package is the one that lets you run callables asynchronously on a whole pool of worker processes, using MPI for the inter-process communication. it's giving main character energy for your parallel code ๐Ÿ”ฅ

The mpi4py.futures package is based on concurrent.futures <https://docs.python.org/3/library/concurrent.futures.html#module-concurrent.futures> from the Python standard library. More precisely, mpi4py.futures provides the MPIPoolExecutor class as a concrete implementation of the abstract class Executor <https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Executor>. The submit() <https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Executor.submit> interface schedules a callable to be executed asynchronously and returns a Future <https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Future> object representing the execution of the callable. Future <https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Future> instances can be queried for the call result or exception. Sets of Future <https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Future> instances can be passed to the wait() <https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.wait> and as_completed() <https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.as_completed> functions.

See also:


MPIPoolExecutor

The MPIPoolExecutor class uses a pool of MPI processes to execute calls asynchronously. By performing computations in separate processes, it allows to side-step the global interpreter lock <https://docs.python.org/3/glossary.html#term-global-interpreter-lock> but also means that only picklable objects can be executed and returned. The __main__ <https://docs.python.org/3/library/__main__.html#module-__main__> module must be importable by worker processes, thus MPIPoolExecutor instances may not work in the interactive interpreter. ๐Ÿ˜ญ (yeah, RIP to REPL girlies, we know)

MPIPoolExecutor takes advantage of the dynamic process management features introduced in the MPI-2 standard. In particular, the MPI.Intracomm.Spawn <#mpi4py.MPI.Intracomm.Spawn> method of MPI.COMM_SELF <#mpi4py.MPI.COMM_SELF> is used in the master (or parent) process to spawn new worker (or child) processes running a Python interpreter. The master process uses a separate thread (one for each MPIPoolExecutor instance) to communicate back and forth with the workers. The worker processes serve the execution of tasks in the main (and only) thread until they are signaled for completion. iconic behavior honestly ๐Ÿ‘‘

Note: The worker processes must import the main script in order to unpickle any callable defined in the __main__ <https://docs.python.org/3/library/__main__.html#module-__main__> module and submitted from the master process. Furthermore, the callables may need access to other global variables. At the worker processes, mpi4py.futures executes the main script code (using the runpy <https://docs.python.org/3/library/runpy.html#module-runpy> module) under the __worker__ namespace to define the __main__ <https://docs.python.org/3/library/__main__.html#module-__main__> module. The __main__ <https://docs.python.org/3/library/__main__.html#module-__main__> and __worker__ modules are added to sys.modules <https://docs.python.org/3/library/sys.html#sys.modules> (both at the master and worker processes) to ensure proper pickling and unpickling.
Warning: During the initial import phase at the workers, the main script cannot create and use new MPIPoolExecutor instances. Otherwise, each worker would attempt to spawn a new pool of workers, leading to infinite recursion. mpi4py.futures detects such recursive attempts to spawn new workers and aborts the MPI execution environment. As the main script code is run under the __worker__ namespace, the easiest way to avoid spawn recursion is using the idiom if __name__ == '__main__': ... in the main script. ๐Ÿ’€ do NOT skip this one bestie, infinite recursion is not the serve you think it is

class mpi4py.futures.MPIPoolExecutor(max_workers=None, initializer=None, initargs=(), **kwargs)

class mpi4py.futures.MPIPoolExecutor(max_workers=None, initializer=None,
initargs=(), **kwargs)

An Executor <https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Executor> subclass that executes calls asynchronously using a pool of at most max_workers processes. If max_workers is None <https://docs.python.org/3/library/constants.html#None> or not given, its value is determined from the MPI4PY_FUTURES_MAX_WORKERS environment variable if set, or the MPI universe size if set, otherwise a single worker process is spawned. If max_workers is lower than or equal to 0, then a ValueError <https://docs.python.org/3/library/exceptions.html#ValueError> will be raised. ๐Ÿซ 

initializer is an optional callable that is called at the start of each worker process before executing any tasks; initargs is a tuple of arguments passed to the initializer. If initializer raises an exception, all pending tasks and any attempt to submit new tasks to the pool will raise a BrokenExecutor <https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.BrokenExecutor> exception. ๐Ÿ˜ตโ€๐Ÿ’ซ yeah, that's a whole mood ruiner.

Other parameters:

okay so, bestie, here are the extra kwargs you can pass to MPIPoolExecutor ๐Ÿ’–

  • python_args โ€” a list or iterable with additional command line flags to pass to the Python executable. Command line flags determined from inspection of sys.flags, sys.warnoptions and sys._xoptions are passed unconditionally. โœจ
  • mpi_info โ€” a dict or iterable yielding (key, value) pairs. These (key, value) pairs are passed (through an MPI.Info object) to the MPI.Intracomm.Spawn call used to spawn worker processes. This mechanism allows telling the MPI runtime system where and how to start the processes. Check the documentation of the backend MPI implementation about the set of keys it interprets and the corresponding format for values. ๐Ÿ’…
  • globals โ€” a dict or iterable yielding (name, value) pairs to initialize the main module namespace in worker processes. ๐ŸŒธ
  • main โ€” If set to False, do not import the __main__ module in worker processes. Setting main to False prevents worker processes from accessing definitions in the parent __main__ namespace. ๐Ÿซถ
  • path โ€” a list or iterable with paths to append to sys.path in worker processes to extend the module search path. ๐Ÿฆ‹
  • wdir โ€” Path to set the current working directory in worker processes using os.chdir(). The initial working directory is set by the MPI implementation. Quality MPI implementations should honor a wdir info key passed through mpi_info, although such feature is not mandatory. ๐Ÿ˜ญ
  • env โ€” a dict or iterable yielding (name, value) pairs with environment variables to update os.environ in worker processes. The initial environment is set by the MPI implementation. MPI implementations may allow setting the initial environment through mpi_info, however such feature is not required nor recommended by the MPI standard. ๐Ÿ’€
  • use_pkl5 โ€” If set to True, use pickle with out-of-band buffers for interprocess communication. If use_pkl5 is set to None or not given, its value is determined from the MPI4PY_FUTURES_USE_PKL5 environment variable. Using pickle with out-of-band buffers may benefit applications dealing with large buffer-like objects like NumPy arrays. See mpi4py.util.pkl5 for additional information. ๐Ÿ”ฅ
  • backoff โ€” a float value specifying the maximum number of seconds a worker thread or process suspends execution with time.sleep() while idle-waiting. If not set, its value is determined from the MPI4PY_FUTURES_BACKOFF environment variable if set, otherwise the default value of 0.001 seconds is used. Lower values will reduce latency and increase execution throughput for very short-lived tasks, albeit at the expense of spinning CPU cores and increased energy consumption. ๐Ÿ‘‘

โœจ submit(fn, /, *args, **kwargs) โœจ

Schedule the callable fn to be executed as fn(*args, **kwargs) and returns a Future object representing the execution of the callable. ๐Ÿ’–

executor = MPIPoolExecutor(max_workers=1)
future = executor.submit(pow, 321, 1234)
print(future.result())

โœจ map(fn, *iterables, timeout=None, chunksize=1, buffersize=None, **kwargs) โœจ

Similar to map(fn, *iterables) except:

  • The iterables are consumed immediately rather than lazily, unless buffersize is specified to limit the number of submitted tasks whose results have not yet been yielded. If the task buffer is full, the caller blocks and iteration over the iterables pauses until a result is yielded from the buffer. ๐Ÿข
  • fn is executed asynchronously and several calls to fn may be made concurrently, out-of-order, in separate processes. ๐Ÿš€

The returned iterator raises a TimeoutError if __next__() is called and the result isnโ€™t available after timeout seconds from the original call to map(). timeout can be an int or a float. If timeout is not specified or None, there is no limit to the wait time. โณ

If fn raises an exception, then that exception will be raised when its value is retrieved from the iterator. ๐Ÿ˜ฑ

This method chops iterables into a number of chunks which it submits to the pool as separate tasks. The (approximate) size of these chunks can be specified by setting chunksize to a positive integer. For very long iterables, using a large value for chunksize can significantly improve performance compared to the default size of one. ๐Ÿฐ

By default, the returned iterator yields results in-order, waiting for successive tasks to complete. This behavior can be changed by passing the keyword argument unordered as True, then the result iterator will yield a result as soon as any of the tasks complete. ๐ŸŽข

executor = MPIPoolExecutor(max_workers=3)
for result in executor.map(pow, [2] * 32, range(32)):
    print(result)

Changed in version 4.1.0: Added the buffersize parameter. ๐Ÿ†•

โœจ starmap(fn, iterable, timeout=None, chunksize=1, buffersize=None, **kwargs) โœจ

Similar to itertools.starmap(fn, iterable). Used instead of map() when argument parameters are already grouped in tuples from a single iterable (the data has been โ€œpre-zippedโ€). map(fn, *iterable) is equivalent to starmap(fn, zip(*iterable)). ๐ŸŒŸ

executor = MPIPoolExecutor(max_workers=3)
iterable = ((2, n) for n in range(32))
for result in executor.starmap(pow, iterable):
    print(result)

Changed in version 4.1.0: Added the buffersize parameter. ๐Ÿ†•

โœจ shutdown(wait=True, cancel_futures=False) โœจ

Signal the executor that it should free any resources that it is using when the currently pending futures are done executing. Calls to submit() and map() made after shutdown() will raise RuntimeError. ๐Ÿ›‘

If wait is True then this method will not return until all the pending futures are done executing and the resources associated with the executor have been freed. If wait is False then this method will return immediately and the resources associated with the executor will be freed when all pending futures are done executing. Regardless of the value of wait, the entire Python program will not exit until all pending futures are done executing. โธ๏ธ

If cancel_futures is True, this method will cancel all pending futures that the executor has not started running. Any futures that are completed or running wonโ€™t be cancelled, regardless of the value of cancel_futures. ๐Ÿšซ

You can avoid having to call this method explicitly if you use the with statement, which will shutdown the executor instance (waiting as if shutdown() were called with wait set to True). ๐ŸŽ€

import time
with MPIPoolExecutor(max_workers=1) as executor:
    future = executor.submit(time.sleep, 2)
assert future.done()

  • bootup(wait=True) โ€” tells the executor to go ahead and allocate all the resources it needs eagerly, like right now, no waiting (especially the MPI worker processes, they're the whole point ๐Ÿ’…). If wait is True <https://docs.python.org/3/library/constants.html#True>, then bootup() literally will not come back until the executor's resources are ready to handle submissions. But here's the thing โ€” resources get allocated automatically on the first call to submit(), so calling bootup() yourself is seldom needed. It's giving optional, bestie. โœจ
  • num_workers โ€” number of worker processes in the pool. ๐Ÿซถ

๐ŸŒˆ MPI4PY_FUTURES_MAX_WORKERS

If the max_workers parameter to MPIPoolExecutor is None <https://docs.python.org/3/library/constants.html#None> or you just didn't pass it at all (no judgment ๐Ÿ™ˆ), then the MPI4PY_FUTURES_MAX_WORKERS environment variable steps in as the fallback value for the maximum number of MPI worker processes to spawn. iykyk.

Added in version 3.1.0.

๐Ÿฆ‹ MPI4PY_FUTURES_USE_PKL5

If the use_pkl5 keyword argument to MPIPoolExecutor is None <https://docs.python.org/3/library/constants.html#None> or not given, the MPI4PY_FUTURES_USE_PKL5 environment variable provides a fallback value for whether the executor should use pickle <https://docs.python.org/3/library/pickle.html#module-pickle> with out-of-band buffers for interprocess communication.

Accepted values are:

Using pickle <https://docs.python.org/3/library/pickle.html#module-pickle> with out-of-band buffers may benefit applications dealing with large buffer-like objects like NumPy arrays. See mpi4py.util.pkl5 <#module-mpi4py.util.pkl5> for additional information. ๐Ÿ”ฅ

Added in version 4.0.0.

๐Ÿ“ MPI4PY_FUTURES_BACKOFF

If the backoff keyword argument to MPIPoolExecutor is not given, the MPI4PY_FUTURES_BACKOFF environment variable can be set to a float <https://docs.python.org/3/library/functions.html#float> value specifying the maximum number of seconds a worker thread or process suspends execution with time.sleep() <https://docs.python.org/3/library/time.html#time.sleep> while idle-waiting.

If it's not set, the default backoff value is 0.001 seconds. Lower values will reduce latency and increase execution throughput for very short-lived tasks โ€” but at the expense of spinning CPU cores and increased energy consumption. so like, trade-offs, it's giving chaos vs. efficiency ๐Ÿ’€

Added in version 4.0.0.


Note: ๐Ÿ“Œ As the master process uses a separate thread to perform MPI communication with the workers, the backend MPI implementation should provide support for MPI.THREAD_MULTIPLE <#mpi4py.MPI.THREAD_MULTIPLE>. However, some popular MPI implementations do not support yet concurrent MPI calls from multiple threads. Additionally, users may decide to initialize MPI with a lower level of thread support. If the level of thread support in the backend MPI is less than MPI.THREAD_MULTIPLE <#mpi4py.MPI.THREAD_MULTIPLE>, mpi4py.futures will use a global lock to serialize MPI calls. If the level of thread support is less than MPI.THREAD_SERIALIZED <#mpi4py.MPI.THREAD_SERIALIZED>, mpi4py.futures will emit a RuntimeWarning <https://docs.python.org/3/library/exceptions.html#RuntimeWarning>.
Warning: โš ๏ธ If the level of thread support in the backend MPI is less than MPI.THREAD_SERIALIZED <#mpi4py.MPI.THREAD_SERIALIZED> (i.e, it is either MPI.THREAD_SINGLE <#mpi4py.MPI.THREAD_SINGLE> or MPI.THREAD_FUNNELED <#mpi4py.MPI.THREAD_FUNNELED>), in theory mpi4py.futures cannot be used. Rather than raising an exception, mpi4py.futures emits a warning and takes a โ€œcross-fingersโ€ attitude ๐Ÿคž to continue execution in the hope that serializing MPI calls with a global lock will actually work. iconic behaviour honestly.

๐Ÿ‘‘ MPICommExecutor

So like, legacy MPI-1 implementations (and also some vendor MPI-2 implementations, not naming names ๐Ÿ’…) do not support the dynamic process management features introduced in the MPI-2 standard. And on top of that, job schedulers and batch systems in supercomputing facilities may pose additional complications to applications using the MPI_Comm_spawn() routine. it's giving suffering.

With these issues in mind, mpi4py.futures supports an additional, more traditional, SPMD-like usage pattern requiring MPI-1 calls only. Python applications are started the usual way, e.g., using the mpiexec command. Python code should make a collective call to the MPICommExecutor context manager to partition the set of MPI processes within a MPI communicator in one master processes and many workers processes. The master process gets access to an MPIPoolExecutor instance to submit tasks. Meanwhile, the worker process follow a different execution path and team-up to execute the tasks submitted from the master. slay, teamwork fr fr ๐Ÿซถ

Besides alleviating the lack of dynamic process management features in legacy MPI-1 or partial MPI-2 implementations, the MPICommExecutor context manager may be useful in classic MPI-based Python applications willing to take advantage of the simple, task-based, master/worker approach available in the mpi4py.futures package.


class mpi4py.futures.MPICommExecutor(comm=None, root=0)

Context manager for MPIPoolExecutor. This context manager splits a MPI (intra)communicator comm (defaults to MPI.COMM_WORLD <#mpi4py.MPI.COMM_WORLD> if not provided or None <https://docs.python.org/3/library/constants.html#None>) in two disjoint sets: a single master process (with rank root in comm) and the remaining worker processes. These sets are then connected through an intercommunicator.

The target of the with <https://docs.python.org/3/reference/compound_stmts.html#with> statement is assigned either an MPIPoolExecutor instance (at the master) or None <https://docs.python.org/3/library/constants.html#None> (at the workers). bestie the workers get nothing, that's literally the deal ๐Ÿ’€

from mpi4py import MPI
from mpi4py.futures import MPICommExecutor

with MPICommExecutor(MPI.COMM_WORLD, root=0) as executor:
    if executor is not None:
       future = executor.submit(abs, -42)
       assert future.result() == 42
       answer = set(executor.map(abs, [-42, 42]))
       assert answer == {42}
Warning: โš ๏ธ If MPICommExecutor is passed a communicator of size one (e.g., MPI.COMM_SELF <#mpi4py.MPI.COMM_SELF>), then the executor instance assigned to the target of the with <https://docs.python.org/3/reference/compound_stmts.html#with> statement will execute all submitted tasks in a single worker thread, thus ensuring that task execution still progress asynchronously. However, the GIL <https://docs.python.org/3/glossary.html#term-GIL> will prevent the main and worker threads from running concurrently in multicore processors. Moreover, the thread context switching may harm noticeably the performance of CPU-bound tasks. In case of I/O-bound tasks, the GIL <https://docs.python.org/3/glossary.html#term-GIL> is not usually an issue, however, as a single worker thread is used, it progress one task at a time. We advice against using MPICommExecutor with communicators of size one and suggest refactoring your code to use instead a ThreadPoolExecutor <https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.ThreadPoolExecutor>. don't do it, we're begging ๐Ÿ™

๐ŸŽ€ Command line

Recalling the issues related to the lack of support for dynamic process management features in MPI implementations (yeah, the whole saga from before ๐Ÿ˜ญ), mpi4py.futures supports an alternative usage pattern where Python code (either from scripts, modules, or zip files) is run under command line control of the mpi4py.futures package by passing -m mpi4py.futures to the python executable.

The mpi4py.futures invocation should be passed a pyfile path to a script (or a zipfile/directory containing a __main__.py file). Additionally, mpi4py.futures accepts -m mod to execute a module named mod, -c cmd to execute a command string cmd, or even - to read commands from standard input (sys.stdin <https://docs.python.org/3/library/sys.html#sys.stdin>). Summarizing, mpi4py.futures can be invoked in the following ways:

  • $ mpiexec -n numprocs python -m mpi4py.futures pyfile [arg] ...
  • $ mpiexec -n numprocs python -m mpi4py.futures -m mod [arg] ...
  • $ mpiexec -n numprocs python -m mpi4py.futures -c cmd [arg] ...
  • $ mpiexec -n numprocs python -m mpi4py.futures - [arg] ...

Before starting the main script execution, mpi4py.futures splits MPI.COMM_WORLD <#mpi4py.MPI.COMM_WORLD> in one master (the process with rank 0 in MPI.COMM_WORLD <#mpi4py.MPI.COMM_WORLD>) and numprocs - 1 workers and connects them through an MPI intercommunicator.

Afterwards, the master process proceeds with the execution of the user script code, which eventually creates MPIPoolExecutor instances to submit tasks. Meanwhile, the worker processes follow a different execution path to serve the master. Upon successful termination of the main script at the master, the entire MPI execution environment exists gracefully. In case of any unhandled exception in the main script, the master process calls MPI.COMM_WORLD.Abort(1) to prevent deadlocks and force termination of entire MPI execution environment. yeah it just nukes everything, respectfully ๐Ÿ’ฅ

Warning: โš ๏ธ Running scripts under command line control of mpi4py.futures is quite similar to executing a single-process application that spawn additional workers as required. However, there is a very important difference users should be aware of. All MPIPoolExecutor instances created at the master will share the pool of workers. Tasks submitted at the master from many different executors will be scheduled for execution in random order as soon as a worker is idle. Any executor can easily starve all the workers (e.g., by calling MPIPoolExecutor.map() with long iterables). If that ever happens, submissions from other executors will not be serviced until free workers are available. lowkey terrifying ngl ๐Ÿ˜ญ

See also: ๐Ÿ‘€

Command line <https://docs.python.org/3/using/cmdline.html#using-on-cmdline> : Documentation on Python command line interface.

โœจ Parallel tasks โœจ

Okay bestie, plot twist incoming ๐Ÿ’… โ€” the mpi4py.futures package is normally all about that embarrassingly parallel life: a whole bunch of sequential tasks that don't care about each other, running asynchronously, living their own truth. But! Even though it's kind of not what it was built for, MPIPoolExecutor can still handle workloads that involve parallel tasks โ€” the kind where worker processes actually talk to each other and coordinate via MPI. It's giving "we're all in this together" energy ๐Ÿซถ

  • mpi4py.futures.get_comm_workers() โ€” grab yourself an intracommunicator that groups the MPI worker processes together.

Now, running parallel tasks with mpi4py.futures comes with RULES, bestie. You don't just vibe your way through this one โ€” check the highlighted lines in the example cpi.py:

  • Use MPIPoolExecutor.num_workers to figure out how many worker processes the executor has, then submit exactly one callable per worker process using the MPIPoolExecutor.submit() method. One each. No double-dipping. ๐Ÿ“
  • The callable you submit has to use get_comm_workers() to get that intracommunicator grouping the MPI worker processes. And then? Highly recommend calling the Barrier() method on the communicator. Why? Because that barrier synchronization is what guarantees every single worker process is executing the submitted callable exactly once โœจ. After that's locked in, the parallel task can safely do literally any kind of point-to-point or collective operation using the returned communicator. Iconic.
  • The Future instances that MPIPoolExecutor.submit() hands back should be collected into a sequence. Then use wait() with that sequence of Future instances to make sure the parallel task is logically complete. Periodt.

๐Ÿงฐ Utilities ๐Ÿงฐ

The mpi4py.futures package also hooks you up with some extra utilities for wrangling Future instances ๐Ÿ’–

  • mpi4py.futures.collect(fs) โ€” gather a whole collection of futures into one shiny new future.

Parameters

  • fs โ€“ Collection of futures.

Returns

  • New future producing as result a list with results from fs.
  • mpi4py.futures.compose(future, resulthook=None, excepthook=None) โ€” compose the completion of a future with result and exception handlers. Very "main character orchestrating her own plot" of it.

Parameters

  • future โ€“ Input future instance.
  • resulthook โ€“ Function to be called once the input future completes with success. Once the input future finish running with success, its result value is the input argument for resulthook. The result of resulthook is set as the result of the output future. If resulthook is None, the output future is completed directly with the result of the input future.
  • excepthook โ€“ Function to be called once the input future completes with failure. Once the input future finish running with failure, its exception value is the input argument for excepthook. If excepthook returns an Exception instance, it is set as the exception of the output future. Otherwise, the result of excepthook is set as the result of the output future. If excepthook is None, the output future is set as failed with the exception from the input future.

Returns

  • Output future instance to be completed once the input future is completed and either resulthook or excepthook finish executing.

๐ŸŒˆ Examples ๐ŸŒˆ

๐ŸŽจ Computing the Julia set ๐ŸŽจ

So the julia.py script below computes the Julia set and dumps an image to disk in binary PGM format. Let's walk through it, bestie ๐ŸŒธ

First it imports MPIPoolExecutor from the mpi4py.futures package. Then there's some global constants and functions implementing the Julia set computation. All the computation is protected with the standard if __name__ == '__main__': ... idiom (you know the one, don't skip it ๐Ÿ™ˆ). The image gets computed scanline by scanline โ€” wait, whole scanlines โ€” submitting all these tasks at once using the map method. The result iterator yields scanlines in-order as the tasks complete. And finally, each scanline is dumped to disk. Slay.

julia.py

from mpi4py.futures import MPIPoolExecutor

x0, x1, w = -2.0, +2.0, 640*2
y0, y1, h = -1.5, +1.5, 480*2
dx = (x1 - x0) / w
dy = (y1 - y0) / h

c = complex(0, 0.65)

def julia(x, y):
    z = complex(x, y)
    n = 255
    while abs(z) < 3 and n > 1:
        z = z**2 + c
        n -= 1
    return n

def julia_line(k):
    line = bytearray(w)
    y = y1 - k * dy
    for j in range(w):
        x = x0 + j * dx
        line[j] = julia(x, y)
    return line

if __name__ == '__main__':

    with MPIPoolExecutor() as executor:
        image = executor.map(julia_line, range(h))
        with open('julia.pgm', 'wb') as f:
            f.write(b'P5 %d %d %d\n' % (w, h, 255))
            for line in image:
                f.write(line)

The recommended way to run this script? Use the mpiexec command, specifying one MPI process (the master) and โ€” optional but recommended, bestie, do it โ€” the desired MPI universe size. That universe size determines how many additional dynamically spawned processes (the workers) you get. The MPI universe size comes either from a batch system or gets set by the user via command-line arguments to mpiexec, or via environment variables. Below are examples for MPICH and Open MPI implementations [1].

In all of these examples, the mpiexec command launches a single master process running the Python interpreter and executing the main script. When required, mpi4py.futures spawns the pool of 16 worker processes. The master submits tasks to the workers and waits for the results. The workers receive incoming tasks, execute them, and send back the results to the master. That's the whole little ecosystem, it's giving community ๐Ÿ

When using the MPICH implementation or its derivatives based on the Hydra process manager, users can set the MPI universe size via the -usize argument to mpiexec:

$ mpiexec -n 1 -usize 17 python julia.py

or, alternatively, by setting the MPIEXEC_UNIVERSE_SIZE environment variable:

$ env MPIEXEC_UNIVERSE_SIZE=17 mpiexec -n 1 python julia.py

In the Open MPI implementation, the MPI universe size can be set via the -host argument to mpiexec:

$ mpiexec -n 1 -host localhost:17 python julia.py

Another way to specify the number of workers is to use the mpi4py.futures-specific environment variable MPI4PY_FUTURES_MAX_WORKERS:

$ env MPI4PY_FUTURES_MAX_WORKERS=16 mpiexec -n 1 python julia.py
Heads up bestie! ๐Ÿ‘€ Note that in this case, the MPI universe size is ignored. Like, fully ignored. Don't come for me.

Alternatively, users may decide to execute the script in a more traditional way โ€” that is, all the MPI processes are started at once. The user script is run under command-line control of mpi4py.futures by passing the -m flag to the python executable:

$ mpiexec -n 17 python -m mpi4py.futures julia.py

As explained previously, the 17 processes are partitioned into one master and 16 workers. The master process executes the main script while the workers execute the tasks submitted by the master. โœจ

[1] When using an MPI implementation other than MPICH or Open MPI, please check the documentation of the implementation and/or batch system for the ways to specify the desired MPI universe size.

๐Ÿ”ข Computing Pi (parallel task) ๐Ÿ”ข

The number \pi can be approximated via numerical integration with the simple midpoint rule, that is:

\pi = \int_{0}^{1} \frac{4}{1+x^2} \,dx \approx
\frac{1}{n} \sum_{i=1}^{n} \frac{4}{1 + \left[\frac{1}{n}
\left(i-\frac{1}{2}\right) \right]^2} .

The following cpi.py script computes such approximations using mpi4py.futures with a parallel task involving a collective reduction operation. The highlighted lines correspond to the rules we discussed up in Parallel tasks โ€” go back and reread them if you need, no shame ๐Ÿ’œ

cpi.py

import math
import sys
from mpi4py.futures import MPIPoolExecutor, wait
from mpi4py.futures import get_comm_workers

def compute_pi(n):
    # Access intracommunicator and synchronize
    comm = get_comm_workers()
    comm.Barrier()

    rank = comm.Get_rank()
    size = comm.Get_size()

    # Local computation
    h = 1.0 / n
    s = 0.0
    for i in range(rank + 1, n + 1, size):
        x = h * (i - 0.5)
        s += 4.0 / (1.0 + x**2)
    pi_partial = s * h

    # Parallel reduce-to-all
    pi = comm.allreduce(pi_partial)

    # All workers return the same value
    return pi

if __name__ == '__main__':
    n = int(sys.argv[1]) if len(sys.argv) > 1 else 256

    with MPIPoolExecutor() as executor:
        # Submit exactly one callable per worker
        P = executor.num_workers
        fs = [executor.submit(compute_pi, n) for _ in range(P)]

        # Wait for all workers to finish
        wait(fs)

        # Get result from the first future object.
        # In this particular example, due to using reduce-to-all,
        # all the other future objects hold the same result value.
        pi = fs[0].result()
        print(
            f"pi: {pi:.16f}, error: {abs(pi - math.pi):.3e}",
            f"({n:d} intervals, {P:d} workers)",
        )

To run in modern MPI-2 mode:

$ env MPI4PY_FUTURES_MAX_WORKERS=4 mpiexec -n 1 python cpi.py 128
pi: 3.1415977398528137, error: 5.086e-06 (128 intervals, 4 workers)

$ env MPI4PY_FUTURES_MAX_WORKERS=8 mpiexec -n 1 python cpi.py 512
pi: 3.1415929714812316, error: 3.179e-07 (512 intervals, 8 workers)

To run in legacy MPI-1 mode:

$ mpiexec -n 5 python -m mpi4py.futures cpi.py 128
pi: 3.1415977398528137, error: 5.086e-06 (128 intervals, 4 workers)

$ mpiexec -n 9 python -m mpi4py.futures cpi.py 512
pi: 3.1415929714812316, error: 3.179e-07 (512 intervals, 8 workers)

๐Ÿ“š Citation ๐Ÿ“š

Okay so if mpi4py.futures has been significant to a project that leads to an academic publication, please acknowledge our work by citing the following article [mpi4py-futures]:

  • [mpi4py-futures] โ€” M. Rogowski, S. Aseeri, D. Keyes, and L. Dalcin, mpi4py.futures: MPI-Based Asynchronous Task Execution for Python, IEEE Transactions on Parallel and Distributed Systems, 34(2):611-622, 2023. <https://doi.org/10.1109/TPDS.2022.3225481>

๐Ÿงฐ MPI4PY.UTIL ๐Ÿงฐ

Added in version 3.1.0.

ok so the mpi4py.util package is literally the grab-bag drawer of the whole library โ€” it collects miscellaneous utilities that live right in the intersection of Python and MPI. bestie, it's giving "junk drawer but make it useful" and honestly? we're obsessed. ๐Ÿ’…


๐Ÿ mpi4py.util.dtlib ๐Ÿ

Added in version 3.1.0.

the mpi4py.util.dtlib module is your little translator between NumPy and MPI datatypes โ€” converter routines, that's the whole job, no cap. โœจ

mpi4py.util.dtlib.from_numpy_dtype(dtype)

Convert NumPy datatype to MPI datatype. girl math but for types. ๐Ÿฆ‹

Parameters

Return type

  • Datatype <#mpi4py.MPI.Datatype>

mpi4py.util.dtlib.to_numpy_dtype(datatype)

Convert MPI datatype to NumPy datatype. the reverse pipeline, periodt. ๐Ÿ’œ

Parameters

  • datatype (Datatype <#mpi4py.MPI.Datatype>) โ€“ MPI datatype.

Return type


๐Ÿฅ’ mpi4py.util.pkl5 ๐Ÿฅ’

Added in version 3.1.0.

so pickle <https://docs.python.org/3/library/pickle.html#module-pickle> protocol 5 (peep PEP 574 <https://peps.python.org/pep-0574/>) rolled in support for out-of-band buffers, which lets you handle certain object types with large memory footprints wayyy more efficiently. it's giving glow-up. โœจ

MPI for Python uses the traditional in-band handling of buffers. That approach is appropriate for communicating non-buffer Python objects, or buffer-like objects with small memory footprints. For point-to-point communication, in-band buffer handling lets you communicate a pickled stream with a single MPI message โ€” at the expense of additional CPU and memory overhead in the pickling and unpickling steps. trade-offs, bestie, always trade-offs. ๐Ÿ˜ญ

the mpi4py.util.pkl5 module provides communicator wrapper classes that reimplement pickle-based point-to-point and collective communication methods using pickle protocol 5. Handling out-of-band buffers necessarily involves multiple MPI messages, which increases latency and hurts performance in the case of small size data. BUT. in the case of large size data, the zero-copy savings of out-of-band buffer handling more than offset the extra latency costs. additionally, these wrapper methods overcome the infamous 2 GiB message count limit (MPI-1 to MPI-3). slay. ๐Ÿ‘‘

class mpi4py.util.pkl5.Request

Request.

Custom request class for nonblocking communications.

Note: Request is not a subclass of mpi4py.MPI.Request <#mpi4py.MPI.Request>

class mpi4py.util.pkl5.Message

Message.

Custom message class for matching probes.

Note: Message is not a subclass of mpi4py.MPI.Message <#mpi4py.MPI.Message>

class mpi4py.util.pkl5.Comm

Communicator.

Base communicator wrapper class.

Return type: Any

irecv(buf=None, source=ANY_SOURCE, tag=ANY_TAG)

Nonblocking receive.

๐Ÿšจ Warning, bestie, listen up: this method cannot be supported reliably and it raises RuntimeError. Like, it's just gonna yell at you. No cap.

Parameters:

  • buf (Buffer | None)
  • source (int)
  • tag (int)

Return type: Request

sendrecv(sendobj, dest, sendtag=0, recvbuf=None, source=ANY_SOURCE, recvtag=ANY_TAG, status=None)

Send and receive. Both at once, main character energy. ๐Ÿ’…

Parameters:

  • sendobj (Any)
  • dest (int)
  • sendtag (int)
  • recvbuf (Buffer | None)
  • source (int)
  • recvtag (int)
  • status (Status | None)

Return type: Any

mprobe(source=ANY_SOURCE, tag=ANY_TAG, status=None)

Blocking test for a matched message. Sits there and waits like your bestie outside the bathroom. ๐Ÿšช

Parameters:

  • source (int)
  • tag (int)
  • status (Status | None)

Return type: Message

improbe(source=ANY_SOURCE, tag=ANY_TAG, status=None)

Nonblocking test for a matched message. Same vibe, but it does NOT wait around. โœจ

Parameters:

  • source (int)
  • tag (int)
  • status (Status | None)

Return type: Message | None

bcast(obj, root=0)

Broadcast.

Added in version 3.1.0.

Parameters:

  • obj (Any)
  • root (int)

Return type: Any

gather(sendobj, root=0)

Gather.

Added in version 4.0.0.

Parameters:

  • sendobj (Any)
  • root (int)

Return type: list[Any] | None

scatter(sendobj, root=0)

Scatter.

Added in version 4.0.0.

Parameters:

  • sendobj (Sequence[Any] | None)
  • root (int)

Return type: Any

allgather(sendobj)

Gather to All. Everybody gets the tea, nobody's left on read. ๐Ÿซถ

Added in version 4.0.0.

Parameters:

  • sendobj (Any)

Return type: list[Any]

alltoall(sendobj)

All to All Scatter/Gather. Chaotic in the best way, fr fr. ๐Ÿ”ฅ

Added in version 4.0.0.

Parameters:

  • sendobj (Sequence[Any])

Return type: list[Any]


class mpi4py.util.pkl5.Intracomm

Intracommunicator.

Intracommunicator wrapper class. It's literally just a lil glow-up wrapper around the comm you already know. ๐ŸŽ€

class mpi4py.util.pkl5.Intercomm

Intercommunicator.

Intercommunicator wrapper class. Same energy, different topology. ๐Ÿฆ‹


โœจ Examples โœจ

test-pkl5-1.py

import numpy as np
from mpi4py import MPI
from mpi4py.util import pkl5

comm = pkl5.Intracomm(MPI.COMM_WORLD)  # comm wrapper
size = comm.Get_size()
rank = comm.Get_rank()
dst = (rank + 1) % size
src = (rank - 1) % size

sobj = np.full(1024**3, rank, dtype='i4')  # > 4 GiB
sreq = comm.isend(sobj, dst, tag=42)
robj = comm.recv (None, src, tag=42)
sreq.Free()

assert np.min(robj) == src
assert np.max(robj) == src

test-pkl5-2.py

import numpy as np
from mpi4py import MPI
from mpi4py.util import pkl5

comm = pkl5.Intracomm(MPI.COMM_WORLD)  # comm wrapper
size = comm.Get_size()
rank = comm.Get_rank()
dst = (rank + 1) % size
src = (rank - 1) % size

sobj = np.full(1024**3, rank, dtype='i4')  # > 4 GiB
sreq = comm.isend(sobj, dst, tag=42)

status = MPI.Status()
rmsg = comm.mprobe(status=status)
assert status.Get_source() == src
assert status.Get_tag() == 42
rreq = rmsg.irecv()
robj = rreq.wait()

sreq.Free()
assert np.max(robj) == src
assert np.min(robj) == src

๐ŸŒˆ mpi4py.util.pool ๐ŸŒˆ

Added in version 4.0.0.

See also:

This module intends to be a drop-in replacement for the multiprocessing.pool interface from the Python standard library. The Pool class exposed here is implemented as a thin wrapper around MPIPoolExecutor. So like, if your code already speaks multiprocessing.pool, it just... works. Slay. ๐Ÿ’…

Note:

The mpi4py.futures package offers a higher level interface for asynchronously pushing tasks to MPI worker process, allowing for a clear separation between submitting tasks and waiting for the results. iykyk โ€” if you want the fancier setup, go there.

class mpi4py.util.pool.Pool

Pool using MPI processes as workers. Your little squad of worker processes, assembled and ready. ๐Ÿ‘‘

__init__(processes=None, initializer=None, initargs=(), **kwargs)

Initialize a new Pool instance.

Parameters:

  • processes (int | None) โ€“ Number of worker processes.
  • initializer (Callable[[...], object] | None) โ€“ An callable used to initialize workers processes.
  • initargs (Iterable[Any]) โ€“ A tuple of arguments to pass to the initializer.
  • kwargs (Any)

Return type: None

Note:

Additional keyword arguments are passed down to the MPIPoolExecutor constructor. So all that extra stuff you're passing? It goes straight to the executor. Periodt. โœจ

Warning, bestie, read this one: the maxtasksperchild and context arguments of multiprocessing.pool.Pool are not supported. If you pass maxtasksperchild or context with anything other than None, you'll get a warning of category UserWarning. Not a vibe. Don't do it. ๐Ÿซถ

apply(func, args=(), kwds={})

Calls func with the arguments args and the keyword arguments kwds. โœจ

It's literally equivalent to func(*args, **kwds). No cap.

Parameters ๐ŸŽ€

  • func โ€” a Callable[[...], T]
  • args โ€” an Iterable[Any]
  • kwds โ€” a Mapping[str, Any]

Return type โ€” T ๐Ÿ’–


apply_async(func, args=(), kwds={}, callback=None, error_callback=None)

The asynchronous version of apply(), and it hands you back an ApplyResult. ๐Ÿฆ‹

Parameters ๐ŸŽ€

  • func โ€” a Callable[..., T]
  • args โ€” an Iterable[Any]
  • kwds โ€” a Mapping[str, Any]
  • callback โ€” a Callable[[T], object] | None
  • error_callback โ€” a Callable[[BaseException], object] | None

Return type โ€” AsyncResult[T] ๐Ÿ’œ


map(func, iterable, chunksize=None)

Applies func to every single element in iterable. ๐Ÿ’…

Equivalent to list(map(func, iterable)).

It blocks until all the results are ready, then returns them in a list. Yes bestie, it will just sit there and wait for you. ๐Ÿงš

The iterable gets choped (their spelling, not mine ๐Ÿ˜ญ) into a number of chunks which are submitted as separate tasks. The (approximate) size of these chunks can be specified by setting chunksize to a positive integer.

Hot tip from the docs: consider using imap() or imap_unordered() with an explicit chunksize for better efficiency. Efficiency is the moment. โญ

Parameters ๐ŸŽ€

  • func โ€” a Callable[[S], T]
  • iterable โ€” an Iterable[S]
  • chunksize โ€” an int | None

Return type โ€” list[T] ๐ŸŒธ


map_async(func, iterable, chunksize=None, callback=None, error_callback=None)

The asynchronous version of map(), and it hands you back a MapResult. ๐Ÿฆ‹

Parameters ๐ŸŽ€

  • func โ€” a Callable[[S], T]
  • iterable โ€” an Iterable[S]
  • chunksize โ€” an int | None
  • callback โ€” a Callable[[T], None] | None
  • error_callback โ€” a Callable[[BaseException], None] | None

Return type โ€” MapResult[T] ๐Ÿ’œ


imap(func, iterable, chunksize=1)

Like map() but it returns an iterator instead of blocking on you. Main character behaviour, honestly. โœจ

Equivalent to map(func, iterable).

Parameters ๐ŸŽ€

  • func โ€” a Callable[[S], T]
  • iterable โ€” an Iterable[S]
  • chunksize โ€” an int

Return type โ€” Iterator[T] ๐Ÿฆ‹


imap_unordered(func, iterable, chunksize=1)

Like imap() but the ordering of the results is arbitrary. ๐ŸŽฒ

Read that again bestie: arbitrary. The results come back in whatever order they finish, not the order you sent them. If order matters to you, this is not the one. ๐Ÿ’€

Parameters ๐ŸŽ€

  • func โ€” a Callable[[S], T]
  • iterable โ€” an Iterable[S]
  • chunksize โ€” an int

Return type โ€” Iterator[T] ๐Ÿ’œ


starmap(func, iterable, chunksize=None)

Applies func to each argument tuple in iterable. ๐ŸŒŸ

Equivalent to list(itertools.starmap(func, iterable)).

It blocks until all the results are ready and returns them in a list. Patience, queen. ๐Ÿ‘‘

The iterable gets choped into a number of chunks which are submitted as separate tasks. The (approximate) size of these chunks can be specified by setting chunksize to a positive integer.

Same tip as before: consider using istarmap() or istarmap_unordered() with an explicit chunksize for better efficiency. ๐Ÿ”ฅ

Parameters ๐ŸŽ€

  • func โ€” a Callable[[...], T]
  • iterable โ€” an Iterable[Iterable[Any]]
  • chunksize โ€” an int | None

Return type โ€” list[T] ๐ŸŒธ


starmap_async(func, iterable, chunksize=None, callback=None, error_callback=None)

The asynchronous version of starmap(), and it hands you back a MapResult. ๐Ÿฆ‹

Parameters ๐ŸŽ€

  • func โ€” a Callable[..., T]
  • iterable โ€” an Iterable[Iterable[Any]]
  • chunksize โ€” an int | None
  • callback โ€” a Callable[[T], None] | None
  • error_callback โ€” a Callable[[BaseException], None] | None

Return type โ€” MapResult[T] ๐Ÿ’œ


istarmap(func, iterable, chunksize=1)

Like starmap() but it returns an iterator. ๐ŸŒˆ

Equivalent to itertools.starmap(func, iterable).

Parameters ๐ŸŽ€

  • func โ€” a Callable[[...], T]

istarmap_unordered(func, iterable, chunksize=1)

okay so bestie, this one is literally istarmap() โ€” but the ordering of results is arbitrary. They arrive whenever they arrive. chaos as a feature โœจ

Parameters

  • func โ€” Callable[[...], T]
  • iterable โ€” Iterable[Iterable[Any]]
  • chunksize โ€” int

Return type: Iterator[T]


close()

Prevent any more tasks from being submitted to the pool. doors? closed. that's the whole function ๐Ÿ’…

Return type: None


terminate()

Stop the worker processes without completing pending tasks. No cleanup arc, we just end it ๐Ÿ˜ญ

Return type: None


join()

Wait for the worker processes to exit. just sit there and let them go, okay? ๐Ÿฆ‹

Return type: None


class mpi4py.util.pool.ThreadPool

Bases: Pool

A pool that uses threads as its workers. ๐Ÿงš


class mpi4py.util.pool.AsyncResult

Asynchronous result. a lil container for a value that hasn't shown up yet ๐ŸŽ€

get(timeout=None) โ€” Return the result when it arrives.

  • If timeout is not None and the result does not arrive within timeout seconds then raise TimeoutError.
  • If the remote call raised an exception then that exception will be reraised.

Parameters

  • timeout โ€” float | None

Return type: T

wait(timeout=None) โ€” Wait until the result is available or timeout seconds pass.

Parameters

  • timeout โ€” float | None

Return type: None

ready() โ€” Return whether the call has completed.

Return type: bool

successful() โ€” Return whether the call completed without raising an exception.

Heads up: if the result is not ready then raise ValueError.

Return type: bool


class mpi4py.util.pool.ApplyResult

Bases: AsyncResult

Result type of apply_async(). ๐Ÿ’–


class mpi4py.util.pool.MapResult

Bases: AsyncResult

Result type of map_async() and starmap_async(). ๐Ÿ’–


mpi4py.util.sync

Added in version 4.0.0.

The mpi4py.util.sync module provides parallel synchronization utilities. everybody on the same page, together, periodt ๐Ÿซถ


Sequential execution

class mpi4py.util.sync.Sequential โ€” Sequential execution.

Context manager for sequential execution within a group of MPI processes. one at a time, in rank order, no cutting the line ๐ŸŒธ

The implementation is based in MPI-1 point-to-point communication. A process with rank i waits in a blocking receive until the previous process rank i-1 finish executing and signals the next rank i with a send.

__init__(comm, tag=0) โ€” Initialize sequential execution.

Parameters

  • comm โ€” Intracomm. Intracommunicator context.
  • tag โ€” int. Tag for point-to-point communication.

Return type: None

__enter__() โ€” Enter sequential execution.

Return type: Self

__exit__(*exc) โ€” Exit sequential execution.

Parameters

  • exc โ€” object

Return type: None

begin() โ€” Begin sequential execution.

Return type: None

end() โ€” End sequential execution.

Return type: None


Global counter

class mpi4py.util.sync.Counter โ€” Global counter.

Produce consecutive values within a group of MPI processes. The counter interface is close to that of itertools.count. it's giving "everyone gets a number, nobody gets the same one" โœจ

The implementation is based in MPI-3 one-sided operations. A root process (typically rank 0) holds the counter, and its value is queried and incremented with an atomic RMA fetch-and-add operation.

__init__(start=0, step=1, *, typecode='i', comm=COMM_SELF, info=INFO_NULL, root=0) โ€” Initialize global counter.

Parameters

  • start โ€” int. Start value.
  • step โ€” int. Increment value.
  • typecode โ€” str. Type code as defined in the array module.
  • comm โ€” Intracomm. Intracommunicator context.
  • info โ€” Info. Info object for RMA context creation.
  • root โ€” int. Process rank holding the counter memory.

Return type: None

__iter__() โ€” Implement iter(self).

Return type: Self

__next__() โ€” Implement next(self).

Return type: int

next(incr=None) โ€” Return current value and increment.

Parameters

  • incr โ€” int | None. Increment value.

Returns: The counter value before incrementing.

Return type: int

free() โ€” Free counter resources. clean up after yourself, bestie ๐ŸŽ€

Return type: None


Mutual exclusion

class mpi4py.util.sync.Mutex โ€” Mutual exclusion.

Establish a critical section or mutual exclusion among MPI processes.

The mutex interface is close to that of threading.Lock and threading.RLock, allowing the use of either recursive or non-recursive mutual exclusion. However, a mutex should be used within a group of MPI processes, not threads. ๐Ÿ‘‘

In non-recursive mode, the semantics of Mutex are somewhat different than these of threading.Lock:

  • Once acquired, a mutex is held and owned by a process until released.
  • Trying to acquire a mutex already held raises RuntimeError.
  • Trying to release a mutex not yet held raises RuntimeError.
fr fr, respect the lock: if it's already held and you try to grab it again, RuntimeError. If you try to release something you never held, RuntimeError. No cap. ๐Ÿ’€

This mutex implementation uses the scalable and fair spinlock algorithm from [mcs-paper] and took inspiration from the MPI-3 RMA implementation of [uam-book]. Bestie, that's a whole academic glow-up for a lock. ๐Ÿ’…

__init__(*, recursive=False, comm=COMM_SELF, info=INFO_NULL)

Initialize mutex object. Yes, constructor, we love a fresh start.

Parameters

  • comm (Intracomm) โ€” Intracommunicator context.
  • recursive (bool) โ€” Whether to allow recursive acquisition.
  • info (Info) โ€” Info object for RMA context creation.

Return type: None

__enter__()

Acquire mutex. Context manager said "I gotchu". ๐Ÿซถ

Return type: Self

__exit__(*exc)

Release mutex.

Parameters

  • exc (object)

Return type: None

acquire(blocking=True)

Acquire mutex, blocking or non-blocking. Your choice, main character.

Parameters

  • blocking (bool) โ€” If True, block until the mutex is held.

Returns: True if the mutex is held, False otherwise.

Return type: bool

release()

Release mutex. Let it gooo, let it gooo. ๐Ÿฆ‹

Return type: None

locked()

Return whether the mutex is held. Vibe check: is it locked or not?

Return type: bool

count()

Return the recursion count.

Return type: int

free()

Free mutex resources. Cleanup era โ€” no leaks, periodt.

Return type: None


[mcs-paper]

John M. Mellor-Crummey and Michael L. Scott. Algorithms for scalable synchronization on shared-memory multiprocessors. ACM Transactions on Computer Systems, 9(1):21-65, February 1991. https://doi.org/10.1145/103727.103729

[uam-book]

William Gropp, Torsten Hoefler, Rajeev Thakur, Ewing Lusk. Using Advanced MPI - Modern Features of the Message-Passing Interface. Chapter 4, Section 4.7, Pages 130-131. The MIT Press, November 2014. https://mitpress.mit.edu/9780262527637/using-advanced-mpi/


๐ŸŽ€ Condition variable


class mpi4py.util.sync.Condition

Condition variable.

A condition variable allows one or more MPI processes to wait until they are notified by another processes. It's giving "don't text them first, wait for the notification". ๐Ÿ’…

The condition variable interface is close to that of threading.Condition, allowing the use of either recursive or non-recursive mutual exclusion. However, the condition variable should be used within a group of MPI processes, not threads. Read that again, bestie โ€” processes, not threads. Important.

This condition variable implementation uses a MPI-3 RMA-based scalable and fair circular queue algorithm to track the set of waiting processes. Circular queue, fair, scalable โ€” she's an overachiever and we respect it. ๐Ÿ‘‘

__init__(mutex=None, *, recursive=True, comm=COMM_SELF, info=INFO_NULL)

Initialize condition variable.

Parameters

  • mutex (Mutex | None) โ€” Mutual exclusion object.
  • recursive (bool) โ€” Whether to allow recursive acquisition.
  • comm (Intracomm) โ€” Intracommunicator context.
  • info (Info) โ€” Info object for RMA context creation.

Return type: None

__enter__()

Acquire the underlying mutex.

Return type: Self

__exit__(*exc)

Release the underlying mutex.

Parameters

  • exc (object)

Return type: None

acquire(blocking=True)

Acquire the underlying mutex.

Parameters

  • blocking (bool)

Return type: bool

release()

Release the underlying mutex.

Return type: None

locked()

Return whether the underlying mutex is held.

Return type: bool

wait()

Wait until notified by another process. Literally just sitting there, patiently, waiting for a sign. ๐Ÿ™ˆ

Returns: Always True.

Return type: Literal[True]

wait_for(predicate)

Wait until a predicate evaluates to True. She waits for the condition to be true, not for a text back. Growth. ๐ŸŒธ

Parameters

  • predicate (Callable[[], T]) โ€” callable returning a boolean.

Returns: The result of predicate once it evaluates to True.

Return type: T

notify(n=1)

Wake up one or more processes waiting on this condition.

Parameters

  • n (int) โ€” Maximum number of processes to wake up.

Returns: The actual number of processes woken up.

Return type: int

notify_all()

Wake up all processes waiting on this condition. Group chat notification, everyone up. ๐Ÿ””

Returns: The actual number of processes woken up.

Return type: int

free()

Free condition resources.

Return type: None


๐Ÿ“ Semaphore object


class mpi4py.util.sync.Semaphore

Semaphore object.

A semaphore object manages an internal counter which is decremented by each acquire() call and incremented by each release() call. The internal counter never reaches a value below zero; when acquire() finds that it is zero, it blocks and waits until some other process calls release(). Counter go down, counter go up, counter never go negative โ€” she has boundaries. ๐Ÿ’…

The semaphore interface is close to that of threading.Semaphore and threading.BoundedSemaphore, allowing the use of either bounded (default) or unbounded semaphores. With a bounded semaphore, the internal counter never exceeds its initial value; otherwise release() raises ValueError. So yeah, unbounded means release() can throw ValueError at you. Not a drill.

This semaphore implementation uses a global Counter and a Condition variable to handle waiting and notification.

__init__(value=1, *, bounded=True, comm=COMM_SELF, info=INFO_NULL)

Initialize semaphore object.

Parameters

  • value (int) โ€” Initial value for internal counter.
  • bounded (bool) โ€” Bound internal counter to initial value.
  • comm (Intracomm) โ€” Intracommunicator context.
  • info (Info) โ€” Info object for RMA context creation.

Return type: None

__enter__()

Acquire semaphore.

Return type: Self โ€” and yes bestie, it literally hands you back Self ๐Ÿ’… so you can keep the chain going

  • __exit__(*exc) โ€” let go of the semaphore, we're done here ๐Ÿซถ
    • exc (object)
    • Return type: None
  • acquire(blocking=True) โ€” grab the semaphore and knock the internal counter down by one โœจ
    • blocking (bool) โ€” if True, just sit there and wait patiently (no cap, it will block) until the semaphore is acquired.
    • Returns: True if the semaphore is acquired, False otherwise.
    • Return type: bool
  • release(n=1) โ€” release the semaphore, bumping that internal counter up by one or more ๐ŸŽ€
    • n (int) โ€” how much to increment the internal counter by.
    • Return type: None
  • free() โ€” free semaphore resources, clean up your mess queen ๐Ÿงน
    • Return type: None

๐Ÿงช Examples ๐Ÿงช

test-sync-1.py

from mpi4py import MPI
from mpi4py.util.sync import Counter, Sequential

comm = MPI.COMM_WORLD

counter = Counter(comm)
with Sequential(comm):
   value = next(counter)
counter.free()

assert comm.rank == value

test-sync-2.py

from mpi4py import MPI
from mpi4py.util.sync import Counter, Mutex

comm = MPI.COMM_WORLD

mutex = Mutex(comm)
counter = Counter(comm)
with mutex:
   value = next(counter)
counter.free()
mutex.free()

assert (
   list(range(comm.size)) ==
   sorted(comm.allgather(value))
)

๐ŸŒˆ MPI4PY.RUN ๐ŸŒˆ

Added in version 3.0.0. โญ

okay so here's the whole vibe ๐Ÿ‘‘ โ€” at import time, mpi4py initializes the MPI execution environment by calling MPI_Init_thread(), and it installs an exit hook to automatically call MPI_Finalize() right before the Python process terminates. And also, mpi4py overrides the default ERRORS_ARE_FATAL error handler in favor of ERRORS_RETURN, which is what lets it translate MPI errors into Python exceptions ๐Ÿฆ‹

These departures from standard MPI behavior may be controversial, but honestly? they're quite convenient inside the highly dynamic Python programming environment, iykyk. Third-party code using mpi4py can just from mpi4py import MPI and do MPI calls without that tedious initialization/finalization handling ๐Ÿ˜ญ. And MPI errors, once they're automatically translated into Python exceptions, can be dealt with using the usual tryโ€ฆexceptโ€ฆfinally clauses โ€” unhandled MPI exceptions will print a traceback, which helps you locate problems in your source code ๐Ÿ”

Unfortunately โ€” and this is the part where we get dramatic โ€” the interplay of automatic MPI finalization and unhandled exceptions may lead to deadlocks ๐Ÿ’€. And in unattended runs, these deadlocks will drain the battery of your laptop, or burn precious allocation hours in your supercomputing facility. Not the allocation hours bestie, NOT the allocation hours ๐Ÿ˜ญ

๐Ÿ˜ญ Exceptions and deadlocks ๐Ÿ˜ญ

Consider the following snippet of Python code. Assume this code is stored in a standard Python script file and run with mpiexec in two or more processes.

deadlock.py

from mpi4py import MPI
assert MPI.COMM_WORLD.Get_size() > 1
rank = MPI.COMM_WORLD.Get_rank()
if rank == 0:
    1/0
    MPI.COMM_WORLD.send(None, dest=1, tag=42)
elif rank == 1:
    MPI.COMM_WORLD.recv(source=0, tag=42)

Process 0 raises a ZeroDivisionError exception before it ever performs a send call to process 1. And because that exception is not handled, the Python interpreter running in process 0 will proceed to exit with non-zero status. BUT โ€” since mpi4py installed a finalizer hook to call MPI_Finalize() before exit, process 0 will block, waiting for the other processes to also enter the MPI_Finalize() call ๐Ÿ˜ณ

Meanwhile, process 1 is blocked waiting for a message to arrive from process 0, so it never reaches MPI_Finalize(). And the whole MPI execution environment is irremediably in a deadlock state ๐Ÿ’€๐Ÿ”’

To alleviate this issue, mpi4py offers a simple, alternative command line execution mechanism based on using the -m flag and implemented with the runpy module. To use this feature, Python code should be run passing -m mpi4py in the command line invoking the Python interpreter. And in the case of unhandled exceptions, the finalizer hook will call MPI_Abort() on the MPI_COMM_WORLD communicator โ€” thus effectively aborting the MPI execution environment ๐Ÿ”ฅ

Warning: When a process is forced to abort, resources (e.g. open files) are not cleaned-up and any registered finalizers (either with the atexit module, the Python C/API function Py_AtExit(), or even the C standard library function atexit()) will not be executed. So likeโ€ฆ aborting execution is an extremely impolite way of ensuring process termination ๐Ÿ™ˆ. However, MPI provides no other mechanism to recover from a deadlock state. Periodt.

๐Ÿ’ป Command line ๐Ÿ’ป

Using -m mpi4py to execute Python code on the command line resembles that of the Python interpreter โœจ

mpiexec -n numprocs python -m mpi4py pyfile [arg] ...
mpiexec -n numprocs python -m mpi4py -m mod [arg] ...
mpiexec -n numprocs python -m mpi4py -c cmd [arg] ...
mpiexec -n numprocs python -m mpi4py - [arg] ...
  • <pyfile> โ€” execute the Python code contained in pyfile, which must be a filesystem path referring to either a Python file, a directory containing a __main__.py file, or a zipfile containing a __main__.py file. ๐Ÿ“
  • -m <mod> โ€” search sys.path for the named module mod and execute its contents.
  • -c <cmd> โ€” execute the Python code in the cmd string command.
  • - โ€” read commands from standard input (sys.stdin).

See also:


๐ŸŒธ MPI4PY.BENCH ๐ŸŒธ

Added in version 3.0.0. โญ


๐Ÿ‘‘ REFERENCE ๐Ÿ‘‘

  • mpi4py.MPI โ€” Message Passing Interface. ๐Ÿ’Œ

๐Ÿ’œ mpi4py.MPI ๐Ÿ’œ

Message Passing Interface.

โœจ Classes โœจ

okay bestie, here's the whole cast of characters ๐Ÿ’– every class chilling in mpi4py.MPI, lined up so you can meet them all:

  • mpi4py.MPI.BottomType โ€” type of BOTTOM.
  • mpi4py.MPI.BufferAutomaticType โ€” type of BUFFER_AUTOMATIC.
  • mpi4py.MPI.Cartcomm โ€” Cartesian topology intracommunicator.
  • mpi4py.MPI.Comm โ€” communication context.
  • mpi4py.MPI.Datatype โ€” datatype object.
  • mpi4py.MPI.Distgraphcomm โ€” distributed graph topology intracommunicator.
  • mpi4py.MPI.Errhandler โ€” error handler.
  • mpi4py.MPI.File โ€” file I/O context.
  • mpi4py.MPI.Graphcomm โ€” general graph topology intracommunicator.
  • mpi4py.MPI.Grequest โ€” generalized request handler.
  • mpi4py.MPI.Group โ€” group of processes.
  • mpi4py.MPI.InPlaceType โ€” type of IN_PLACE.
  • mpi4py.MPI.Info โ€” info object.
  • mpi4py.MPI.Intercomm โ€” intercommunicator.
  • mpi4py.MPI.Intracomm โ€” intracommunicator.
  • mpi4py.MPI.Message โ€” matched message.
  • mpi4py.MPI.Op โ€” reduction operation.
  • mpi4py.MPI.Pickle โ€” pickle/unpickle Python objects.
  • mpi4py.MPI.Prequest โ€” persistent request handler.
  • mpi4py.MPI.Request โ€” request handler.
  • mpi4py.MPI.Session โ€” session context.
  • mpi4py.MPI.Status โ€” status object.
  • mpi4py.MPI.Topocomm โ€” topology intracommunicator.
  • mpi4py.MPI.Win โ€” remote memory access context.
  • mpi4py.MPI.buffer โ€” buffer.
  • mpi4py.MPI.memory โ€” alias of mpi4py.MPI.buffer.

mpi4py.MPI.BottomType

class mpi4py.MPI.BottomType

Bases: object

It's literally just the type of BOTTOM ๐Ÿ’… that's the whole gig, no notes.

static __new__(cls)

Return type: Self


mpi4py.MPI.BufferAutomaticType

class mpi4py.MPI.BufferAutomaticType

Bases: object

The type of BUFFER_AUTOMATIC โœจ a whole vibe, and that vibe is automatic.

static __new__(cls)

Return type: Self


mpi4py.MPI.Cartcomm

class mpi4py.MPI.Cartcomm

Bases: Topocomm

Cartesian topology intracommunicator ๐Ÿ—บ๏ธ bestie this is the one where your processes live on a nice tidy grid, very organized, very demure.

static __new__(cls, comm=None)

Parameters:

  • comm (Cartcomm | None)

Return type: Self

โœจ Methods Summary โœจ

okay bestie, here's the whole roster of what you can do with your cartesian communicator, no cap:

  • Get_cart_rank(coords) โ€” translate logical coordinates into ranks. glow-up from position to process ID ๐Ÿ’…
  • Get_coords(rank) โ€” the reverse, translating ranks back into logical coordinates
  • Get_dim() โ€” hand you the number of dimensions
  • Get_topo() โ€” spill all the info about the cartesian topology
  • Shift(direction, disp) โ€” give you the process ranks you need for data shifting with Sendrecv <#mpi4py.MPI.Comm.Sendrecv>
  • Sub(remain_dims) โ€” produce a lower-dimensional Cartesian topology. shrinking but make it iconic ๐Ÿฆ‹

๐ŸŽ€ Attributes Summary ๐ŸŽ€

  • coords โ€” Coordinates.
  • dim โ€” Number of dimensions.
  • dims โ€” Dimensions.
  • ndim โ€” Number of dimensions.
  • periods โ€” Periodicity.
  • topo โ€” Topology information.

๐Ÿ“– Methods Documentation ๐Ÿ“–

Get_cart_rank(coords)

Translate logical coordinates to ranks. literally the coordinates-to-rank translator of your dreams โœจ

Parameters

  • coords (Sequence[int])

Return type

int

Get_coords(rank)

Translate ranks to logical coordinates. going the other way, equally slay ๐Ÿ’–

Parameters

  • rank (int)

Return type

list[int]

Get_dim()

Return number of dimensions.

Return type

int

Get_topo()

Return information on the cartesian topology.

Return type

tuple[list[int], list[int], list[int]]

Shift(direction, disp)

Return a process ranks for data shifting with Sendrecv <#mpi4py.MPI.Comm.Sendrecv>.

Parameters

  • direction (int)
  • disp (int)

Return type

tuple[int, int]

Sub(remain_dims)

Return a lower-dimensional Cartesian topology.

Parameters

  • remain_dims (Sequence[bool])

Return type

Cartcomm <#mpi4py.MPI.Cartcomm>


๐Ÿ’ซ Attributes Documentation ๐Ÿ’ซ

coords

Coordinates.

dim

Number of dimensions.

dims

Dimensions.

ndim

Number of dimensions.

periods

Periodicity.

topo

Topology information.


๐ŸŒˆ mpi4py.MPI.Comm ๐ŸŒˆ

class mpi4py.MPI.Comm

Bases: object <https://docs.python.org/3/library/functions.html#object>

Communication context. yeah, this is the moment, this is the main character ๐Ÿ‘‘

static __new__(cls, comm=None)

Parameters

Return type

Self <https://docs.python.org/3/library/typing.html#typing.Self>

  • Abort([errorcode]) โ€” Terminate the MPI execution environment. ๐Ÿ˜ญ like, the whole thing. everyone out. pass an errorcode if you want to be specific about why you're nuking it from orbit ๐Ÿ’€
  • Ack_failed([num_to_ack]) โ€” Acknowledge failures on a communicator.</p> you're basically signing off on the mess ๐Ÿ’… num_to_ack tells it how many failures you're acknowledging.
  • Agree(flag) โ€” Blocking agreement. everybody has to agree, and nobody moves until they do ๐Ÿซถ the flag is your vote.
  • Allgather(sendbuf, recvbuf) โ€” Gather to All. everyone sends, everyone receives the whole set. no secrets on this comm, bestie โœจ
  • Allgather_init(sendbuf, recvbuf[, info]) โ€” Persistent Gather to All. same energy as Allgather, but it sticks around so you can fire it off again and again ๐Ÿ”ฅ optional info for extra intel.
  • Allgatherv(sendbuf, recvbuf) โ€” Gather to All Vector. the vector version โ€” because sometimes everyone's bringing a different amount of stuff to the party ๐ŸŽ€
  • Allgatherv_init(sendbuf, recvbuf[, info]) โ€” Persistent Gather to All Vector. vector edition, but persistent. info is optional, as always ๐Ÿ™ˆ
  • Allreduce(sendbuf, recvbuf[, op]) โ€” Reduce to All. crunch everyone's numbers down and hand the result to literally everyone ๐Ÿ‘‘ drop an op in there to pick your reduction.
  • Allreduce_init(sendbuf, recvbuf[, op, info]) โ€” Persistent Reduce to All.</persistent> persistent flavor โ€” op and info are both optional here, fancy ๐Ÿ’…
  • Alltoall(sendbuf, recvbuf) โ€” All to All Scatter/Gather. everyone trades with everyone. it's giving group project where everyone actually participates for once ๐ŸŒˆ
  • Alltoall_init(sendbuf, recvbuf[, info]) โ€” Persistent All to All Scatter/Gather. same swap, but persistent so you can rerun it. info optional โœจ
  • Alltoallv(sendbuf, recvbuf) โ€” All to All Scatter/Gather Vector. the vector version โ€” unequal amounts welcome, no judgement ๐Ÿฆ‹
  • Alltoallv_init(sendbuf, recvbuf[, info]) โ€” Persistent All to All Scatter/Gather Vector. vector + persistent = the combo meal ๐Ÿ“ info optional.
  • Alltoallw(sendbuf, recvbuf) โ€” All to All Scatter/Gather General. the general one. maximum flexibility, maximum power, main character energy fr fr ๐Ÿ‘‘
  • Alltoallw_init(sendbuf, recvbuf[, info]) โ€” Persistent All to All Scatter/Gather General. general AND persistent. and yes, info is optional ๐Ÿ’œ
  • Attach_buffer(buf) โ€” Attach a user-provided buffer for sending in buffered mode. you hand it buf, it uses it. that's the whole vibe ๐Ÿซถ
  • Barrier() โ€” Barrier synchronization. everyone waits at the line until everyone's there. no cuts, no stragglers โญ
  • Barrier_init([info]) โ€” Persistent Barrier. the barrier you can reuse. info optional, obviously ๐Ÿ’…
  • Bcast(buf[, root]) โ€” Broadcast data from one process to all other processes. one source, everybody else listening. root says who's holding the mic ๐ŸŽค
  • Bcast_init(buf[, root, info]) โ€” Persistent Broadcast. the persistent remix โ€” root and info both optional โœจ
  • Bsend(buf, dest[, tag]) โ€” Blocking send in buffered mode. buffered mode means it can return before the receiver is ready. dest is where it's headed, tag optional ๐ŸŽ€
  • Bsend_init(buf, dest[, tag]) โ€” Persistent request for a send in buffered mode. same buffered send, but you get a persistent request back. dest required, tag optional ๐Ÿ’–
  • Call_errhandler(errorcode) โ€” Call the error handler installed on a communicator. you pass the errorcode, it invokes whatever handler is on deck ๐Ÿ˜ญ
  • Clone() โ€” Clone an existing communicator. copy-paste but make it MPI. no args, no drama ๐Ÿฆ‹
  • Compare(comm) โ€” Compare two communicators. you give it a comm, it tells you how they relate. iconique ๐Ÿ”
  • Create(group) โ€” Create communicator from group. hand it a group, get a communicator back. slay โœจ
  • Create_errhandler(errhandler_fn) โ€” Create a new error handler for communicators. pass your errhandler_fn and boom, custom error handling ๐Ÿ‘‘
  • Create_keyval([copy_fn, delete_fn, nopython]) โ€” Create a new attribute key for communicators. all three args are optional: copy_fn, delete_fn, and nopython ๐Ÿ’…
  • Delete_attr(keyval) โ€” Delete attribute value associated with a key. give it the keyval and that attribute is gone ๐Ÿซถ
  • Detach_buffer() โ€” Remove an existing attached buffer. the undo button for Attach_buffer. no args needed ๐ŸŽ€
  • Disconnect() โ€” Disconnect from a communicator. you and this communicator? it's over. no cap, it's just over ๐Ÿ’€
  • Dup([info]) โ€” Duplicate a communicator. ๐Ÿ’ซ
  • Dup_with_info(info) โ€” Duplicate a communicator with hints, bestie. โœจ
  • Flush_buffer() โ€” Block until all buffered messages have been transmitted. it's giving "wait for itโ€ฆ" energy ๐Ÿซถ
  • Free() โ€” Free a communicator.
  • Free_keyval(keyval) โ€” Free an attribute key for communicators. ๐Ÿ”‘
  • Gather(sendbuf, recvbuf[, root]) โ€” Gather data to one process from all other processes.
  • Gather_init(sendbuf, recvbuf[, root, info]) โ€” Persistent Gather. ๐Ÿ‘‘
  • Gatherv(sendbuf, recvbuf[, root]) โ€” Gather Vector.
  • Gatherv_init(sendbuf, recvbuf[, root, info]) โ€” Persistent Gather Vector.
  • Get_attr(keyval) โ€” Retrieve attribute value by key.
  • Get_errhandler() โ€” Get the error handler for a communicator.
  • Get_failed() โ€” Extract the group of failed processes. ๐Ÿ’€
  • Get_group() โ€” Access the group associated with a communicator.
  • Get_info() โ€” Return the current hints for a communicator.
  • Get_name() โ€” Get the print name for this communicator. ๐ŸŽ€
  • Get_parent() โ€” Return the parent intercommunicator for this process.
  • Get_rank() โ€” Return the rank of this process in a communicator.
  • Get_size() โ€” Return the number of processes in a communicator.
  • Get_topology() โ€” Return the type of topology (if any) associated with a communicator.
  • Iagree(flag) โ€” Nonblocking agreement.
  • Iallgather(sendbuf, recvbuf) โ€” Nonblocking Gather to All.
  • Iallgatherv(sendbuf, recvbuf) โ€” Nonblocking Gather to All Vector.
  • Iallreduce(sendbuf, recvbuf[, op]) โ€” Nonblocking Reduce to All.
  • Ialltoall(sendbuf, recvbuf) โ€” Nonblocking All to All Scatter/Gather.
  • Ialltoallv(sendbuf, recvbuf) โ€” Nonblocking All to All Scatter/Gather Vector.
  • Ialltoallw(sendbuf, recvbuf) โ€” Nonblocking All to All Scatter/Gather General.
  • Ibarrier() โ€” Nonblocking Barrier.
  • Ibcast(buf[, root]) โ€” Nonblocking Broadcast. ๐Ÿ“ฃ
  • Ibsend(buf, dest[, tag]) โ€” Nonblocking send in buffered mode.
  • Idup([info]) โ€” Nonblocking duplicate a communicator.
  • Idup_with_info(info) โ€” Nonblocking duplicate a communicator with hints.

okay but notice how every single one of these that starts with a capital I is just the nonblocking version of its non-I bestie?? it's giving "same girl, different era" energy fr fr ๐Ÿ’… the I prefix literally just means "you get a request object back and you go live your life, we'll handle the waiting later" โ€” no cap. ๐Ÿฆ‹

okay we're still deep in the communicator method lineup, alphabetically slaying, no skips, keep up bestie ๐Ÿ’–

  • Iflush_buffer() โ€” nonblocking flush for buffered messages. โœจ
  • Igather(sendbuf, recvbuf[, root]) โ€” nonblocking Gather.
  • Igatherv(sendbuf, recvbuf[, root]) โ€” nonblocking Gather Vector. the v stands for very extra ๐Ÿ’…
  • Improbe([source, tag, status]) โ€” nonblocking test for a matched message. matched specifically, okay? iykyk.
  • Iprobe([source, tag, status]) โ€” nonblocking test for a message. just any message fr fr.
  • Irecv(buf[, source, tag]) โ€” nonblocking receive. she's not gonna wait around for you ๐Ÿซถ
  • Ireduce(sendbuf, recvbuf[, op, root]) โ€” nonblocking Reduce to Root.
  • Ireduce_scatter(sendbuf, recvbuf[, ...]) โ€” nonblocking Reduce-Scatter, the vector version.
  • Ireduce_scatter_block(sendbuf, recvbuf[, op]) โ€” nonblocking Reduce-Scatter Block, and to be clear that's the regular, non-vector version. two different girls, don't confuse them ๐Ÿ’€
  • Irsend(buf, dest[, tag]) โ€” nonblocking send in ready mode. she assumes you're ready, do not disappoint her.
  • Is_inter() โ€” tells you whether the communicator is an intercommunicator.
  • Is_intra() โ€” tells you whether the communicator is an intracommunicator. yes bestie, they're different, that's the whole point.
  • Is_revoked() โ€” indicates whether the communicator has been revoked. ๐Ÿ˜ญ
  • Iscatter(sendbuf, recvbuf[, root]) โ€” nonblocking Scatter.
  • Iscatterv(sendbuf, recvbuf[, root]) โ€” nonblocking Scatter Vector.
  • Isend(buf, dest[, tag]) โ€” nonblocking send. iconic, the moment, no notes ๐Ÿ‘‘
  • Isendrecv(sendbuf, dest[, sendtag, recvbuf, ...]) โ€” nonblocking send and receive. doing both at once, multitasking queen ๐ŸŒˆ
  • Isendrecv_replace(buf, dest[, sendtag, ...]) โ€” send and receive a message, with the replace twist.
  • Ishrink() โ€” nonblocking shrink of a communicator, removing all failed processes.
  • Issend(buf, dest[, tag]) โ€” nonblocking send in synchronous mode. the s is doing so much work.
  • Join(fd) โ€” interconnects two processes that are connected by a socket. ๐Ÿฆ‹
  • Mprobe([source, tag, status]) โ€” blocking test for a matched message. yeah, blocking โ€” she will sit there and wait, respectfully.
  • Precv_init(buf, partitions[, source, tag, info]) โ€” creates a request for a partitioned recv operation.
  • Probe([source, tag, status]) โ€” blocking test for a message.
  • Psend_init(buf, partitions, dest[, tag, info]) โ€” creates a request for a partitioned send operation.
  • Recv(buf[, source, tag, status]) โ€” blocking receive. she waits. patiently. for you. ๐Ÿฅบ
  • Recv_init(buf[, source, tag]) โ€” creates a persistent request for a receive. it's giving commitment ๐Ÿ’œ
  • Reduce(sendbuf, recvbuf[, op, root]) โ€” Reduce to Root.
  • Reduce_init(sendbuf, recvbuf[, op, root, info]) โ€” persistent Reduce to Root. she's back and she's forever.

and we're still not done, the list keeps going, stay with me ๐ŸŽ€

  • Reduce_scatter(sendbuf, recvbuf[, ...]) โ€” Reduce-Scatter, but make it fancy โ€” this is the vector version. ๐Ÿฆ‹
  • Reduce_scatter_block(sendbuf, recvbuf[, op]) โ€” Reduce-Scatter Block, the regular non-vector one. No frills, just vibes. โœจ
  • Reduce_scatter_block_init(sendbuf, recvbuf) โ€” Persistent Reduce-Scatter Block (again: regular, non-vector, we keep it simple bestie). ๐Ÿ”
  • Reduce_scatter_init(sendbuf, recvbuf[, ...]) โ€” Persistent Reduce-Scatter, and yeah it's the vector flavor. ๐Ÿ‘‘
  • Revoke() โ€” Revoke a communicator. It's giving "you're on time out". ๐Ÿ’€
  • Rsend(buf, dest[, tag]) โ€” Blocking send, but in ready mode. ๐Ÿƒโ™€๏ธ
  • Rsend_init(buf, dest[, tag]) โ€” A persistent request for a send in ready mode. Set it once, reuse it forever, iconic behavior. ๐ŸŽ€
  • Scatter(sendbuf, recvbuf[, root]) โ€” Scatter data from one process out to all the other processes. Sharing is caring fr fr. ๐ŸŒธ
  • Scatter_init(sendbuf, recvbuf[, root, info]) โ€” Persistent Scatter. Same energy, reusable wrapper. ๐Ÿ”
  • Scatterv(sendbuf, recvbuf[, root]) โ€” Scatter Vector. Vector edition, obviously. ๐ŸŒˆ
  • Scatterv_init(sendbuf, recvbuf[, root, info]) โ€” Persistent Scatter Vector. Yeah bestie, the vector one but persistent. โœจ
  • Send(buf, dest[, tag]) โ€” Blocking send. Classic. The blueprint. ๐Ÿ’…
  • Send_init(buf, dest[, tag]) โ€” Creates a persistent request for a standard send. ๐ŸŒŸ
  • Sendrecv(sendbuf, dest[, sendtag, recvbuf, ...]) โ€” Send AND receive a message. Doing both at once is such main character energy. ๐Ÿ‘‘
  • Sendrecv_replace(buf, dest[, sendtag, ...]) โ€” Send and receive a message โ€” the replace edition. ๐Ÿ”„
  • Set_attr(keyval, attrval) โ€” Stores an attribute value that's associated with a key. ๐Ÿ—๏ธ
  • Set_errhandler(errhandler) โ€” Sets the error handler for a communicator. So when things go sideways, you already decided how it's handled. ๐Ÿ˜ญ
  • Set_info(info) โ€” Sets new values for the hints associated with a communicator. ๐Ÿงš
  • Set_name(name) โ€” Sets the print name for this communicator. Naming things is self care. ๐Ÿ’–
  • Shrink() โ€” Shrinks a communicator to remove all the failed processes. Cleaning house, no cap. ๐Ÿงน
  • Split([color, key]) โ€” Splits a communicator by color and key. ๐Ÿ’œ
  • Split_type(split_type[, key, info]) โ€” Splits a communicator by split type. ๐Ÿฆ‹
  • Ssend(buf, dest[, tag]) โ€” Blocking send, but in synchronous mode. ๐Ÿค
  • Ssend_init(buf, dest[, tag]) โ€” Persistent request for a send in synchronous mode. ๐Ÿ”
  • allgather(sendobj) โ€” Gather to All. Everybody gets everything, we love an equal distribution moment. ๐ŸŒธ
  • allreduce(sendobj[, op]) โ€” Reduce to All. ๐Ÿ“‰
  • alltoall(sendobj) โ€” All to All Scatter/Gather. The chaotic group chat of collectives, honestly. ๐Ÿ’€
  • barrier() โ€” Barrier synchronization. Everyone waits here until everyone's ready โ€” literally the group chat "ok are we all here?" ๐Ÿšง
  • bcast(obj[, root]) โ€” Broadcast. One to everyone, no side conversations. ๐Ÿ“ข
  • bsend(obj, dest[, tag]) โ€” Send in buffered mode. ๐Ÿงบ
  • f2py(arg) โ€” no description given, she's mysterious like that. ๐Ÿ™ˆ
  • free() โ€” Calls Free if it's not null or predefined. โœจ

  • fromhandle(handle) โ€” Create object from MPI handle. ๐Ÿซถ
  • fromint(arg, /) โ€” Translate integer handle to object.
  • gather(sendobj[, root]) โ€” Gather.
  • ibsend(obj, dest[, tag]) โ€” Nonblocking send in buffered mode.
  • improbe([source, tag, status]) โ€” Nonblocking test for a matched message.
  • iprobe([source, tag, status]) โ€” Nonblocking test for a message.
  • irecv([buf, source, tag]) โ€” Nonblocking receive.
  • isend(obj, dest[, tag]) โ€” Nonblocking send.
  • issend(obj, dest[, tag]) โ€” Nonblocking send in synchronous mode.
  • mprobe([source, tag, status]) โ€” Blocking test for a matched message.
  • probe([source, tag, status]) โ€” Blocking test for a message.
  • py2f() โ€” (no description, she's mysterious like that ๐Ÿ’…)
  • recv([buf, source, tag, status]) โ€” Receive.
  • reduce(sendobj[, op, root]) โ€” Reduce to Root.
  • scatter(sendobj[, root]) โ€” Scatter.
  • send(obj, dest[, tag]) โ€” Send in standard mode.
  • sendrecv(sendobj, dest[, sendtag, recvbuf, ...]) โ€” Send and Receive.
  • ssend(obj, dest[, tag]) โ€” Send in synchronous mode.
  • toint() โ€” Translate object to integer handle.

โœจ Attributes Summary โœจ

okay bestie, these are the lil vibes you can just read off a communicator, no method call needed ๐ŸŽ€

  • group โ€” Group.
  • handle โ€” MPI handle.
  • info โ€” Info hints.
  • is_inter โ€” Is intercommunicator.
  • is_intra โ€” Is intracommunicator.
  • is_topo โ€” Is a topology.
  • name โ€” Print name.
  • rank โ€” Rank of this process.
  • size โ€” Number of processes.
  • topology โ€” Topology type.

๐Ÿ’… Methods Documentation ๐Ÿ’…

okay so now we get into the actual receipts, method by method. grab a snack, this is the good part ๐Ÿ“


Abort(errorcode=0)

Terminate the MPI execution environment. ๐Ÿ˜ญ like, it's over over.

Warning: The invocation of this method prevents the execution of various Python exit and cleanup mechanisms. Use this method as a last resort to prevent parallel deadlocks in case of unrecoverable errors. fr fr, this is the nuclear option โ€” only reach for it when everything else is giving deadlock energy ๐Ÿ’€

Parameters

  • errorcode (int)

Return type

  • NoReturn

Ack_failed(num_to_ack=None)

Acknowledge failures on a communicator.

Parameters

  • num_to_ack (int | None)

Return type

  • int

Agree(flag)

Blocking agreement. everyone has to agree before we move on, it's giving group project but make it โœจsynchronizedโœจ

Parameters

  • flag (int)

Return type

  • int

Allgather(sendbuf, recvbuf)

Gather to All. ๐ŸŒˆ

Gather data from all processes and broadcast the combined data to all other processes. literally everyone gets everybody's tea, no FOMO allowed ๐Ÿซถ

Parameters

  • sendbuf (BufSpec | InPlace)
  • recvbuf (BufSpecB)

Return type

  • None

Allgather_init(sendbuf, recvbuf, info=INFO_NULL)

Persistent Gather to All.

Parameters

  • sendbuf (BufSpec | InPlace)
  • recvbuf (BufSpecB)
  • info (Info)

Return type

  • Prequest

Allgatherv(sendbuf, recvbuf)

Gather to All Vector.

and that's where we're leaving it for now bestie, more incoming ๐Ÿ’–

Gathers data from every process and sends it back out to all the other processes โ€” but here's the โœจspicyโœจ part: each one can contribute a different amount of data and sit at a different displacement. Not all equal-sized chunks, bestie. Everyone brings their own lil' pile. ๐Ÿ’…

Parameters

  • sendbuf (BufSpec | InPlace) ๐Ÿซถ
  • recvbuf (BufSpecV) ๐ŸŒธ

Return type โ€” None


Allgatherv_init(sendbuf, recvbuf, info=INFO_NULL)

Persistent Gather to All Vector. ๐Ÿฆ‹ Same energy as Allgatherv, but it hands you back a persistent request instead of doing the thing right away. Set it up once, then fire it off whenever. Obsessed.

Parameters

  • sendbuf (BufSpec | InPlace)
  • recvbuf (BufSpecV)
  • info (Info)

Return type โ€” Prequest ๐Ÿ’–


Allreduce(sendbuf, recvbuf, op=SUM)

Reduce to All. ๐Ÿ”ฅ Everyone smashes their data together with op, and then everyone gets the answer. No one's left out, no main character hogging the result. Iconic behaviour fr fr.

Parameters

  • sendbuf (BufSpec | InPlace)
  • recvbuf (BufSpec)
  • op (Op)

Return type โ€” None


Allreduce_init(sendbuf, recvbuf, op=SUM, info=INFO_NULL)

Persistent Reduce to All. โœจ The persistent-request version of Allreduce โ€” set it up, get a Prequest, reuse it forever. So efficient. We love a repeat performer. ๐Ÿ‘‘

Parameters

  • sendbuf (BufSpec | InPlace)
  • recvbuf (BufSpec)
  • op (Op)
  • info (Info)

Return type โ€” Prequest ๐Ÿ’œ


Alltoall(sendbuf, recvbuf)

All to All Scatter/Gather. ๐ŸŽ€ Send data to all processes and recv data from all processes โ€” like a group chat where literally everyone is @-ing everyone. The full send-and-receive glow-up.

Parameters

  • sendbuf (BufSpecB | InPlace)
  • recvbuf (BufSpecB)

Return type โ€” None


Alltoall_init(sendbuf, recvbuf, info=INFO_NULL)

Persistent All to All Scatter/Gather. ๐Ÿ’ซ All the all-to-all energy, but persistent. Build the request once, vibe forever.

Parameters

  • sendbuf (BufSpecB | InPlace)
  • recvbuf (BufSpecB)
  • info (Info)

Return type โ€” Prequest ๐Ÿฆ‹


Alltoallv(sendbuf, recvbuf)

All to All Scatter/Gather Vector. ๐ŸŒˆ Send data to all processes and recv data from all processes โ€” and yes, everyone gets to specify different amounts of data and different displacements. No more pretending we're all the same size. Body positivity for buffers. ๐Ÿ’…

Parameters

  • sendbuf (BufSpecV | InPlace)
  • recvbuf (BufSpecV)

Return type โ€” None


Alltoallv_init(sendbuf, recvbuf, info=INFO_NULL)

Persistent All to All Scatter/Gather Vector. โœจ The vector all-to-all, but make it persistent. A Prequest you can keep in your pocket. ๐Ÿซถ

Parameters

  • sendbuf (BufSpecV | InPlace)
  • recvbuf (BufSpecV)
  • info (Info)

Return type โ€” Prequest


Alltoallw(sendbuf, recvbuf)

All to All Scatter/Gather General. ๐Ÿ‘‘ Send/recv data to/from all processes, and this one lets you specify different counts, displacements, and datatypes for every single dest/source. Maximum customisation, zero compromises. It's giving "I designed my own outfit for every party". ๐ŸŽ€

Parameters

  • sendbuf (BufSpecW | InPlace)
  • recvbuf (BufSpecW)

Return type โ€” None


Alltoallw_init(sendbuf, recvbuf, info=INFO_NULL)

Persistent All to All Scatter/Gather General. ๐Ÿ’œ Same fully-customisable general all-to-all, now in a persistent-request flavour. Chef's kiss. ๐Ÿ˜ญ

Parameters

  • sendbuf (BufSpecW | InPlace)
  • recvbuf (BufSpecW)
  • info (Info)

Return type โ€” Prequest โญ


Attach_buffer(buf)

Attach a user-provided buffer for sending in buffered mode. ๐Ÿงบ You're handing MPI your own lil' basket so buffered sends have somewhere to stash things. Very demure, very mindful, very prepared. ๐Ÿ“

Parameters

  • buf (Buffer | None)

Return type โ€” None


Barrier()

Barrier synchronization. โณ The classic "okay everyone STOP and wait until we're all here" moment. Nobody moves until the whole squad arrives. It's the group photo pose. ๐Ÿ“ธ

Return type โ€” None


Barrier_init(info=INFO_NULL)

Persistent Barrier. ๐Ÿฆ‹ A barrier that you set up once and can reuse โ€” no re-declaring, just vibes.

Parameters

  • info (Info)

Return type โ€” Prequest ๐Ÿ’–


Bcast(buf, root=0)

Broadcast data from one process to all other processes. ๐Ÿ“ฃ One process gets the mic, everyone else listens and copies it down. root decides who's holding the aux. Default root is 0, so the usual suspect. ๐ŸŽค

Parameters

  • buf (BufSpec)
  • root (int)

Return type โ€” None


Bcast_init(buf, root=0, info=INFO_NULL)

Persistent Broadcast. โœจ Broadcast, but persistent โ€” get your Prequest, reuse it on repeat. A hit single, basically. ๐ŸŽถ

Parameters

  • buf (BufSpec)
  • root (int)
  • info (Info)

Return type โ€” Prequest


Bsend(buf, dest, tag=0)

Blocking send in buffered mode. ๐Ÿ“ฆ It sends, it blocks, and it uses that buffered-mode setup you attached earlier. dest is who's getting it, tag is the lil' label (defaults to 0). ๐Ÿท๏ธ

Parameters

  • buf (BufSpec)
  • dest (int)
  • tag (int)

Return type โ€” None


Bsend_init(buf, dest, tag=0)

Persistent request for a send in buffered mode. ๐Ÿซถ The buffered send, but persistent โ€” and this one hands you a Request (not a Prequest, bestie, watch the type ๐Ÿ‘€).

Parameters

  • buf (BufSpec)
  • dest (int)
  • tag (int)

Return type โ€” Request ๐Ÿ’œ


Call_errhandler(errorcode)

Call the error handler installed on a communicator. ๐Ÿšจ You're poking the handler that's currently attached to this communicator and telling it "hey, here's the errorcode, deal with it". Dramatic, but sometimes necessary. ๐Ÿ˜ญ

Parameters

  • errorcode (int)

Return type โ€” None


Clone()

Clone an existing communicator. ๐Ÿ‘ฏ A copy of the communicator โ€” same energy, whole new object. Dupe, but make it official.

Return type โ€” Self ๐Ÿ’–


Compare(comm)

Compare two communicators. ๐Ÿ” Ask it how this communicator stacks up against comm and it hands you back an int telling you the deal.

Parameters

  • comm (Comm)

Return type โ€” int


Create(group)

Create communicator from group. ๐Ÿ› ๏ธ Feed it a Group and it'll spin you up a fresh Comm. Build-a-bear, but for communicators.

Parameters

  • group (Group)

Return type โ€” Comm โœจ


classmethod Create_errhandler(errhandler_fn)

Create a new error handler for communicators. ๐Ÿšจโœจ Give it a callable and it makes you a brand-new Errhandler. The callable takes a Comm and an int, and returns None โ€” that's the whole contract, no cap.

Parameters

  • errhandler_fn (Callable[[Comm, int], None])

Return type โ€” Errhandler ๐ŸŽ€


classmethod Create_keyval(copy_fn=None, delete_fn=None, nopython=False)

Create a new attribute key for communicators. ๐Ÿ—๏ธ You're minting a brand-new attribute key so you can stash extra stuff on communicators. Both callback slots default to None, and nopython defaults to False. Very custom, very yours.

Parameters

  • copy_fn (Callable[[Comm, int, Any], Any] | None) ๐Ÿฆ‹
  • delete_fn (Callable[[Comm, int, Any], None] | None) โ€” the callback that fires when an attribute gets deleted
  • nopython (bool) โ€” whether to skip Python-level callback dispatch

Return type: int


Delete_attr(keyval)</p> ๐Ÿ—‘๏ธ

okay so this one deletes the attribute value that's chilling with a particular key. bye bestie ๐Ÿ‘‹

Parameters

  • keyval (int) โ€” the key whose attribute you're yeeting

Return type: None


Detach_buffer()</p> ๐Ÿ“ฆ

Removes a buffer that was already attached. Un-glues it. simple as that.

Return type: Buffer | None


Disconnect()</p> ๐Ÿ”Œ

Disconnect from a communicator. it's giving "we need to talk" energy but for comms.

Return type: None


Dup(info=None)</p> ๐Ÿ‘ฏ

Duplicate a communicator. one comm becomes two, iconic behaviour, no notes.

Parameters

  • info (Info | None) โ€” hints for the new copy, or nothing at all

Return type: Self


Dup_with_info(info)</p> ๐Ÿ‘ฏโ€โ™€๏ธโœจ

Duplicate a communicator with hints. same dupe energy, but you're feeding it info for real this time.

Parameters

  • info (Info) โ€” the hints, and this time they're not optional

Return type: Self


Flush_buffer()</p> ๐Ÿšฝ๐Ÿ’จ

Block until every buffered message has actually been transmitted. like, sit there and wait, bestie, the messages are still in transit ๐Ÿซถ

Return type: None


Free()</p> ๐Ÿ•Š๏ธ

Free a communicator. release it into the wild.

Return type: None


classmethod Free_keyval(keyval)</p> ๐Ÿ”‘

Free an attribute key for communicators. it's a classmethod, so you call it on the class itself, not on an instance. iykyk.

Parameters

  • keyval (int) โ€” the key you're freeing

Return type: int


Gather(sendbuf, recvbuf, root=0)</p> ๐Ÿงบ

Gather data to one process from all the other processes. everyone hands their stuff to root, root holds the whole pile. main character root energy fr fr ๐Ÿ‘‘

Parameters

  • sendbuf (BufSpec | InPlace) โ€” what you're sending
  • recvbuf (BufSpecB | None) โ€” where it all lands (only meaningful on root)
  • root (int) โ€” the process collecting everything, defaults to 0

Return type: None


Gather_init(sendbuf, recvbuf, root=0, info=INFO_NULL)</p> ๐Ÿงบโœจ

Persistent Gather. same gathering vibe, but you set it up once and reuse it. lowkey efficient.

Parameters

  • sendbuf (BufSpec | InPlace) โ€” what you're sending
  • recvbuf (BufSpecB | None) โ€” where it lands
  • root (int) โ€” the collector, defaults to 0
  • info (Info) โ€” hints, defaults to INFO_NULL

Return type: Prequest


Gatherv(sendbuf, recvbuf, root=0)</p> ๐Ÿงบ๐ŸŒˆ

Gather Vector. Gather data to one process from all the other processes โ€” except everyone can send different amounts of data, at different displacements. no uniformity required, we love range ๐Ÿ’…

Parameters

  • sendbuf (BufSpec | InPlace) โ€” what you're sending
  • recvbuf (BufSpecV | None) โ€” where it lands, vector-style
  • root (int) โ€” the collector, defaults to 0

Return type: None


Gatherv_init(sendbuf, recvbuf, root=0, info=INFO_NULL)</p> ๐Ÿงบ๐ŸŒˆโœจ

Persistent Gather Vector. yes it's the persistent version of Gatherv, and yes it still does the different-amounts-different-displacements thing.

Parameters

  • sendbuf (BufSpec | InPlace) โ€” what you're sending
  • recvbuf (BufSpecV | None) โ€” where it lands
  • root (int) โ€” the collector, defaults to 0
  • info (Info) โ€” hints, defaults to INFO_NULL

Return type: Prequest


Get_attr(keyval)</p> ๐Ÿ”

Retrieve an attribute value by key. the reverse of Delete_attr, if you will.

Parameters

  • keyval (int) โ€” the key you're looking up

Return type: int | Any | None


Get_errhandler()</p> ๐Ÿšจ

Get the error handler for a communicator. who's on aux when things go wrong.

Return type: Errhandler


Get_failed()</p> ๐Ÿ’€

Extract the group of failed processes. yeah. the ones that did not make it.

Return type: Group


Get_group()</p> ๐Ÿ‘ฅ

Access the group associated with a communicator. the whole squad, in group form.

Return type: Group


Get_info()</p> ๐Ÿ“‹

Return the current hints for a communicator. receipts on what you told it.

Return type: Info


Get_name()</p> ๐Ÿท๏ธ

Get the print name for this communicator. its little nickname for display purposes.

Return type: str


classmethod Get_parent()</p> ๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘ง

Return the parent intercommunicator for this process. it's a classmethod, so call it on the class. family reunion vibes.

Return type: Intercomm


Get_rank()</p> ๐Ÿ”ข

Return the rank of this process in a communicator. who am i. classic.

Return type: int


Get_size()</p> ๐Ÿ”ขโœจ

Return the number of processes in a communicator. how many of us are in the group chat.

Return type: int


Get_topology()</p> ๐Ÿ—บ๏ธ

Return the type of topology (if any) associated with a communicator. if there's no topology, that's also an answer, bestie.

Return type: int


Iagree(flag)</p> ๐Ÿค

Nonblocking agreement. the I prefix means you get a Request back instead of just waiting around. very on the go.

Parameters

  • flag (Buffer) โ€” the buffer for the agreement flag

Return type: Request


Iallgather(sendbuf, recvbuf)</p> ๐Ÿ“ฃ

Nonblocking Gather to All. everyone sends, everyone receives. equal-opportunity communication ๐ŸŒˆ

Parameters

  • sendbuf (BufSpec | InPlace) โ€” what you're sending
  • recvbuf (BufSpecB) โ€” where it lands

Return type: Request


Iallgatherv(sendbuf, recvbuf)</p> ๐Ÿ“ฃ๐ŸŒˆ

Nonblocking Gather to All Vector. same as above but with the vector flavour โ€” different counts, different displacements.

Parameters

  • sendbuf (BufSpec | InPlace) โ€” what you're sending
  • recvbuf (BufSpecV) โ€” where it lands

Return type: Request


Iallreduce(sendbuf, recvbuf, op=SUM)</p> โž•โœจ

Nonblocking Reduce to All. everyone contributes, everyone gets the combined result. collective slay.

Parameters

  • sendbuf (BufSpec | InPlace) โ€” what you're contributing
  • recvbuf (BufSpec) โ€” where the result lands
  • op (Op) โ€” the reduction operation, defaults to SUM

Return type: Request


Ialltoall(sendbuf, recvbuf)</p> ๐Ÿ”„

Nonblocking All to All Scatter/Gather. literally everyone trades with everyone. chaotic? maybe. iconic? absolutely.

Parameters

  • sendbuf (BufSpecB | InPlace) โ€” what you're sending
  • recvbuf (BufSpecB) โ€” what you're receiving

Return type: Request


Ialltoallv(sendbuf, recvbuf)</p> ๐Ÿ”„๐ŸŒˆ

Nonblocking All to All Scatter/Gather Vector. the vector version โ€” so the amounts and displacements can differ per partner.

Parameters

  • sendbuf (BufSpecV | InPlace) โ€” what you're sending
  • recvbuf (BufSpecV) โ€” what you're receiving

Return type: Request


Ialltoallw(sendbuf, recvbuf)</p> ๐Ÿ”„๐Ÿ‘‘

Nonblocking All to All Scatter/Gather General. the general one. the most unhinged (affectionate) of the all-to-all family.

Parameters

  • sendbuf (BufSpecW | InPlace) โ€” the thing you're sending, or the in-place flex if you're skipping the separate send buffer ๐Ÿซถ
  • recvbuf (BufSpecW) โ€” where the goods land

Return type: Request


Ibarrier()

Nonblocking Barrier. Nobody moves till everybody's here, but make it async so you're not just standing there ๐Ÿ’…

Return type: Request


Ibcast(buf, root=0)

Nonblocking Broadcast. One root yaps, everyone else receives the tea โœจ

Parameters

  • buf (BufSpec) โ€” the buffer getting broadcast
  • root (int) โ€” who's the source of truth here

Return type: Request


Ibsend(buf, dest, tag=0)

Nonblocking send, but in buffered mode ๐Ÿงบ โ€” the message gets stashed locally so the send can finish without the receiver already waiting.

Parameters

  • buf (BufSpec) โ€” what you're sending
  • dest (int) โ€” who gets it
  • tag (int) โ€” the little label that keeps your messages straight

Return type: Request


Idup(info=None)

Nonblocking duplicate a communicator ๐Ÿ‘ฏ โ€” clone the whole vibe, no blocking.

Parameters

  • info (Info | None) โ€” optional hints to hand over

Return type: tuple[Self, Request] โ€” the new communicator and the request you gotta babysit, bestie


Idup_with_info(info)

Nonblocking duplicate a communicator with hints ๐ŸŽ€ โ€” same clone energy, but you're required to pass the hints, no skipping.

Parameters

  • info (Info) โ€” the hints, mandatory this time

Return type: tuple[Self, Request]


Iflush_buffer()

Nonblocking flush for buffered messages ๐Ÿšฝโœจ โ€” kicks out everything you shoved into the buffer with Bsend, asynchronously.

Return type: Request


Igather(sendbuf, recvbuf, root=0)

Nonblocking Gather โ€” everybody sends their piece to the root, but nobody waits around for it ๐ŸŒธ

Parameters

  • sendbuf (BufSpec | InPlace) โ€” your contribution
  • recvbuf (BufSpecB | None) โ€” where the pile lands (root's business, so None elsewhere)
  • root (int) โ€” the one collecting everything

Return type: Request


Igatherv(sendbuf, recvbuf, root=0)

Nonblocking Gather Vector โ€” like gather, except everyone's allowed to bring a different amount ๐Ÿ“. Nobody has to match.

Parameters

  • sendbuf (BufSpec | InPlace) โ€” your piece, whatever size it is
  • recvbuf (BufSpecV | None) โ€” the uneven pile at the root
  • root (int) โ€” the collector

Return type: Request


Improbe(source=ANY_SOURCE, tag=ANY_TAG, status=None)

Nonblocking test for a matched message ๐Ÿ” โ€” peeks and, if there's something there, actually matches it and hands you the Message.

Parameters

  • source (int) โ€” who you're checking on
  • tag (int) โ€” which tag you're checking for
  • status (Status | None) โ€” where to stash the status info

Return type: Message | None โ€” a message if there is one, None if there isn't ๐Ÿ˜ญ


Iprobe(source=ANY_SOURCE, tag=ANY_TAG, status=None)

Nonblocking test for a message ๐Ÿ‘€ โ€” just checks if one's waiting, doesn't consume it.

Parameters

  • source (int) โ€” the sender you're side-eyeing
  • tag (int) โ€” the tag you're side-eyeing
  • status (Status | None) โ€” optional status receptacle

Return type: bool


Irecv(buf, source=ANY_SOURCE, tag=ANY_TAG)

Nonblocking receive ๐Ÿ“ฅ โ€” you set it up, get a Request back, and go live your life until it's ready.

Parameters

  • buf (BufSpec) โ€” where the incoming thing goes
  • source (int) โ€” who you're expecting
  • tag (int) โ€” which tag you're expecting

Return type: Request


Ireduce(sendbuf, recvbuf, op=SUM, root=0)

Nonblocking Reduce to Root ๐Ÿ”ฅ โ€” everyone combines their stuff into one result, root gets it, nobody blocks.

Parameters

  • sendbuf (BufSpec | InPlace) โ€” your input
  • recvbuf (BufSpec | None) โ€” the final answer (root only)
  • op (Op) โ€” how you're combining, defaults to SUM
  • root (int) โ€” who receives the result

Return type: Request


Ireduce_scatter(sendbuf, recvbuf, recvcounts=None, op=SUM)

Nonblocking Reduce-Scatter, vector version ๐ŸŒˆ โ€” reduce everything together, then scatter chunks of varying sizes back out.

Parameters

  • sendbuf (BufSpec | InPlace) โ€” your input
  • recvbuf (BufSpec) โ€” your share of the result
  • recvcounts (Sequence[int] | None) โ€” how much each rank gets, uneven welcome
  • op (Op) โ€” the reduction operator, defaults to SUM

Return type: Request


Ireduce_scatter_block(sendbuf, recvbuf, op=SUM)

Nonblocking Reduce-Scatter Block โ€” the regular, non-vector version ๐Ÿ’–. Everyone gets the same-sized chunk, no custom counts needed.

Parameters

  • sendbuf (BufSpecB | InPlace) โ€” your input
  • recvbuf (BufSpec | BufSpecB) โ€” your equal-sized slice
  • op (Op) โ€” the operator, defaults to SUM

Return type: Request


Irsend(buf, dest, tag=0)

Nonblocking send in ready mode โšก โ€” only legal if the matching receive is already posted. Do not play with this one casually, fr fr.

Parameters

  • buf (BufSpec) โ€” what's going out
  • dest (int) โ€” who it's going to
  • tag (int) โ€” the message tag

Return type: Request


Is_inter()

Return whether the communicator is an intercommunicator ๐Ÿฆ‹ โ€” i.e. it bridges two separate groups.

Return type: bool


Is_intra()

Return whether the communicator is an intracommunicator ๐ŸŒธ โ€” i.e. everyone's in one single group.

Return type: bool


Is_revoked()

Indicate whether the communicator has been revoked ๐Ÿ’€ โ€” you'd wanna know if it was.

Return type: bool


Iscatter(sendbuf, recvbuf, root=0)

Nonblocking Scatter โ€” root splits the goods and flings them out, async edition ๐ŸŽ€

Parameters

  • sendbuf (BufSpecB | None) โ€” the pile being split (root's job, None for everyone else)
  • recvbuf (BufSpec | InPlace) โ€” your incoming share
  • root (int) โ€” the one doing the splitting

Return type: Request


Iscatterv(sendbuf, recvbuf, root=0)

Nonblocking Scatter Vector โ€” scattering, but each rank gets a different amount ๐Ÿ“. Equal portions are so last season.

Parameters

  • sendbuf (BufSpecV | None) โ€” the uneven pile (root only)
  • recvbuf (BufSpec | InPlace) โ€” your custom-sized share
  • root (int) โ€” the splitter

Return type: Request


Isend(buf, dest, tag=0)

Nonblocking send ๐Ÿ“ค โ€” the classic. Fire it off, grab your Request, deal with it later.

Parameters

  • buf (BufSpec) โ€” what you're sending
  • dest (int) โ€” the lucky recipient
  • tag (int) โ€” the tag, keeping your messages from getting mixed up

Return type: Request


Isendrecv(sendbuf, dest, sendtag=0, recvbuf=None, source=ANY_SOURCE, recvtag=ANY_TAG)

Nonblocking send and receive, in one go ๐Ÿ”„ โ€” no deadlock drama, no awkward waiting, just pure main character energy.

Parameters

  • sendbuf (BufSpec) โ€” the thing you're shipping out
  • dest โ€” (int) ๐Ÿ’– the rank you're aiming at
  • sendtag โ€” (int) the tag you're stamping on the outgoing message
  • recvbuf โ€” (BufSpec | None) where the incoming stuff lands, or None if you're not catching anything
  • source โ€” (int) who you're listening for
  • recvtag โ€” (int) the tag you're matching on the way in

Return type: Request


Isendrecv_replace(buf, dest, sendtag=0, source=ANY_SOURCE, recvtag=ANY_TAG)

Okay bestie, this one sends a message and receives one, and the tea is that the same buffer buf is used for both โ€” send it out, get the replacement back in the same spot. Recycling queen ๐Ÿ‘‘โœจ

Note: this function is guaranteed not to deadlock in situations where pairs of blocking sends and receives may deadlock. That's literally the whole point of it existing, no cap.
Caution: a common mistake when using this function is to mismatch the tags with the source and destination ranks, which can result in deadlock. So likeโ€ฆ double-check your tags, bestie, I'm begging ๐Ÿ™๐Ÿ’€

Parameters

  • buf โ€” (BufSpec) ๐Ÿซถ
  • dest โ€” (int)
  • sendtag โ€” (int)
  • source โ€” (int)
  • recvtag โ€” (int)

Return type: Request


Ishrink()

Nonblocking shrink a communicator to remove all failed processes. โœ‚๏ธ bye felicia, you're not in this group chat anymore.

Return type: tuple[Comm, Request] โ€” yes, a tuple, two things at once, it's giving multitasking ๐Ÿ’…


Issend(buf, dest, tag=0)

Nonblocking send in synchronous mode. It's the same vibe as the normal send but โœจsynchronousโœจ, and nonblocking, so your code keeps moving while it does its thing.

Parameters

  • buf โ€” (BufSpec) ๐ŸŒธ
  • dest โ€” (int) ๐ŸŽฏ
  • tag โ€” (int) ๐Ÿท๏ธ

Return type: Request


classmethod Join(fd)

Interconnect two processes connected by a socket. It's a classmethod, so call it on the class itself, not on an instance. ๐Ÿ”Œ

Parameters

  • fd โ€” (int) the file descriptor, literally just a number bestie

Return type: Intercomm


Mprobe(source=ANY_SOURCE, tag=ANY_TAG, status=None)

Blocking test for a matched message. ๐Ÿ‘€ It sits there and waits (blocks!) until a message that actually matches shows up โ€” matched, as in the source/tag actually line up. No match, no return.

Parameters

  • source โ€” (int) ๐ŸŒˆ
  • tag โ€” (int)
  • status โ€” (Status | None) ๐ŸŽ€

Return type: Message


Precv_init(buf, partitions, source=ANY_SOURCE, tag=ANY_TAG, info=INFO_NULL)

Create a request for a partitioned recv operation. Partitioned, as in partitions chunks of the buffer, and you get a Prequest back so you can fire it off whenever. ๐Ÿงš

Parameters

  • buf โ€” (BufSpec)
  • partitions โ€” (int)
  • source โ€” (int)
  • tag โ€” (int)
  • info โ€” (Info)

Return type: Prequest


Probe(source=ANY_SOURCE, tag=ANY_TAG, status=None)

Blocking test for a message. It just tells you if a message is there and gives you the status tea.

Note: this function blocks until the message arrives. So do not call it if you were hoping to do literally anything else in the meantime. ๐Ÿ˜ญ

Parameters

  • source โ€” (int)
  • tag โ€” (int)
  • status โ€” (Status | None)

Return type: Literal[True] โ€” that's it. True. Iconic, honestly. โœ…


Psend_init(buf, partitions, dest, tag=0, info=INFO_NULL)

Create a request for a partitioned send operation. Same partitioned energy as Precv_init but going out instead of coming in. ๐Ÿ’Œ

Parameters

  • buf โ€” (BufSpec)
  • partitions โ€” (int)
  • dest โ€” (int)
  • tag โ€” (int)
  • info โ€” (Info)

Return type: Prequest


Recv(buf, source=ANY_SOURCE, tag=ANY_TAG, status=None)

Blocking receive. Classic. The bread and butter. ๐Ÿž๐Ÿงˆ

Note: this function blocks until the message is received. It will simply sit there. Patiently. Forever if it has to.

Parameters

  • buf โ€” (BufSpec) the landing zone ๐Ÿ›ฌ
  • source โ€” (int)
  • tag โ€” (int)
  • status โ€” (Status | None)

Return type: None


Recv_init(buf, source=ANY_SOURCE, tag=ANY_TAG)

Create a persistent request for a receive. Persistent, as in you set it up once and reuse it, which is a whole mood. ๐Ÿ”

Parameters

  • buf โ€” (BufSpec)
  • source โ€” (int)
  • tag โ€” (int)

Return type: Prequest


Reduce(sendbuf, recvbuf, op=SUM, root=0)

Reduce to Root. Everybody's sending their data in and it all gets squished together with op (default SUM, so we're adding ๐Ÿ’…) and the result ends up at rank root.

Parameters

  • sendbuf โ€” (BufSpec | InPlace)
  • recvbuf โ€” (BufSpec | None)
  • op โ€” (Op)
  • root โ€” (int)

Return type: None


Reduce_init(sendbuf, recvbuf, op=SUM, root=0, info=INFO_NULL)

Persistent Reduce to Root. Same deal as above, but you get a Prequest you can launch over and over. ๐Ÿฆ‹

Parameters

  • sendbuf โ€” (BufSpec | InPlace)
  • recvbuf โ€” (BufSpec | None)
  • op โ€” (Op)
  • root โ€” (int)
  • info โ€” (Info)

Return type: Prequest


Reduce_scatter(sendbuf, recvbuf, recvcounts=None, op=SUM)

Reduce-Scatter, vector version. Everybody reduces, then the result gets scattered out in uneven little pieces โ€” recvcounts is how you say who gets how much. ๐Ÿ“๐Ÿ“๐Ÿ“

Parameters

  • sendbuf โ€” (BufSpec | InPlace)
  • recvbuf โ€” (BufSpec)
  • recvcounts โ€” (Sequence[int] | None)
  • op โ€” (Op)

Return type: None


Reduce_scatter_block(sendbuf, recvbuf, op=SUM)

Reduce-Scatter Block โ€” the regular, non-vector version. No recvcounts list here, everyone just gets the same amount, periodt. ๐Ÿ‘‘

Parameters

  • sendbuf โ€” (BufSpecB | InPlace)
  • recvbuf โ€” (BufSpec | BufSpecB)
  • op โ€” (Op)

Return type: None


Reduce_scatter_block_init(sendbuf, recvbuf, op=SUM, info=INFO_NULL)

Persistent Reduce-Scatter Block โ€” again, the regular, non-vector version, but now you get a reusable Prequest out of it. ๐ŸŽ€โœจ

Parameters

  • sendbuf โ€” (BufSpecB | InPlace)
  • recvbuf โ€” (BufSpec | BufSpecB)
  • op โ€” (Op)
  • info โ€” (Info)

Return type: Prequest

Return type: Prequest


๐Ÿซถ Reduce_scatter_init(sendbuf, recvbuf, recvcounts=None, op=SUM, info=INFO_NULL)

Persistent Reduce-Scatter, but make it the vector version โœจ (so every rank can get a different amount, no cap).

Parameters

  • sendbuf โ€” BufSpec or InPlace
  • recvbuf โ€” BufSpec
  • recvcounts โ€” Sequence[int] or None
  • op โ€” Op
  • info โ€” Info

Return type: Prequest


๐Ÿ’… Revoke()

Revoke a communicator. Yeah bestie, it's exactly what it sounds like ๐Ÿซ 

Return type: None


๐Ÿ“ Rsend(buf, dest, tag=0)

Blocking send, but in ready mode ๐Ÿ”ฅ (so the matching receive better already be posted, iykyk).

Parameters

  • buf โ€” BufSpec
  • dest โ€” int
  • tag โ€” int

Return type: None


๐Ÿงš Rsend_init(buf, dest, tag=0)

A persistent request for a send in ready mode. Set it up once, fire it off forever, slay ๐Ÿ’ซ

Parameters

  • buf โ€” BufSpec
  • dest โ€” int
  • tag โ€” int

Return type: Request


๐ŸŒˆ Scatter(sendbuf, recvbuf, root=0)

Scatter data from one process out to all the other processes ๐Ÿฆ‹ one root, everybody gets a piece, we love a distribution moment.

Parameters

  • sendbuf โ€” BufSpecB or None
  • recvbuf โ€” BufSpec or InPlace
  • root โ€” int

Return type: None


โญ Scatter_init(sendbuf, recvbuf, root=0, info=INFO_NULL)

Persistent Scatter ๐Ÿ’– set it up one time, then just keep hitting it.

Parameters

  • sendbuf โ€” BufSpecB or None
  • recvbuf โ€” BufSpec or InPlace
  • root โ€” int
  • info โ€” Info

Return type: Prequest


๐ŸŽ€ Scatterv(sendbuf, recvbuf, root=0)

Scatter Vector ๐ŸŒธ

Scatter data from one process to all other processes, except here you get to hand out different amounts of data and displacements โ€” everyone gets a custom-sized lil gift ๐ŸŽ

Parameters

  • sendbuf โ€” BufSpecV or None
  • recvbuf โ€” BufSpec or InPlace
  • root โ€” int

Return type: None


๐Ÿ’œ Scatterv_init(sendbuf, recvbuf, root=0, info=INFO_NULL)

Persistent Scatter Vector ๐Ÿ’… the custom-sized-gift version, but make it reusable.

Parameters

  • sendbuf โ€” BufSpecV or None
  • recvbuf โ€” BufSpec or InPlace
  • root โ€” int
  • info โ€” Info

Return type: Prequest


๐Ÿ‘‘ Send(buf, dest, tag=0)

Blocking send. The classic. The icon. The moment ๐Ÿซถ

Note: This function may block until the message is received. Whether Send blocks or not depends on several factors and is implementation dependent. So likeโ€ฆ don't build your whole personality around it returning immediately, okay? ๐Ÿ˜ญ

Parameters

  • buf โ€” BufSpec
  • dest โ€” int
  • tag โ€” int

Return type: None


โœจ Send_init(buf, dest, tag=0)

Create a persistent request for a standard send ๐Ÿ’–

Parameters

  • buf โ€” BufSpec
  • dest โ€” int
  • tag โ€” int

Return type: Prequest


๐Ÿฆ‹ Sendrecv(sendbuf, dest, sendtag=0, recvbuf=None, source=ANY_SOURCE, recvtag=ANY_TAG, status=None)

Send and receive a message. One call, two jobs, main character energy fr fr ๐Ÿ”ฅ

Note: This function is guaranteed not to deadlock in situations where pairs of blocking sends and receives may deadlock. So it's the safe bestie in a room full of risky ones ๐Ÿ’š
Caution: A common mistake when using this function is to mismatch the tags with the source and destination ranks, which can result in deadlock. Do NOT do this. It's giving chaos and not the cute kind ๐Ÿ’€

Parameters

  • sendbuf โ€” BufSpec
  • dest โ€” int
  • sendtag โ€” int
  • recvbuf โ€” BufSpec or None
  • source โ€” int
  • recvtag โ€” int
  • status โ€” Status or None

Return type: None


๐Ÿ’ซ Sendrecv_replace(buf, dest, sendtag=0, source=ANY_SOURCE, recvtag=ANY_TAG, status=None)

Send and receive a message. Same vibe as above, but the buffer gets replaced in place ๐ŸŒธ

Note: This function is guaranteed not to deadlock in situations where pairs of blocking sends and receives may deadlock. Obsessed with the reliability honestly ๐Ÿ’š
Caution: A common mistake when using this function is to mismatch the tags with the source and destination ranks, which can result in deadlock. Yeah bestie, same trap, don't fall in it ๐Ÿ™ˆ

Parameters

  • buf โ€” BufSpec
  • dest โ€” int
  • sendtag โ€” int
  • source โ€” int
  • recvtag โ€” int
  • status โ€” Status or None

Return type: None


๐ŸŽ€ Set_attr(keyval, attrval)

Store an attribute value associated with a key ๐Ÿ—๏ธ lil key-value situation, keep it cute.

Parameters

  • keyval โ€” int
  • attrval โ€” Any

Return type: None


๐ŸŒŸ Set_errhandler(errhandler)

Set the error handler for a communicator ๐Ÿšจ decide once and for all how you wanna be told things went wrong.

Parameters

  • errhandler โ€” Errhandler

Return type: None


๐Ÿซง Set_info(info)

Set new values for the hints associated with a communicator ๐Ÿ’ญ updating the vibe notes.

Parameters

  • info โ€” Info

Return type: None


๐Ÿ’– Set_name(name)

Set the print name for this communicator ๐Ÿท๏ธ give it a little nickname so it shows up cute in debug output.

Parameters

  • name โ€” str
  • Return type: None โ€” yeah, nothing comes back out of this one, and that's the whole vibe ๐Ÿ’…
  • Shrink() โ€” shrinks a communicator, and by shrink I mean it removes all failed processes so the group can keep it moving. Collective glow-down. ๐Ÿงš
    • Return type: Comm
  • Split(color=0, key=0) โ€” splits the communicator up by color and key. Sorting-hat energy, fr fr. ๐ŸŽ€
    • Parameters:
      • color (int)
      • key (int)
    • Return type: Comm
  • Split_type(split_type, key=0, info=INFO_NULL) โ€” same split energy but this time you're splitting by split type, and you can pass Info along for the ride. โœจ
    • Parameters:
      • split_type (int)
      • key (int)
      • info (Info)
    • Return type: Comm
  • Ssend(buf, dest, tag=0) โ€” a blocking send, but make it synchronous mode. It's giving "I'm not done until you've acknowledged me," no cap. ๐Ÿ˜ค
    • Parameters:
      • buf (BufSpec)
      • dest (int)
      • tag (int)
    • Return type: None
  • Ssend_init(buf, dest, tag=0) โ€” a persistent request for a send in synchronous mode. Set it up now, fire it whenever. So organized. ๐Ÿ’…
    • Parameters:
      • buf (BufSpec)
      • dest (int)
      • tag (int)
    • Return type: Request
  • allgather(sendobj) โ€” Gather to All. Everybody gets everybody's stuff. Sharing is caring, bestie. ๐Ÿซถ
    • Parameters:
      • sendobj (Any)
    • Return type: list[Any]
  • allreduce(sendobj, op=SUM) โ€” Reduce to All. Everyone does the reduction, everyone gets the answer. The most democratic thing in this whole file. ๐Ÿ‘‘
    • Parameters:
      • sendobj (Any)
      • op (Op | Callable[[Any, Any], Any])
    • Return type: Any
  • alltoall(sendobj) โ€” All to All Scatter/Gather. Chaotic but make it organized. ๐ŸŒˆ
    • Parameters:
      • sendobj (Sequence[Any])
    • Return type: list[Any]
  • barrier() โ€” Barrier synchronization. Everyone waits right here together, no cutting the line, no exceptions. โœ‹
    • Note: This method is equivalent to Barrier.
    • Return type: None
  • bcast(obj, root=0) โ€” Broadcast. root yells, everyone hears it. ๐Ÿ“ข
    • Parameters:
      • obj (Any)
      • root (int)
    • Return type: Any
  • bsend(obj, dest, tag=0) โ€” send, but in buffered mode. The message chills in a buffer until it's ready to go. ๐Ÿ“
    • Parameters:
      • obj (Any)
      • dest (int)
      • tag (int)
    • Return type: None
  • classmethod f2py(arg) โ€” it's a classmethod, it takes arg, it hands back a Comm. No description given, it's just out here being mysterious. ๐Ÿ™ˆ
    • Parameters:
      • arg (int)
    • Return type: Comm
  • free() โ€” calls Free if it's not null and not predefined. Basically: if you're not nothing and you're not already special, you're free to go, bestie. ๐Ÿฆ‹
    • Return type: None
  • classmethod fromhandle(handle) โ€” creates an object from an MPI handle. Full glow-up, handle to object, iconic. โœจ
    • Parameters:
      • handle (int)
    • Return type: Comm
  • classmethod fromint(arg, /) โ€” translates an integer handle into an object. Also note that lone / โ€” arg is positional-only, so don't try to get cute with keywords. ๐Ÿ’…
    • Parameters:
      • arg (int)
    • Return type: Comm
  • gather(sendobj, root=0) โ€” Gather. Everything gets pulled in to root, and everyone else just vibes. ๐Ÿ”ฅ
    • Parameters:
      • sendobj (Any)
      • root (int)
    • Return type: list[Any] | None
  • ibsend(obj, dest, tag=0) โ€” nonblocking send in buffered mode. Same buffered energy, but you don't sit around waiting for it. ๐Ÿƒโ€โ™€๏ธ
    • Parameters:
      • obj (Any)
      • dest (int)
      • tag (int)
    • Return type: Request
  • improbe(source=ANY_SOURCE, tag=ANY_TAG, status=None) โ€” nonblocking test for a matched message. Peeking to see if your message has arrived and is ready to be matched up. ๐Ÿ‘€
    • Parameters:
      • source (int)
      • tag (int)
      • status (Status | None)
    • Return type: Message | None
  • iprobe(source=ANY_SOURCE, tag=ANY_TAG, status=None) โ€” nonblocking test for a message. Just checking, not committing. ๐Ÿซฃ
    • Parameters:
      • source (int)
      • tag (int)
      • status (Status | None)
    • Return type: bool
  • irecv(buf=None, source=ANY_SOURCE, tag=ANY_TAG) โ€” nonblocking receive. It comes back with a Request immediately and you deal with the rest later. Main character time management. โฐ
    • Parameters:
      • buf (Buffer | None)
      • source (int)
      • tag (int)
    • Return type: Request
  • isend(obj, dest, tag=0) โ€” nonblocking send. Drop it and keep moving, bestie. ๐Ÿ’จ
    • Parameters:
      • obj (Any)
      • dest (int)
      • tag (int)
    • Return type: Request
  • issend(obj, dest, tag=0) โ€” nonblocking send in synchronous mode. Both at once, obsessed with the range. ๐ŸŒŸ
    • Parameters:
      • obj (Any)
      • dest (int)
      • tag (int)
    • Return type: Request
  • mprobe(source=ANY_SOURCE, tag=ANY_TAG, status=None) โ€” blocking test for a matched message. ๐Ÿ’…

So like, probe is the vibe-check version, but mprobe is the full matched message tea. It waits until a matching message actually lands, then hands you the whole thing. no cap.

Parameters

  • source โ€” int
  • tag โ€” int
  • status โ€” Status or None

Return type: Message

  • probe(source=ANY_SOURCE, tag=ANY_TAG, status=None) โ€” blocking test for a message. โœจ

It literally just blocks until some message shows up, then tells you yes. It's giving "is anyone there??" energy, bestie.

Parameters

  • source โ€” int
  • tag โ€” int
  • status โ€” Status or None

Return type: Literal[True]

  • py2f() โ€” no description in the original, it's just out here doing its thing. ๐Ÿฆ‹

Return type: int

  • recv(buf=None, source=ANY_SOURCE, tag=ANY_TAG, status=None) โ€” receive. ๐Ÿ“ฅ

The main character of message-passing ngl. You get a message, you get an answer, slay.

Parameters

  • buf โ€” Buffer or None
  • source โ€” int
  • tag โ€” int
  • status โ€” Status or None

Return type: Any

  • reduce(sendobj, op=SUM, root=0) โ€” reduce to root. ๐ŸŒ€

Everyone sends their little contribution, everything gets smooshed together with op, and the result goes to the root. Iconic group-project behaviour, except this one actually works.

Parameters

  • sendobj โ€” Any
  • op โ€” Op or Callable[[Any, Any], Any]
  • root โ€” int

Return type: Any or None

  • scatter(sendobj, root=0) โ€” scatter. ๐ŸŒˆ

The reverse of gather, fr fr. One big chunk gets split up and yeeted out to everyone from the root.

Parameters

  • sendobj โ€” Sequence[Any] or None
  • root โ€” int

Return type: Any

  • send(obj, dest, tag=0) โ€” send in standard mode. ๐Ÿš€

Parameters

  • obj โ€” Any
  • dest โ€” int
  • tag โ€” int

Return type: None

  • sendrecv(sendobj, dest, sendtag=0, recvbuf=None, source=ANY_SOURCE, recvtag=ANY_TAG, status=None) โ€” send and receive. ๐Ÿ”ฅ

Sending and receiving at the same time?? multitasking queen behaviour, honestly.

Parameters

  • sendobj โ€” Any
  • dest โ€” int
  • sendtag โ€” int
  • recvbuf โ€” Buffer or None
  • source โ€” int
  • recvtag โ€” int
  • status โ€” Status or None

Return type: Any

  • ssend(obj, dest, tag=0) โ€” send in synchronous mode. โณ

Parameters

  • obj โ€” Any
  • dest โ€” int
  • tag โ€” int

Return type: None

  • toint() โ€” translate object to integer handle. ๐Ÿ”ข

Return type: int


๐ŸŽ€ Attributes Documentation ๐ŸŽ€

  • group โ€” Group.
  • handle โ€” MPI handle.
  • info โ€” Info hints.
  • is_inter โ€” is intercommunicator.
  • is_intra โ€” is intracommunicator.
  • is_topo โ€” is a topology.
  • name โ€” print name.
  • rank โ€” rank of this process.
  • size โ€” number of processes.
  • topology โ€” topology type.

๐Ÿฆ‹ mpi4py.MPI.Datatype ๐Ÿฆ‹

class mpi4py.MPI.Datatype

Bases: object

Datatype object. it's giving very "I am the blueprint" energy ๐Ÿ’œ

static __new__(cls, datatype=None)

Parameters

  • datatype โ€” Datatype or None

Return type: Self

โœจ Methods Summary โœจ

okay bestie, here's the whole menu of Datatype methods, no skips, no cap ๐Ÿ’…

  • Commit() โ€” commit the datatype. it's giving "yes i'm ready now" ๐Ÿซถ
  • Create_contiguous(count) โ€” create a contiguous datatype.
  • Create_darray(size, rank, gsizes, distribs, ...) โ€” create a datatype for a distributed array on Cartesian process grids.
  • Create_f90_complex(p, r) โ€” return a bounded complex datatype.
  • Create_f90_integer(r) โ€” return a bounded integer datatype.
  • Create_f90_real(p, r) โ€” return a bounded real datatype.
  • Create_hindexed(blocklengths, displacements) โ€” create an indexed datatype.
  • Create_hindexed_block(blocklength, displacements) โ€” create an indexed datatype with constant-sized blocks.
  • Create_hvector(count, blocklength, stride) โ€” create a vector (strided) datatype with stride in bytes.
  • Create_indexed(blocklengths, displacements) โ€” create an indexed datatype.
  • Create_indexed_block(blocklength, displacements) โ€” create an indexed datatype with constant-sized blocks.
  • Create_keyval([copy_fn, delete_fn, nopython]) โ€” create a new attribute key for datatypes.
  • Create_resized(lb, extent) โ€” create a datatype with a new lower bound and extent.
  • Create_struct(blocklengths, displacements, ...) โ€” create a general composite (struct) datatype.
  • Create_subarray(sizes, subsizes, starts[, order]) โ€” create a datatype for a subarray of a multidimensional array.
  • Create_vector(count, blocklength, stride) โ€” create a vector (strided) datatype.
  • Delete_attr(keyval) โ€” delete attribute value associated with a key.
  • Dup() โ€” duplicate a datatype.
  • Free() โ€” free the datatype.
  • Free_keyval(keyval) โ€” free an attribute key for datatypes.
  • Get_attr(keyval) โ€” retrieve attribute value by key.
  • Get_contents() โ€” return the input arguments used to create a datatype.
  • Get_envelope() โ€” return the number of input arguments used to create a datatype.
  • Get_extent() โ€” return lower bound and extent of datatype.
  • Get_name() โ€” get the print name for this datatype.
  • Get_size() โ€” return the number of bytes occupied by entries in the datatype.
  • Get_true_extent() โ€” return the true lower bound and extent of a datatype.
  • Get_value_index(value, index) โ€” return a predefined pair datatype.
  • Match_size(typeclass, size) โ€” find a datatype matching a specified size in bytes.

  • Unpack(inbuf, position, outbuf, comm) โ€” unpacks from contiguous memory according to datatype ๐Ÿ“ฆ
  • Unpack_external(datarep, inbuf, position, outbuf) โ€” unpacks from contiguous memory according to datatype ๐Ÿ“ฆ
  • decode() โ€” convenience method for decoding a datatype, so cute of her ๐Ÿ’–
  • f2py(arg) โ€” (bestie the docs really just left this one blank, no cap ๐Ÿ’€)
  • free() โ€” calls Free if not null or predefined ๐Ÿงน
  • fromcode(code) โ€” gets a predefined MPI datatype from a character code or type string ๐Ÿ”ค
  • fromhandle(handle) โ€” creates an object from an MPI handle โœจ
  • fromint(arg, /) โ€” translates an integer handle to an object ๐Ÿ”ข
  • py2f() โ€” (again, nothing here, the void stared back ๐Ÿ™ˆ)
  • tocode() โ€” gets a character code or type string from a predefined MPI datatype ๐Ÿ”ค
  • toint() โ€” translates an object to an integer handle ๐Ÿ”ข

โœจ Attributes Summary โœจ

okay these are the lil properties you can just... read off a datatype, no method call needed, we love a low-effort slay ๐ŸŽ€

  • combiner โ€” Combiner.
  • contents โ€” Contents.
  • envelope โ€” Envelope.
  • extent โ€” Extent.
  • handle โ€” MPI handle.
  • is_named โ€” Is a named datatype.
  • is_predefined โ€” Is a predefined datatype.
  • lb โ€” Lower bound.
  • name โ€” Print name.
  • size โ€” Size (in bytes).
  • true_extent โ€” True extent.
  • true_lb โ€” True lower bound.
  • true_ub โ€” True upper bound.
  • typechar โ€” Character code.
  • typestr โ€” Type string.
  • ub โ€” Upper bound.

โœจ Methods Documentation โœจ

the actual receipts, one method at a time ๐Ÿ’…

Commit()

commits the datatype. that's it, that's the whole vibe โ€” she's committed now ๐Ÿ’

Return type

Create_contiguous(count)

creates a contiguous datatype ๐Ÿงฑ

Parameters

Return type

  • Self โ€” https://docs.python.org/3/library/typing.html#typing.Self
  • Create_darray(size, rank, gsizes, distribs, dargs, psizes, order=ORDER_C) โ€” bestie this one literally builds you a datatype for a distributed array sitting on top of Cartesian process grids. very main character of it. ๐Ÿ’ซ
    • size (int)
    • rank (int)
    • gsizes (Sequence[int])
    • distribs (Sequence[int])
    • dargs (Sequence[int])
    • psizes (Sequence[int])
    • order (int)
    • Returns: Self
  • Create_f90_complex(p, r) (classmethod) โ€” hands you back a bounded complex datatype. that's it that's the whole vibe. โœจ
    • p (int)
    • r (int)
    • Returns: Self
  • Create_f90_integer(r) (classmethod) โ€” a bounded integer datatype, freshly served, no notes. ๐Ÿงš
    • r (int)
    • Returns: Self
  • Create_f90_real(p, r) (classmethod) โ€” yep you guessed it, a bounded real datatype. iconic, consistent, we love a trio. ๐Ÿ’œ
    • p (int)
    • r (int)
    • Returns: Self
  • Create_hindexed(blocklengths, displacements) โ€” makes an indexed datatype for you. ngl it's giving structured-data energy.
๐Ÿšจ heads up bestie: the displacements here are measured in bytes. do not come for me, that's just how it is.
  • blocklengths (Sequence[int])
  • displacements (Sequence[int])
  • Returns: Self
  • Create_hindexed_block(blocklength, displacements) โ€” indexed datatype but every single block is the same size. uniform, tidy, lowkey obsessed. ๐ŸŽ€
๐Ÿšจ same warning, same energy: displacements are measured in bytes.
  • blocklength (int)
  • displacements (Sequence[int])
  • Returns: Self
  • Create_hvector(count, blocklength, stride) โ€” a vector (strided) datatype where the stride is in bytes. she's strutting fr fr. ๐Ÿ”ฅ
    • count (int)
    • blocklength (int)
    • stride (int)
    • Returns: Self
  • Create_indexed(blocklengths, displacements) โ€” an indexed datatype. the h-free sibling, still slaying. ๐Ÿ’…
    • blocklengths (Sequence[int])
    • displacements (Sequence[int])
    • Returns: Self
  • Create_indexed_block(blocklength, displacements) โ€” indexed datatype with constant-sized blocks. blocklength stays one single number, she doesn't do ranges. โœจ
    • blocklength (int)
    • displacements (Sequence[int])
    • Returns: Self
  • Create_keyval(copy_fn=None, delete_fn=None, nopython=False) (classmethod) โ€” creates a brand new attribute key for datatypes and returns the key as an int. giving registry energy, honestly. ๐Ÿ‘‘
    • copy_fn (Callable[[Datatype, int, Any], Any] | None)
    • delete_fn (Callable[[Datatype, int, Any], None] | None)
    • nopython (bool)
    • Returns: int
  • Create_resized(lb, extent) โ€” creates a datatype with a whole new lower bound and extent. glow-up but for byte layouts. ๐Ÿฆ‹
    • lb (int)
    • extent (int)
    • Returns: Self
  • Create_struct(blocklengths, displacements, datatypes) (classmethod) โ€” the big one: a general composite (struct) datatype. this is the everything-everywhere-all-at-once of datatypes. ๐ŸŒˆ
๐Ÿšจ you know the drill by now: displacements are measured in bytes.
  • blocklengths (Sequence[int])
  • displacements (Sequence[int])
  • datatypes (Sequence[Datatype])
  • Returns: Self
  • Create_subarray(sizes, subsizes, starts, order=ORDER_C) โ€” creates a datatype for a subarray carved out of a multidimensional array. tiny slice, big energy. ๐Ÿ“
    • sizes (Sequence[int])
    • subsizes (Sequence[int])
    • starts (Sequence[int])
  • order (int) โ€” an int bestie, that's the whole vibe ๐Ÿซถ

Return type โ€” Self โœจ


Create_vector(count, blocklength, stride) ๐Ÿงš

Makes a vector (strided) datatype. literally the moment you needed structure with โœจgapsโœจ in it, no cap ๐Ÿ’…

Parameters

  • count (int)
  • blocklength (int)
  • stride (int)

Return type โ€” Self ๐ŸŒธ


Delete_attr(keyval) ๐ŸŽ€

Yeets the attribute value that's hanging out with a key. bye boo ๐Ÿ‘‹

Parameters

  • keyval (int)

Return type โ€” None ๐Ÿ’€


Dup() ๐Ÿฆ‹

Duplicates a datatype. it's giving copy-and-paste but make it MPI โœจ

Return type โ€” Self ๐Ÿ’–


Free() ๐Ÿซถ

Frees the datatype. release it into the wild, bestie ๐Ÿ•Š๏ธ

Return type โ€” None ๐Ÿ’€


classmethod Free_keyval(keyval) ๐Ÿ‘‘

Frees an attribute key for datatypes. key said "my time has come" โœจ

Parameters

  • keyval (int)

Return type โ€” int ๐Ÿ’…


Get_attr(keyval) ๐Ÿ”ฅ

Retrieves an attribute value by key. like a lil lookup, but iconic ๐ŸŒˆ

Parameters

  • keyval (int)

Return type โ€” int | Any | None ๐Ÿ’œ


Get_contents() โญ

Returns the input arguments you used to create a datatype. it's the receipts, bestie, the whole origin story ๐Ÿงพโœจ

Return type

tuple[list[int], list[int], list[int], list[Datatype]]

Get_envelope() ๐ŸŒธ

Returns how many input arguments went into creating a datatype. the headcount of the situation ๐ŸŽ€

Return type

tuple[int, int, int, int, int]

Get_extent() ๐Ÿฆ‹

Returns the lower bound and the extent of the datatype. two numbers, one destiny ๐Ÿ’ซ

Return type

tuple[int, int]

Get_name() ๐Ÿท๏ธ

Gets the print name for this datatype. what it calls itself ๐Ÿ’…

Return type โ€” str โœจ


Get_size() ๐Ÿ“

Returns the number of bytes that the entries in the datatype occupy. size check but for memory, slay ๐Ÿ’–

Return type โ€” int ๐Ÿ”ฅ


Get_true_extent() ๐Ÿ’Ž

Returns the true lower bound and extent of a datatype. the honest version, no filter, periodt ๐Ÿซถ

Return type

tuple[int, int]

classmethod Get_value_index(value, index) ๐Ÿ‘‘

Returns a predefined pair datatype. a lil matched set, iconic behavior ๐ŸŽ€

Parameters

  • value (Datatype)
  • index (Datatype)

Return type โ€” Self โญ


classmethod Match_size(typeclass, size) ๐Ÿงš

Finds a datatype that matches a specified size in bytes. it's giving matchmaking but for types ๐Ÿ’˜

Parameters

  • typeclass (int)
  • size (int)

Return type โ€” Self ๐ŸŒˆ


Pack(inbuf, outbuf, position, comm) ๐ŸŽ’

Packs into contiguous memory according to the datatype. squish it in there bestie โœจ

Parameters

  • inbuf (BufSpec)
  • outbuf (BufSpec)
  • position (int)
  • comm (Comm)

Return type โ€” int ๐Ÿ’œ


Pack_external(datarep, inbuf, outbuf, position) ๐ŸŒ

Packs into contiguous memory according to the datatype.

Uses the portable data representation external32. travel-ready, no cap ๐Ÿงณโœจ

Parameters

  • datarep (str)
  • inbuf (BufSpec)
  • outbuf (BufSpec)
  • position (int)

Return type โ€” int ๐Ÿ”ฅ


Pack_external_size(datarep, count) ๐Ÿ“ฆ

Figures out how much space you need to pack a message.

Uses the portable data representation external32. same travel energy ๐Ÿ’ซ

Note: returns an upper bound measured in bytes. so it's an estimate, bestie, don't come for it ๐Ÿ™ˆ

Parameters

  • datarep (str)
  • count (int)

Return type โ€” int ๐Ÿ’…


Pack_size(count, comm) ๐Ÿ“

Figures out how much space you need to pack a message. the calculator moment ๐Ÿงฎโœจ

Note: returns an upper bound measured in bytes. again โ€” upper bound, not the tea, just the ceiling ๐Ÿซถ

Parameters

  • count (int)
  • comm (Comm)

Return type โ€” int ๐Ÿ’–


Set_attr(keyval, attrval) ๐ŸŽ€

Stores an attribute value associated with a key. put it in the vault, bestie ๐Ÿ”

Parameters

  • keyval (int)
  • attrval (Any)

Return type โ€” None ๐Ÿ’€


Set_name(name) ๐Ÿท๏ธ

Sets the print name for this datatype. rebrand szn โœจ

Parameters

  • name (str)

Return type โ€” None ๐Ÿ’€


Unpack(inbuf, position, outbuf, comm) ๐ŸŽ

Unpacks from contiguous memory according to the datatype. the un-squish, we love to see it ๐ŸŒˆ

Parameters

  • inbuf (BufSpec)
  • position (int)
  • outbuf (BufSpec)
  • comm (Comm)

Return type โ€” int ๐Ÿ”ฅ


Unpack_external(datarep, inbuf, position, outbuf) ๐ŸŒ

Unpacks from contiguous memory according to the datatype.

Uses the portable data representation external32. ๐Ÿงณ

Parameters

  • datarep (str)
  • inbuf (BufSpec)
  • position (int)
  • outbuf (BufSpec)

decode() โ€” convenience method for decoding a datatype ๐Ÿ’…

Return type: tuple <https://docs.python.org/3/library/stdtypes.html#tuple>[Datatype <#mpi4py.MPI.Datatype>, str <https://docs.python.org/3/library/stdtypes.html#str>, dict <https://docs.python.org/3/library/stdtypes.html#dict>[str <https://docs.python.org/3/library/stdtypes.html#str>, Any <https://docs.python.org/3/library/typing.html#typing.Any>]]


classmethod f2py(arg)

Return type: Datatype <#mpi4py.MPI.Datatype>


free() โ€” Call Free if not null or predefined. bestie it literally just tidies up ๐Ÿ’–

Return type: None <https://docs.python.org/3/library/constants.html#None>


classmethod fromcode(code) โ€” Get a predefined MPI datatype from a character code or type string. iykyk โœจ

Return type: Datatype <#mpi4py.MPI.Datatype>


classmethod fromhandle(handle) โ€” Create an object from an MPI handle. giving very much "make me a real one from this int" ๐Ÿช„

Return type: Datatype <#mpi4py.MPI.Datatype>


classmethod fromint(arg, /) โ€” Translate an integer handle to an object.

Return type: Datatype <#mpi4py.MPI.Datatype>


py2f()

Return type: int <https://docs.python.org/3/library/functions.html#int>


tocode() โ€” Get a character code or type string from a predefined MPI datatype.

Return type: str <https://docs.python.org/3/library/stdtypes.html#str>


toint() โ€” Translate an object to an integer handle.

Return type: int <https://docs.python.org/3/library/functions.html#int>


โœจ Attributes Documentation โœจ

  • combiner โ€” Combiner.
  • contents โ€” Contents.
  • envelope โ€” Envelope.
  • extent โ€” Extent.
  • handle โ€” MPI handle.
  • is_named โ€” Is a named datatype.
  • is_predefined โ€” Is a predefined datatype.
  • lb โ€” Lower bound.
  • name โ€” Print name.
  • size โ€” Size (in bytes).
  • true_extent โ€” True extent.
  • true_lb โ€” True lower bound.
  • true_ub โ€” True upper bound.
  • typechar โ€” Character code.
  • typestr โ€” Type string.
  • ub โ€” Upper bound.

๐Ÿฆ‹ mpi4py.MPI.Distgraphcomm

class mpi4py.MPI.Distgraphcomm

Bases: Topocomm <#mpi4py.MPI.Topocomm>

Distributed graph topology intracommunicator. okay so this is the โœจfancyโœจ communicator for distributed graphs, no cap ๐ŸŒˆ

static __new__(cls, comm=None)

Return type: Self <https://docs.python.org/3/library/typing.html#typing.Self>


Methods Summary ๐Ÿ“‹

  • Get_dist_neighbors() โ€” Return adjacency information for a distributed graph topology.
  • Get_dist_neighbors_count() โ€” Return adjacency information for a distributed graph topology.

Methods Documentation ๐Ÿ’–

Get_dist_neighbors() โ€” Return adjacency information for a distributed graph topology.

Return type: tuple <https://docs.python.org/3/library/stdtypes.html#tuple>[list <https://docs.python.org/3/library/stdtypes.html#list>[int <https://docs.python.org/3/library/functions.html#int>], list <https://docs.python.org/3/library/stdtypes.html#list>[int <https://docs.python.org/3/library/functions.html#int>], tuple <https://docs.python.org/3/library/stdtypes.html#tuple>[list <https://docs.python.org/3/library/stdtypes.html#list>[int <https://docs.python.org/3/library/functions.html#int>], list <https://docs.python.org/3/library/stdtypes.html#list>[int <https://docs.python.org/3/library/functions.html#int>]] | None <https://docs.python.org/3/library/constants.html#None>]


Get_dist_neighbors_count() โ€” Return adjacency information for a distributed graph topology.

Return type: int <https://docs.python.org/3/library/functions.html#int>


๐ŸŽ€ mpi4py.MPI.Errhandler

class mpi4py.MPI.Errhandler

Bases: object <https://docs.python.org/3/library/functions.html#object>

Error handler. the one who handles the drama when MPI throws a fit ๐Ÿ’…๐Ÿ˜ญ

static __new__(cls, errhandler=None)

Return type: Self <https://docs.python.org/3/library/typing.html#typing.Self>


Methods Summary ๐Ÿ“‹

  • Free() โ€” Free an error handler.
  • f2py(arg) โ€” (no description, bestie, it just is)
  • free() โ€” Call Free if not null.
  • fromhandle(handle) โ€” Create object from MPI handle.
  • fromint(arg, /) โ€” Translate integer handle to object.
  • py2f() โ€” (again, no description, we vibe)
  • toint() โ€” Translate object to integer handle.

Attributes Summary โœจ

  • handle โ€” MPI handle.

Methods Documentation ๐Ÿ’–

Free() โ€” Free an error handler.

Return type: None <https://docs.python.org/3/library/constants.html#None>


classmethod f2py(arg)

Return type: Errhandler <#mpi4py.MPI.Errhandler>


free() โ€” Call Free if not null.

Return type: None <https://docs.python.org/3/library/constants.html#None>


classmethod fromhandle(handle) โ€” Create object from MPI handle.

Return type: Errhandler <#mpi4py.MPI.Errhandler>


classmethod fromint(arg, /) โ€” Translate integer handle to object.

Return type: Errhandler <#mpi4py.MPI.Errhandler>


py2f()

  • toint() โ€” bestie this one takes the object and hands you back the integer handle for it. that's it, that's the whole job. so iconic of it ๐Ÿ’…

Return type: int


โœจ Attributes Documentation โœจ

  • handle โ€” the raw MPI handle, just vibing there as an attribute. this is the actual underlying thing, the real one, the main character ๐Ÿ‘‘

๐Ÿฆ‹ mpi4py.MPI.File ๐Ÿฆ‹

class mpi4py.MPI.File

Bases: object

okay so this is the File I/O context, periodt. it's the whole vibe for doing file stuff in MPI โ€” collective reads, collective writes, the works. lowkey one of the most useful little objects in the whole module ๐Ÿซถ

  • static __new__(cls, file=None)

the constructor situation. ngl it's static and it's __new__, so yes it's doing the fancy object-creation dance ๐Ÿ™ˆ

Parameters:

  • file (File | None) โ€” the file you're wrapping up in a fresh object, or None if you're not passing one. your call, bestie ๐Ÿ’–

Return type: Self โ€” it hands you back an instance of itself, as is only correct โœจ

โœจ Methods Summary โœจ

okay bestie, here's the whole menu of what a File object can do for you โ€” every single method, no skips, no gatekeeping ๐Ÿ’…

  • Call_errhandler(errorcode) โ€” rings up the error handler that's installed on a file. like, calling in backup for the drama ๐Ÿซถ
  • Close() โ€” closes a file. bye babe, it was real ๐Ÿ‘‹โœจ
  • Create_errhandler(errhandler_fn) โ€” builds you a shiny new error handler, but for files specifically ๐ŸŽ€
  • Delete(filename[, info]) โ€” deletes a file. gone, reduced to atoms ๐Ÿ’€
  • Get_amode() โ€” hands back the file access mode.
  • Get_atomicity() โ€” hands back the atomicity mode.
  • Get_byte_offset(offset) โ€” gives you the absolute byte position in the file ๐Ÿ“
  • Get_errhandler() โ€” gets the error handler for a file.
  • Get_group() โ€” lets you access the group of processes that opened the file. the whole squad, together ๐Ÿ‘‘
  • Get_info() โ€” returns the current hints for a file.
  • Get_position() โ€” returns the current position of the individual file pointer.
  • Get_position_shared() โ€” returns the current position of the shared file pointer.
  • Get_size() โ€” returns the file size.
  • Get_type_extent(datatype) โ€” returns the extent of datatype in the file.
  • Get_view() โ€” returns the file view. main character reveal energy ๐ŸŒˆ
  • Iread(buf) โ€” nonblocking read using the individual file pointer.
  • Iread_all(buf) โ€” nonblocking collective read using the individual file pointer.
  • Iread_at(offset, buf) โ€” nonblocking read using an explicit offset.
  • Iread_at_all(offset, buf) โ€” nonblocking collective read using an explicit offset.
  • Iread_shared(buf) โ€” nonblocking read using the shared file pointer.
  • Iwrite(buf) โ€” nonblocking write using the individual file pointer.
  • Iwrite_all(buf) โ€” nonblocking collective write using the individual file pointer.
  • Iwrite_at(offset, buf) โ€” nonblocking write using an explicit offset.
  • Iwrite_at_all(offset, buf) โ€” nonblocking collective write using an explicit offset.
  • Iwrite_shared(buf) โ€” nonblocking write using the shared file pointer.
  • Open(comm, filename[, amode, info]) โ€” opens a file. the classic, the icon, the moment ๐ŸŒŸ
  • Preallocate(size) โ€” preallocates storage space for a file. manifesting that space before you even need it ๐Ÿ”ฎ
  • Read(buf[, status]) โ€” read using the individual file pointer.
  • Read_all(buf[, status]) โ€” collective read using the individual file pointer.
  • Read_all_begin(buf) โ€” starts a split collective read using the individual file pointer.
  • Read_all_end(buf[, status]) โ€” wraps up a split collective read that was using the individual file pointer ๐Ÿ’–
  • Read_at(offset, buf[, status]) โ€” reads at an offset you literally hand it, no pointer drama โœจ
  • Read_at_all(offset, buf[, status]) โ€” the collective version of reading at an explicit offset ๐ŸŽ€
  • Read_at_all_begin(offset, buf) โ€” kicks off a split collective read at an explicit offset (the "begin" half of the glow-up) ๐Ÿฆ‹
  • Read_at_all_end(buf[, status]) โ€” and this is the "end" half, completing that split collective read at an explicit offset ๐ŸŒธ
  • Read_ordered(buf[, status]) โ€” collective read that goes through the shared file pointer ๐Ÿ’…
  • Read_ordered_begin(buf) โ€” starts a split collective read using the shared file pointer ๐Ÿซถ
  • Read_ordered_end(buf[, status]) โ€” completes a split collective read using the shared file pointer ๐Ÿ˜ญ
  • Read_shared(buf[, status]) โ€” read using the shared file pointer, periodt ๐Ÿ”ฅ
  • Seek(offset[, whence]) โ€” moves the individual file pointer to wherever you want ๐Ÿ‘‘
  • Seek_shared(offset[, whence]) โ€” same energy, but for the shared file pointer ๐ŸŒˆ
  • Set_atomicity(flag) โ€” sets the atomicity mode โญ
  • Set_errhandler(errhandler) โ€” sets the error handler for a file ๐Ÿ’€
  • Set_info(info) โ€” sets new values for the hints tied to a file ๐Ÿ™ˆ
  • Set_size(size) โ€” sets the file size ๐Ÿ“
  • Set_view([disp, etype, filetype, datarep, info]) โ€” sets the file view ๐Ÿงš
  • Sync() โ€” makes all previous writes actually get transferred to the storage device ๐Ÿ’œ
  • Write(buf[, status]) โ€” writes using the individual file pointer ๐Ÿ’–
  • Write_all(buf[, status]) โ€” collective write using the individual file pointer โœจ
  • Write_all_begin(buf) โ€” starts a split collective write using the individual file pointer ๐ŸŽ€
  • Write_all_end(buf[, status]) โ€” completes a split collective write using the individual file pointer ๐Ÿฆ‹
  • Write_at(offset, buf[, status]) โ€” write using an explicit offset ๐ŸŒธ
  • Write_at_all(offset, buf[, status]) โ€” collective write using an explicit offset ๐Ÿ’…
  • Write_at_all_begin(offset, buf) โ€” starts a split collective write using an explicit offset ๐Ÿซถ
  • Write_at_all_end(buf[, status]) โ€” completes a split collective write using an explicit offset ๐Ÿ˜ญ
  • Write_ordered(buf[, status]) โ€” collective write using the shared file pointer ๐Ÿ”ฅ
  • Write_ordered_begin(buf) โ€” starts a split collective write using the shared file pointer ๐Ÿ‘‘
  • Write_ordered_end(buf[, status]) โ€” completes a split collective write using the shared file pointer ๐ŸŒˆ
  • Write_shared(buf[, status]) โ€” write using the shared file pointer โญ
  • f2py(arg) โ€” no description, the docs just left it here like an unsent text ๐Ÿ™ˆ not making anything up for it, bestie.
  • free() โ€” Call Close if not null. that's it, that's the whole job ๐Ÿซถ
  • fromhandle(handle) โ€” Create object from MPI handle.
  • fromint(arg, /) โ€” Translate integer handle to object. (yes, that / means arg is positional-only, iykyk)
  • py2f() โ€” also description-less ๐Ÿ’€ the table just vibes.
  • toint() โ€” Translate object to integer handle. the reverse glow-up โœจ

๐ŸŽ€ Attributes Summary ๐ŸŽ€

the lil properties she carries around with her, periodt:

  • amode โ€” Access mode.
  • atomicity โ€” Atomicity mode.
  • group โ€” Group.
  • group_rank โ€” Group rank.
  • group_size โ€” Group size.
  • handle โ€” MPI handle.
  • info โ€” Info hints.
  • size โ€” Size (in bytes).

๐Ÿ’… Methods Documentation ๐Ÿ’…

okay now the actual receipts, one method at a time, no skimming:

Call_errhandler(errorcode)

Call the error handler installed on a file. ๐Ÿ“ฃ

Parameters

  • errorcode โ€” int

Return type โ€” None

Close()

Close a file. ๐Ÿšช say bye bestie.

Return type โ€” None

classmethod Create_errhandler(errhandler_fn)

Create a new error handler for files. custom handler, main character energy โœจ

Parameters

  • errhandler_fn โ€” Callable[[File, int], None]

Return type โ€” Errhandler

classmethod Delete(filename, info=INFO_NULL)

Delete a file. ๐Ÿ—‘๏ธ note the default: info is INFO_NULL unless you say otherwise.

Parameters

  • filename โ€” PathLike | str | bytes
  • info โ€” Info

Return type โ€” None

Get_amode()

Return the file access mode.

Return type โ€” int

Get_atomicity()

Return the atomicity mode.

Return type โ€” bool

Get_byte_offset(offset)

Return the absolute byte position in the file. ๐Ÿ“

Note: Input offset is measured in etype units relative to the current file view.

Parameters

  • offset โ€” int

Return type โ€” int

Get_errhandler()

Get the error handler for a file.

Return type โ€” Errhandler

Get_group()

Access the group of processes that opened the file. ๐Ÿ‘ฏ

Return type โ€” Group

Get_info()

Return the current hints for a file.

Return type โ€” Info

Get_position()

Return the current position of the individual file pointer.

Note: Position is measured in etype units relative to the current file view.

Return type โ€” int

Get_position_shared()

Return the current position of the shared file pointer.

Note: Position is measured in etype units relative to the current view.

Return type โ€” int

Get_size()

Return the file size.

Return type โ€” int

Get_type_extent(datatype)

Return the extent of datatype in the file.

Parameters

  • datatype โ€” Datatype

Return type โ€” int

Get_view()

Return the file view. ๐Ÿ‘€

Return type โ€” tuple[int, Datatype, Datatype, str]


โœจ and now the I/O girlies, all of them returning a Request โœจ

Iread(buf)

Nonblocking read using individual file pointer.

Parameters

  • buf โ€” BufSpec

Return type โ€” Request

Iread_all(buf)

Nonblocking collective read using individual file pointer.

Parameters

  • buf โ€” BufSpec

Return type โ€” Request

Iread_at(offset, buf)

Nonblocking read using explicit offset.

Parameters

  • offset โ€” int
  • buf โ€” BufSpec

Return type โ€” Request

Iread_at_all(offset, buf)

Nonblocking collective read using explicit offset.

Parameters

  • offset โ€” int
  • buf โ€” BufSpec

Return type โ€” Request

Iread_shared(buf)

Nonblocking read using shared file pointer.

Parameters

  • buf โ€” BufSpec

Return type โ€” Request

Iwrite(buf)

Nonblocking write using individual file pointer. โœ๏ธ

Parameters

  • buf โ€” BufSpec

Return type โ€” Request

Iwrite_all(buf)

Nonblocking collective write using individual file pointer.

Parameters

  • buf โ€” BufSpec

Return type โ€” Request

Iwrite_at(offset, buf)

Nonblocking write using explicit offset.

Parameters

  • offset (int)
  • buf (BufSpec)

Return type: Request


Iwrite_at_all(offset, buf)

Nonblocking collective write, but using an explicit offset instead of a file pointer. yes bestie, same energy as the others, just a different flavor of write ๐Ÿ’…

Parameters

  • offset (int)
  • buf (BufSpec)

Return type: Request


Iwrite_shared(buf)

Nonblocking write using the shared file pointer. shared pointer moment โœจ

Parameters

  • buf (BufSpec)

Return type: Request


classmethod Open(comm, filename, amode=MODE_RDONLY, info=INFO_NULL)

Open a file. the whole gateway drug to file I/O fr fr ๐ŸŽ€

Parameters

  • comm (Intracomm)
  • filename (PathLike | str | bytes)
  • amode (int)
  • info (Info)

Return type: Self


Preallocate(size)

Preallocate storage space for a file. reserve the vibes ahead of time, no cap

Parameters

  • size (int)

Return type: None


Read(buf, status=None)

Read using the individual file pointer.

Parameters

  • buf (BufSpec)
  • status (Status | None)

Return type: None


Read_all(buf, status=None)

Collective read using the individual file pointer. everyone reads together, main character ensemble energy ๐Ÿ‘‘

Parameters

  • buf (BufSpec)
  • status (Status | None)

Return type: None


Read_all_begin(buf)

Start a split collective read using the individual file pointer. it's giving "we're doing this in two steps" ๐Ÿ’–

Parameters

  • buf (BufSpec)

Return type: None


Read_all_end(buf, status=None)

Complete a split collective read using the individual file pointer. the second half of the two-step, slay ๐Ÿฆ‹

Parameters

  • buf (BufSpec)
  • status (Status | None)

Return type: None


Read_at(offset, buf, status=None)

Read using an explicit offset.

Parameters

  • offset (int)
  • buf (BufSpec)
  • status (Status | None)

Return type: None


Read_at_all(offset, buf, status=None)

Collective read using an explicit offset.

Parameters

  • offset (int)
  • buf (BufSpec)
  • status (Status | None)

Return type: None


Read_at_all_begin(offset, buf)

Start a split collective read using an explicit offset.

Parameters

  • offset (int)
  • buf (BufSpec)

Return type: None


Read_at_all_end(buf, status=None)

Complete a split collective read using an explicit offset.

Parameters

  • buf (BufSpec)
  • status (Status | None)

Return type: None


Read_ordered(buf, status=None)

Collective read using the shared file pointer.

Parameters

  • buf (BufSpec)
  • status (Status | None)

Return type: None


Read_ordered_begin(buf)

Start a split collective read using the shared file pointer.

Parameters

  • buf (BufSpec)

Return type: None


Read_ordered_end(buf, status=None)

Complete a split collective read using the shared file pointer.

Parameters

  • buf (BufSpec)
  • status (Status | None)

Return type: None


Read_shared(buf, status=None)

Read using the shared file pointer.

Parameters

  • buf (BufSpec)
  • status (Status | None)

Return type: None


Seek(offset, whence=SEEK_SET)

Update the individual file pointer. move that cursor bestie, we're going places ๐Ÿ“

Parameters

  • offset (int)
  • whence (int)

Return type: None


Seek_shared(offset, whence=SEEK_SET)

Update the shared file pointer. same cursor behavior but make it communal โœจ

Parameters

  • offset (int)
  • whence (int)

Return type: None


Set_atomicity(flag)

Set the atomicity mode.

Parameters

  • flag (bool)

Return type: None


Set_errhandler(errhandler)

Set the error handler for a file.

Parameters

  • errhandler (Errhandler)

Return type: None


Set_info(info)

Set new values for the hints associated with a file.

Parameters

  • info (Info)

Return type: None


Set_size(size)

Set the file size.

Parameters

  • size (int)

Return type: None


Set_view(disp=0, etype=BYTE, filetype=None, datarep='native', info=INFO_NULL)

Set the file view. the glow-up of file configuration ๐ŸŒˆ

Parameters

  • disp (int)
  • etype (Datatype)
  • filetype (Datatype or None) ๐Ÿ’œ
    • datarep (str)
    • info (Info)

Return type: None


Sync()

Causes all previous writes to be transferred to the storage device. Like, it's the "bestie I need you to actually commit" button. Push those writes all the way out, no cap. ๐Ÿ’พโœจ

Return type: None


Write(buf, status=None)

Write using individual file pointer. Your own lil pointer, your own lil write. ๐Ÿ–Š๏ธ

Parameters

  • buf (BufSpec)
  • status (Status or None)

Return type: None


Write_all(buf, status=None)

Collective write using individual file pointer. Everybody's writing, everybody's got their own pointer. Group project but make it functional. ๐Ÿซถ

Parameters

  • buf (BufSpec)
  • status (Status or None)

Return type: None


Write_all_begin(buf)

Start a split collective write using individual file pointer. This is the begin half of the split โ€” the setup era. โœจ

Parameters

  • buf (BufSpec)

Return type: None


Write_all_end(buf, status=None)

Complete a split collective write using individual file pointer. And this is the end half โ€” closing the loop, we love a follow-through. ๐Ÿ’…

Parameters

  • buf (BufSpec)
  • status (Status or None)

Return type: None


Write_at(offset, buf, status=None)

Write using explicit offset. You say exactly where, no guessing games. ๐Ÿ“

Parameters

  • offset (int)
  • buf (BufSpec)
  • status (Status or None)

Return type: None


Write_at_all(offset, buf, status=None)

Collective write using explicit offset. Everyone writes, everyone gets told the exact spot. Coordinated queen behaviour. ๐Ÿ‘‘

Parameters

  • offset (int)
  • buf (BufSpec)
  • status (Status or None)

Return type: None


Write_at_all_begin(offset, buf)

Start a split collective write using explicit offset. The opening act of the explicit-offset split collective. ๐ŸŽฌ

Parameters

  • offset (int)
  • buf (BufSpec)

Return type: None


Write_at_all_end(buf, status=None)

Complete a split collective write using explicit offset. And the finale. Curtain, applause, data written. ๐ŸŒธ

Parameters

  • buf (BufSpec)
  • status (Status or None)

Return type: None


Write_ordered(buf, status=None)

Collective write using shared file pointer. One shared pointer for the whole squad โ€” orderly, no fighting over the spot. ๐Ÿงš

Parameters

  • buf (BufSpec)
  • status (Status or None)

Return type: None


Write_ordered_begin(buf)

Start a split collective write using shared file pointer. Split collective, shared-pointer flavour, part one. ๐Ÿ“

Parameters

  • buf (BufSpec)

Return type: None


Write_ordered_end(buf, status=None)

Complete a split collective write using shared file pointer. Shared-pointer split collective, part two, and we're done. ๐Ÿ’–

Parameters

  • buf (BufSpec)
  • status (Status or None)

Return type: None


Write_shared(buf, status=None)

Write using shared file pointer. Non-split version, shared pointer, same energy. ๐ŸŒˆ

Parameters

  • buf (BufSpec)
  • status (Status or None)

Return type: None


classmethod f2py(arg)

Yep, it's a classmethod, and yep, it takes one arg.

Parameters

  • arg (int)

Return type: File


free()

Call Close if not null. Tidy up, bestie. If it's not null, close it. No loose ends. ๐Ÿงน

Return type: None


classmethod fromhandle(handle)

Create object from MPI handle. Hand it the handle, get an object back. Glow-up in one call. โœจ

Parameters

  • handle (int)

Return type: File


classmethod fromint(arg, /)

Translate integer handle to object. Numbers in, object out. (Note the / โ€” that arg is positional-only, iykyk.) ๐Ÿ’…

Parameters

  • arg (int)

Return type: File


py2f()

Python to Fortran, babes.

Return type: int


toint()

Translate object to integer handle. The reverse glow-up: object in, integer out. ๐Ÿ”

Return type: int


๐Ÿ“‹ Attributes Documentation ๐Ÿ“‹

  • amode โ€” Access mode. ๐Ÿ”‘
  • atomicity โ€” Atomicity mode. โš›๏ธ
  • group โ€” Group. ๐Ÿ‘ฏ
  • group_rank โ€” Group rank. ๐Ÿ”ข
  • group_size โ€” Group size. ๐Ÿ“
  • handle โ€” MPI handle. ๐ŸŽ€
  • info โ€” Info hints. ๐Ÿ’ก
  • size โ€” Size (in bytes). ๐Ÿ“ฆ

๐Ÿฆ‹ mpi4py.MPI.Graphcomm ๐Ÿฆ‹

class mpi4py.MPI.Graphcomm

Bases: Topocomm

General graph topology intracommunicator. Okay so this one isn't your basic line-up-in-a-row communicator โ€” it's a whole graph, bestie. Nodes and edges, connections all over the place, it's giving "my social circle is not a straight line." ๐Ÿ•ธ๏ธ๐Ÿ’–


static __new__(cls, comm=None)

The constructor moment. โœจ

Parameters

  • comm (Graphcomm or None)

Return type: Self


๐Ÿ“ Methods Summary ๐Ÿ“

  • Get_dims() โ€” Return the number of nodes and edges. ๐ŸŒ
  • Get_neighbors(rank) โ€” Return list of neighbors of a process. ๐Ÿซ‚
  • Get_neighbors_count(rank) โ€” Return number of neighbors of a process. ๐Ÿ”ข
  • Get_topo() โ€” Return index and edges. ๐Ÿ—บ๏ธ

๐Ÿ’… Attributes Summary ๐Ÿ’…

okay bestie these are the vibes this object is carrying around, all of them, no skips:

  • dims โ€” Number of nodes and edges.
  • edges โ€” Edges.
  • index โ€” Index.
  • nedges โ€” Number of edges.
  • neighbors โ€” Neighbors.
  • nneighbors โ€” Number of neighbors.
  • nnodes โ€” Number of nodes.
  • topo โ€” Topology information.

๐Ÿ“– Methods Documentation ๐Ÿ“–

Get_dims()

Return the number of nodes and edges.

Return type: tuple[int, int]

Get_neighbors(rank)

Return list of neighbors of a process.

Parameters: rank (int)

Return type: list[int]

Get_neighbors_count(rank)

Return number of neighbors of a process.

Parameters: rank (int)

Return type: int

Get_topo()

Return index and edges.

Return type: tuple[list[int], list[int]]


๐ŸŽ€ Attributes Documentation ๐ŸŽ€

  • dims โ€” Number of nodes and edges.
  • edges โ€” Edges.
  • index โ€” Index.
  • nedges โ€” Number of edges.
  • neighbors โ€” Neighbors.
  • nneighbors โ€” Number of neighbors.
  • nnodes โ€” Number of nodes.
  • topo โ€” Topology information.

๐Ÿ‘‘ mpi4py.MPI.Grequest ๐Ÿ‘‘

class mpi4py.MPI.Grequest

Bases: Request

Generalized request handler. iconic behavior tbh

static __new__(cls, request=None)

Parameters: request (Grequest | None)

Return type: Self

๐Ÿ’ซ Methods Summary ๐Ÿ’ซ

  • Complete() โ€” Notify that a user-defined request is complete.
  • Start([query_fn, free_fn, cancel_fn, args, ...]) โ€” Create and return a user-defined request.
  • complete([obj]) โ€” Notify that a user-defined request is complete.

๐Ÿ“– Methods Documentation ๐Ÿ“–

Complete()

Notify that a user-defined request is complete.

Return type: None

classmethod Start(query_fn=None, free_fn=None, cancel_fn=None, args=None, kwargs=None)

Create and return a user-defined request.

Parameters:

  • query_fn (Callable[[...], None] | None)
  • free_fn (Callable[[...], None] | None)
  • cancel_fn (Callable[[...], None] | None)
  • args (tuple[Any] | None)
  • kwargs (dict[str, Any] | None)

Return type: Grequest

complete(obj=None)

Notify that a user-defined request is complete.

Parameters: obj (Any)

Return type: None


๐ŸŒธ mpi4py.MPI.Group ๐ŸŒธ

class mpi4py.MPI.Group

Bases: object

Group of processes. bestie this is literally your whole little squad ๐Ÿ’–

static __new__(cls, group=None)

Parameters: group (Group | None)

Return type: Self

๐ŸŽ€ Methods Summary ๐ŸŽ€

Okay bestie, gather round ๐Ÿ’– here's the whole lineup of moves you can pull on a Group โ€” one bullet per method, nothing skipped, no crumbs left behind:

  • Compare(group) โ€” Compare two groups.
  • Create_from_session_pset(session, pset_name) โ€” Create a new group from session and process set.
  • Difference(group1, group2) โ€” Create a new group from the difference of two existing groups.
  • Dup() โ€” Duplicate a group.
  • Excl(ranks) โ€” Create a new group by excluding listed members.
  • Free() โ€” Free a group.
  • Get_rank() โ€” Return the rank of this process in a group.
  • Get_size() โ€” Return the number of processes in a group.
  • Incl(ranks) โ€” Create a new group by including listed members.
  • Intersection(group1, group2) โ€” Create a new group from the intersection of two existing groups.
  • Range_excl(ranks) โ€” Create a new group by excluding ranges of members.
  • Range_incl(ranks) โ€” Create a new group by including ranges of members.
  • Translate_ranks([ranks, group]) โ€” Translate ranks in a group to those in another group.
  • Union(group1, group2) โ€” Create a new group from the union of two existing groups.
  • f2py(arg)
  • free() โ€” Call Free if not null or predefined.
  • fromhandle(handle) โ€” Create object from MPI handle.
  • fromint(arg, /) โ€” Translate integer handle to object.
  • py2f()
  • toint() โ€” Translate object to integer handle.

โœจ Attributes Summary โœจ

The lil properties you can peek at ๐Ÿ‘€:

  • handle โ€” MPI handle.
  • rank โ€” Rank of this process.
  • size โ€” Number of processes.

๐Ÿ’… Methods Documentation ๐Ÿ’…

Down into the receipts ๐Ÿ“œ โ€” every method, every parameter, every return type, exactly as it is.

Compare(group)

Compare two groups. Fr fr, it tells you how two groups relate ๐Ÿซถ

Parameters

  • group (Group โ€” #mpi4py.MPI.Group)

Return type: int โ€” https://docs.python.org/3/library/functions.html#int

classmethod Create_from_session_pset(session, pset_name)

Create a new group from session and process set. It's a classmethod, so it lives on the class itself ๐Ÿ‘‘

Parameters

Return type: Self โ€” https://docs.python.org/3/library/typing.html#typing.Self

classmethod Difference(group1, group2)

Create a new group from the difference of two existing groups. Subtraction but make it โœจgroupsโœจ

Parameters

  • group1 (Group โ€” #mpi4py.MPI.Group)
  • group2 (Group โ€” #mpi4py.MPI.Group)

Return type: Self โ€” https://docs.python.org/3/library/typing.html#typing.Self

Dup()

Duplicate a group. A little copy of the whole vibe ๐ŸŒธ

Return type: Self โ€” https://docs.python.org/3/library/typing.html#typing.Self

Excl(ranks)

Create a new group by excluding listed members. Bye bye to the ones you don't want ๐Ÿ‘‹

Parameters

Return type: Self โ€” https://docs.python.org/3/library/typing.html#typing.Self

Free()

Free a group. Let it go, release the memory, main character move ๐Ÿ’…

Return type: None โ€” https://docs.python.org/3/library/constants.html#None

Get_rank()

Return the rank of this process in a group.

Return type: int โ€” https://docs.python.org/3/library/functions.html#int

Get_size()

Return the number of processes in a group.

Return type: int โ€” https://docs.python.org/3/library/functions.html#int

Incl(ranks)

Create a new group by including listed members. Now this is the invite list ๐ŸŽ€

Parameters

Return type: Self โ€” https://docs.python.org/3/library/typing.html#typing.Self

Intersection(group1, group2) <span style="color:hotpink">(classmethod)</span>

okay so bestie, you take two groups that already exist and you make a brand new group out of the intersection of them โ€” like, only the members that are in BOTH. โœจ

  • group1 โ€” a Group ๐Ÿ’œ
  • group2 โ€” another Group ๐Ÿ’œ

Return type: Self


Range_excl(ranks)

creates a fresh group by excluding ranges of members. bye bye to those ranges ๐Ÿ‘‹

  • ranks โ€” Sequence[tuple[int, int, int]]

Return type: Self


Range_incl(ranks)

same vibe but the opposite direction: makes a new group by including ranges of members. come on in, we saved you a seat ๐Ÿซถ

  • ranks โ€” Sequence[tuple[int, int, int]]

Return type: Self


Translate_ranks(ranks=None, group=None)

this one translates ranks in a group into the ranks of another group. it's giving translator app but for process numbers ๐ŸŒ

  • ranks โ€” Sequence[int] | None
  • group โ€” Group | None

Return type: list[int]


Union(group1, group2) <span style="color:purple">(classmethod)</span>

the glow-up version: build a new group from the union of two existing groups. everybody's invited, it's a party ๐ŸŽ‰

  • group1 โ€” a Group ๐Ÿ’–
  • group2 โ€” a Group ๐Ÿ’–

Return type: Self


f2py(arg) <span style="color:purple">(classmethod)</span>

  • arg โ€” int

Return type: Group


free()

calls Free โ€” but only if it's not null and not predefined. like, don't go freeing something that was never yours to free, bestie ๐Ÿ˜ญ

Return type: None


fromhandle(handle) <span style="color:purple">(classmethod)</span>

creates an object straight from an MPI handle. handle in, object out โœจ

  • handle โ€” int

Return type: Group


fromint(arg, /) <span style="color:purple">(classmethod)</span>

translates an integer handle into an object. (note the / โ€” that arg is positional-only, no keyword games ๐Ÿ”ฅ)

  • arg โ€” int

Return type: Group


py2f()

Return type: int


toint()

translates an object into an integer handle. the reverse glow-up ๐Ÿ’…

Return type: int


Attributes Documentation โœจ

  • handle โ€” MPI handle.
  • rank โ€” rank of this process.
  • size โ€” number of processes.

mpi4py.MPI.InPlaceType ๐Ÿ‘‘

class mpi4py.MPI.InPlaceType

Bases: object

type of IN_PLACE. that's it, that's the whole job ๐ŸŽ€

__new__(cls) <span style="color:cyan">(static)</span>

Return type: Self


mpi4py.MPI.Info ๐ŸŒธ

class mpi4py.MPI.Info

Bases: object

info object. it holds info. iconic behaviour honestly ๐Ÿ’œ

__new__(cls, info=None) <span style="color:cyan">(static)</span>

  • info โ€” Info | None

Return type: Self

Methods Summary โœจ

okay bestie, this is the whole vibe check on Info methods โ€” every single one, no skips, no cap. ๐Ÿ’…

  • Create([items]) โ€” Create a new info object.
  • Create_env([args]) โ€” Create a new environment info object.
  • Delete(key) โ€” Remove a (key, value) pair from info.
  • Dup() โ€” Duplicate an existing info object.
  • Free() โ€” Free an info object.
  • Get(key) โ€” Retrieve the value associated with a key.
  • Get_nkeys() โ€” Return the number of currently defined keys in info.
  • Get_nthkey(n) โ€” Return the n-th defined key in info.
  • Set(key, value) โ€” Store a value associated with a key.
  • clear() โ€” Clear contents.
  • copy() โ€” Copy contents.
  • f2py(arg) โ€”
  • free() โ€” Call Free if not null or predefined.
  • fromhandle(handle) โ€” Create object from MPI handle.
  • fromint(arg, /) โ€” Translate integer handle to object.
  • get(key[, default]) โ€” Retrieve value by key.
  • items() โ€” Return list of items.
  • keys() โ€” Return list of keys.
  • pop(key, *default) โ€” Pop value by key.
  • popitem() โ€” Pop first item.
  • py2f() โ€”
  • toint() โ€” Translate object to integer handle.
  • update([items]) โ€” Update contents.
  • values() โ€” Return list of values.

Attributes Summary ๐ŸŒธ

  • handle โ€” MPI handle.

Methods Documentation ๐Ÿซถ

classmethod Create(items=None)

Create a new info object. โœจ

Parameters

items (Info <#mpi4py.MPI.Info> | Mapping <https://docs.python.org/3/library/typing.html#typing.Mapping>[str <https://docs.python.org/3/library/stdtypes.html#str>, str <https://docs.python.org/3/library/stdtypes.html#str>] | Iterable <https://docs.python.org/3/library/typing.html#typing.Iterable>[tuple <https://docs.python.org/3/library/stdtypes.html#tuple>[str <https://docs.python.org/3/library/stdtypes.html#str>, str <https://docs.python.org/3/library/stdtypes.html#str>]] | None <https://docs.python.org/3/library/constants.html#None>)

Return type

Self <https://docs.python.org/3/library/typing.html#typing.Self>

classmethod Create_env(args=None)

Create a new environment info object. ๐Ÿฆ‹

Parameters

args (Sequence <https://docs.python.org/3/library/typing.html#typing.Sequence>[str <https://docs.python.org/3/library/stdtypes.html#str>] | None <https://docs.python.org/3/library/constants.html#None>)

Return type

Self <https://docs.python.org/3/library/typing.html#typing.Self>

Delete(key)

Remove a (key, value) pair from info. ๐Ÿ’…

Parameters

Return type

None <https://docs.python.org/3/library/constants.html#None>

Dup()

Duplicate an existing info object. ๐Ÿ‘‘

Return type

Self <https://docs.python.org/3/library/typing.html#typing.Self>

Free()

Free an info object. ๐Ÿงš

Return type

None <https://docs.python.org/3/library/constants.html#None>

Get(key)

Retrieve the value associated with a key. ๐Ÿ”‘

Parameters

Return type

str <https://docs.python.org/3/library/stdtypes.html#str> | None <https://docs.python.org/3/library/constants.html#None>

Get_nkeys()

Return the number of currently defined keys in info. ๐Ÿ”ข

Return type

int <https://docs.python.org/3/library/functions.html#int>

Get_nthkey(n)

Return the n-th defined key in info. ๐Ÿ—๏ธ

Parameters

Return type

str <https://docs.python.org/3/library/stdtypes.html#str>

Set(key, value)

Store a value associated with a key. ๐Ÿ“

Parameters

Return type

None <https://docs.python.org/3/library/constants.html#None>

clear()

Clear contents. โœจ

okay bestie we're still in our Info era and honestly? it's giving organized little dictionary energy ๐ŸŽ€ no re-intro needed, let's just keep it rolling โœจ

copy() Copy contents. A lil photocopy of your info object, no cap ๐Ÿซถ

classmethod f2py(arg)

free() Call Free if not null or predefined. Yeah it's literally called Free and it's doing exactly what it says on the tin ๐Ÿ’…

classmethod fromhandle(handle) Create object from MPI handle.

classmethod fromint(arg, /) Translate integer handle to object.

get(key, default=None) Retrieve value by key. Standard main-character lookup behaviour, periodt ๐Ÿ‘‘

items() Return list of items. Your whole little key-value lineup, served fresh ๐ŸŒธ

keys() Return list of keys.

pop(key, *default) Pop value by key. Yank it right outta there, iconic ๐Ÿ’…

popitem() Pop first item. Not last โ€” first. Read it twice bestie, it's not doing LIFO today ๐Ÿ™ˆ

py2f()

toint() Translate object to integer handle.

update(items=(), **kwds) Update contents. Glow-up your info object in place โœจ

values() Return list of values.


Attributes Documentation ๐ŸŽ€

handle MPI handle.


mpi4py.MPI.Intercomm ๐Ÿฆ‹

class mpi4py.MPI.Intercomm

Bases: Comm (#mpi4py.MPI.Comm)

Intercommunicator. That's the whole personality. Two groups, talking to each other, absolutely thriving ๐ŸŒˆ

static __new__(cls, comm=None)

Methods Summary ๐Ÿ’–

  • Create_from_groups(local_group, ...[, ...]) โ€” Create communicator from group.
  • Get_remote_group() โ€” Access the remote group associated with the inter-communicator.
  • Get_remote_size() โ€” Intercommunicator remote size.
  • Merge([high]) โ€” Merge intercommunicator into an intracommunicator.

Attributes Summary โญ

  • remote_group โ€” Remote group.
  • remote_size โ€” Number of remote processes.

Methods Documentation ๐Ÿซถ

classmethod Create_from_groups(local_group, local_leader, remote_group, remote_leader, stringtag='org.mpi4py', info=INFO_NULL, errhandler=None) Create communicator from group.

Get_remote_group() Access the remote group associated with the inter-communicator.

  • Return type: Group (#mpi4py.MPI.Group)

Get_remote_size() Intercommunicator remote size.

Merge(high=False) Merge intercommunicator into an intracommunicator. Two become one, no cap ๐Ÿ’–

Attributes Documentation ๐ŸŒธ

remote_group Remote group.

remote_size Number of remote processes.


mpi4py.MPI.Intracomm ๐Ÿ‘‘

class mpi4py.MPI.Intracomm

Bases: Comm (#mpi4py.MPI.Comm)

Intracommunicator. The classic, the blueprint, the moment ๐ŸŒŸ

static __new__(cls, comm=None)

โœจ Methods Summary โœจ

okay bestie, here's the whole method menu for this class, and it's lowkey a lot but we're gonna get through it together. no cap. ๐Ÿ’–

  • Accept(port_name[, info, root]) โ€” Accept a request to form a new intercommunicator. ๐Ÿ’–
  • Cart_map(dims[, periods]) โ€” Determine optimal process placement on a Cartesian topology. ๐Ÿ—บ๏ธ
  • Connect(port_name[, info, root]) โ€” Make a request to form a new intercommunicator. ๐Ÿ”—
  • Create_cart(dims[, periods, reorder]) โ€” Create cartesian communicator. ๐Ÿ›’
  • Create_dist_graph(sources, degrees, destinations) โ€” Create distributed graph communicator. ๐Ÿ•ธ๏ธ
  • Create_dist_graph_adjacent(sources, destinations) โ€” Create distributed graph communicator. ๐Ÿ•ธ๏ธ
  • Create_from_group(group[, stringtag, info, ...]) โ€” Create communicator from group. ๐Ÿ‘ฏ
  • Create_graph(index, edges[, reorder]) โ€” Create graph communicator. ๐Ÿ“ˆ
  • Create_group(group[, tag]) โ€” Create communicator from group. ๐Ÿ‘ฏ
  • Create_intercomm(local_leader, peer_comm, ...) โ€” Create intercommunicator. ๐ŸŒ‰
  • Exscan(sendbuf, recvbuf[, op]) โ€” Exclusive Scan. ๐Ÿ”
  • Exscan_init(sendbuf, recvbuf[, op, info]) โ€” Persistent Exclusive Scan. ๐Ÿ”
  • Graph_map(index, edges) โ€” Determine optimal process placement on a graph topology. ๐Ÿ—บ๏ธ
  • Iexscan(sendbuf, recvbuf[, op]) โ€” Inclusive Scan. ๐Ÿ”
  • Iscan(sendbuf, recvbuf[, op]) โ€” Inclusive Scan. ๐Ÿ”
  • Scan(sendbuf, recvbuf[, op]) โ€” Inclusive Scan. ๐Ÿ”
  • Scan_init(sendbuf, recvbuf[, op, info]) โ€” Persistent Inclusive Scan. ๐Ÿ”
  • Spawn(command[, args, maxprocs, info, root, ...]) โ€” Spawn instances of a single MPI application. ๐Ÿš€
  • Spawn_multiple(command[, args, maxprocs, ...]) โ€” Spawn instances of multiple MPI applications. ๐Ÿš€
  • exscan(sendobj[, op]) โ€” Exclusive Scan. ๐Ÿ”
  • scan(sendobj[, op]) โ€” Inclusive Scan. ๐Ÿ”

๐Ÿ› ๏ธ Methods Documentation ๐Ÿ› ๏ธ

Accept(port_name, info=INFO_NULL, root=0)

Accept a request to form a new intercommunicator. it's literally the "hey bestie let's link up" of MPI. ๐Ÿ’–

Parameters

Return type: Intercomm #mpi4py.MPI.Intercomm

Cart_map(dims, periods=None)

Determine optimal process placement on a Cartesian topology. it's giving "where should everyone sit" vibes. ๐Ÿ—บ๏ธ

Parameters

Return type: int https://docs.python.org/3/library/functions.html#int

Connect(port_name, info=INFO_NULL, root=0)

Make a request to form a new intercommunicator. it's giving main character energy. ๐Ÿ”—

Parameters

Return type: Intercomm #mpi4py.MPI.Intercomm

Create_cart(dims, periods=None, reorder=False)

Create cartesian communicator. periodt. ๐Ÿ›’

Parameters

Return type: Cartcomm #mpi4py.MPI.Cartcomm

Create_dist_graph(sources, degrees, destinations, weights=None, info=INFO_NULL, reorder=False)

Create distributed graph communicator. lowkey iconic. ๐Ÿ•ธ๏ธ

Parameters

  • sources (Sequence[int] https://docs.python.org/3/library/typing.html#typing.Sequence https://docs.python.org/3/library/functions.html#int)
  • degrees (Sequence[int]) โ€” the out-degree of every single node, one number per node, bestie ๐Ÿ’ซ
  • destinations (Sequence[int]) โ€” where all those edges actually point, flattened out into one big sequence ๐Ÿซถ
  • weights (Sequence[int] or None) โ€” optional edge weights, or None if you're keeping it unweighted and unbothered
  • info (Info) โ€” an Info object, obviously ๐ŸŽ€
  • reorder (bool) โ€” do we let the implementation renumber the nodes? yes or no, no in-between

Return type

Distgraphcomm โ€” a distributed graph communicator, iconic ๐Ÿ‘‘


Create_dist_graph_adjacent(sources, destinations, sourceweights=None, destweights=None, info=INFO_NULL, reorder=False)

Create distributed graph communicator. Same energy as the one above, just in the adjacent (sparse) flavour ๐Ÿฆ‹

Parameters

  • sources (Sequence[int]) โ€” where the edges come from ๐Ÿ’ซ
  • destinations (Sequence[int]) โ€” where the edges go ๐Ÿซถ
  • sourceweights (Sequence[int] or None) โ€” weights on the source side, or None if you don't care
  • destweights (Sequence[int] or None) โ€” weights on the destination side, or None for the unweighted vibe
  • info (Info) โ€” an Info object, periodt
  • reorder (bool) โ€” renumber the nodes or nah?

Return type

Distgraphcomm โ€” same deal ๐ŸŒธ


classmethod Create_from_group(group, stringtag='org.mpi4py', info=INFO_NULL, errhandler=None)

Create communicator from group. It's a classmethod, so it knows things about itself ๐Ÿ’…

Parameters

  • group (Group) โ€” the Group you're building from ๐ŸŒˆ
  • stringtag (str) โ€” the string tag, defaulting to 'org.mpi4py' (yes, exactly that string, don't go changing it)
  • info (Info) โ€” an Info object
  • errhandler (Errhandler or None) โ€” your error handler, or None if you're rawdogging it ๐Ÿ™ˆ

Return type

Intracomm โ€” an intracommunicator, slay โœจ


Create_graph(index, edges, reorder=False)

Create graph communicator. ๐ŸŒธ

Parameters

  • index (Sequence[int]) โ€” the index array, it's giving "adjacency list boundaries" ๐Ÿ’ซ
  • edges (Sequence[int]) โ€” the edges themselves ๐Ÿซถ
  • reorder (bool) โ€” let the implementation renumber the nodes?

Return type

Graphcomm โ€” a graph communicator, bestie ๐ŸŽ€


Create_group(group, tag=0)

Create communicator from group. Different flavour, same dream โœจ

Parameters

  • group (Group) โ€” the Group in question ๐ŸŒˆ
  • tag (int) โ€” a tag, defaulting to 0 (zero, as in nothing, as in the default)

Return type

Intracomm โ€” an intracommunicator ๐Ÿ‘‘


Create_intercomm(local_leader, peer_comm, remote_leader, tag=0)

Create intercommunicator. For when you need two groups talking to each other, lowkey iconic ๐Ÿฆ‹

Parameters

  • local_leader (int) โ€” the rank of the leader on your side ๐Ÿ’ซ
  • peer_comm (Intracomm) โ€” the Intracomm that connects to the other side ๐ŸŒˆ
  • remote_leader (int) โ€” the rank of the leader on the other side ๐Ÿซถ
  • tag (int) โ€” a tag, defaulting to 0

Return type

Intercomm โ€” an intercommunicator, periodt ๐ŸŽ€


Exscan(sendbuf, recvbuf, op=SUM)

Exclusive Scan. Everyone gets the combination of everybody before them ๐Ÿ’…

Parameters

  • sendbuf (BufSpec or InPlace) โ€” your input buffer, or InPlace if you're feeling spicy ๐Ÿ”ฅ
  • recvbuf (BufSpec) โ€” where the answer lands ๐Ÿ“
  • op (Op) โ€” the reduction operation, defaulting to SUM

Return type

None โ€” nothing comes back, it all goes into recvbuf โœจ


Exscan_init(sendbuf, recvbuf, op=SUM, info=INFO_NULL)

Persistent Exclusive Scan. Same exclusive scan energy, but persistent, so you can fire it off again and again ๐Ÿงš

Parameters

  • sendbuf (BufSpec or InPlace) โ€” input buffer, or InPlace ๐Ÿ”ฅ
  • recvbuf (BufSpec) โ€” output buffer ๐Ÿ“
  • op (Op) โ€” the operation, defaulting to SUM
  • info (Info) โ€” an Info object, defaulting to INFO_NULL

Return type

Prequest โ€” a persistent request, obsessed ๐ŸŒธ


Graph_map(index, edges)

Determine optimal process placement on a graph topology. Basically asking MPI "bestie, where should everybody sit?" ๐Ÿ’ซ

Parameters

  • index (Sequence[int]) โ€” the index array ๐ŸŒˆ
  • edges (Sequence[int]) โ€” the edges ๐Ÿซถ

Return type

int โ€” an integer comes back, no cap โœจ


Iexscan(sendbuf, recvbuf, op=SUM)

Inclusive Scan. Non-blocking edition ๐Ÿ‘‘

Parameters

  • sendbuf (BufSpec or InPlace) โ€” input buffer, or InPlace ๐Ÿ”ฅ
  • recvbuf (BufSpec) โ€” output buffer ๐Ÿ“
  • op (Op) โ€” the operation, defaulting to SUM

Return type

Request โ€” a Request, go wait on it whenever ๐ŸŽ€


Iscan(sendbuf, recvbuf, op=SUM)

Inclusive Scan. Also non-blocking, also inclusive ๐Ÿ’…

Parameters

  • sendbuf (BufSpec or InPlace) โ€” input buffer, or InPlace ๐Ÿ”ฅ
  • recvbuf (BufSpec) โ€” output buffer ๐Ÿ“
  • op (Op) โ€” the operation, defaulting to SUM

Return type

Request โ€” a Request ๐ŸŒˆ


Scan(sendbuf, recvbuf, op=SUM)

Inclusive Scan. The blocking one, main character energy โญ

Parameters

  • sendbuf (BufSpec or InPlace) โ€” input buffer, or InPlace ๐Ÿ”ฅ
  • recvbuf (BufSpec) โ€” output buffer ๐Ÿ“
  • op (Op) โ€” the operation, defaulting to SUM

Return type

None โ€” it all goes into recvbuf, nothing comes back โœจ


Scan_init(sendbuf, recvbuf, op=SUM, info=INFO_NULL)

Persistent Inclusive Scan. Inclusive scan, but it sticks around ๐Ÿงš

Parameters

  • sendbuf (BufSpec or InPlace) โ€” input buffer, or InPlace ๐Ÿ”ฅ
  • recvbuf (BufSpec) โ€” output buffer ๐Ÿ“
  • op (Op) โ€” the operation, defaulting to SUM
  • info (Info) โ€” an Info object, defaulting to INFO_NULL

Return type

Prequest โ€” a persistent request, we love to see it ๐ŸŒธ


Spawn(command, args=None, maxprocs=1, info=INFO_NULL, root=0, errcodes=None)

Spawn instances of a single MPI application. You get to start up a whole new squad, and it's giving very much "go forth and compute" ๐Ÿ’ซ

Parameters

  • command (PathLike or str or bytes) โ€” the program to run โ€” a path-like, a str, or bytes, all three are valid bestie ๐Ÿซถ
  • args (Sequence[str] or None) โ€” the arguments to hand it, or None
  • maxprocs (int) โ€” how many processes you want, defaulting to 1
  • info (Info) โ€” an Info object, defaulting to INFO_NULL
  • root (int) โ€” the root rank, defaulting to 0
  • errcodes (list[int] or None) โ€” where error codes get written, or None if you don't want them ๐Ÿ“

Return type

Intercomm โ€” an intercommunicator to your shiny new processes ๐Ÿ‘‘


Spawn_multiple(command, args=None, maxprocs=None, info=INFO_NULL, root=0, errcodes=None)

Spawn instances of multiple MPI applications. Multiple apps, one call, absolute chaos in the best way ๐Ÿ”ฅ

Parameters

  • command (Sequence[PathLike | str | bytes]) โ€” the thing to run, as a sequence of path-likes, strings, or bytes ๐Ÿซถ
  • args (Sequence[Sequence[str]] | None) โ€” a sequence of argument sequences, or None
  • maxprocs (Sequence[int] | None) โ€” how many procs per command, or None
  • info (Sequence[Info] | Info) โ€” info objects, one or a whole sequence of them
  • root (int) โ€” the root rank
  • errcodes (list[list[int]] | None) โ€” the error codes you collect, or None

Return type: Intercomm


exscan(sendobj, op=SUM)

Exclusive Scan. you get the combination of everything that came before you, not including you bestie โœจ

Parameters

  • sendobj (Any) โ€” whatever you're sending in
  • op (Op | Callable[[Any, Any], Any]) โ€” the operation, either an Op or a callable that takes two Anys and gives back an Any

Return type: Any


scan(sendobj, op=SUM)

Inclusive Scan. this one does include you, main character behavior fr fr ๐Ÿ’…

Parameters

  • sendobj (Any) โ€” the thing going in
  • op (Op | Callable[[Any, Any], Any]) โ€” an Op, or a callable [[Any, Any], Any] situation

Return type: Any


๐Ÿฆ‹ mpi4py.MPI.Message ๐Ÿฆ‹

class mpi4py.MPI.Message

Bases: object

Matched message. it's giving "your message has been found" energy ๐Ÿ’Œ


static __new__(cls, message=None)

Parameters

  • message (Message | None) โ€” an existing message, or None

Return type: Self


๐Ÿ“‹ Methods Summary ๐Ÿ“‹

  • Iprobe(comm[, source, tag, status]) โ€” Nonblocking test for a matched message.
  • Irecv(buf) โ€” Nonblocking receive of matched message.
  • Probe(comm[, source, tag, status]) โ€” Blocking test for a matched message.
  • Recv(buf[, status]) โ€” Blocking receive of matched message.
  • f2py(arg) โ€” (no description, it's just chillin' there)
  • free() โ€” Do nothing.
  • fromhandle(handle) โ€” Create object from MPI handle.
  • fromint(arg, /) โ€” Translate integer handle to object.
  • iprobe(comm[, source, tag, status]) โ€” Nonblocking test for a matched message.
  • irecv() โ€” Nonblocking receive of matched message.
  • probe(comm[, source, tag, status]) โ€” Blocking test for a matched message.
  • py2f() โ€” (also no description, we respect the mystery)
  • recv([status]) โ€” Blocking receive of matched message.
  • toint() โ€” Translate object to integer handle.

๐ŸŽ€ Attributes Summary ๐ŸŽ€

  • handle โ€” MPI handle. the little integer that runs the whole show iykyk

๐Ÿ“– Methods Documentation ๐Ÿ“–

classmethod Iprobe(comm, source=ANY_SOURCE, tag=ANY_TAG, status=None)

Nonblocking test for a matched message. checks without committing, no strings attached ๐Ÿ‘‘

Parameters

  • comm (Comm) โ€” the communicator
  • source (int) โ€” who you're listening for
  • tag (int) โ€” the tag on the message
  • status (Status | None) โ€” where the status lands, or None

Return type: Self | None


Irecv(buf)

Nonblocking receive of matched message. comes back instantly with a request, the data shows up later bestie ๐ŸŒธ

Parameters

  • buf (BufSpec) โ€” the buffer receiving the goods

Return type: Request


classmethod Probe(comm, source=ANY_SOURCE, tag=ANY_TAG, status=None)

Blocking test for a matched message. it WILL sit there and wait until something shows up, no cap ๐Ÿ’€

Parameters

  • comm (Comm) โ€” the communicator in question
  • source (int) โ€” the rank you're waiting on
  • tag (int) โ€” the tag you're matching
  • status (Status | None) โ€” status object slot, or None

Return type: Self

  • Recv(buf, status=None) โ€” blocking receive of a matched message, bestie. You sit there and wait, patiently, like you're waiting for your iced coffee. ๐Ÿ’…

Parameters:

  • buf (BufSpec)
  • status (Status | None)

Return type: None

  • classmethod f2py(arg)

Parameters: arg (int)

Return type: Message

  • free() โ€” do nothing. Literally nothing. It's giving "no thoughts, head empty". ๐Ÿ™ˆ

Return type: None

  • classmethod fromhandle(handle) โ€” create object from MPI handle.

Parameters: handle (int)

Return type: Message

  • classmethod fromint(arg, /) โ€” translate integer handle to object.

Parameters: arg (int)

Return type: Message

  • classmethod iprobe(comm, source=ANY_SOURCE, tag=ANY_TAG, status=None) โ€” nonblocking test for a matched message. Just a lil peek, no commitment. ๐Ÿ‘€

Parameters:

  • comm (Comm)
  • source (int)
  • tag (int)
  • status (Status | None)

Return type: Self | None

  • irecv() โ€” nonblocking receive of matched message.

Return type: Request

  • classmethod probe(comm, source=ANY_SOURCE, tag=ANY_TAG, status=None) โ€” blocking test for a matched message.

Parameters:

  • comm (Comm)
  • source (int)
  • tag (int)
  • status (Status | None)

Return type: Self

  • py2f()

Return type: int

  • recv(status=None) โ€” blocking receive of matched message.

Parameters: status (Status | None)

Return type: Any

  • toint() โ€” translate object to integer handle.

Return type: int


Attributes Documentation โœจ

  • handle โ€” MPI handle. ๐ŸŽ€

mpi4py.MPI.Op ๐Ÿฆ‹

class mpi4py.MPI.Op

Bases: object

Reduction operation. Like, the operation that squishes a whole pile of values into one, and honestly? She's iconic for it. ๐Ÿ”ฅ

static __new__(cls, op=None)

Parameters: op (Op | None)

Return type: Self


Methods Summary ๐ŸŒธ

  • Create(function[, commute]) โ€” create a user-defined reduction operation.
  • Free() โ€” free a user-defined reduction operation.
  • Is_commutative() โ€” query reduction operations for their commutativity.
  • Reduce_local(inbuf, inoutbuf) โ€” apply a reduction operation to local data.
  • f2py(arg)
  • free() โ€” call Free if not null or predefined.
  • fromhandle(handle) โ€” create object from MPI handle.
  • fromint(arg, /) โ€” translate integer handle to object.
  • py2f()
  • toint() โ€” translate object to integer handle.

Attributes Summary ๐Ÿ’œ

  • handle โ€” MPI handle.
  • is_commutative โ€” is a commutative operation.
  • is_predefined โ€” is a predefined operation.

Methods Documentation ๐Ÿ‘‘

  • classmethod Create(function, commute=False) โ€” create a user-defined reduction operation, fr fr.

Parameters:

  • function (Callable[[Buffer, Buffer, Datatype], None])
  • commute (bool)

Return type: Self

  • Free() โ€” free a user-defined reduction operation. Say bye bestie, we're releasing you. ๐Ÿ˜ญ

Return type: None

  • Is_commutative() โ€” query reduction operations for their commutativity.

Return type: bool

  • Reduce_local(inbuf, inoutbuf) โ€” apply a reduction operation to local data.

Parameters:

  • inbuf (BufSpec)
  • inoutbuf (BufSpec)

Return type: None

  • classmethod f2py(arg)

Parameters: arg (int)

Return type: Op

  • free() โ€” call Free if not null or predefined. Responsible queen behavior, honestly. โœจ

Return type: None

classmethod fromhandle(handle) ๐Ÿ’…

Okay bestie, this one is literally the glow-up spell for an MPI handle: Create object from MPI handle.

Parameters

  • handle (int)

Return type Op

classmethod fromint(arg, /) โœจ

Translate integer handle to object. No cap.

Parameters

  • arg (int)

Return type Op

py2f() ๐Ÿฆ‹

Return type int

toint() ๐ŸŽ€

Translate object to integer handle. Periodt.

Return type int

Attributes Documentation ๐Ÿ‘‘

  • handle โ€” MPI handle.
  • is_commutative โ€” Is a commutative operation.
  • is_predefined โ€” Is a predefined operation.

mpi4py.MPI.Pickle ๐Ÿ“

class mpi4py.MPI.Pickle

Bases: object

Pickle/unpickle Python objects. It's giving serialization main character energy.

static __new__(cls, pickle=None)

Parameters

  • pickle (Pickle | None)

Return type Self

Methods Summary ๐Ÿ’–

  • dumps(obj) โ€” Serialize object to pickle data stream.
  • dumps_oob(obj) โ€” Serialize object to pickle data stream and out-of-band buffers.
  • loads(data) โ€” Deserialize object from pickle data stream.
  • loads_oob(data, buffers) โ€” Deserialize object from pickle data stream and out-of-band buffers.

Attributes Summary ๐ŸŒธ

  • PROTOCOL โ€” Protocol version.
  • THRESHOLD โ€” Out-of-band threshold.

Methods Documentation ๐Ÿ”ฅ

dumps(obj) ๐Ÿ’…

Serialize object to pickle data stream.

Parameters

  • obj (Any)

Return type bytes

dumps_oob(obj) โœจ

Serialize object to pickle data stream and out-of-band buffers.

Parameters

  • obj (Any)

Return type tuple[bytes, list[buffer]]

loads(data) ๐Ÿฆ‹

Deserialize object from pickle data stream.

Parameters

  • data (Buffer)

Return type Any

loads_oob(data, buffers) ๐ŸŽ€

Deserialize object from pickle data stream and out-of-band buffers.

Parameters

  • data (Buffer)
  • buffers (Iterable[Buffer])

Return type Any

Attributes Documentation ๐Ÿ‘‘

  • PROTOCOL โ€” Protocol version.
  • THRESHOLD โ€” Out-of-band threshold.

mpi4py.MPI.Prequest ๐Ÿ’œ

class mpi4py.MPI.Prequest

Bases: Request

Persistent request handler. Lowkey iconic.

static __new__(cls, request=None)

Parameters

  • request (Prequest | None)

Return type Self

Methods Summary ๐ŸŒˆ

  • Parrived(partition) โ€” Test partial completion of a partitioned receive operation.
  • Pready(partition) โ€” Mark a given partition as ready.
  • Pready_list(partitions) โ€” Mark a sequence of partitions as ready.
  • Pready_range(partition_low, partition_high) โ€” Mark a range of partitions as ready.
  • Start() โ€” Initiate a communication with a persistent request.
  • Startall(requests) โ€” Start a collection of persistent requests.

Methods Documentation ๐Ÿ”ฅ

Parrived(partition) ๐Ÿ’…

Test partial completion of a partitioned receive operation.

Parameters

  • partition (int)

Return type bool

Pready(partition) โœจ

Mark a given partition as ready.

Parameters

  • partition (int)

Return type None

Pready_list(partitions) ๐Ÿฆ‹

Mark a sequence of partitions as ready.

Parameters

  • partitions (Sequence[int])

Return type None

Pready_range(partition_low, partition_high) ๐ŸŽ€

Mark a range of partitions as ready.

Parameters

  • partition_low (int)
  • partition_high (int)

Return type None

Start() ๐Ÿ”ฅ

Initiate a communication with a persistent request.

Return type None

classmethod Startall(requests) ๐Ÿ‘‘

Start a collection of persistent requests.

  • requests โ€” a list of Prequest objects ๐Ÿ’… like, hand me the whole squad of pending requests at once, bestie

Return type: None โ€” she does the thing and gives you nothing back, and that's the whole point, no cap ๐Ÿซถ


mpi4py.MPI.Request

class mpi4py.MPI.Request

Bases: object

Okay so this is the Request handler โœจ the little object that holds onto a nonblocking operation so you can check on it later. It's giving "I'll text you when it's done" energy, and honestly? Iconic. ๐Ÿ‘‘

static __new__(cls, request=None)

Not me casually dropping a static constructor on you ๐Ÿ™ˆ yes, it's __new__, yes it's static, yes we're being fancy today.

Parameters:

  • request โ€” a Request, or None if you're feeling mysterious ๐Ÿ’€

Return type: Self โ€” she hands back a brand new shiny Self, as one does ๐ŸŒธ


โœจ Methods Summary โœจ

okay bestie, here's the whole squad of methods, both the CamelCase version and the lowercase version, because this class said "why not both" and honestly? iconic of it ๐Ÿ’…

  • Cancel() โ€” cancel a request. bye bye request ๐Ÿซถ
  • Free() โ€” free a communication request. let it go, bestie, release the memory
  • Get_status([status]) โ€” a non-destructive test for the completion of a request (peeks, doesn't disturb ๐Ÿ’–)
  • Get_status_all(requests[, statuses]) โ€” non-destructive test for the completion of all the requests
  • Get_status_any(requests[, status]) โ€” non-destructive test for the completion of any of the requests
  • Get_status_some(requests[, statuses]) โ€” non-destructive test for completion of some requests
  • Test([status]) โ€” test for the completion of a non-blocking operation
  • Testall(requests[, statuses]) โ€” test for completion of all previously initiated requests
  • Testany(requests[, status]) โ€” test for completion of any previously initiated request
  • Testsome(requests[, statuses]) โ€” test for completion of some previously initiated requests
  • Wait([status]) โ€” wait for a non-blocking operation to complete (this one actually blocks, no cap)
  • Waitall(requests[, statuses]) โ€” wait for all previously initiated requests to complete
  • Waitany(requests[, status]) โ€” wait for any previously initiated request to complete
  • Waitsome(requests[, statuses]) โ€” wait for some previously initiated requests to complete
  • cancel() โ€” cancel a request (the lowercase remix ๐ŸŒˆ)
  • f2py(arg) โ€” no description given, it's giving mystery โœจ
  • free() โ€” call Free if not null
  • fromhandle(handle) โ€” create object from MPI handle
  • fromint(arg, /) โ€” translate integer handle to object
  • get_status([status]) โ€” non-destructive test for the completion of a request
  • get_status_all(requests[, statuses]) โ€” non-destructive test for the completion of all requests
  • get_status_any(requests[, status]) โ€” non-destructive test for the completion of any requests
  • get_status_some(requests[, statuses]) โ€” non-destructive test for completion of some requests
  • py2f() โ€” also no description, the manpage is keeping secrets ๐Ÿ’€
  • test([status]) โ€” test for the completion of a non-blocking operation
  • testall(requests[, statuses]) โ€” test for completion of all previously initiated requests
  • testany(requests[, status]) โ€” test for completion of any previously initiated request
  • testsome(requests[, statuses]) โ€” test for completion of some previously initiated requests
  • toint() โ€” translate object to integer handle
  • wait([status]) โ€” wait for a non-blocking operation to complete
notice how Get_status/get_status and friends are literally the same vibe twice? yeah. pick whichever one matches your code's aesthetic, they're both here, we don't gatekeep ๐ŸŽ€

  • waitall(requests[, statuses]) โ€” blocks until all the requests you already kicked off are done. every single one, bestie, no stragglers, no "almost there" ๐Ÿ’…
  • waitany(requests[, status]) โ€” blocks until any one of your previously initiated requests completes. first one home gets the crown ๐Ÿ‘‘
  • waitsome(requests[, statuses]) โ€” blocks until some of your previously initiated requests complete. not all, not one, just... some. iconic chaos ๐Ÿฆ‹

โœจ Attributes Summary โœจ

  • handle โ€” the MPI handle. that's it, that's the whole vibe ๐ŸŽ€

๐Ÿ’… Methods Documentation ๐Ÿ’…

Cancel()

Cancel a request. ๐Ÿšซ

Free()

Free a communication request. let it go, bestie, it's not yours anymore ๐Ÿ•Š๏ธ

Get_status(status=None)

Non-destructive test for the completion of a request. peek at it, don't touch it ๐Ÿ‘€

classmethod Get_status_all(requests, statuses=None)

Non-destructive test for the completion of all requests.

classmethod Get_status_any(requests, status=None)

Non-destructive test for the completion of any requests.

classmethod Get_status_some(requests, statuses=None)

Non-destructive test for completion of some requests.

Test(status=None)

Test for the completion of a non-blocking operation. lowkey just checking in, no waiting around ๐Ÿซถ

classmethod Testall(requests, statuses=None)

Test for completion of all previously initiated requests.

classmethod Testany(requests, status=None)

Test for completion of any previously initiated request.

classmethod Testsome(requests, statuses=None)

Test for completion of some previously initiated requests.

Wait(status=None)

Wait for a non-blocking operation to complete. sit down, hydrate, it'll be done when it's done ๐Ÿ’–

classmethod Waitall(requests, statuses=None)

Wait for all previously initiated requests to complete. all of them. every last one. periodt ๐Ÿ”ฅ

classmethod Waitany(requests, status=None)

Wait for any previously initiated request to complete. first one to finish, you're the main character now โœจ

classmethod Waitsome(requests, statuses=None)

Wait for some previously initiated requests to complete.

cancel()

Cancel a request. same energy as Cancel(), just lowercase and chill ๐ŸงŠ

classmethod f2py(arg)

Return type: Request ๐Ÿ’–


free() ๐ŸŽ€

Calls Free if the thing isn't null. That's it, that's the whole job.

Return type: None

classmethod fromhandle(handle) ๐Ÿช„

Builds you a whole object out of an MPI handle. Glow-up from raw number to real class, no cap.

Parameters:

  • handle (int)

Return type: Request

classmethod fromint(arg, /) ๐ŸŒˆ

Takes an integer handle and translates it into the object. Same energy as fromhandle, different entry point.

Parameters:

  • arg (int)

Return type: Request

get_status(status=None) ๐Ÿ‘€

A non-destructive test for whether a request has finished. It peeks, it does not consume. Respectful king behavior.

Parameters:

  • status (Status | None)

Return type: bool

classmethod get_status_all(requests, statuses=None) ๐Ÿ‘‘

Non-destructive test for the completion of all the requests. Everybody has to be done or it's a no from me.

Parameters:

  • requests (Sequence[Request])
  • statuses (list[Status] | None)

Return type: bool

classmethod get_status_any(requests, status=None) โœจ

Non-destructive test for the completion of any of the requests. One single one finishing is enough to make it slay.

Parameters:

  • requests (Sequence[Request])
  • status (Status | None)

Return type: tuple[int, bool]

classmethod get_status_some(requests, statuses=None) ๐ŸŒธ

Non-destructive test for the completion of some of the requests. A little subset of finished vibes.

Parameters:

  • requests (Sequence[Request])
  • statuses (list[Status] | None)

Return type: list[int] | None

py2f() ๐Ÿโžก๏ธ๐Ÿ”ข

No description in the docs, bestie โ€” it just hands you back an int.

Return type: int

test(status=None) ๐Ÿงช

Tests whether a non-blocking operation has completed. Note this one is not the "non-destructive" crew โ€” it's the real test.

Parameters:

  • status (Status | None)

Return type: tuple[bool, Any | None]

classmethod testall(requests, statuses=None) ๐Ÿ”ฅ

Tests for the completion of all the requests you previously initiated. Full house only.

Parameters:

  • requests (Sequence[Request])
  • statuses (list[Status] | None)

Return type: tuple[bool, list[Any] | None]

classmethod testany(requests, status=None) โญ

Tests for the completion of any previously initiated request. First one to cross the finish line gets the attention.

Parameters:

  • requests (Sequence[Request])
  • status (Status | None)

Return type: tuple[int, bool, Any | None]

classmethod testsome(requests, statuses=None) ๐Ÿ’…

Tests for the completion of some of the previously initiated requests. A lil group of overachievers, honestly iconic.

Parameters:

  • requests (Sequence[Request])
  • statuses (list[Status] | None)

Return type: tuple[list[int] | None, list[Any] | None]

toint() ๐Ÿ”ข

Translates the object into an integer handle. The reverse glow-down, and I mean that with love.

Return type: int

wait(status=None) โณ

Waits for a non-blocking operation to complete. Yes, it will sit there and hold your hand until it's done. Loyal.

Parameters:

  • status (Status | None)

Return type: Any

classmethod waitall(requests, statuses=None) ๐Ÿซถ

Waits for all previously initiated requests to complete. Every single one of them, no skipping, we are not leaving anybody behind.

Parameters:

  • requests (Sequence[Request])
  • statuses (list[Status] | None)

Return type: list[Any]

classmethod waitany(requests, status=None) ๐Ÿฆ‹

Waits for any previously initiated request to complete. Whichever one gets there first, that's the one we're celebrating.

Parameters:

  • requests (Sequence[Request])
  • status (Status | None)

Return type: tuple[int, Any]

classmethod waitsome(requests, statuses=None) ๐Ÿ“

Waits for some of the previously initiated requests to complete. Not all of them โ€” just however many show up to the party.

Parameters:

  • requests (Sequence[Request])
  • statuses (list[Status] | None)

Return type: tuple[list[int] | None, list[Any] | None]

Attributes Documentation ๐Ÿ“Œ

  • handle โ€” MPI handle.

๐ŸŒธ mpi4py.MPI.Session ๐ŸŒธ

class mpi4py.MPI.Session

Bases: object

Okay bestie, this is the Session context โœจ โ€” think of it as a whole vibe of MPI-ness that you can spin up, poke at, and shut down on its own terms.

static __new__(cls, session=None)
  • Parameters โ€” session (Session | None)
  • Return type โ€” Self

Methods Summary ๐Ÿ’…

  • Attach_buffer(buf) โ€” Attach a user-provided buffer for sending in buffered mode.
  • Call_errhandler(errorcode) โ€” Call the error handler installed on a session.
  • Create_errhandler(errhandler_fn) โ€” Create a new error handler for sessions.
  • Create_group(pset_name) โ€” Create a new group from session and process set.
  • Detach_buffer() โ€” Remove an existing attached buffer.
  • Finalize() โ€” Finalize a session.
  • Flush_buffer() โ€” Block until all buffered messages have been transmitted.
  • Get_errhandler() โ€” Get the error handler for a session.
  • Get_info() โ€” Return the current hints for a session.
  • Get_nth_pset(n[, info]) โ€” Name of the n-th process set.
  • Get_num_psets([info]) โ€” Number of available process sets.
  • Get_pset_info(pset_name) โ€” Return the current hints for a session and process set.
  • Iflush_buffer() โ€” Nonblocking flush for buffered messages.
  • Init([info, errhandler]) โ€” Create a new session.
  • Set_errhandler(errhandler) โ€” Set the error handler for a session.
  • f2py(arg)
  • free() โ€” Call Finalize if not null.
  • fromhandle(handle) โ€” Create object from MPI handle.
  • fromint(arg, /) โ€” Translate integer handle to object.
  • py2f()
  • toint() โ€” Translate object to integer handle.

Attributes Summary ๐ŸŽ€

  • handle โ€” MPI handle.

Methods Documentation ๐Ÿ“–

Attach_buffer(buf)

Attach a user-provided buffer for sending in buffered mode. ๐Ÿซ™โœจ

  • Parameters โ€” buf (Buffer | None)
  • Return type โ€” None

Call_errhandler(errorcode)

Call the error handler installed on a session. Like ringing the little alarm bell you set up earlier ๐Ÿ“ฃ

  • Parameters โ€” errorcode (int)
  • Return type โ€” None

classmethod Create_errhandler(errhandler_fn)

Create a new error handler for sessions. Custom alarm bell, made by you ๐Ÿ’…

  • Parameters โ€” errhandler_fn (Callable[[Session, int], None])
  • Return type โ€” Errhandler

Create_group(pset_name)

Create a new group from session and process set. Squish a session + a process set together and boom, a group ๐Ÿซถ

  • Parameters โ€” pset_name (str)

Return type: Group ๐Ÿซถ


Detach_buffer()

Say bye to a buffer you'd attached earlier โ€” it just takes the attached buffer back off the shelf, that's it.

  • Return type: Buffer | None

Finalize()

Wrap up a session. That's the whole job. ๐Ÿ‘‹

  • Return type: None

Flush_buffer()

Blocks (like, actually waits) until every single buffered message has been transmitted. Nothing sneaky gets left in the queue, bestie. โœจ

  • Return type: None

Get_errhandler()

Hands you the error handler that's hooked up to a session.

  • Return type: Errhandler

Get_info()

Returns the current hints for a session. The tea, basically. ๐Ÿ“

  • Return type: Info

Get_nth_pset(n, info=INFO_NULL)

Gives you the name of the n-th process set. No cap.

Parameters:

  • n (int)
  • info (Info)
  • Return type: str

Get_num_psets(info=INFO_NULL)

How many process sets are even available. The headcount. ๐Ÿ‘‘

Parameters:

  • info (Info)
  • Return type: int

Get_pset_info(pset_name)

Returns the current hints for a session and a process set โ€” both at once, iconic.

Parameters:

  • pset_name (str)
  • Return type: Info

Iflush_buffer()

Same energy as flushing buffered messages, but nonblocking โ€” it does not sit there waiting. It hands you a request instead. ๐Ÿ’…

  • Return type: Request

classmethod Init(info=INFO_NULL, errhandler=None)

Creates a brand new session. Main character origin story. โœจ

Parameters:

  • info (Info)
  • errhandler (Errhandler | None)
  • Return type: Self

Set_errhandler(errhandler)

Sets the error handler for a session. Pick your handler, commit to it.

Parameters:

  • errhandler (Errhandler)
  • Return type: None

classmethod f2py(arg)

Parameters:

  • arg (int)
  • Return type: Session

free()

Calls Finalize if not null.

  • Return type: None

classmethod fromhandle(handle)

Builds an object straight from an MPI handle. ๐ŸŽ€

Parameters:

  • handle (int)
  • Return type: Session

classmethod fromint(arg, /)

Translates an integer handle into an object. Glow-up complete. ๐ŸŒธ

Parameters:

  • arg (int)
  • Return type: Session

py2f()

  • Return type: int

toint()

Translates an object into an integer handle.

  • Return type: int

Attributes Documentation ๐Ÿ“Œ

handle

MPI handle.


mpi4py.MPI.Status ๐Ÿ’œ

class mpi4py.MPI.Status

Bases: object

Status object.


static __new__(cls, status=None)

Parameters:

  • status (Status | None)
  • Return type: Self

Methods Summary ๐Ÿฆ‹

  • Get_count([datatype]) โ€” Get the number of top level elements.
  • Get_elements(datatype) โ€” Get the number of basic elements in a datatype.
  • Get_error() โ€” Get message error.
  • Get_source() โ€” Get message source.
  • Get_tag() โ€” Get message tag.
  • Is_cancelled() โ€” Test to see if a request was cancelled.
  • Set_cancelled(flag) โ€” Set the cancelled state associated with a status.
  • Set_elements(datatype, count) โ€” Set the number of elements in a status.
  • Set_error(error) โ€” Set message error.
  • Set_source(source) โ€” Set message source.
  • Set_tag(tag) โ€” Set message tag.
  • f2py(arg)
  • py2f()
  • tomemory() โ€” Return status memory view.

Attributes Summary ๐ŸŒˆ

  • cancelled โ€” Cancelled state.
  • count โ€” Byte count.
  • error โ€” Message error.
  • source โ€” Message source.
  • tag โ€” Message tag.

Methods Documentation โœจ

Get_count(datatype=BYTE)

Gives you the number of top level elements.

Parameters:

  • datatype (Datatype)
  • Return type: int

Get_elements(datatype)

Gives you the number of basic elements in a datatype.

Parameters:

  • datatype (Datatype)
  • Return type: int

โœจ Get_error()

Gives you the message error. That's it, that's the whole thing ๐Ÿ’…

  • Return type โ€” int

โœจ Get_source()

Gives you the message source. Yes queen, it's right there ๐ŸŒธ

  • Return type โ€” int

โœจ Get_tag()

Gives you the message tag. The little label on the message, iconic โœจ

  • Return type โ€” int

โœจ Is_cancelled()

Checks whether a request got cancelled. Lowkey useful, no cap ๐Ÿฆ‹

  • Return type โ€” bool

โœจ Set_cancelled(flag)

Sets the cancelled state that's associated with a status.

โš ๏ธ Heads up bestie: only reach for this one when you're implementing query callback functions for generalized requests. Not a casual-use situation, fr fr.
  • Parameters
    • flag โ€” bool
  • Return type โ€” None

โœจ Set_elements(datatype, count)

Sets the number of elements in a status. Bestie, we're literally counting โœจ

โš ๏ธ Listen: this is only for when you're implementing query callback functions for generalized requests. Stay in your lane, it's giving specialized ๐Ÿ’…
  • Parameters
    • datatype โ€” Datatype
    • count โ€” int
  • Return type โ€” None

โœจ Set_error(error)

Sets the message error.

  • Parameters
    • error โ€” int
  • Return type โ€” None

โœจ Set_source(source)

Sets the message source.

  • Parameters
    • source โ€” int
  • Return type โ€” None

โœจ Set_tag(tag)

Sets the message tag.

  • Parameters
    • tag โ€” int
  • Return type โ€” None

โœจ classmethod f2py(arg)

A classmethod, so you're calling it on the class itself, not on an instance. Main character energy ๐ŸŒŸ

  • Parameters
    • arg โ€” list[int]
  • Return type โ€” Self

โœจ py2f()

  • Return type โ€” list[int]

โœจ tomemory()

Returns the status as a memory view. It's giving "here's the raw view" ๐Ÿ‘‘

  • Return type โ€” memoryview

๐ŸŽ€ Attributes Documentation

cancelled

Cancelled state.

count

Byte count.

error

Message error.

source

Message source.

tag

Message tag.


๐Ÿ’œ mpi4py.MPI.Topocomm

class mpi4py.MPI.Topocomm

Bases: Intracomm

Topology intracommunicator. Bestie, this is the comm that actually knows who its neighbors are ๐Ÿฆ‹


static __new__(cls, comm=None)

  • Parameters
    • comm โ€” Topocomm | None
  • Return type โ€” Self

๐Ÿ“‹ Methods Summary

okay so here's the whole roster, and every single one of them is here, no skips, no cuts ๐Ÿ’–

  • Ineighbor_allgather(sendbuf, recvbuf) โ€” Nonblocking Neighbor Gather to All.
  • Ineighbor_allgatherv(sendbuf, recvbuf) โ€” Nonblocking Neighbor Gather to All Vector.
  • Ineighbor_alltoall(sendbuf, recvbuf) โ€” Nonblocking Neighbor All to All.
  • Ineighbor_alltoallv(sendbuf, recvbuf) โ€” Nonblocking Neighbor All to All Vector.
  • Ineighbor_alltoallw(sendbuf, recvbuf) โ€” Nonblocking Neighbor All to All General.
  • Neighbor_allgather(sendbuf, recvbuf) โ€” Neighbor Gather to All.
  • Neighbor_allgather_init(sendbuf, recvbuf[, info]) โ€” Persistent Neighbor Gather to All.
  • Neighbor_allgatherv(sendbuf, recvbuf) โ€” Neighbor Gather to All Vector.
  • Neighbor_allgatherv_init(sendbuf, recvbuf[, ...]) โ€” Persistent Neighbor Gather to All Vector.
  • Neighbor_alltoall(sendbuf, recvbuf) โ€” Neighbor All to All.
  • Neighbor_alltoall_init(sendbuf, recvbuf[, info]) โ€” Persistent Neighbor All to All.
  • Neighbor_alltoallv(sendbuf, recvbuf) โ€” Neighbor All to All Vector.
  • Neighbor_alltoallv_init(sendbuf, recvbuf[, info]) โ€” Persistent Neighbor All to All Vector.
  • Neighbor_alltoallw(sendbuf, recvbuf) โ€” Neighbor All to All General.
  • Neighbor_alltoallw_init(sendbuf, recvbuf[, info]) โ€” Persistent Neighbor All to All General.
  • neighbor_allgather(sendobj) โ€” Neighbor Gather to All.
  • neighbor_alltoall(sendobj) โ€” Neighbor All to All.

Attributes Summary ๐Ÿ’–

  • degrees โ€” the number of incoming and outgoing neighbors, combined. bestie gets both directions, no cap ๐ŸŽ€
  • indegree โ€” how many neighbors are pointing at you. incoming only ๐Ÿ’Œ
  • inedges โ€” the incoming neighbors themselves. the whole list, not just the count โœจ
  • inoutedges โ€” incoming and outgoing neighbors, all in one place ๐Ÿฆ‹
  • outdegree โ€” how many neighbors you're pointing at. outgoing only ๐Ÿ“ค
  • outedges โ€” the outgoing neighbors themselves ๐ŸŒธ

Methods Documentation ๐Ÿ“

Ineighbor_allgather(sendbuf, recvbuf)

Nonblocking Neighbor Gather to All. ๐Ÿƒโ™€๏ธ๐Ÿ’จ

Parameters

  • sendbuf (BufSpec)
  • recvbuf (BufSpecB)

Return type Request

Ineighbor_allgatherv(sendbuf, recvbuf)

Nonblocking Neighbor Gather to All Vector. ๐Ÿ’…

Parameters

  • sendbuf (BufSpec)
  • recvbuf (BufSpecV)

Return type Request

Ineighbor_alltoall(sendbuf, recvbuf)

Nonblocking Neighbor All to All. ๐Ÿ”ฅ

Parameters

  • sendbuf (BufSpecB)
  • recvbuf (BufSpecB)

Return type Request

Ineighbor_alltoallv(sendbuf, recvbuf)

Nonblocking Neighbor All to All Vector. โœจ

Parameters

  • sendbuf (BufSpecV)
  • recvbuf (BufSpecV)

Return type Request

Ineighbor_alltoallw(sendbuf, recvbuf)

Nonblocking Neighbor All to All General. ๐Ÿ‘‘

Parameters

  • sendbuf (BufSpecW)
  • recvbuf (BufSpecW)

Return type Request

Neighbor_allgather(sendbuf, recvbuf)

Neighbor Gather to All. ๐ŸŒธ

Parameters

  • sendbuf (BufSpec)
  • recvbuf (BufSpecB)

Return type None

Neighbor_allgather_init(sendbuf, recvbuf, info=INFO_NULL)

Persistent Neighbor Gather to All. ๐ŸŽ€

Parameters

  • sendbuf (BufSpec)
  • recvbuf (BufSpecB)
  • info (Info)

Return type Prequest

Neighbor_allgatherv(sendbuf, recvbuf)

Neighbor Gather to All Vector. ๐Ÿฆ‹

Parameters

  • sendbuf (BufSpec)
  • recvbuf (BufSpecV)

Return type None

Neighbor_allgatherv_init(sendbuf, recvbuf, info=INFO_NULL)

Persistent Neighbor Gather to All Vector. ๐Ÿ’œ

Parameters

  • sendbuf (BufSpec)
  • recvbuf (BufSpecV)
  • info (Info)

Return type Prequest

Neighbor_alltoall(sendbuf, recvbuf)

Neighbor All to All. โญ

Parameters

  • sendbuf (BufSpecB)
  • recvbuf (BufSpecB)

Return type None

Neighbor_alltoall_init(sendbuf, recvbuf, info=INFO_NULL)

Persistent Neighbor All to All. ๐Ÿ’–

Parameters

  • sendbuf (BufSpecB)
  • recvbuf (BufSpecB)
  • info (Info)

Return type Prequest

Neighbor_alltoallv(sendbuf, recvbuf)

Neighbor All to All Vector. ๐ŸŒˆ

Parameters

  • sendbuf (BufSpecV)
  • recvbuf (BufSpecV)

Return type None

Neighbor_alltoallv_init(sendbuf, recvbuf, info=INFO_NULL)

Persistent Neighbor All to All Vector. ๐Ÿงš

Parameters

  • sendbuf (BufSpecV)
  • recvbuf (BufSpecV)
  • info (Info)

Return type Prequest

Neighbor_alltoallw(sendbuf, recvbuf)

Neighbor All to All General. ๐Ÿ’ซ

Parameters

  • sendbuf (BufSpecW)
  • recvbuf (BufSpecW)

Return type None

Neighbor_alltoallw_init(sendbuf, recvbuf, info=INFO_NULL)

Persistent Neighbor All to All General. ๐Ÿ”ฎ

Parameters

  • sendbuf (BufSpecW)
  • recvbuf (BufSpecW)
  • info (Info)

Return type Prequest

neighbor_allgather(sendobj)

Neighbor Gather to All. ๐Ÿซถ

Parameters sendobj (Any)

Return type list[Any]

neighbor_alltoall(sendobj)

Neighbor All to All. ๐Ÿ’

Parameters sendobj (list[Any])

Return type list[Any]


Attributes Documentation ๐ŸŽ€

degrees

Number of incoming and outgoing neighbors.

indegree

Number of incoming neighbors.

inedges

Incoming neighbors.

inoutedges

Incoming and outgoing neighbors.

outdegree

Number of outgoing neighbors.

outedges

Outgoing neighbors.


mpi4py.MPI.Win ๐Ÿ‘‘

class mpi4py.MPI.Win

Bases: object

Remote memory access context. โœจ (yes bestie, we're doing one-sided comms now, it's giving main character energy ๐ŸŒŸ)

static __new__(cls, win=None)

Parameters win (Win | None)

Return type Self

๐Ÿ’ซ Methods Summary ๐Ÿ’ซ

okay bestie, here's the whole roster of what a window object can do, and yes it's giving a lot of methods, but they're all one-sided communication baddies so let's get into it โœจ

  • Accumulate(origin, target_rank[, target, op]) โ€” Accumulate data into the target process. ๐Ÿซถ
  • Allocate(size[, disp_unit, info, comm]) โ€” Create an window object for one-sided communication.
  • Allocate_shared(size[, disp_unit, info, comm]) โ€” Create an window object for one-sided communication.
  • Attach(memory) โ€” Attach a local memory region.
  • Call_errhandler(errorcode) โ€” Call the error handler installed on a window.
  • Compare_and_swap(origin, compare, result, ...) โ€” Perform one-sided atomic compare-and-swap. ๐Ÿ”ฅ
  • Complete() โ€” Complete an RMA operation begun after an Start.
  • Create(memory[, disp_unit, info, comm]) โ€” Create an window object for one-sided communication.
  • Create_dynamic([info, comm]) โ€” Create an window object for one-sided communication.
  • Create_errhandler(errhandler_fn) โ€” Create a new error handler for windows.
  • Create_keyval([copy_fn, delete_fn, nopython]) โ€” Create a new attribute key for windows.
  • Delete_attr(keyval) โ€” Delete attribute value associated with a key.
  • Detach(memory) โ€” Detach a local memory region.
  • Fence([assertion]) โ€” Perform an MPI fence synchronization on a window. ๐Ÿšง
  • Fetch_and_op(origin, result, target_rank[, ...]) โ€” Perform one-sided read-modify-write.
  • Flush(rank) โ€” Complete all outstanding RMA operations at a target.
  • Flush_all() โ€” Complete all outstanding RMA operations at all targets.
  • Flush_local(rank) โ€” Complete locally all outstanding RMA operations at a target.
  • Flush_local_all() โ€” Complete locally all outstanding RMA operations at all targets.
  • Free() โ€” Free a window.
  • Free_keyval(keyval) โ€” Free an attribute key for windows.
  • Get(origin, target_rank[, target]) โ€” Get data from a memory window on a remote process. ๐Ÿ‘€
  • Get_accumulate(origin, result, target_rank) โ€” Fetch-and-accumulate data into the target process.
  • Get_attr(keyval) โ€” Retrieve attribute value by key.
  • Get_errhandler() โ€” Get the error handler for a window.
  • Get_group() โ€” Access the group of processes that created the window.
  • Get_info() โ€” Return the current hints for a window.
  • Get_name() โ€” Get the print name for this window.
  • Lock(rank[, lock_type, assertion]) โ€” Begin an RMA access epoch at the target process. ๐Ÿ”

okay so the Win method menu does not stop, bestie โ€” here's the second half of the alphabet, all the R's and S's plus the little utility girlies chilling at the bottom. every single one, no skips, no cap ๐Ÿ’–

  • Lock_all([assertion]) โ€” kick off an RMA access epoch at all the processes at once. not one, not a few โ€” everybody. group blast energy ๐Ÿ’…
  • Post(group[, assertion]) โ€” start an RMA exposure epoch. this is you saying "i'm open for business" โœจ
  • Put(origin, target_rank[, target]) โ€” put data into a memory window living on a remote process. yeet it over there ๐Ÿซถ
  • Raccumulate(origin, target_rank[, target, op]) โ€” fetch-<em>and</em>-accumulate data into the target process. so it grabs the value and adds to it, one move, iconic ๐Ÿ˜Œ
  • Rget(origin, target_rank[, target]) โ€” get data from a memory window on a remote process. reaching across the network and snatching it, respectfully ๐ŸŽ€
  • Rget_accumulate(origin, result, target_rank) โ€” accumulate data into the target process using remote memory access ๐Ÿ”ฅ
  • Rput(origin, target_rank[, target]) โ€” put data into a memory window on a remote process. yes it's basically Put's twin, and yes they're both here, the docs said so ๐ŸŒธ
  • Set_attr(keyval, attrval) โ€” store an attribute value that's tied to a key. lil storage locker, but for attributes ๐Ÿ’œ
  • Set_errhandler(errhandler) โ€” set the error handler for a window. choose who catches the chaos when things go sideways ๐Ÿ’€
  • Set_info(info) โ€” set new values for the hints associated with a window. hint glow-up โœจ
  • Set_name(name) โ€” set the print name for this window. name your baby ๐ŸŽ€
  • Shared_query(rank) โ€” query the process-local address for remote memory segments. "where does that live on <em>my</em> side?" ๐Ÿ“
  • Start(group[, assertion]) โ€” start an RMA access epoch for MPI ๐Ÿฆ‹
  • Sync() โ€” synchronize the public and private copies of the window. get them on the same page, fr fr ๐Ÿซถ
  • Test() โ€” test whether an RMA exposure epoch has completed. non-blocking vibe check, it just tells you yes or no ๐Ÿ‘€
  • Unlock(rank) โ€” complete an RMA access epoch at the target process. wrap it up, we're done here ๐Ÿ’…
  • Unlock_all() โ€” complete an RMA access epoch at all processes. same energy, but for everybody at once ๐ŸŒˆ
  • Wait() โ€” complete an RMA exposure epoch begun with Post. the patient sibling of Test โญ
  • f2py(arg) โ€” the docs literally leave the description blank here, bestie. no tea, no crumbs, we don't invent ๐Ÿ™ˆ
  • free() โ€” call Free if not null. polite little cleanup moment ๐Ÿงน
  • fromhandle(handle) โ€” create an object from an MPI handle ๐Ÿ”‘
  • fromint(arg, /) โ€” translate an integer handle to an object. numbers to objects, glow-up complete โœจ
  • py2f() โ€” also blank in the docs. an enigma, a mystery, a girl who says nothing ๐Ÿ˜ญ
  • toint() โ€” translate an object to an integer handle. the reverse magic trick ๐Ÿช„
  • tomemory() โ€” return window memory buffer. hand it over, we're taking it ๐Ÿ“

and that's the whole table wrapped, but the page is so not done yet โ€” keep scrolling, we're still going ๐Ÿ’–

๐Ÿ’– Attributes Summary ๐Ÿ’–

okay bestie, here's the quick lil vibe check on what attributes a Win is carrying around:

  • attrs โ€” Attributes.
  • flavor โ€” Create flavor.
  • group โ€” Group.
  • group_rank โ€” Group rank.
  • group_size โ€” Group size.
  • handle โ€” MPI handle.
  • info โ€” Info hints.
  • model โ€” Memory model.
  • name โ€” Print name.

๐ŸŒธ Methods Documentation ๐ŸŒธ

Accumulate(origin, target_rank, target=None, op=SUM)

Accumulate data into the target process. fr fr, you're dumping your data into somebody else's spot.

Parameters

  • origin (BufSpec)
  • target_rank (int)
  • target (TargetSpec | None)
  • op (Op)

Return type

None

classmethod Allocate(size, disp_unit=1, info=INFO_NULL, comm=COMM_SELF)

Create an window object for one-sided communication. (yes bestie, the manpage itself said "an window", we don't fix, we respect ๐Ÿ’…)

Parameters

  • size (int)
  • disp_unit (int)
  • info (Info)
  • comm (Intracomm)

Return type

Self

classmethod Allocate_shared(size, disp_unit=1, info=INFO_NULL, comm=COMM_SELF)

Create an window object for one-sided communication. shared edition, so everybody's on the same page literally.

Parameters

  • size (int)
  • disp_unit (int)
  • info (Info)
  • comm (Intracomm)

Return type

Self

Attach(memory)

Attach a local memory region. plugging your lil memory chunk in, iconic.

Parameters

  • memory (Buffer)

Return type

None

Call_errhandler(errorcode)

Call the error handler installed on a window. yep, you're summoning the error handler.

Parameters

  • errorcode (int)

Return type

None

Compare_and_swap(origin, compare, result, target_rank, target_disp=0)

Perform one-sided atomic compare-and-swap. the atomic part is the โœจ moment โœจ, no cap.

Parameters

  • origin (BufSpec)
  • compare (BufSpec)
  • result (BufSpec)
  • target_rank (int)
  • target_disp (int)

Return type

None

Complete()

Complete an RMA operation begun after an Start. closing the loop on your started RMA era.

Return type

None

classmethod Create(memory, disp_unit=1, info=INFO_NULL, comm=COMM_SELF)

Create an window object for one-sided communication. the main character window-maker tbh.

Parameters

  • memory (Buffer | Bottom)
  • disp_unit (int)
  • info (Info)
  • comm (Intracomm)

Return type

Self

classmethod Create_dynamic(info=INFO_NULL, comm=COMM_SELF)

Create an window object for one-sided communication. dynamic flavor, keeping it flexible.

Parameters

  • info (Info)
  • comm (Intracomm)

Return type

Self

classmethod Create_errhandler(errhandler_fn)

Create a new error handler for windows. building your own lil safety net, we love to see it.

Parameters

  • errhandler_fn (Callable[[Win, int], None])

Return type

Errhandler

classmethod Create_keyval(copy_fn=None, delete_fn=None, nopython=False)

Create a new attribute key for windows. your custom key era begins now ๐Ÿ”‘

Parameters

  • copy_fn (Callable[[Win, int, Any], Any] | None)
  • delete_fn (Callable[[Win, int, Any], None] | None)
  • nopython (bool)

Return type

int

Delete_attr(keyval)

Delete attribute value associated with a key. bye bye attribute, we hardly knew ye.

Parameters

  • keyval (int)

Return type

None

Detach(memory)

Detach a local memory region. unplugging that memory chunk, respectfully.

Parameters

  • memory (Buffer)

Return type

None

Fence(assertion=0)

Perform an MPI fence synchronization on a window. everyone sync up besties ๐Ÿšง

Parameters

  • assertion (int)

Return type

None

Fetch_and_op(origin, result, target_rank, target_disp=0, op=SUM)

Perform one-sided read-modify-write. grab it, tweak it, put it back, one trip.

Parameters

  • origin (BufSpec)
  • result (BufSpec)
  • target_rank (int)
  • target_disp (int)
  • op (Op)

Return type

None

Flush(rank)

Complete all outstanding RMA operations at a target. clearing out the queue at that rank, no leftovers.

Parameters

  • rank (int)

Return type

None

Flush_all()

okay bestie, this one means complete all outstanding RMA operations at all targets. Like, every single one, everywhere. no stragglers. ๐Ÿ’…

Return type: None


Flush_local(rank)

Complete locally all outstanding RMA operations at a target. the "locally" is doing a lot of work there, so read it carefully fr fr ๐Ÿซถ

Parameters:

  • rank (int)

Return type: None


Flush_local_all()

Complete locally all outstanding RMA operations at all targets. same energy as Flush_local but it's giving "everyone at once". โœจ

Return type: None


Free()

Free a window. that's it, that's the whole vibe. window freed, slay. ๐ŸŽ€

Return type: None


classmethod Free_keyval(keyval)

Free an attribute key for windows. this is a classmethod, don't forget, it's not an instance situation. ๐Ÿ’…

Parameters:

  • keyval (int)

Return type: int


Get(origin, target_rank, target=None)

Get data from a memory window on a remote process. it's a get. from remote memory. you're welcome. ๐Ÿ’–

Parameters:

  • origin (BufSpec)
  • target_rank (int)
  • target (TargetSpec | None)

Return type: None


Get_accumulate(origin, result, target_rank, target=None, op=SUM)

Fetch-and-accumulate data into the target process. yes it does both things, that's the whole point of the name bestie, no cap. ๐Ÿ”ฅ

Parameters:

  • origin (BufSpec)
  • result (BufSpec)
  • target_rank (int)
  • target (TargetSpec | None)
  • op (Op) โ€” default is SUM

Return type: None


Get_attr(keyval)

Retrieve attribute value by key. give it the key, get the value back. iconic behaviour honestly. ๐Ÿ‘‘

Parameters:

  • keyval (int)

Return type: int | Any | None


Get_errhandler()

Get the error handler for a window.

Return type: Errhandler


Get_group()

Access the group of processes that created the window. the whole little crew that made this window happen ๐Ÿซถ

Return type: Group


Get_info()

Return the current hints for a window.

Return type: Info


Get_name()

Get the print name for this window. every window deserves a name, lowkey. ๐ŸŒธ

Return type: str


Lock(rank, lock_type=LOCK_EXCLUSIVE, assertion=0)

Begin an RMA access epoch at the target process. note the defaults, they're doing work here: lock_type defaults to LOCK_EXCLUSIVE and assertion defaults to 0. ๐Ÿ’…

Parameters:

  • rank (int)
  • lock_type (int)
  • assertion (int)

Return type: None


Lock_all(assertion=0)

Begin an RMA access epoch at all processes. all of them. the whole group chat. โœจ

Parameters:

  • assertion (int) โ€” default 0

Return type: None


Post(group, assertion=0)

Start an RMA exposure epoch. yes "exposure epoch", that's the actual name, I don't make the rules. ๐Ÿ™ˆ

Parameters:

  • group (Group)
  • assertion (int) โ€” default 0

Return type: None


Put(origin, target_rank, target=None)

Put data into a memory window on a remote process. it's a put. into remote memory. as advertised. ๐Ÿ’–

Parameters:

  • origin (BufSpec)
  • target_rank (int)
  • target (TargetSpec | None)

Return type: None


Raccumulate(origin, target_rank, target=None, op=SUM)

Fetch-and-accumulate data into the target process. the R up front means it's the nonblocking version and you get a Request back, bestie. ๐Ÿ”ฅ

Parameters:

  • origin (BufSpec)
  • target_rank (int)
  • target (TargetSpec | None)
  • op (Op) โ€” default is SUM

Return type: Request


Rget(origin, target_rank, target=None)

Get data from a memory window on a remote process. again, but nonblocking this time, hence the R and the Request. ๐Ÿฆ‹

Parameters:

  • origin (BufSpec)
  • target_rank (int)
  • target (TargetSpec | None)

Return type: Request


Rget_accumulate(origin, result, target_rank, target=None, op=SUM)

Accumulate data into the target process using remote memory access. yes it's the nonblocking one, and yes you get a Request. โœจ

Parameters:

  • origin (BufSpec)
  • result (BufSpec)
  • target_rank (int)
  • target (TargetSpec | None)
  • op (Op) โ€” default is SUM

Return type: Request


Rput(origin, target_rank, target=None)

Put data into a memory window on a remote process. nonblocking put, Request back, you know the drill by now fr fr. ๐Ÿ’œ

Parameters:

  • origin (BufSpec)
  • target_rank (int)
  • target (TargetSpec | None)

Return type: Request


Set_attr(keyval, attrval)

Store attribute value associated with a key. give it a key AND a value, both are required, don't be shy. ๐ŸŽ€

Parameters:

  • keyval (int)
  • attrval (Any)

Return type: None


Set_errhandler(errhandler)

Set the error handler for a window.

Parameters:

  • errhandler (Errhandler)

Return type: None


Set_info(info)

Set new values for the hints associated with a window.

Parameters:

  • info (Info)

Return type: None


Set_name(name)

Set the print name for this window. go on, name it something cute. ๐ŸŒธ

Parameters:

  • name (str)

Return type: None


Shared_query(rank)

Query the process-local address for remote memory segments.

Parameters:

  • rank (int)

Return type: tuple[buffer, int] โ€” yeah bestie, a tuple, one buffer and one int, that's the whole vibe ๐Ÿ’ซ


Start(group, assertion=0)

Kick off an RMA access epoch for MPI. Go time ๐Ÿ

Parameters

  • group (Group) โ€” the crew you're opening the epoch with
  • assertion (int) โ€” your little hint to the implementation, no cap

Return type: None

Sync()

Synchronize the public and private copies of the window. Making them match, like matching outfits fr fr ๐ŸŽ€

Return type: None

Test()

Test whether an RMA exposure epoch has completed. Just checking in ๐Ÿ‘€

Return type: bool

Unlock(rank)

Complete an RMA access epoch at the target process. Say bye to that one rank ๐Ÿ’…

Parameters

  • rank (int)

Return type: None

Unlock_all()

Complete an RMA access epoch at all processes. Group hug, everyone's dismissed ๐Ÿซถ

Return type: None

Wait()

Complete an RMA exposure epoch begun with Post. Sit there and wait for it to wrap up, main character patience energy โœจ

Return type: Literal[True]

classmethod f2py(arg)

Parameters

  • arg (int)

Return type: Win

free()

Call Free if not null. Only nukes it when there's actually something to nuke ๐Ÿ’€

Return type: None

classmethod fromhandle(handle)

Create object from MPI handle. Turning a raw handle into a whole object, it's giving glow-up ๐ŸŒŸ

Parameters

  • handle (int)

Return type: Win

classmethod fromint(arg, /)

Translate integer handle to object.

Parameters

  • arg (int)

Return type: Win

py2f()

Return type: int

toint()

Translate object to integer handle. Python side โ†’ integer side, the classic handoff ๐Ÿ”

Return type: int

tomemory()

Return window memory buffer.

Return type: buffer


โœจ Attributes Documentation โœจ

  • attrs โ€” Attributes.
  • flavor โ€” Create flavor.
  • group โ€” Group.
  • group_rank โ€” Group rank.
  • group_size โ€” Group size.
  • handle โ€” MPI handle.
  • info โ€” Info hints.
  • model โ€” Memory model.
  • name โ€” Print name.

๐Ÿซง mpi4py.MPI.buffer ๐Ÿซง

class mpi4py.MPI.buffer

Bases: object

Buffer. That's it, that's the whole description, iconic brevity ๐Ÿ˜Œ

static __new__(cls, buf, /)

Parameters

  • buf (Buffer)

Return type: Self

๐Ÿ“‹ Methods Summary

  • allocate(nbytes[, clear]) โ€” Buffer allocation.
  • cast(format[, shape]) โ€” Cast to a memoryview with new format or shape.
  • fromaddress(address, nbytes[, readonly]) โ€” Buffer from address and size in bytes.
  • frombuffer(obj[, readonly]) โ€” Buffer from buffer-like object.
  • release() โ€” Release the underlying buffer exposed by the buffer object.
  • tobytes([order]) โ€” Return the data in the buffer as a byte string.
  • toreadonly() โ€” Return a readonly version of the buffer object.

๐Ÿ“‹ Attributes Summary

  • address โ€” Buffer address.
  • format โ€” Format of each element.
  • itemsize โ€” Size (in bytes) of each element.
  • nbytes โ€” Buffer size (in bytes).
  • obj โ€” Object exposing buffer.
  • readonly โ€” Buffer is read-only.

๐Ÿ› ๏ธ Methods Documentation ๐Ÿ› ๏ธ

static allocate(nbytes, clear=False)

Buffer allocation. Fresh buffer, freshly allocated, periodt ๐Ÿ’–

Parameters

  • nbytes (int)
  • clear (bool)

Return type: buffer

cast(format, shape=Ellipsis)

Cast to a memoryview with new format or shape. Reinterpreting the whole thing, it's giving new outfit same person ๐ŸŒˆ

Parameters

  • format (str)
  • shape (list[int] | tuple[int, ...])

Return type: memoryview

static fromaddress(address, nbytes, readonly=False)

Buffer from address and size in bytes. You bring the address, it brings the bytes ๐Ÿงš

Parameters

  • address (int)
  • nbytes (int)
  • readonly (bool)

Return type: buffer

static frombuffer(obj, readonly=False)

Buffer from buffer-like object. If it quacks like a buffer, it's a buffer ๐Ÿ’…

Parameters

  • obj (Buffer)
  • readonly (bool)

Return type: buffer

release()

Release the underlying buffer exposed by the buffer object.

Return type: None (<https://docs.python.org/3/library/constants.html#None>)

okay bestie, we're still deep in the buffer zone and it's giving immaculate โœจ. Let's keep it moving, no cap.

tobytes(order=None)

This one hands you the data sitting in the buffer as a byte string. It's literally just bytes, fr fr. ๐Ÿ’…

Parameters:

Return type: bytes (<https://docs.python.org/3/library/stdtypes.html#bytes>)

toreadonly()

Returns a readonly version of the buffer object. Same vibe, but you can't touch it. ๐Ÿ™ˆ

Return type: buffer (<#mpi4py.MPI.buffer>)

Attributes Documentation

Here are the attributes, and every single one is iconic in its own way:

  • address โ€” Buffer address. ๐Ÿ“
  • format โ€” Format of each element. ๐ŸŽ€
  • itemsize โ€” Size (in bytes) of each element. ๐Ÿ“
  • nbytes โ€” Buffer size (in bytes). ๐Ÿ“ฆ
  • obj โ€” Object exposing buffer. ๐Ÿซถ
  • readonly โ€” Buffer is read-only. ๐Ÿ”’

mpi4py.MPI.memory

mpi4py.MPI.memory โ€” alias of buffer (<#mpi4py.MPI.buffer>). It's literally the same thing, just a different name. Slay. โœจ

Exceptions

  • Exception (<#mpi4py.MPI.Exception>) โ€” Exception class. ๐Ÿ’€

mpi4py.MPI.Exception

exception mpi4py.MPI.Exception

Bases: RuntimeError (<https://docs.python.org/3/library/exceptions.html#RuntimeError>)

Exception class. It's the main character of error handling. ๐Ÿ‘‘

__init__(ierr=SUCCESS, /)

Parameters:

Return type: None (<https://docs.python.org/3/library/constants.html#None>)

Methods Summary

  • Get_error_class() โ€” Error class.
  • Get_error_code() โ€” Error code.
  • Get_error_string() โ€” Error string.

Attributes Summary

  • error_class โ€” Error class.
  • error_code โ€” Error code.
  • error_string โ€” Error string.

Methods Documentation

Get_error_class()

Error class.

Return type: int (<https://docs.python.org/3/library/functions.html#int>)

Get_error_code()

Error code.

Return type: int (<https://docs.python.org/3/library/functions.html#int>)

Get_error_string()

Error string.

Return type: str (<https://docs.python.org/3/library/stdtypes.html#str>)

Attributes Documentation

  • error_class โ€” Error class.
  • error_code โ€” Error code.
  • error_string โ€” Error string.

โœจ Functions โœจ

okay bestie, here's the whole roster of module-level functions hanging out in mpi4py.MPI โ€” the little global helpers that make the MPI world go round ๐Ÿซถ read them like a contact list, because that's basically what they are.


  • Add_error_class() โ€” adds a brand-new error class to the pile of error classes everyone already knows about โœจ
  • Add_error_code(errorclass) โ€” tacks an error code onto a specific error class, like adding a new sticker to the collection ๐Ÿ’…
  • Add_error_string(errorcode, string) โ€” pairs an error string with either an error class or an error code, so the error actually has something to say ๐Ÿ’ฌ
  • Aint_add(base, disp) โ€” hands you back the sum of the base address and the displacement. math but for pointers ๐Ÿงฎ
  • Aint_diff(addr1, addr2) โ€” gives you the difference between two absolute addresses, lowkey just subtraction with aura ๐Ÿ’€
  • Alloc_mem(size[, info]) โ€” allocates memory meant for message passing and remote memory access. it's giving malloc but make it MPI ๐ŸŽ€
  • Attach_buffer(buf) โ€” attaches a buffer you provided so stuff can be sent in buffered mode. your buffer, your rules ๐Ÿ’–
  • Close_port(port_name) โ€” closes a port. that's it, that's the tweet ๐Ÿ”’
  • Compute_dims(nnodes, dims) โ€” returns a balanced distribution of processes across each coordinate direction. perfectly balanced, as all things should be โš–๏ธ
  • Detach_buffer() โ€” removes an attached buffer that's currently attached. bye bestie ๐Ÿ‘‹
  • Finalize() โ€” terminates the MPI execution environment. the grand finale, the last bow ๐ŸŽญ
  • Flush_buffer() โ€” blocks until every single buffered message has actually been transmitted. sit there and wait, no skipping the queue โณ
  • Free_mem(mem) โ€” frees memory that was allocated with Alloc_mem. what Alloc_mem giveth, Free_mem taketh away ๐Ÿงน
  • Get_abi_fortran_info() โ€” obtains information about the Fortran MPI ABI. fortran girlies, this one's for you ๐ŸŒธ
  • Get_abi_info() โ€” obtains information about the MPI ABI ๐Ÿ“‹
  • Get_abi_version() โ€” obtains the MPI ABI version number. numbers, iconic ๐Ÿ”ข
  • Get_address(location) โ€” gets the address of a location in memory. pointing at things, professionally ๐Ÿ‘‰
  • Get_error_class(errorcode) โ€” converts an error code into an error class ๐Ÿ”„
  • Get_error_string(errorcode) โ€” returns the error string for a given error class or error code. it explains itself, we love a self-aware function ๐Ÿ“–
  • Get_hw_resource_info() โ€” obtains information about the hardware platform of the processor doing the calling ๐Ÿ–ฅ๏ธโœจ
  • Get_library_version() โ€” obtains the version string of the MPI library. version check, as always ๐Ÿ’…
  • Get_processor_name() โ€” obtains the name of the processor that's calling. hi, what's your name ๐ŸŽค
  • Get_version() โ€” obtains the version number of the MPI standard ๐Ÿ“œ
  • Iflush_buffer() โ€” nonblocking flush for buffered messages. same energy as Flush_buffer but it does not wait around for you ๐Ÿƒโ€โ™€๏ธ
  • Init() โ€” initializes the MPI execution environment. the beginning of everything ๐ŸŒ…
  • Init_thread([required]) โ€” initializes the MPI execution environment, thread edition ๐Ÿงต
  • Is_finalized() โ€” indicates whether Finalize has completed. yes or no, no in-between ๐ŸŽฏ
  • Is_initialized() โ€” indicates whether Init has been called โœ…
  • Is_thread_main() โ€” indicates whether this thread is the one that called Init or Init_thread. main character check ๐Ÿ‘‘

the way that half of these are just "initialize this" and "is it initialized yet"โ€ฆ the lore is consistent at least ๐Ÿ˜ญ

okay bestie we're still deep in the roster scroll, no context switch, just vibes and functions ๐Ÿ’… continuing the lineup:

  • Lookup_name <#mpi4py.MPI.Lookup_name>(service_name[, info]) โ€” looks up a port name given a service name โœจ
  • Open_port <#mpi4py.MPI.Open_port>([info]) โ€” returns an address you use to connect a group of processes ๐Ÿซถ
  • Pcontrol <#mpi4py.MPI.Pcontrol>(level) โ€” controls profiling, literally just that ๐ŸŒธ
  • Publish_name <#mpi4py.MPI.Publish_name>(service_name, port_name[, info]) โ€” publishes a service name ๐Ÿ“ฃ
  • Query_thread <#mpi4py.MPI.Query_thread>() โ€” hands you back the level of thread support the MPI library is providing ๐Ÿงต
  • Register_datarep <#mpi4py.MPI.Register_datarep>(datarep, read_fn, write_fn, ...) โ€” registers user-defined data representations ๐Ÿ’–
  • Remove_error_class <#mpi4py.MPI.Remove_error_class>(errorclass) โ€” removes an error class from the known error classes ๐Ÿ—‘๏ธ
  • Remove_error_code <#mpi4py.MPI.Remove_error_code>(errorcode) โ€” removes an error code from the known error codes
  • Remove_error_string <#mpi4py.MPI.Remove_error_string>(errorcode) โ€” removes the error string association from an error class or error code
  • Unpublish_name <#mpi4py.MPI.Unpublish_name>(service_name, port_name[, info]) โ€” unpublishes a service name, off the shelf it goes
  • Wtick <#mpi4py.MPI.Wtick>() โ€” returns the resolution of Wtime <#mpi4py.MPI.Wtime> โฑ๏ธ
  • Wtime <#mpi4py.MPI.Wtime>() โ€” returns an elapsed time on the calling processor
  • get_vendor <#mpi4py.MPI.get_vendor>() โ€” information about the underlying MPI implementation ๐Ÿ‘‘

mpi4py.MPI.Add_error_class

mpi4py.MPI.Add_error_class()

Adds an error class to the known error classes. lowkey essential ๐ŸŽ€

Return type: int <https://docs.python.org/3/library/functions.html#int>


mpi4py.MPI.Add_error_code

mpi4py.MPI.Add_error_code(errorclass)

Adds an error code to an error class ๐Ÿ’–

Parameters:

Return type: int <https://docs.python.org/3/library/functions.html#int>


mpi4py.MPI.Add_error_string

mpi4py.MPI.Add_error_string(errorcode, string)

Associates an error string with an error class or an error code ๐ŸŒธ

Parameters:

Return type: None <https://docs.python.org/3/library/constants.html#None>


mpi4py.MPI.Aint_add

mpi4py.MPI.Aint_add(base, disp)

Returns the sum of base address and displacement ๐Ÿงฎ

Parameters:

Return type: int <https://docs.python.org/3/library/functions.html#int>


mpi4py.MPI.Aint_diff

mpi4py.MPI.Aint_diff(addr1, addr2)

Returns the difference between absolute addresses ๐Ÿ“

Parameters:

Return type: int <https://docs.python.org/3/library/functions.html#int>


mpi4py.MPI.Alloc_mem

mpi4py.MPI.Alloc_mem(size, info=INFO_NULL)

Allocates memory for message passing and remote memory access ๐Ÿซถ

Parameters:

Return type: buffer <#mpi4py.MPI.buffer>


mpi4py.MPI.Attach_buffer

mpi4py.MPI.Attach_buffer(buf)

Attaches a user-provided buffer for sending in buffered mode ๐Ÿ“ฆ

Parameters:

Return type: None <https://docs.python.org/3/library/constants.html#None>


mpi4py.MPI.Close_port

mpi4py.MPI.Close_port(port_name)

Closes a port ๐Ÿšช

Parameters:

Return type: None <https://docs.python.org/3/library/constants.html#None>


mpi4py.MPI.Compute_dims

mpi4py.MPI.Compute_dims(nnodes, dims)

Returns a balanced distribution of processes per coordinate direction โš–๏ธ

Parameters:

Return type: list <https://docs.python.org/3/library/stdtypes.html#list>[int <https://docs.python.org/3/library/functions.html#int>]


mpi4py.MPI.Detach_buffer

mpi4py.MPI.Detach_buffer()

Removes an existing attached buffer ๐Ÿ—‘๏ธ

Return type: Buffer <#mpi4py.typing.Buffer> | None <https://docs.python.org/3/library/constants.html#None>


mpi4py.MPI.Finalize

mpi4py.MPI.Finalize()

Terminates the MPI execution environment ๐Ÿ

Return type: None <https://docs.python.org/3/library/constants.html#None>


mpi4py.MPI.Flush_buffer

mpi4py.MPI.Flush_buffer()

Blocks until all buffered messages have been transmitted ๐Ÿšฐ

Return type: None <https://docs.python.org/3/library/constants.html#None>


mpi4py.MPI.Free_mem

mpi4py.MPI.Free_mem(mem)

Frees memory allocated with Alloc_mem <#mpi4py.MPI.Alloc_mem> ๐Ÿงน

Parameters:

  • mem (buffer <#mpi4py.MPI.buffer>)

Return type: None <https://docs.python.org/3/library/constants.html#None>


mpi4py.MPI.Get_abi_fortran_info

mpi4py.MPI.Get_abi_fortran_info()

Obtains information about the Fortran MPI ABI ๐Ÿ”ง

Return type: Info <#mpi4py.MPI.Info>


mpi4py.MPI.Get_abi_info

mpi4py.MPI.Get_abi_info()

Obtains information about the MPI ABI ๐Ÿ”

Return type: Info <#mpi4py.MPI.Info>


mpi4py.MPI.Get_abi_version

mpi4py.MPI.Get_abi_version()

Obtains the MPI ABI version number ๐Ÿ”ข

Return type: tuple <https://docs.python.org/3/library/stdtypes.html#tuple>[int <https://docs.python.org/3/library/functions.html#int>, int <https://docs.python.org/3/library/functions.html#int>]

mpi4py.MPI.Get_address

mpi4py.MPI.Get_address(location)

okay so this one is literally just: hand it a location and it tells you the address of that spot in memory. that's it, that's the whole vibe โœจ

  • location โ€” Buffer | Bottom

Returns โ†’ int ๐Ÿ’–


mpi4py.MPI.Get_error_class

mpi4py.MPI.Get_error_class(errorcode)

take an error code and translate it into its error class, bestie. glow-up for error codes ๐Ÿ’…

  • errorcode โ€” int

Returns โ†’ int


mpi4py.MPI.Get_error_string

mpi4py.MPI.Get_error_string(errorcode)

give me the words!! this hands you the error string for whatever error class or error code you pass in. so you can actually read what went wrong instead of staring at a number like ๐Ÿ˜ญ

  • errorcode โ€” int

Returns โ†’ str


mpi4py.MPI.Get_hw_resource_info

mpi4py.MPI.Get_hw_resource_info()

no arguments, no stress. it pulls info about the hardware platform of the processor that's calling it. hardware lore ๐Ÿ”ฅ

Returns โ†’ Info


mpi4py.MPI.Get_library_version

mpi4py.MPI.Get_library_version()

gets you the version string of the MPI library. version check era ๐Ÿ‘‘

Returns โ†’ str


mpi4py.MPI.Get_processor_name

mpi4py.MPI.Get_processor_name()

asks the calling processor for its name. yes it knows its own name, it's that girl ๐ŸŒธ

Returns โ†’ str


mpi4py.MPI.Get_version

mpi4py.MPI.Get_version()

version number of the MPI standard itself. note: it comes back as a tuple of two ints, not a string, so don't @ me ๐Ÿ’€

Returns โ†’ tuple[int, int]


mpi4py.MPI.Iflush_buffer

mpi4py.MPI.Iflush_buffer()

nonblocking flush for buffered messages. yes, nonblocking, meaning it does not wait around for you โ€” it hands you a Request and dips ๐Ÿฆ‹

Returns โ†’ Request


mpi4py.MPI.Init

mpi4py.MPI.Init()

the big one. initializes the MPI execution environment. like, the whole thing doesn't work without this. main character energy fr fr โœจ

Returns โ†’ None


mpi4py.MPI.Init_thread

mpi4py.MPI.Init_thread(required=THREAD_MULTIPLE)

also initializes the MPI execution environment, but make it threaded ๐Ÿงต the required arg defaults to THREAD_MULTIPLE, which is highkey the most you can ask for.

  • required โ€” int

Returns โ†’ int


mpi4py.MPI.Is_finalized

mpi4py.MPI.Is_finalized()

tells you whether Finalize has finished yet. a bool, no drama ๐Ÿ’œ

Returns โ†’ bool


mpi4py.MPI.Is_initialized

mpi4py.MPI.Is_initialized()

tells you whether Init has been called. vibe check on your own setup ๐ŸŽ€

Returns โ†’ bool


mpi4py.MPI.Is_thread_main

mpi4py.MPI.Is_thread_main()

asking the real questions: did this thread call Init or Init_thread? if yes, you're the main character. if noโ€ฆ still valid ๐Ÿ’–

Returns โ†’ bool


mpi4py.MPI.Lookup_name

mpi4py.MPI.Lookup_name(service_name, info=INFO_NULL)

looks up a port name when you give it a service name. the info argument defaults to INFO_NULL, so it's optional, chill ๐Ÿซถ

  • service_name โ€” str
  • info โ€” Info (defaults to INFO_NULL)

Returns โ†’ str


mpi4py.MPI.Open_port

mpi4py.MPI.Open_port(info=INFO_NULL)

returns an address you can use to connect a whole group of processes together. very "let's get the group chat going" ๐ŸŒˆ

  • info โ€” Info (defaults to INFO_NULL)

Returns โ†’ str


mpi4py.MPI.Pcontrol

mpi4py.MPI.Pcontrol(level)

controls profiling. that's the whole description, I'm not gonna invent lore for it ๐Ÿ˜ญ

  • level โ€” int

Returns โ†’ None


mpi4py.MPI.Publish_name

mpi4py.MPI.Publish_name(service_name, port_name, info=INFO_NULL)

publishes a service name โ€” so other processes can find it. info again defaults to INFO_NULL โœจ

  • service_name โ€” str
  • port_name โ€” str
  • info โ€” Info (defaults to INFO_NULL)

Returns โ†’ None


mpi4py.MPI.Query_thread

mpi4py.MPI.Query_thread()

returns the level of thread support the MPI library is actually giving you. not what you asked for โ€” what you got ๐Ÿ’…

Returns โ†’ int


mpi4py.MPI.Register_datarep

mpi4py.MPI.Register_datarep(datarep, read_fn, write_fn, extent_fn)

register your own user-defined data representations. very DIY, very craft-core ๐ŸŽ€

  • datarep โ€” str
  • read_fn โ€” Callable[[Buffer, Datatype, int, Buffer, int], None]
  • write_fn โ€” Callable[[Buffer, Datatype, int, Buffer, int], None]
  • extent_fn โ€” Callable[[Datatype], int]

Returns โ†’ None


mpi4py.MPI.Remove_error_class

mpi4py.MPI.Remove_error_class(errorclass)

un-registers an error class from the known error classes. bye bestie ๐Ÿ‘‹

  • errorclass โ€” int

Returns โ†’ None


mpi4py.MPI.Remove_error_code

mpi4py.MPI.Remove_error_code(errorcode)

same energy, different target: removes an error code from the known error codes ๐Ÿ’€

  • errorcode โ€” int

Returns โ†’ None


mpi4py.MPI.Remove_error_string

mpi4py.MPI.Remove_error_string(errorcode)

breaks up the error string + error class/code association. it's giving "we're not together anymore" ๐Ÿ˜ญ

  • errorcode โ€” int

Returns โ†’ None


mpi4py.MPI.Unpublish_name

mpi4py.MPI.Unpublish_name(service_name, port_name, info=INFO_NULL)

unpublishes a service name. the reverse of Publish_name, obviously, iconic symmetry โœจ

  • service_name โ€” str
  • port_name โ€” str
  • info โ€” Info (defaults to INFO_NULL)

Returns โ†’ None


mpi4py.MPI.Wtick

mpi4py.MPI.Wtick()

tells you the resolution of Wtime. so you know how fine-grained your clock reading actually is โฑ๏ธ

Returns โ†’ float


mpi4py.MPI.Wtime

mpi4py.MPI.Wtime()

returns an elapsed time on the calling processor. your basic clock read, no cap ๐Ÿ’œ

Returns โ†’ float


mpi4py.MPI.get_vendor

mpi4py.MPI.get_vendor()

the gossip function!! tells you about the underlying MPI implementation you're actually running on ๐Ÿ”

Returns:

  • a string with the name of the MPI implementation.
  • an integer 3-tuple version number (major, minor, micro).

Returns โ†’ tuple[str, tuple[int, int, int]]

so you get the name and the numbers, together, as a tuple. slay ๐Ÿซถ

โœจ Attributes โœจ

okay bestie, gather round, because here's the whole vibe check on the attributes. every single one is a constant, and every single one is type int. no cap. let's go ๐Ÿ’…

okay bestie the error-constant parade is still going, don't unclench yet ๐Ÿ’… every single one of these is a lil named constant, and every single one is chillin' as an int <https://docs.python.org/3/library/functions.html#int> โ€” no cap, that's the whole vibe:

and that's the whole block of error codes, each one anchored at its own lil spot <#mpi4py.MPI.ERR_KEYVAL>-style so you can jump straight to it, iykyk ๐Ÿซถ

okay so we are still in the constants zone and it's giving โœจint energyโœจ โ€” every single one of these is a plain old int, no cap. here's the whole lineup, nothing skipped, nothing merged, we move ๐Ÿ’…

fr fr, that's the whole list โ€” if you were hoping for a surprise non-int type in there, bestie, there isn't one ๐Ÿ˜ญ every single constant above is type int and that's the tea.

okay bestie we are STILL in the constants list and it is lowkey never-ending ๐Ÿ’€ but every single one of these is an int โ€” the Python builtin int, fr (https://docs.python.org/3/library/functions.html#int) โ€” and each one has its own little anchor link. no skipping, we're doing all of them, periodt โœจ


and now we glide on over from error codes into the ordering + typeclass constants, which are also all just ints, iconic honestly ๐Ÿ‘‘

okay continuing the great constant parade bestie โœจ we're still deep in the reference and this stretch is literally just a lineup of int values, no cap ๐ŸŽ€

tiny PSA before we go: whenever it says "of type int" below, that's linking out to the Python docs at https://docs.python.org/3/library/functions.html#int โ€” same URL every single time, so I'm not retyping it twenty-three times, iykyk ๐Ÿ’…

  • MPI.TYPECLASS_COMPLEX โ€” Constant TYPECLASS_COMPLEX of type int ๐Ÿ’–
  • DISTRIBUTE_NONE โ€” Constant DISTRIBUTE_NONE of type int. distributing: declined ๐Ÿ™ˆ
  • DISTRIBUTE_BLOCK โ€” Constant DISTRIBUTE_BLOCK of type int. block it out ๐Ÿงฑ
  • DISTRIBUTE_CYCLIC โ€” Constant DISTRIBUTE_CYCLIC of type int. round and round we go ๐ŸŒ€
  • DISTRIBUTE_DFLT_DARG โ€” Constant DISTRIBUTE_DFLT_DARG of type int ๐ŸŒธ
  • COMBINER_NAMED โ€” Constant COMBINER_NAMED of type int โœจ
  • COMBINER_DUP โ€” Constant COMBINER_DUP of type int ๐Ÿฆ‹
  • COMBINER_CONTIGUOUS โ€” Constant COMBINER_CONTIGUOUS of type int ๐Ÿ”ฅ
  • COMBINER_VECTOR โ€” Constant COMBINER_VECTOR of type int ๐ŸŽ€
  • COMBINER_HVECTOR โ€” Constant COMBINER_HVECTOR of type int ๐Ÿ’œ
  • COMBINER_INDEXED โ€” Constant COMBINER_INDEXED of type int โญ
  • COMBINER_HINDEXED โ€” Constant COMBINER_HINDEXED of type int ๐ŸŒˆ
  • COMBINER_INDEXED_BLOCK โ€” Constant COMBINER_INDEXED_BLOCK of type int ๐Ÿ‘‘
  • COMBINER_HINDEXED_BLOCK โ€” Constant COMBINER_HINDEXED_BLOCK of type int ๐Ÿ’€
  • COMBINER_STRUCT โ€” Constant COMBINER_STRUCT of type int ๐Ÿ“
  • COMBINER_SUBARRAY โ€” Constant COMBINER_SUBARRAY of type int ๐Ÿงš
  • COMBINER_DARRAY โ€” Constant COMBINER_DARRAY of type int ๐ŸŒธ
  • COMBINER_RESIZED โ€” Constant COMBINER_RESIZED of type int ๐Ÿ’–
  • COMBINER_VALUE_INDEX โ€” Constant COMBINER_VALUE_INDEX of type int โœจ
  • COMBINER_F90_INTEGER โ€” Constant COMBINER_F90_INTEGER of type int ๐Ÿซถ
  • COMBINER_F90_REAL โ€” Constant COMBINER_F90_REAL of type int ๐Ÿ’…
  • COMBINER_F90_COMPLEX โ€” Constant COMBINER_F90_COMPLEX of type int ๐ŸŒˆ
  • F_SOURCE โ€” Constant F_SOURCE of type int โญ

and yeah that's where this part taps out, bestie โ€” more coming, don't you dare stop scrolling ๐Ÿ’œ

โ€ฆand the constant parade just keeps going, bestie ๐ŸŽ‰ so real quick, before we list them: every single one of these is a plain int, no cap โ€” that's the only type situation happening here. The int docs live at https://docs.python.org/3/library/functions.html#int if you ever wanna peek, but honestly? It's giving "just vibes and integers." Periodt. ๐Ÿ’…

  • F_TAG โ€” constant F_TAG, of type int โœจ
  • F_ERROR โ€” constant F_ERROR, of type int ๐Ÿ’–
  • F_STATUS_SIZE โ€” constant F_STATUS_SIZE, of type int ๐ŸŽ€
  • IDENT โ€” constant IDENT, of type int ๐Ÿฆ‹
  • CONGRUENT โ€” constant CONGRUENT, of type int ๐ŸŒธ
  • SIMILAR โ€” constant SIMILAR, of type int ๐Ÿ’œ
  • UNEQUAL โ€” constant UNEQUAL, of type int ๐Ÿ˜ญ
  • CART โ€” constant CART, of type int ๐Ÿ”ฅ
  • GRAPH โ€” constant GRAPH, of type int ๐Ÿ‘‘
  • DIST_GRAPH โ€” constant DIST_GRAPH, of type int ๐ŸŒˆ
  • UNWEIGHTED โ€” constant UNWEIGHTED, of type int โญ
  • WEIGHTS_EMPTY โ€” constant WEIGHTS_EMPTY, of type int ๐Ÿ“
  • COMM_TYPE_SHARED โ€” constant COMM_TYPE_SHARED, of type int ๐Ÿซถ
  • COMM_TYPE_HW_GUIDED โ€” constant COMM_TYPE_HW_GUIDED, of type int ๐Ÿงš
  • COMM_TYPE_HW_UNGUIDED โ€” constant COMM_TYPE_HW_UNGUIDED, of type int ๐Ÿ’ซ
  • COMM_TYPE_RESOURCE_GUIDED โ€” constant COMM_TYPE_RESOURCE_GUIDED, of type int ๐ŸŒŸ
  • BSEND_OVERHEAD โ€” constant BSEND_OVERHEAD, of type int ๐Ÿ’€
  • WIN_FLAVOR_CREATE โ€” constant WIN_FLAVOR_CREATE, of type int ๐Ÿ™ˆ
  • WIN_FLAVOR_ALLOCATE โ€” constant WIN_FLAVOR_ALLOCATE, of type int ๐Ÿ’–
  • WIN_FLAVOR_DYNAMIC โ€” constant WIN_FLAVOR_DYNAMIC, of type int โœจ
  • WIN_FLAVOR_SHARED โ€” constant WIN_FLAVOR_SHARED, of type int ๐ŸŽ€
  • WIN_SEPARATE โ€” constant WIN_SEPARATE, of type int ๐Ÿฆ‹

and that's the whole int-coded crew, bestie โ€” lowkey iconic of them to all show up looking exactly the same ๐Ÿซถ keep scrolling, there's more where that came from ๐Ÿ˜Œ

okay bestie, we're still in the constant zone and there's a LOT of them, so let's keep it moving ๐Ÿ’… these are all just plain old constants, each one of type int (you know, the Python int situation), and they're all living their best life in mpi4py.MPI. no cap, that's the whole vibe of every single one:

  • WIN_UNIFIED โ€” Constant WIN_UNIFIED, and yes it's type int ๐Ÿซถ
  • MODE_NOCHECK โ€” Constant MODE_NOCHECK, type int โœจ
  • MODE_NOSTORE โ€” Constant MODE_NOSTORE, type int โœจ
  • MODE_NOPUT โ€” Constant MODE_NOPUT, type int โœจ
  • MODE_NOPRECEDE โ€” Constant MODE_NOPRECEDE, type int โœจ
  • MODE_NOSUCCEED โ€” Constant MODE_NOSUCCEED, type int โœจ
  • LOCK_EXCLUSIVE โ€” Constant LOCK_EXCLUSIVE, type int ๐Ÿ”’
  • LOCK_SHARED โ€” Constant LOCK_SHARED, type int ๐Ÿ”’
  • MODE_RDONLY โ€” Constant MODE_RDONLY, type int ๐Ÿ“–
  • MODE_WRONLY โ€” Constant MODE_WRONLY, type int โœ๏ธ
  • MODE_RDWR โ€” Constant MODE_RDWR, type int ๐Ÿ“–โœ๏ธ
  • MODE_CREATE โ€” Constant MODE_CREATE, type int ๐Ÿ†•
  • MODE_EXCL โ€” Constant MODE_EXCL, type int ๐Ÿšซ
  • MODE_DELETE_ON_CLOSE โ€” Constant MODE_DELETE_ON_CLOSE, type int ๐Ÿ’€
  • MODE_UNIQUE_OPEN โ€” Constant MODE_UNIQUE_OPEN, type int ๐Ÿ‘‘
  • MODE_SEQUENTIAL โ€” Constant MODE_SEQUENTIAL, type int ๐Ÿ”ข
  • MODE_APPEND โ€” Constant MODE_APPEND, type int โž•
  • SEEK_SET โ€” Constant SEEK_SET, type int ๐ŸŽฏ
  • SEEK_CUR โ€” Constant SEEK_CUR, type int ๐Ÿ“
  • SEEK_END โ€” Constant SEEK_END, type int ๐Ÿ”š
  • DISPLACEMENT_CURRENT โ€” Constant DISPLACEMENT_CURRENT, type int ๐ŸŒŠ
  • DISP_CUR โ€” Constant DISP_CUR, type int ๐ŸŒŠ
  • THREAD_SINGLE โ€” Constant THREAD_SINGLE, type int ๐Ÿงต
fr fr, every single one of these is literally just a constant of type int. that's the whole tea. no behaviour notes, no tricks, just vibes and integers ๐Ÿ’œ

and yeah, THREAD_SINGLE is where we're leaving off โ€” the energy is still going, don't you worry ๐Ÿฆ‹

...and the roster just keeps going, bestie. We're still deep in the mpi4py.MPI constant-and-object directory, and it does <em>not</em> stop. Here's the next batch, each one exactly as it appears: ๐Ÿ‘‡



Now the MAX_ family, aka the "how long can this string possibly be" girlies. All of them are constants of type int (https://docs.python.org/3/library/functions.html#int), no cap:

  • MAX_PROCESSOR_NAME (#mpi4py.MPI.MAX_PROCESSOR_NAME)
  • MAX_ERROR_STRING (#mpi4py.MPI.MAX_ERROR_STRING)
  • MAX_PORT_NAME (#mpi4py.MPI.MAX_PORT_NAME)
  • MAX_INFO_KEY (#mpi4py.MPI.MAX_INFO_KEY)
  • MAX_INFO_VAL (#mpi4py.MPI.MAX_INFO_VAL)
  • MAX_OBJECT_NAME (#mpi4py.MPI.MAX_OBJECT_NAME)
  • MAX_DATAREP_STRING (#mpi4py.MPI.MAX_DATAREP_STRING)
  • MAX_LIBRARY_VERSION_STRING (#mpi4py.MPI.MAX_LIBRARY_VERSION_STRING)
  • MAX_PSET_NAME_LEN (#mpi4py.MPI.MAX_PSET_NAME_LEN)
  • MAX_STRINGTAG_LEN (#mpi4py.MPI.MAX_STRINGTAG_LEN)

Ten of them. All int. All here. We ate. โœจ


And now the main character section: the datatype objects. Every single one of these is an object of type Datatype (#mpi4py.MPI.Datatype), and each lives at its own little anchor. Say hi: ๐ŸŒธ

  • DATATYPE_NULL (#mpi4py.MPI.DATATYPE_NULL) โ€” an object of type Datatype (#mpi4py.MPI.Datatype).
  • PACKED (#mpi4py.MPI.PACKED) โ€” an object of type Datatype (#mpi4py.MPI.Datatype).
  • BYTE (#mpi4py.MPI.BYTE) โ€” an object of type Datatype (#mpi4py.MPI.Datatype).
  • AINT (#mpi4py.MPI.AINT) โ€” an object of type Datatype (#mpi4py.MPI.Datatype).
  • OFFSET (#mpi4py.MPI.OFFSET) โ€” an object of type Datatype (#mpi4py.MPI.Datatype).
  • COUNT (#mpi4py.MPI.COUNT) โ€” an object of type Datatype (#mpi4py.MPI.Datatype).
  • CHAR (#mpi4py.MPI.CHAR) โ€” an object of type Datatype (#mpi4py.MPI.Datatype).
  • WCHAR (#mpi4py.MPI.WCHAR) โ€” an object of type Datatype (#mpi4py.MPI.Datatype).
  • SIGNED_CHAR (#mpi4py.MPI.SIGNED_CHAR) โ€” an object of type Datatype (#mpi4py.MPI.Datatype).
Heads up bestie: that's where this part cuts off mid-roll call. The datatype parade is not over. ๐Ÿฆ‹
  • SHORT โ€” Object SHORT of type Datatype โœจ
  • INT โ€” Object INT of type Datatype ๐Ÿ’–
  • LONG โ€” Object LONG of type Datatype ๐ŸŽ€
  • LONG_LONG โ€” Object LONG_LONG of type Datatype ๐Ÿฆ‹
  • UNSIGNED_CHAR โ€” Object UNSIGNED_CHAR of type Datatype ๐ŸŒธ
  • UNSIGNED_SHORT โ€” Object UNSIGNED_SHORT of type Datatype ๐Ÿ’…
  • UNSIGNED โ€” Object UNSIGNED of type Datatype ๐Ÿซถ
  • UNSIGNED_LONG โ€” Object UNSIGNED_LONG of type Datatype ๐Ÿ˜ญ
  • UNSIGNED_LONG_LONG โ€” Object UNSIGNED_LONG_LONG of type Datatype ๐Ÿ”ฅ
  • FLOAT โ€” Object FLOAT of type Datatype ๐Ÿ‘‘
  • DOUBLE โ€” Object DOUBLE of type Datatype ๐ŸŒˆ
  • LONG_DOUBLE โ€” Object LONG_DOUBLE of type Datatype โญ
  • C_BOOL โ€” Object C_BOOL of type Datatype ๐Ÿ’€
  • INT8_T โ€” Object INT8_T of type Datatype ๐Ÿ™ˆ
  • INT16_T โ€” Object INT16_T of type Datatype ๐Ÿ“
  • INT32_T โ€” Object INT32_T of type Datatype ๐Ÿงš
  • INT64_T โ€” Object INT64_T of type Datatype ๐Ÿ’œ
  • UINT8_T โ€” Object UINT8_T of type Datatype โœจ
  • UINT16_T โ€” Object UINT16_T of type Datatype ๐Ÿ’–
  • UINT32_T โ€” Object UINT32_T of type Datatype ๐ŸŽ€
  • UINT64_T โ€” Object UINT64_T of type Datatype ๐Ÿฆ‹
  • FLOAT16_T โ€” Object FLOAT16_T of type Datatype ๐ŸŒธ
  • FLOAT32_T โ€” Object FLOAT32_T of type Datatype ๐Ÿ’…
  • FLOAT64_T โ€” Object FLOAT64_T of type Datatype ๐Ÿซถ
  • BFLOAT16_T โ€” Object BFLOAT16_T of type Datatype ๐Ÿ˜ญ
  • C_COMPLEX โ€” Object C_COMPLEX of type Datatype ๐Ÿ”ฅ
  • C_FLOAT_COMPLEX โ€” Object C_FLOAT_COMPLEX of type Datatype ๐Ÿ‘‘

okay bestie we're still in the datatype lineup ๐Ÿ’… same energy as before โ€” every single one of these is a Datatype object, and imma keep them in the exact order they showed up, no skipping, no reordering, periodt:

  • C_DOUBLE_COMPLEX โ€” a Datatype object, that's the whole vibe ๐Ÿฆ‹
  • C_LONG_DOUBLE_COMPLEX โ€” yep, another Datatype object, she's real
  • CXX_BOOL โ€” Datatype object, slay
  • CXX_FLOAT_COMPLEX โ€” you guessed it, a Datatype object โœจ
  • CXX_DOUBLE_COMPLEX โ€” Datatype object, iconic behavior
  • CXX_LONG_DOUBLE_COMPLEX โ€” still a Datatype object, bestie, they're all like this
  • SHORT_INT โ€” Datatype object ๐ŸŽ€
  • INT_INT โ€” Datatype object, okurr
  • TWOINT โ€” a Datatype object, not me checking twice ๐Ÿ’€
  • LONG_INT โ€” Datatype object fr fr
  • FLOAT_INT โ€” Datatype object, lowkey stunning
  • DOUBLE_INT โ€” Datatype object ๐ŸŒธ
  • LONG_DOUBLE_INT โ€” Datatype object, the long one of the group
  • CHARACTER โ€” Datatype object, main character energy obviously ๐Ÿ‘‘
  • LOGICAL โ€” Datatype object, makes sense to me
  • INTEGER โ€” Datatype object ๐Ÿ’œ
  • REAL โ€” Datatype object, keeping it real
  • DOUBLE_PRECISION โ€” Datatype object, precise as always
  • COMPLEX โ€” Datatype object, it's giving layers ๐Ÿงš
  • DOUBLE_COMPLEX โ€” Datatype object, twice the complexity
  • LOGICAL1 โ€” Datatype object โญ
  • LOGICAL2 โ€” Datatype object, the sequel
  • LOGICAL4 โ€” Datatype object, still going
  • LOGICAL8 โ€” Datatype object ๐ŸŒˆ
  • LOGICAL16 โ€” Datatype object, big number energy
  • INTEGER1 โ€” Datatype object ๐Ÿซถ
  • INTEGER2 โ€” Datatype object, and we're still countingโ€ฆ

and yeah the list just keeps going, so hold that thought bestie ๐Ÿ˜ญ โ€” there's more coming right up ๐Ÿ’–

okay continuing the datatype roll call, bestie โ€” same deal as before, every single one of these is an object of type Datatype ๐Ÿ’…

  • INTEGER4 โ€” Object INTEGER4 of type Datatype โœจ
  • INTEGER8 โ€” Object INTEGER8 of type Datatype ๐Ÿ’–
  • INTEGER16 โ€” Object INTEGER16 of type Datatype ๐ŸŽ€
  • REAL2 โ€” Object REAL2 of type Datatype ๐Ÿฆ‹
  • REAL4 โ€” Object REAL4 of type Datatype ๐ŸŒธ
  • REAL8 โ€” Object REAL8 of type Datatype ๐Ÿ’ซ
  • REAL16 โ€” Object REAL16 of type Datatype โญ
  • COMPLEX4 โ€” Object COMPLEX4 of type Datatype ๐Ÿ’œ
  • COMPLEX8 โ€” Object COMPLEX8 of type Datatype ๐Ÿงš
  • COMPLEX16 โ€” Object COMPLEX16 of type Datatype ๐ŸŒˆ
  • COMPLEX32 โ€” Object COMPLEX32 of type Datatype ๐Ÿ”ฅ
  • UNSIGNED_INT โ€” Object UNSIGNED_INT of type Datatype ๐Ÿซถ
  • SIGNED_SHORT โ€” Object SIGNED_SHORT of type Datatype ๐Ÿ’•
  • SIGNED_INT โ€” Object SIGNED_INT of type Datatype โœจ
  • SIGNED_LONG โ€” Object SIGNED_LONG of type Datatype ๐Ÿ’…
  • SIGNED_LONG_LONG โ€” Object SIGNED_LONG_LONG of type Datatype ๐Ÿ‘‘
  • BOOL โ€” Object BOOL of type Datatype ๐Ÿ“
  • SINT8_T โ€” Object SINT8_T of type Datatype ๐ŸŒท
  • SINT16_T โ€” Object SINT16_T of type Datatype ๐Ÿฆ„
  • SINT32_T โ€” Object SINT32_T of type Datatype ๐ŸŒŸ
  • SINT64_T โ€” Object SINT64_T of type Datatype ๐Ÿ’Ž
  • F_BOOL โ€” Object F_BOOL of type Datatype ๐ŸŽ€
  • F_INT โ€” Object F_INT of type Datatype ๐ŸŒธ
  • F_FLOAT โ€” Object F_FLOAT of type Datatype ๐Ÿฆ‹
  • F_DOUBLE โ€” Object F_DOUBLE of type Datatype ๐Ÿ’–
  • F_COMPLEX โ€” Object F_COMPLEX of type Datatype โœจ
  • F_FLOAT_COMPLEX โ€” Object F_FLOAT_COMPLEX of type Datatype ๐Ÿ”ฅ
  • F_DOUBLE_COMPLEX โ€” Object F_DOUBLE_COMPLEX of type Datatype ๐Ÿ’œ

ngl the way this list just keeps going? iconic. and there's more coming, so stay with me ๐Ÿซถ

โ€ฆand the roll call just keeps going, bestie, we are not done yet โœจ

  • REQUEST_NULL โ€” the REQUEST_NULL object, type Request ๐Ÿซถ
  • MESSAGE_NULL โ€” the MESSAGE_NULL object, type Message
  • MESSAGE_NO_PROC โ€” the MESSAGE_NO_PROC object, type Message

okay now we're in our Op era and it's giving math class but make it fashion ๐Ÿ’… every single one of these is an object of type Op:

  • OP_NULL โ€” the OP_NULL object, type Op
  • MAX โ€” the MAX object, type Op
  • MIN โ€” the MIN object, type Op
  • SUM โ€” the SUM object, type Op
  • PROD โ€” the PROD object, type Op
  • LAND โ€” the LAND object, type Op
  • BAND โ€” the BAND object, type Op
  • LOR โ€” the LOR object, type Op
  • BOR โ€” the BOR object, type Op
  • LXOR โ€” the LXOR object, type Op
  • BXOR โ€” the BXOR object, type Op
  • MAXLOC โ€” the MAXLOC object, type Op
  • MINLOC โ€” the MINLOC object, type Op
  • REPLACE โ€” the REPLACE object, type Op
  • NO_OP โ€” the NO_OP object, type Op

groups, bestie, groups ๐ŸŒธ

  • GROUP_NULL โ€” the GROUP_NULL object, type Group
  • GROUP_EMPTY โ€” the GROUP_EMPTY object, type Group

info time, no cap ๐Ÿฆ‹

  • INFO_NULL โ€” the INFO_NULL object, type Info
  • INFO_ENV โ€” the INFO_ENV object, type Info

error handlers, aka the "who's gonna tell them" squad ๐Ÿ˜ญ

  • ERRHANDLER_NULL โ€” the ERRHANDLER_NULL object, type Errhandler
  • ERRORS_RETURN โ€” the ERRORS_RETURN object, type Errhandler
  • ERRORS_ABORT โ€” the ERRORS_ABORT object, type Errhandler
  • ERRORS_ARE_FATAL โ€” the ERRORS_ARE_FATAL object, type Errhandler

comms, the main character energy of the whole module ๐Ÿ‘‘

  • SESSION_NULL โ€” the SESSION_NULL object, type Session
  • COMM_NULL โ€” the COMM_NULL object, type Comm
  • COMM_SELF โ€” the COMM_SELF object, type Intracomm
  • COMM_WORLD โ€” the COMM_WORLD object, type Intracomm

and one last one for the window girlies ๐ŸชŸ

  • WIN_NULL โ€” the WIN_NULL object, type Win

every name up there is literally spelled exactly like that, all caps, underscores and all โ€” do not freestyle it, bestie, COMM_WORLD is not COMMWORLD and she will not forgive you ๐Ÿ’€

okay bestie, last five rows of that table, hold on to your wig ๐Ÿ’…

  • FILE_NULL โ€” object FILE_NULL, and its type is File
  • BOTTOM โ€” object BOTTOM, type BottomType
  • IN_PLACE โ€” object IN_PLACE, type InPlaceType
  • BUFFER_AUTOMATIC โ€” object BUFFER_AUTOMATIC, type BufferAutomaticType
  • pickle โ€” object pickle, type Pickle

โœจ and nowโ€ฆ the CONSTANTS โœจ

no cap, this is just a big ol' parade of int values. every single one of them is a plain Python int (you know, the int from the Python standard library docs), and every one is literally equal to its own name. iconic behaviour honestly ๐ŸŽ€

  • mpi4py.MPI.UNDEFINED โ€” mpi4py.MPI.UNDEFINED: int = UNDEFINED. Constant UNDEFINED, type int ๐Ÿ’œ
  • mpi4py.MPI.ANY_SOURCE โ€” mpi4py.MPI.ANY_SOURCE: int = ANY_SOURCE. Constant ANY_SOURCE, type int
  • mpi4py.MPI.ANY_TAG โ€” mpi4py.MPI.ANY_TAG: int = ANY_TAG. Constant ANY_TAG, type int
  • mpi4py.MPI.PROC_NULL โ€” mpi4py.MPI.PROC_NULL: int = PROC_NULL. Constant PROC_NULL, type int
  • mpi4py.MPI.ROOT โ€” mpi4py.MPI.ROOT: int = ROOT. Constant ROOT, type int
  • mpi4py.MPI.KEYVAL_INVALID โ€” mpi4py.MPI.KEYVAL_INVALID: int = KEYVAL_INVALID. Constant KEYVAL_INVALID, type int
  • mpi4py.MPI.TAG_UB โ€” mpi4py.MPI.TAG_UB: int = TAG_UB. Constant TAG_UB, type int
  • mpi4py.MPI.IO โ€” mpi4py.MPI.IO: int = IO. Constant IO, type int
  • mpi4py.MPI.WTIME_IS_GLOBAL โ€” mpi4py.MPI.WTIME_IS_GLOBAL: int = WTIME_IS_GLOBAL. Constant WTIME_IS_GLOBAL, type int
  • mpi4py.MPI.UNIVERSE_SIZE โ€” mpi4py.MPI.UNIVERSE_SIZE: int = UNIVERSE_SIZE. Constant UNIVERSE_SIZE, type int
  • mpi4py.MPI.APPNUM โ€” mpi4py.MPI.APPNUM: int = APPNUM. Constant APPNUM, type int
  • mpi4py.MPI.LASTUSEDCODE โ€” mpi4py.MPI.LASTUSEDCODE: int = LASTUSEDCODE. Constant LASTUSEDCODE, type int
  • mpi4py.MPI.WIN_BASE โ€” mpi4py.MPI.WIN_BASE: int = WIN_BASE. Constant WIN_BASE, type int
  • mpi4py.MPI.WIN_SIZE โ€” mpi4py.MPI.WIN_SIZE: int = WIN_SIZE. Constant WIN_SIZE, type int
  • mpi4py.MPI.WIN_DISP_UNIT โ€” mpi4py.MPI.WIN_DISP_UNIT: int = WIN_DISP_UNIT. Constant WIN_DISP_UNIT, type int
  • mpi4py.MPI.WIN_CREATE_FLAVOR โ€” mpi4py.MPI.WIN_CREATE_FLAVOR: int = WIN_CREATE_FLAVOR. Constant WIN_CREATE_FLAVOR, type int
  • mpi4py.MPI.WIN_FLAVOR โ€” mpi4py.MPI.WIN_FLAVOR: int = WIN_FLAVOR. Constant WIN_FLAVOR, type int
  • mpi4py.MPI.WIN_MODEL โ€” mpi4py.MPI.WIN_MODEL: int = WIN_MODEL. Constant WIN_MODEL, type int
  • mpi4py.MPI.SUCCESS โ€” mpi4py.MPI.SUCCESS: int = SUCCESS. Constant SUCCESS, type int
  • mpi4py.MPI.ERR_LASTCODE โ€” mpi4py.MPI.ERR_LASTCODE: int = ERR_LASTCODE. Constant ERR_LASTCODE, type int
  • mpi4py.MPI.ERR_ABI โ€” mpi4py.MPI.ERR_ABI: int = ERR_ABI. Constant ERR_ABI, type int
  • mpi4py.MPI.ERR_TYPE โ€” mpi4py.MPI.ERR_TYPE: int = ERR_TYPE. Constant ERR_TYPE, type int
  • mpi4py.MPI.ERR_REQUEST โ€” mpi4py.MPI.ERR_REQUEST: int = ERR_REQUEST. Constant ERR_REQUEST, type int
  • mpi4py.MPI.ERR_OP โ€” mpi4py.MPI.ERR_OP: int = ERR_OP. Constant ERR_OP, type int
  • mpi4py.MPI.ERR_GROUP โ€” mpi4py.MPI.ERR_GROUP: int = ERR_GROUP. Constant ERR_GROUP, type int
  • mpi4py.MPI.ERR_INFO โ€” mpi4py.MPI.ERR_INFO: int = ERR_INFO. Constant ERR_INFO, type int
  • mpi4py.MPI.ERR_ERRHANDLER โ€” mpi4py.MPI.ERR_ERRHANDLER: int = ERR_ERRHANDLER. Constant ERR_ERRHANDLER, type int
  • mpi4py.MPI.ERR_SESSION โ€” mpi4py.MPI.ERR_SESSION: int = ERR_SESSION. Constant ERR_SESSION, type int
  • mpi4py.MPI.ERR_COMM โ€” mpi4py.MPI.ERR_COMM: int = ERR_COMM. Constant ERR_COMM, type int
  • mpi4py.MPI.ERR_WIN โ€” mpi4py.MPI.ERR_WIN: int = ERR_WIN. Constant ERR_WIN, type int
  • mpi4py.MPI.ERR_FILE โ€” mpi4py.MPI.ERR_FILE: int = ERR_FILE. Constant ERR_FILE, type int
  • mpi4py.MPI.ERR_BUFFER โ€” mpi4py.MPI.ERR_BUFFER: int = ERR_BUFFER. Constant ERR_BUFFER, type int
  • mpi4py.MPI.ERR_COUNT โ€” mpi4py.MPI.ERR_COUNT: int = ERR_COUNT. Constant ERR_COUNT, type int
  • mpi4py.MPI.ERR_TAG โ€” mpi4py.MPI.ERR_TAG: int = ERR_TAG. Constant ERR_TAG, type int
  • mpi4py.MPI.ERR_RANK โ€” mpi4py.MPI.ERR_RANK: int = ERR_RANK. Constant ERR_RANK, type int
  • mpi4py.MPI.ERR_ROOT โ€” mpi4py.MPI.ERR_ROOT: int = ERR_ROOT. Constant ERR_ROOT, type int
  • mpi4py.MPI.ERR_TRUNCATE โ€” mpi4py.MPI.ERR_TRUNCATE: int = ERR_TRUNCATE. Constant ERR_TRUNCATE, type int
  • mpi4py.MPI.ERR_IN_STATUS โ€” mpi4py.MPI.ERR_IN_STATUS: int = ERR_IN_STATUS. Constant ERR_IN_STATUS, type int

that's the whole error-code squad right there, every last one, bestie ๐Ÿ’–

okay bestie, we're deep in the error constant zone now ๐ŸŒธ โ€” every single one of these is a constant of type int (the regular Python int, the one that lives at https://docs.python.org/3/library/functions.html#int), and each one's value is literally its own name. No cap. Here we go, one by one, no skipping, we're finishing this list together ๐Ÿ’…

mpi4py.MPI.ERR_PENDING

mpi4py.MPI.ERR_PENDING: int = ERR_PENDING

Constant ERR_PENDING of type int. The name is doing the absolute most and I respect it โœจ

mpi4py.MPI.ERR_TOPOLOGY

mpi4py.MPI.ERR_TOPOLOGY: int = ERR_TOPOLOGY

Constant ERR_TOPOLOGY of type int. Say it with me: topology ๐Ÿ’ซ

mpi4py.MPI.ERR_DIMS

mpi4py.MPI.ERR_DIMS: int = ERR_DIMS

Constant ERR_DIMS of type int. Short name, big energy ๐ŸŽ€

mpi4py.MPI.ERR_ARG

mpi4py.MPI.ERR_ARG: int = ERR_ARG

Constant ERR_ARG of type int. Three letters. Iconic minimalism ๐Ÿฆ‹

mpi4py.MPI.ERR_OTHER

mpi4py.MPI.ERR_OTHER: int = ERR_OTHER

Constant ERR_OTHER of type int. The "miscellaneous" of error constants and honestly? Relatable ๐Ÿซถ

mpi4py.MPI.ERR_UNKNOWN

mpi4py.MPI.ERR_UNKNOWN: int = ERR_UNKNOWN

Constant ERR_UNKNOWN of type int. Mysterious. Enigmatic. Main character ๐Ÿ”ฅ

mpi4py.MPI.ERR_INTERN

mpi4py.MPI.ERR_INTERN: int = ERR_INTERN

Constant ERR_INTERN of type int. Internal business only, we don't ask questions ๐Ÿ™ˆ

mpi4py.MPI.ERR_KEYVAL

mpi4py.MPI.ERR_KEYVAL: int = ERR_KEYVAL

Constant ERR_KEYVAL of type int. Key-value coded, literally ๐Ÿ’œ

mpi4py.MPI.ERR_NO_MEM

mpi4py.MPI.ERR_NO_MEM: int = ERR_NO_MEM

Constant ERR_NO_MEM of type int. Deep breaths, bestie ๐Ÿ˜ญ

mpi4py.MPI.ERR_INFO_KEY

mpi4py.MPI.ERR_INFO_KEY: int = ERR_INFO_KEY

Constant ERR_INFO_KEY of type int. The key half of the info duo ๐Ÿ”‘

mpi4py.MPI.ERR_INFO_VALUE

mpi4py.MPI.ERR_INFO_VALUE: int = ERR_INFO_VALUE

Constant ERR_INFO_VALUE of type int. And here's the value half, they come as a set ๐Ÿ’ž

mpi4py.MPI.ERR_INFO_NOKEY

mpi4py.MPI.ERR_INFO_NOKEY: int = ERR_INFO_NOKEY

Constant ERR_INFO_NOKEY of type int. No key, no problem, we still list it ๐ŸŽ€

mpi4py.MPI.ERR_SPAWN

mpi4py.MPI.ERR_SPAWN: int = ERR_SPAWN

Constant ERR_SPAWN of type int. Spawn like a video game, obsessed ๐ŸŽฎ

mpi4py.MPI.ERR_PORT

mpi4py.MPI.ERR_PORT: int = ERR_PORT

Constant ERR_PORT of type int. Four letters, maximum vibe ๐ŸŒŠ

mpi4py.MPI.ERR_SERVICE

mpi4py.MPI.ERR_SERVICE: int = ERR_SERVICE

Constant ERR_SERVICE of type int. Customer service voice: activated ๐Ÿ’…

mpi4py.MPI.ERR_NAME

mpi4py.MPI.ERR_NAME: int = ERR_NAME

Constant ERR_NAME of type int. What's in a name? This constant, apparently โœจ

mpi4py.MPI.ERR_PROC_ABORTED

mpi4py.MPI.ERR_PROC_ABORTED: int = ERR_PROC_ABORTED

Constant ERR_PROC_ABORTED of type int. Long name, full drama, love that for it ๐ŸŽญ

mpi4py.MPI.ERR_BASE

mpi4py.MPI.ERR_BASE: int = ERR_BASE

Constant ERR_BASE of type int. The foundation, the blueprint, the base ๐Ÿ’…

mpi4py.MPI.ERR_SIZE

mpi4py.MPI.ERR_SIZE: int = ERR_SIZE

Constant ERR_SIZE of type int. Size matters, and so does listing every constant ๐Ÿ“

mpi4py.MPI.ERR_DISP

mpi4py.MPI.ERR_DISP: int = ERR_DISP

Constant ERR_DISP of type int. Short for displacement and short in general ๐Ÿฆ‹

mpi4py.MPI.ERR_ASSERT

mpi4py.MPI.ERR_ASSERT: int = ERR_ASSERT

Constant ERR_ASSERT of type int. Asserting itself, as it should ๐Ÿ‘‘

mpi4py.MPI.ERR_LOCKTYPE

mpi4py.MPI.ERR_LOCKTYPE: int = ERR_LOCKTYPE

Constant ERR_LOCKTYPE of type int. Locked in ๐Ÿ”’


mpi4py.MPI.ERR_RMA_CONFLICT

mpi4py.MPI.ERR_RMA_CONFLICT: int = ERR_RMA_CONFLICT

Constant ERR_RMA_CONFLICT of type int. The RMA era begins and the names get longer, we love a glow-up ๐ŸŒˆ

mpi4py.MPI.ERR_RMA_SYNC

mpi4py.MPI.ERR_RMA_SYNC: int = ERR_RMA_SYNC

Constant ERR_RMA_SYNC of type int. Syncing up with the group chat ๐Ÿ’ฌ

mpi4py.MPI.ERR_RMA_RANGE

mpi4py.MPI.ERR_RMA_RANGE: int = ERR_RMA_RANGE

Constant ERR_RMA_RANGE of type int. Out of range but never out of style ๐Ÿ’œ

mpi4py.MPI.ERR_RMA_ATTACH

mpi4py.MPI.ERR_RMA_ATTACH: int = ERR_RMA_ATTACH

Constant ERR_RMA_ATTACH of type int. Attachment issues, but make it MPI ๐Ÿ˜ญ

mpi4py.MPI.ERR_RMA_SHARED

mpi4py.MPI.ERR_RMA_SHARED: int = ERR_RMA_SHARED

Constant ERR_RMA_SHARED of type int. Sharing is caring, bestie ๐Ÿซถ

mpi4py.MPI.ERR_RMA_FLAVOR

mpi4py.MPI.ERR_RMA_FLAVOR: int = ERR_RMA_FLAVOR

Constant ERR_RMA_FLAVOR of type int. Flavor?! In MY error constant list?! Yes, and it ate ๐Ÿ“


mpi4py.MPI.ERR_BAD_FILE

mpi4py.MPI.ERR_BAD_FILE: int = ERR_BAD_FILE

Constant ERR_BAD_FILE of type int. Bad file, bad file, whatcha gonna do ๐Ÿ“

mpi4py.MPI.ERR_NO_SUCH_FILE

mpi4py.MPI.ERR_NO_SUCH_FILE: int = ERR_NO_SUCH_FILE

Constant ERR_NO_SUCH_FILE of type int. It's not there. It was never there. ๐Ÿ’€

mpi4py.MPI.ERR_FILE_EXISTS

mpi4py.MPI.ERR_FILE_EXISTS: int = ERR_FILE_EXISTS

Constant ERR_FILE_EXISTS of type int. It IS there, actually, and it was there first ๐Ÿ’…

mpi4py.MPI.ERR_FILE_IN_USE

mpi4py.MPI.ERR_FILE_IN_USE: int = ERR_FILE_IN_USE

Constant ERR_FILE_IN_USE of type int. Currently busy, do not perceive it ๐Ÿ™ˆ

mpi4py.MPI.ERR_AMODE

mpi4py.MPI.ERR_AMODE: int = ERR_AMODE

Constant ERR_AMODE of type int. Access mode, abbreviated, efficient, slay โœจ

mpi4py.MPI.ERR_ACCESS

mpi4py.MPI.ERR_ACCESS: int = ERR_ACCESS

Constant ERR_ACCESS of type int. Access denied, respectfully ๐Ÿšซ

mpi4py.MPI.ERR_READ_ONLY

mpi4py.MPI.ERR_READ_ONLY: int = ERR_READ_ONLY

Constant ERR_READ_ONLY of type int. Look but don't touch, fr fr ๐Ÿ‘€

mpi4py.MPI.ERR_NO_SPACE

mpi4py.MPI.ERR_NO_SPACE: int = ERR_NO_SPACE

Constant ERR_NO_SPACE of type int. No room at the inn ๐Ÿ˜ญ

mpi4py.MPI.ERR_QUOTA

mpi4py.MPI.ERR_QUOTA: int = ERR_QUOTA

Constant ERR_QUOTA of type int. You've hit your limit bestie, go touch grass ๐ŸŒธ

mpi4py.MPI.ERR_NOT_SAME

mpi4py.MPI.ERR_NOT_SAME: int = ERR_NOT_SAME

Constant ERR_NOT_SAME of type int. Not the same, and it's not even trying to be ๐Ÿฆ‹

mpi4py.MPI.ERR_IO

mpi4py.MPI.ERR_IO: int = ERR_IO

Constant ERR_IO of type int. Two letters, maximum chaos potential ๐Ÿ”ฅ

mpi4py.MPI.ERR_UNSUPPORTED_OPERATION

mpi4py.MPI.ERR_UNSUPPORTED_OPERATION: int = ERR_UNSUPPORTED_OPERATION

Constant ERR_UNSUPPORTED_OPERATION of type int. We do not support that operation and we said what we said ๐Ÿ’…

mpi4py.MPI.ERR_UNSUPPORTED_DATAREP

mpi4py.MPI.ERR_UNSUPPORTED_DATAREP: int = ERR_UNSUPPORTED_DATAREP

Constant ERR_UNSUPPORTED_DATAREP of type int. Same energy, different data representation, no cap ๐ŸŽ€

mpi4py.MPI.ERR_CONVERSION

mpi4py.MPI.ERR_CONVERSION: int = ERR_CONVERSION

Constant ERR_CONVERSION of type int. Glow-up attempt failed to convert ๐Ÿ˜ญ

mpi4py.MPI.ERR_DUP_DATAREP

mpi4py.MPI.ERR_DUP_DATAREP: int = ERR_DUP_DATAREP

Constant ERR_DUP_DATAREP of type int. Duplicate datarep, we've seen this one before ๐Ÿซ 

mpi4py.MPI.ERR_VALUE_TOO_LARGE

mpi4py.MPI.ERR_VALUE_TOO_LARGE: int = ERR_VALUE_TOO_LARGE

Constant ERR_VALUE_TOO_LARGE of type int. Too much. Too big. Too powerful. ๐Ÿ‘‘

mpi4py.MPI.ERR_REVOKED

mpi4py.MPI.ERR_REVOKED: int = ERR_REVOKED

Constant ERR_REVOKED of type int. Revoked, like your group chat privileges ๐Ÿ’€

mpi4py.MPI.ERR_PROC_FAILED

mpi4py.MPI.ERR_PROC_FAILED: int = ERR_PROC_FAILED

Constant ERR_PROC_FAILED of type int. And we close out this batch with the saddest name of the bunch, rest in pieces ๐Ÿ˜ญ๐Ÿซถ

๐Ÿฉท mpi4py.MPI.ERR_PROC_FAILED_PENDING

mpi4py.MPI.ERR_PROC_FAILED_PENDING: int = ERR_PROC_FAILED_PENDING

Constant ERR_PROC_FAILED_PENDING, and she's of type int. that's the whole entry bestie, no crumbs left behind ๐Ÿ’–


๐Ÿงก mpi4py.MPI.ORDER_C

mpi4py.MPI.ORDER_C: int = ORDER_C

Constant ORDER_C of type int. the C is right there in the name, slay ๐Ÿ’…


๐Ÿงก mpi4py.MPI.ORDER_FORTRAN

mpi4py.MPI.ORDER_FORTRAN: int = ORDER_FORTRAN

Constant ORDER_FORTRAN of type int. her full legal name, no nicknames ๐ŸŒธ


๐Ÿงก mpi4py.MPI.ORDER_F

mpi4py.MPI.ORDER_F: int = ORDER_F

Constant ORDER_F of type int. the short version of the above, because she contains multitudes โœจ


๐Ÿ’œ mpi4py.MPI.TYPECLASS_LOGICAL

mpi4py.MPI.TYPECLASS_LOGICAL: int = TYPECLASS_LOGICAL

Constant TYPECLASS_LOGICAL of type int. typeclass girlies rise ๐Ÿซถ


๐Ÿ’œ mpi4py.MPI.TYPECLASS_INTEGER

mpi4py.MPI.TYPECLASS_INTEGER: int = TYPECLASS_INTEGER

Constant TYPECLASS_INTEGER of type int. and yes she is herself an int, we love a self-consistent queen ๐Ÿ’–


๐Ÿ’œ mpi4py.MPI.TYPECLASS_REAL

mpi4py.MPI.TYPECLASS_REAL: int = TYPECLASS_REAL

Constant TYPECLASS_REAL of type int. keeping it real, literally โœจ


๐Ÿ’œ mpi4py.MPI.TYPECLASS_COMPLEX

mpi4py.MPI.TYPECLASS_COMPLEX: int = TYPECLASS_COMPLEX

Constant TYPECLASS_COMPLEX of type int. she's complicated and that's her brand ๐Ÿ’…


๐Ÿฆ‹ mpi4py.MPI.DISTRIBUTE_NONE

mpi4py.MPI.DISTRIBUTE_NONE: int = DISTRIBUTE_NONE

Constant DISTRIBUTE_NONE of type int. distributing absolutely nothing, and doing it flawlessly ๐Ÿ˜Œ


๐Ÿฆ‹ mpi4py.MPI.DISTRIBUTE_BLOCK

mpi4py.MPI.DISTRIBUTE_BLOCK: int = DISTRIBUTE_BLOCK

Constant DISTRIBUTE_BLOCK of type int. block party, everyone invited ๐ŸŽ€


๐Ÿฆ‹ mpi4py.MPI.DISTRIBUTE_CYCLIC

mpi4py.MPI.DISTRIBUTE_CYCLIC: int = DISTRIBUTE_CYCLIC

Constant DISTRIBUTE_CYCLIC of type int. going in circles but make it fashion ๐ŸŒ€


๐Ÿฆ‹ mpi4py.MPI.DISTRIBUTE_DFLT_DARG

mpi4py.MPI.DISTRIBUTE_DFLT_DARG: int = DISTRIBUTE_DFLT_DARG

Constant DISTRIBUTE_DFLT_DARG of type int. the default one, the darg of it all, no cap ๐Ÿ’–


๐Ÿ‘‘ mpi4py.MPI.COMBINER_NAMED

mpi4py.MPI.COMBINER_NAMED: int = COMBINER_NAMED

Constant COMBINER_NAMED of type int. welcome to the COMBINER cinematic universe, we're here all day โœจ


๐Ÿ‘‘ mpi4py.MPI.COMBINER_DUP

mpi4py.MPI.COMBINER_DUP: int = COMBINER_DUP

Constant COMBINER_DUP of type int. duplicating the vibe fr fr ๐Ÿ’…


๐Ÿ‘‘ mpi4py.MPI.COMBINER_CONTIGUOUS

mpi4py.MPI.COMBINER_CONTIGUOUS: int = COMBINER_CONTIGUOUS

Constant COMBINER_CONTIGUOUS of type int. all in a row, no gaps, iconic behavior ๐ŸŽ€


๐Ÿ‘‘ mpi4py.MPI.COMBINER_VECTOR

mpi4py.MPI.COMBINER_VECTOR: int = COMBINER_VECTOR

Constant COMBINER_VECTOR of type int. she has direction and she has magnitude, periodt ๐ŸŒˆ


๐Ÿ‘‘ mpi4py.MPI.COMBINER_HVECTOR

mpi4py.MPI.COMBINER_HVECTOR: int = COMBINER_HVECTOR

Constant COMBINER_HVECTOR of type int. the H stands for her, obviously ๐Ÿ’œ


๐Ÿ‘‘ mpi4py.MPI.COMBINER_INDEXED

mpi4py.MPI.COMBINER_INDEXED: int = COMBINER_INDEXED

Constant COMBINER_INDEXED of type int. indexed and unbothered ๐Ÿซถ


๐Ÿ‘‘ mpi4py.MPI.COMBINER_HINDEXED

mpi4py.MPI.COMBINER_HINDEXED: int = COMBINER_HINDEXED

Constant COMBINER_HINDEXED of type int. the H returns, she's booked and busy ๐Ÿ’…


๐Ÿ‘‘ mpi4py.MPI.COMBINER_INDEXED_BLOCK

mpi4py.MPI.COMBINER_INDEXED_BLOCK: int = COMBINER_INDEXED_BLOCK

Constant COMBINER_INDEXED_BLOCK of type int. indexed AND blocked, a crossover event ๐Ÿ”ฅ


๐Ÿ‘‘ mpi4py.MPI.COMBINER_HINDEXED_BLOCK

mpi4py.MPI.COMBINER_HINDEXED_BLOCK: int = COMBINER_HINDEXED_BLOCK

Constant COMBINER_HINDEXED_BLOCK of type int. the sequel to the crossover, and honestly it ate ๐Ÿ˜ญ


๐Ÿ‘‘ mpi4py.MPI.COMBINER_STRUCT

mpi4py.MPI.COMBINER_STRUCT: int = COMBINER_STRUCT

Constant COMBINER_STRUCT of type int. structured, organized, thriving ๐ŸŒธ


๐Ÿ‘‘ mpi4py.MPI.COMBINER_SUBARRAY

mpi4py.MPI.COMBINER_SUBARRAY: int = COMBINER_SUBARRAY

Constant COMBINER_SUBARRAY of type int. a whole array but like, a sub one ๐Ÿ’–


๐Ÿ‘‘ mpi4py.MPI.COMBINER_DARRAY

mpi4py.MPI.COMBINER_DARRAY: int = COMBINER_DARRAY

Constant COMBINER_DARRAY of type int. the D is doing a lot of heavy lifting here and we respect it ๐ŸŽ€


๐Ÿ‘‘ mpi4py.MPI.COMBINER_RESIZED

mpi4py.MPI.COMBINER_RESIZED: int = COMBINER_RESIZED

Constant COMBINER_RESIZED of type int. glow-up arc, resized and reborn โœจ


๐Ÿ‘‘ mpi4py.MPI.COMBINER_VALUE_INDEX

mpi4py.MPI.COMBINER_VALUE_INDEX: int = COMBINER_VALUE_INDEX

Constant COMBINER_VALUE_INDEX of type int. values AND index, she's doing both jobs ๐Ÿ’…


๐Ÿ‘‘ mpi4py.MPI.COMBINER_F90_INTEGER

mpi4py.MPI.COMBINER_F90_INTEGER: int = COMBINER_F90_INTEGER

Constant COMBINER_F90_INTEGER of type int. Fortran 90 said hello and we said hi back ๐Ÿซถ


๐Ÿ‘‘ mpi4py.MPI.COMBINER_F90_REAL

mpi4py.MPI.COMBINER_F90_REAL: int = COMBINER_F90_REAL

Constant COMBINER_F90_REAL of type int. still Fortran 90, still real ๐Ÿ’œ


๐Ÿ‘‘ mpi4py.MPI.COMBINER_F90_COMPLEX

mpi4py.MPI.COMBINER_F90_COMPLEX: int = COMBINER_F90_COMPLEX

Constant COMBINER_F90_COMPLEX of type int. the last of the F90 trio, and she understood the assignment ๐ŸŒˆ


๐ŸŒŸ mpi4py.MPI.F_SOURCE

mpi4py.MPI.F_SOURCE: int = F_SOURCE

Constant F_SOURCE of type int. we're in the F_ era now, buckle up bestie ๐ŸŽ€


๐ŸŒŸ mpi4py.MPI.F_TAG

mpi4py.MPI.F_TAG: int = F_TAG

Constant F_TAG of type int. she's tagged, she's iconic, she's an int ๐Ÿ’–


๐ŸŒŸ mpi4py.MPI.F_ERROR

mpi4py.MPI.F_ERROR: int = F_ERROR

Constant F_ERROR of type int. error by name, not by nature ๐Ÿ˜Œ


๐ŸŒŸ mpi4py.MPI.F_STATUS_SIZE

mpi4py.MPI.F_STATUS_SIZE: int = F_STATUS_SIZE

Constant F_STATUS_SIZE of type int. size queen behavior but for statuses ๐Ÿซถ


๐Ÿ”ฅ mpi4py.MPI.IDENT

mpi4py.MPI.IDENT: int = IDENT

Constant IDENT of type int. identical to nothing, she's one of a kind โœจ


๐Ÿ”ฅ mpi4py.MPI.CONGRUENT

mpi4py.MPI.CONGRUENT: int = CONGRUENT

Constant CONGRUENT of type int. she matches the energy, she's congruent with it ๐Ÿ’…


๐Ÿ”ฅ mpi4py.MPI.SIMILAR

mpi4py.MPI.SIMILAR: int = SIMILAR

Constant SIMILAR of type int. not identical but like, the same vibe ๐ŸŒธ


๐Ÿ”ฅ mpi4py.MPI.UNEQUAL

mpi4py.MPI.UNEQUAL: int = UNEQUAL

Constant UNEQUAL of type int. she said we are NOT the same and honestly? valid ๐Ÿ˜ญ


๐Ÿ—บ๏ธ mpi4py.MPI.CART

mpi4py.MPI.CART: int = CART

Constant CART of type int. topology arc begins, we're going cartesian ๐Ÿงญ


๐Ÿ—บ๏ธ mpi4py.MPI.GRAPH

mpi4py.MPI.GRAPH: int = GRAPH

Constant GRAPH of type int. graph girlies, your moment has arrived ๐Ÿ“ˆ


๐Ÿ—บ๏ธ mpi4py.MPI.DIST_GRAPH

mpi4py.MPI.DIST_GRAPH: int = DIST_GRAPH

Constant DIST_GRAPH of type int. the distributed sequel, and she devoured ๐Ÿ’…


๐Ÿ—บ๏ธ mpi4py.MPI.UNWEIGHTED

mpi4py.MPI.UNWEIGHTED: int = UNWEIGHTED

Constant UNWEIGHTED of type int. no weights, no baggage, she travels light ๐Ÿฆ‹


๐Ÿ—บ๏ธ mpi4py.MPI.WEIGHTS_EMPTY

mpi4py.MPI.WEIGHTS_EMPTY: int = WEIGHTS_EMPTY

Constant WEIGHTS_EMPTY of type int. the weights are empty bestie, the container is empty, that's the whole thing ๐Ÿซ™


๐ŸŒˆ mpi4py.MPI.COMM_TYPE_SHARED

mpi4py.MPI.COMM_TYPE_SHARED: int = COMM_TYPE_SHARED

Constant COMM_TYPE_SHARED of type int. sharing is caring, and she cares ๐ŸŒธ


๐ŸŒˆ mpi4py.MPI.COMM_TYPE_HW_GUIDED

mpi4py.MPI.COMM_TYPE_HW_GUIDED: int = COMM_TYPE_HW_GUIDED

Constant COMM_TYPE_HW_GUIDED of type int. hardware-guided, main character energy, and that's the last one in this batch so let's keep scrolling ๐Ÿ‘‘๐Ÿ’–

๐Ÿ’… mpi4py.MPI.COMM_TYPE_HW_UNGUIDED

mpi4py.MPI.COMM_TYPE_HW_UNGUIDED: int = COMM_TYPE_HW_UNGUIDED

okay so this is the constant COMM_TYPE_HW_UNGUIDED, and its whole deal is that it's an int <https://docs.python.org/3/library/functions.html#int>. that's it, that's the vibe. โœจ

๐Ÿ’… mpi4py.MPI.COMM_TYPE_RESOURCE_GUIDED

mpi4py.MPI.COMM_TYPE_RESOURCE_GUIDED: int = COMM_TYPE_RESOURCE_GUIDED

constant COMM_TYPE_RESOURCE_GUIDED, type int <https://docs.python.org/3/library/functions.html#int>. she's giving resource-guided energy and she's an integer, periodt. ๐ŸŽ€

๐Ÿซถ mpi4py.MPI.BSEND_OVERHEAD

mpi4py.MPI.BSEND_OVERHEAD: int = BSEND_OVERHEAD

the constant BSEND_OVERHEAD, and bestie, it is of type int <https://docs.python.org/3/library/functions.html#int>. lowkey iconic. ๐Ÿ’–

๐Ÿฆ‹ mpi4py.MPI.WIN_FLAVOR_CREATE

mpi4py.MPI.WIN_FLAVOR_CREATE: int = WIN_FLAVOR_CREATE

constant WIN_FLAVOR_CREATE โ€” an int <https://docs.python.org/3/library/functions.html#int>. window flavor number one, and she is an integer fr fr. โœจ

๐Ÿฆ‹ mpi4py.MPI.WIN_FLAVOR_ALLOCATE

mpi4py.MPI.WIN_FLAVOR_ALLOCATE: int = WIN_FLAVOR_ALLOCATE

constant WIN_FLAVOR_ALLOCATE, type int <https://docs.python.org/3/library/functions.html#int>. allocate-flavored, int-shaped, obsessed. ๐Ÿ’œ

๐Ÿฆ‹ mpi4py.MPI.WIN_FLAVOR_DYNAMIC

mpi4py.MPI.WIN_FLAVOR_DYNAMIC: int = WIN_FLAVOR_DYNAMIC

constant WIN_FLAVOR_DYNAMIC, of type int <https://docs.python.org/3/library/functions.html#int>. dynamic queen, still an int, no cap. ๐ŸŒˆ

๐Ÿฆ‹ mpi4py.MPI.WIN_FLAVOR_SHARED

mpi4py.MPI.WIN_FLAVOR_SHARED: int = WIN_FLAVOR_SHARED

constant WIN_FLAVOR_SHARED โ€” int <https://docs.python.org/3/library/functions.html#int>. sharing is caring and it's an integer. ๐Ÿซถ

๐ŸŒธ mpi4py.MPI.WIN_SEPARATE

mpi4py.MPI.WIN_SEPARATE: int = WIN_SEPARATE

constant WIN_SEPARATE, type int <https://docs.python.org/3/library/functions.html#int>. separate but still an int, she's doing her own thing. ๐Ÿ’…

๐ŸŒธ mpi4py.MPI.WIN_UNIFIED

mpi4py.MPI.WIN_UNIFIED: int = WIN_UNIFIED

constant WIN_UNIFIED, of type int <https://docs.python.org/3/library/functions.html#int>. unified and unbothered, and yes, an integer. ๐Ÿ‘‘

โญ mpi4py.MPI.MODE_NOCHECK

mpi4py.MPI.MODE_NOCHECK: int = MODE_NOCHECK

constant MODE_NOCHECK, and she's an int <https://docs.python.org/3/library/functions.html#int>. no check, no stress, all int. โœจ

โญ mpi4py.MPI.MODE_NOSTORE

mpi4py.MPI.MODE_NOSTORE: int = MODE_NOSTORE

constant MODE_NOSTORE โ€” type int <https://docs.python.org/3/library/functions.html#int>. nothing stored except the fact that she's an integer. ๐ŸŽ€

โญ mpi4py.MPI.MODE_NOPUT

mpi4py.MPI.MODE_NOPUT: int = MODE_NOPUT

constant MODE_NOPUT, of type int <https://docs.python.org/3/library/functions.html#int>. no putting, but definitely an int. ๐Ÿ’–

โญ mpi4py.MPI.MODE_NOPRECEDE

mpi4py.MPI.MODE_NOPRECEDE: int = MODE_NOPRECEDE

constant MODE_NOPRECEDE, type int <https://docs.python.org/3/library/functions.html#int>. nothing precedes her except being an integer. ๐Ÿฆ‹

โญ mpi4py.MPI.MODE_NOSUCCEED

mpi4py.MPI.MODE_NOSUCCEED: int = MODE_NOSUCCEED

constant MODE_NOSUCCEED โ€” int <https://docs.python.org/3/library/functions.html#int>. nothing succeeds her exceptโ€ฆ more integers. ๐ŸŒˆ

๐Ÿ”ฅ mpi4py.MPI.LOCK_EXCLUSIVE

mpi4py.MPI.LOCK_EXCLUSIVE: int = LOCK_EXCLUSIVE

constant LOCK_EXCLUSIVE, of type int <https://docs.python.org/3/library/functions.html#int>. exclusive lock energy, main character, still an int. ๐Ÿ‘‘

๐Ÿ”ฅ mpi4py.MPI.LOCK_SHARED

mpi4py.MPI.LOCK_SHARED: int = LOCK_SHARED

constant LOCK_SHARED, type int <https://docs.python.org/3/library/functions.html#int>. shared lock, shared vibes, shared int-ness. ๐Ÿซถ

๐ŸŽ€ mpi4py.MPI.MODE_RDONLY

mpi4py.MPI.MODE_RDONLY: int = MODE_RDONLY

constant MODE_RDONLY, and it's an int <https://docs.python.org/3/library/functions.html#int>. read-only mode, but read this: she's an integer. โœจ

๐ŸŽ€ mpi4py.MPI.MODE_WRONLY

mpi4py.MPI.MODE_WRONLY: int = MODE_WRONLY

constant MODE_WRONLY โ€” type int <https://docs.python.org/3/library/functions.html#int>. write-only, but I'm writing this down: int. ๐Ÿ’œ

๐ŸŽ€ mpi4py.MPI.MODE_RDWR

mpi4py.MPI.MODE_RDWR: int = MODE_RDWR

constant MODE_RDWR, of type int <https://docs.python.org/3/library/functions.html#int>. read AND write, she does both, and she's an integer. ๐Ÿ’…

๐ŸŒธ mpi4py.MPI.MODE_CREATE

mpi4py.MPI.MODE_CREATE: int = MODE_CREATE

constant MODE_CREATE, type int <https://docs.python.org/3/library/functions.html#int>. creating a whole vibe, and also an int. ๐ŸŒŸ

๐ŸŒธ mpi4py.MPI.MODE_EXCL

mpi4py.MPI.MODE_EXCL: int = MODE_EXCL

constant MODE_EXCL โ€” int <https://docs.python.org/3/library/functions.html#int>. exclusive behavior, inclusive heart, integer soul. ๐Ÿฆ‹

๐ŸŒธ mpi4py.MPI.MODE_DELETE_ON_CLOSE

mpi4py.MPI.MODE_DELETE_ON_CLOSE: int = MODE_DELETE_ON_CLOSE

constant MODE_DELETE_ON_CLOSE, of type int <https://docs.python.org/3/library/functions.html#int>. delete on close bestie, and yes she's an int. ๐Ÿ’–

๐ŸŒธ mpi4py.MPI.MODE_UNIQUE_OPEN

mpi4py.MPI.MODE_UNIQUE_OPEN: int = MODE_UNIQUE_OPEN

constant MODE_UNIQUE_OPEN, type int <https://docs.python.org/3/library/functions.html#int>. unique open, unique int, we love to see it. ๐ŸŽ€

๐ŸŒธ mpi4py.MPI.MODE_SEQUENTIAL

mpi4py.MPI.MODE_SEQUENTIAL: int = MODE_SEQUENTIAL

constant MODE_SEQUENTIAL, and she is an int <https://docs.python.org/3/library/functions.html#int>. one thing after another, sequentially, as an integer. โญ

๐ŸŒธ mpi4py.MPI.MODE_APPEND

mpi4py.MPI.MODE_APPEND: int = MODE_APPEND

constant MODE_APPEND โ€” type int <https://docs.python.org/3/library/functions.html#int>. append energy, integer reality. ๐Ÿ”ฅ

๐Ÿงš mpi4py.MPI.SEEK_SET

mpi4py.MPI.SEEK_SET: int = SEEK_SET

constant SEEK_SET, of type int <https://docs.python.org/3/library/functions.html#int>. set your position, set your standards, stay an int. ๐Ÿ’…

๐Ÿงš mpi4py.MPI.SEEK_CUR

mpi4py.MPI.SEEK_CUR: int = SEEK_CUR

constant SEEK_CUR, type int <https://docs.python.org/3/library/functions.html#int>. current position, current mood, current int. ๐ŸŒˆ

๐Ÿงš mpi4py.MPI.SEEK_END

mpi4py.MPI.SEEK_END: int = SEEK_END

constant SEEK_END โ€” int <https://docs.python.org/3/library/functions.html#int>. seek to the end, but never the end of the int pipeline. ๐Ÿ‘‘

๐Ÿ“ mpi4py.MPI.DISPLACEMENT_CURRENT

mpi4py.MPI.DISPLACEMENT_CURRENT: int = DISPLACEMENT_CURRENT

constant DISPLACEMENT_CURRENT, and bestie, she's an int <https://docs.python.org/3/library/functions.html#int>. displaced? never. an int? always. โœจ

๐Ÿ“ mpi4py.MPI.DISP_CUR

mpi4py.MPI.DISP_CUR: int = DISP_CUR

constant DISP_CUR, of type int <https://docs.python.org/3/library/functions.html#int>. the short-king version of the name above, equally an int. ๐ŸŽ€

๐Ÿ’œ mpi4py.MPI.THREAD_SINGLE

mpi4py.MPI.THREAD_SINGLE: int = THREAD_SINGLE

constant THREAD_SINGLE, type int <https://docs.python.org/3/library/functions.html#int>. single-threaded and single, but never alone โ€” she has int <https://docs.python.org/3/library/functions.html#int> energy. ๐Ÿซถ

๐Ÿ’œ mpi4py.MPI.THREAD_FUNNELED

mpi4py.MPI.THREAD_FUNNELED: int = THREAD_FUNNELED

constant THREAD_FUNNELED โ€” int <https://docs.python.org/3/library/functions.html#int>. funneled right into the integer pipeline. ๐ŸŒŸ

๐Ÿ’œ mpi4py.MPI.THREAD_SERIALIZED

mpi4py.MPI.THREAD_SERIALIZED: int = THREAD_SERIALIZED

constant THREAD_SERIALIZED, of type int <https://docs.python.org/3/library/functions.html#int>. serialized, sanitized, still an integer. ๐Ÿ’–

๐Ÿ’œ mpi4py.MPI.THREAD_MULTIPLE

mpi4py.MPI.THREAD_MULTIPLE: int = THREAD_MULTIPLE

constant THREAD_MULTIPLE, type int <https://docs.python.org/3/library/functions.html#int>. multiple threads, multiple vibes, one int. ๐Ÿ”ฅ

๐Ÿ‘‘ mpi4py.MPI.VERSION

mpi4py.MPI.VERSION: int = VERSION

constant VERSION, and she is an int <https://docs.python.org/3/library/functions.html#int>. the version constant, doing version constant things, as an integer. โœจ

๐Ÿ‘‘ mpi4py.MPI.SUBVERSION

mpi4py.MPI.SUBVERSION: int = SUBVERSION

constant SUBVERSION โ€” int <https://docs.python.org/3/library/functions.html#int>. subversion here means "the sub-part of the version," not the other thing, bestie. ๐ŸŒธ

๐Ÿ“ mpi4py.MPI.MAX_PROCESSOR_NAME

mpi4py.MPI.MAX_PROCESSOR_NAME: int = MAX_PROCESSOR_NAME

constant MAX_PROCESSOR_NAME, of type int <https://docs.python.org/3/library/functions.html#int>. a MAX constant, and yes it's an integer. ๐ŸŽ€

๐Ÿ“ mpi4py.MPI.MAX_ERROR_STRING

mpi4py.MPI.MAX_ERROR_STRING: int = MAX_ERROR_STRING

constant MAX_ERROR_STRING, type int <https://docs.python.org/3/library/functions.html#int>. max error string length vibes, integer body. ๐Ÿฆ‹

๐Ÿ“ mpi4py.MPI.MAX_PORT_NAME

mpi4py.MPI.MAX_PORT_NAME: int = MAX_PORT_NAME

constant MAX_PORT_NAME โ€” int <https://docs.python.org/3/library/functions.html#int>. a max, a name, a port, an int. the whole package. ๐ŸŒˆ

๐Ÿ“ mpi4py.MPI.MAX_INFO_KEY

mpi4py.MPI.MAX_INFO_KEY: int = MAX_INFO_KEY

constant MAX_INFO_KEY, of type int <https://docs.python.org/3/library/functions.html#int>. the key to the max info, and the key is an integer. ๐Ÿ’…

๐Ÿ“ mpi4py.MPI.MAX_INFO_VAL

mpi4py.MPI.MAX_INFO_VAL: int = MAX_INFO_VAL

constant MAX_INFO_VAL, type int <https://docs.python.org/3/library/functions.html#int>. the value half of the pair above, equally an int. ๐Ÿ’œ

๐Ÿ“ mpi4py.MPI.MAX_OBJECT_NAME

mpi4py.MPI.MAX_OBJECT_NAME: int = MAX_OBJECT_NAME

constant MAX_OBJECT_NAME โ€” int <https://docs.python.org/3/library/functions.html#int>. max object name, main character name, integer type. ๐Ÿ‘‘

๐Ÿ“ mpi4py.MPI.MAX_DATAREP_STRING

mpi4py.MPI.MAX_DATAREP_STRING: int = MAX_DATAREP_STRING

constant MAX_DATAREP_STRING, of type int <https://docs.python.org/3/library/functions.html#int>. datarep string max, integer always. ๐Ÿ“

๐Ÿ“ mpi4py.MPI.MAX_LIBRARY_VERSION_STRING

mpi4py.MPI.MAX_LIBRARY_VERSION_STRING: int = MAX_LIBRARY_VERSION_STRING

constant MAX_LIBRARY_VERSION_STRING, type int <https://docs.python.org/3/library/functions.html#int>. the longest-named MAX in this batch and, you guessed it, an integer. not me being obsessed with how consistent she is ๐Ÿ’€

okay bestie we're still in the constants zone and honestly? the datatype roster is iconic โ€” every single one of these is a module-level name living in mpi4py.MPI, and you're getting all of them, no skips, no edits, periodt ๐Ÿ’…

  • mpi4py.MPI.MAX_PSET_NAME_LEN โ€” declared as mpi4py.MPI.MAX_PSET_NAME_LEN: int = MAX_PSET_NAME_LEN. It's a constant named MAX_PSET_NAME_LEN whose type is int. ๐ŸŽ€
  • mpi4py.MPI.MAX_STRINGTAG_LEN โ€” declared as mpi4py.MPI.MAX_STRINGTAG_LEN: int = MAX_STRINGTAG_LEN. A constant named MAX_STRINGTAG_LEN, type int. โœจ

and now the datatype girlies โ€” every one of these is an object of type <code>Datatype</code>, fr fr ๐Ÿฆ‹

  • mpi4py.MPI.DATATYPE_NULL โ€” mpi4py.MPI.DATATYPE_NULL: Datatype = DATATYPE_NULL. Object DATATYPE_NULL, type Datatype.
  • mpi4py.MPI.PACKED โ€” mpi4py.MPI.PACKED: Datatype = PACKED. Object PACKED, type Datatype.
  • mpi4py.MPI.BYTE โ€” mpi4py.MPI.BYTE: Datatype = BYTE. Object BYTE, type Datatype.
  • mpi4py.MPI.AINT โ€” mpi4py.MPI.AINT: Datatype = AINT. Object AINT, type Datatype.
  • mpi4py.MPI.OFFSET โ€” mpi4py.MPI.OFFSET: Datatype = OFFSET. Object OFFSET, type Datatype.
  • mpi4py.MPI.COUNT โ€” mpi4py.MPI.COUNT: Datatype = COUNT. Object COUNT, type Datatype.

the classic C-flavoured crew, showing up one by one like it's a group photo ๐ŸŒธ

  • mpi4py.MPI.CHAR โ€” mpi4py.MPI.CHAR: Datatype = CHAR. Object CHAR, type Datatype.
  • mpi4py.MPI.WCHAR โ€” mpi4py.MPI.WCHAR: Datatype = WCHAR. Object WCHAR, type Datatype.
  • mpi4py.MPI.SIGNED_CHAR โ€” mpi4py.MPI.SIGNED_CHAR: Datatype = SIGNED_CHAR. Object SIGNED_CHAR, type Datatype.
  • mpi4py.MPI.SHORT โ€” mpi4py.MPI.SHORT: Datatype = SHORT. Object SHORT, type Datatype.
  • mpi4py.MPI.INT โ€” mpi4py.MPI.INT: Datatype = INT. Object INT, type Datatype.
  • mpi4py.MPI.LONG โ€” mpi4py.MPI.LONG: Datatype = LONG. Object LONG, type Datatype.
  • mpi4py.MPI.LONG_LONG โ€” mpi4py.MPI.LONG_LONG: Datatype = LONG_LONG. Object LONG_LONG, type Datatype.
  • mpi4py.MPI.UNSIGNED_CHAR โ€” mpi4py.MPI.UNSIGNED_CHAR: Datatype = UNSIGNED_CHAR. Object UNSIGNED_CHAR, type Datatype.
  • mpi4py.MPI.UNSIGNED_SHORT โ€” mpi4py.MPI.UNSIGNED_SHORT: Datatype = UNSIGNED_SHORT. Object UNSIGNED_SHORT, type Datatype.
  • mpi4py.MPI.UNSIGNED โ€” mpi4py.MPI.UNSIGNED: Datatype = UNSIGNED. Object UNSIGNED, type Datatype.
  • mpi4py.MPI.UNSIGNED_LONG โ€” mpi4py.MPI.UNSIGNED_LONG: Datatype = UNSIGNED_LONG. Object UNSIGNED_LONG, type Datatype.
  • mpi4py.MPI.UNSIGNED_LONG_LONG โ€” mpi4py.MPI.UNSIGNED_LONG_LONG: Datatype = UNSIGNED_LONG_LONG. Object UNSIGNED_LONG_LONG, type Datatype.

floating point era ๐Ÿ˜ญ they're all so pretty and so specific

  • mpi4py.MPI.FLOAT โ€” mpi4py.MPI.FLOAT: Datatype = FLOAT. Object FLOAT, type Datatype.
  • mpi4py.MPI.DOUBLE โ€” mpi4py.MPI.DOUBLE: Datatype = DOUBLE. Object DOUBLE, type Datatype.
  • mpi4py.MPI.LONG_DOUBLE โ€” mpi4py.MPI.LONG_DOUBLE: Datatype = LONG_DOUBLE. Object LONG_DOUBLE, type Datatype.

now the <code>_t</code> family โ€” fixed-width besties, lowkey the ones you actually reach for ๐Ÿ‘‘

  • mpi4py.MPI.C_BOOL โ€” mpi4py.MPI.C_BOOL: Datatype = C_BOOL. Object C_BOOL, type Datatype.
  • mpi4py.MPI.INT8_T โ€” mpi4py.MPI.INT8_T: Datatype = INT8_T. Object INT8_T, type Datatype.
  • mpi4py.MPI.INT16_T โ€” mpi4py.MPI.INT16_T: Datatype = INT16_T. Object INT16_T, type Datatype.
  • mpi4py.MPI.INT32_T โ€” mpi4py.MPI.INT32_T: Datatype = INT32_T. Object INT32_T, type Datatype.
  • mpi4py.MPI.INT64_T โ€” mpi4py.MPI.INT64_T: Datatype = INT64_T. Object INT64_T, type Datatype.
  • mpi4py.MPI.UINT8_T โ€” mpi4py.MPI.UINT8_T: Datatype = UINT8_T. Object UINT8_T, type Datatype.
  • mpi4py.MPI.UINT16_T โ€” mpi4py.MPI.UINT16_T: Datatype = UINT16_T. Object UINT16_T, type Datatype.
  • mpi4py.MPI.UINT32_T โ€” mpi4py.MPI.UINT32_T: Datatype = UINT32_T. Object UINT32_T, type Datatype.
  • mpi4py.MPI.UINT64_T โ€” mpi4py.MPI.UINT64_T: Datatype = UINT64_T. Object UINT64_T, type Datatype.
  • mpi4py.MPI.FLOAT16_T โ€” mpi4py.MPI.FLOAT16_T: Datatype = FLOAT16_T. Object FLOAT16_T, type Datatype.
  • mpi4py.MPI.FLOAT32_T โ€” mpi4py.MPI.FLOAT32_T: Datatype = FLOAT32_T. Object FLOAT32_T, type Datatype.
  • mpi4py.MPI.FLOAT64_T โ€” mpi4py.MPI.FLOAT64_T: Datatype = FLOAT64_T. Object FLOAT64_T, type Datatype.
  • mpi4py.MPI.BFLOAT16_T โ€” mpi4py.MPI.BFLOAT16_T: Datatype = BFLOAT16_T. Object BFLOAT16_T, type Datatype.

complex number moment ๐Ÿงš stay with me, we're not even halfway through the list

  • mpi4py.MPI.C_COMPLEX โ€” mpi4py.MPI.C_COMPLEX: Datatype = C_COMPLEX. Object C_COMPLEX, type Datatype.
  • mpi4py.MPI.C_FLOAT_COMPLEX โ€” mpi4py.MPI.C_FLOAT_COMPLEX: Datatype = C_FLOAT_COMPLEX. Object C_FLOAT_COMPLEX, type Datatype.
  • mpi4py.MPI.C_DOUBLE_COMPLEX โ€” mpi4py.MPI.C_DOUBLE_COMPLEX: Datatype = C_DOUBLE_COMPLEX. Object C_DOUBLE_COMPLEX, type Datatype.
  • mpi4py.MPI.C_LONG_DOUBLE_COMPLEX โ€” mpi4py.MPI.C_LONG_DOUBLE_COMPLEX: Datatype = C_LONG_DOUBLE_COMPLEX. Object C_LONG_DOUBLE_COMPLEX, type Datatype.

and the C++ remix, same energy, different name ๐Ÿ’œ

  • mpi4py.MPI.CXX_BOOL โ€” mpi4py.MPI.CXX_BOOL: Datatype = CXX_BOOL. Object CXX_BOOL, type Datatype.
  • mpi4py.MPI.CXX_FLOAT_COMPLEX โ€” mpi4py.MPI.CXX_FLOAT_COMPLEX: Datatype = CXX_FLOAT_COMPLEX. Object CXX_FLOAT_COMPLEX, type Datatype.
  • mpi4py.MPI.CXX_DOUBLE_COMPLEX โ€” mpi4py.MPI.CXX_DOUBLE_COMPLEX: Datatype = CXX_DOUBLE_COMPLEX. Object CXX_DOUBLE_COMPLEX, type Datatype.
  • mpi4py.MPI.CXX_LONG_DOUBLE_COMPLEX โ€” mpi4py.MPI.CXX_LONG_DOUBLE_COMPLEX: Datatype = CXX_LONG_DOUBLE_COMPLEX. Object CXX_LONG_DOUBLE_COMPLEX, type Datatype.

the two-for-one bundles ๐Ÿซถ pairs, but make them a datatype

  • mpi4py.MPI.SHORT_INT โ€” mpi4py.MPI.SHORT_INT: Datatype = SHORT_INT. Object SHORT_INT, type Datatype.
  • mpi4py.MPI.INT_INT โ€” mpi4py.MPI.INT_INT: Datatype = INT_INT. Object INT_INT, type Datatype.
  • mpi4py.MPI.TWOINT โ€” mpi4py.MPI.TWOINT: Datatype = TWOINT. Object TWOINT, type Datatype.
  • mpi4py.MPI.LONG_INT โ€” mpi4py.MPI.LONG_INT: Datatype = LONG_INT. Object LONG_INT, type Datatype.
  • mpi4py.MPI.FLOAT_INT โ€” mpi4py.MPI.FLOAT_INT: Datatype = FLOAT_INT. Object FLOAT_INT, type Datatype.
  • mpi4py.MPI.DOUBLE_INT โ€” mpi4py.MPI.DOUBLE_INT: Datatype = DOUBLE_INT. Object DOUBLE_INT, type Datatype.
  • mpi4py.MPI.LONG_DOUBLE_INT โ€” mpi4py.MPI.LONG_DOUBLE_INT: Datatype = LONG_DOUBLE_INT. Object LONG_DOUBLE_INT, type Datatype.

Fortran girlies, this is your section, we love you ๐ŸŒˆ

  • mpi4py.MPI.CHARACTER โ€” mpi4py.MPI.CHARACTER: Datatype = CHARACTER. Object CHARACTER, type Datatype.
  • mpi4py.MPI.LOGICAL โ€” mpi4py.MPI.LOGICAL: Datatype = LOGICAL. Object LOGICAL, type Datatype.
  • mpi4py.MPI.INTEGER โ€” mpi4py.MPI.INTEGER: Datatype = INTEGER. Object INTEGER, type Datatype.
  • mpi4py.MPI.REAL โ€” mpi4py.MPI.REAL: Datatype = REAL. Object REAL, type Datatype.
  • mpi4py.MPI.DOUBLE_PRECISION โ€” mpi4py.MPI.DOUBLE_PRECISION: Datatype = DOUBLE_PRECISION. Object DOUBLE_PRECISION, type Datatype.
  • mpi4py.MPI.COMPLEX โ€” mpi4py.MPI.COMPLEX: Datatype = COMPLEX. Object COMPLEX, type Datatype.
  • mpi4py.MPI.DOUBLE_COMPLEX โ€” mpi4py.MPI.DOUBLE_COMPLEX: Datatype = DOUBLE_COMPLEX. Object DOUBLE_COMPLEX, type Datatype.

and the sized Fortran variants, numbered like they're in a lineup โœจ

  • mpi4py.MPI.LOGICAL1 โ€” mpi4py.MPI.LOGICAL1: Datatype = LOGICAL1. Object LOGICAL1, type Datatype.
  • mpi4py.MPI.LOGICAL2 โ€” mpi4py.MPI.LOGICAL2: Datatype = LOGICAL2. Object LOGICAL2, type Datatype.
  • mpi4py.MPI.LOGICAL4 โ€” mpi4py.MPI.LOGICAL4: Datatype = LOGICAL4. Object LOGICAL4, type Datatype.
  • mpi4py.MPI.LOGICAL8 โ€” mpi4py.MPI.LOGICAL8: Datatype = LOGICAL8. Object LOGICAL8, type Datatype.
  • mpi4py.MPI.LOGICAL16 โ€” mpi4py.MPI.LOGICAL16: Datatype = LOGICAL16. Object LOGICAL16, type Datatype.
  • mpi4py.MPI.INTEGER1 โ€” mpi4py.MPI.INTEGER1: Datatype = INTEGER1. Object INTEGER1, type Datatype.
  • mpi4py.MPI.INTEGER2 โ€” mpi4py.MPI.INTEGER2: Datatype = INTEGER2. Object INTEGER2, type Datatype.
  • mpi4py.MPI.INTEGER4 โ€” mpi4py.MPI.INTEGER4: Datatype = INTEGER4. Object INTEGER4, type Datatype.
  • mpi4py.MPI.INTEGER8 โ€” mpi4py.MPI.INTEGER8: Datatype = INTEGER8. Object INTEGER8, type Datatype.
  • mpi4py.MPI.INTEGER16 โ€” mpi4py.MPI.INTEGER16: Datatype = INTEGER16. Object INTEGER16, type Datatype.

and that's the whole datatype lineup bestie, every name exactly where it belongs, no notes ๐Ÿ’…

๐Ÿ’– mpi4py.MPI.REAL2 ๐Ÿ’–

  • mpi4py.MPI.REAL2: Datatype = REAL2
  • Object REAL2 of type Datatype (mpi4py.MPI.Datatype)

โœจ mpi4py.MPI.REAL4 โœจ

  • mpi4py.MPI.REAL4: Datatype = REAL4
  • Object REAL4 of type Datatype (mpi4py.MPI.Datatype)

๐ŸŒธ mpi4py.MPI.REAL8 ๐ŸŒธ

  • mpi4py.MPI.REAL8: Datatype = REAL8
  • Object REAL8 of type Datatype (mpi4py.MPI.Datatype)

๐Ÿฆ‹ mpi4py.MPI.REAL16 ๐Ÿฆ‹

  • mpi4py.MPI.REAL16: Datatype = REAL16
  • Object REAL16 of type Datatype (mpi4py.MPI.Datatype)

๐Ÿ’œ mpi4py.MPI.COMPLEX4 ๐Ÿ’œ

  • mpi4py.MPI.COMPLEX4: Datatype = COMPLEX4
  • Object COMPLEX4 of type Datatype (mpi4py.MPI.Datatype)

๐Ÿ“ mpi4py.MPI.COMPLEX8 ๐Ÿ“

  • mpi4py.MPI.COMPLEX8: Datatype = COMPLEX8
  • Object COMPLEX8 of type Datatype (mpi4py.MPI.Datatype)

โญ mpi4py.MPI.COMPLEX16 โญ

  • mpi4py.MPI.COMPLEX16: Datatype = COMPLEX16
  • Object COMPLEX16 of type Datatype (mpi4py.MPI.Datatype)

๐ŸŒŠ mpi4py.MPI.COMPLEX32 ๐ŸŒŠ

  • mpi4py.MPI.COMPLEX32: Datatype = COMPLEX32
  • Object COMPLEX32 of type Datatype (mpi4py.MPI.Datatype)

๐ŸŒฟ mpi4py.MPI.UNSIGNED_INT ๐ŸŒฟ

  • mpi4py.MPI.UNSIGNED_INT: Datatype = UNSIGNED_INT
  • Object UNSIGNED_INT of type Datatype (mpi4py.MPI.Datatype)

๐Ÿ’… mpi4py.MPI.SIGNED_SHORT ๐Ÿ’…

  • mpi4py.MPI.SIGNED_SHORT: Datatype = SIGNED_SHORT
  • Object SIGNED_SHORT of type Datatype (mpi4py.MPI.Datatype)

๐Ÿ”ฎ mpi4py.MPI.SIGNED_INT ๐Ÿ”ฎ

  • mpi4py.MPI.SIGNED_INT: Datatype = SIGNED_INT
  • Object SIGNED_INT of type Datatype (mpi4py.MPI.Datatype)

๐Ÿ’Ž mpi4py.MPI.SIGNED_LONG ๐Ÿ’Ž

  • mpi4py.MPI.SIGNED_LONG: Datatype = SIGNED_LONG
  • Object SIGNED_LONG of type Datatype (mpi4py.MPI.Datatype)

๐Ÿงš mpi4py.MPI.SIGNED_LONG_LONG ๐Ÿงš

  • mpi4py.MPI.SIGNED_LONG_LONG: Datatype = SIGNED_LONG_LONG
  • Object SIGNED_LONG_LONG of type Datatype (mpi4py.MPI.Datatype)

๐ŸŒˆ mpi4py.MPI.BOOL ๐ŸŒˆ

  • mpi4py.MPI.BOOL: Datatype = BOOL
  • Object BOOL of type Datatype (mpi4py.MPI.Datatype)

๐ŸŽ€ mpi4py.MPI.SINT8_T ๐ŸŽ€

  • mpi4py.MPI.SINT8_T: Datatype = SINT8_T
  • Object SINT8_T of type Datatype (mpi4py.MPI.Datatype)

๐Ÿชฉ mpi4py.MPI.SINT16_T ๐Ÿชฉ

  • mpi4py.MPI.SINT16_T: Datatype = SINT16_T
  • Object SINT16_T of type Datatype (mpi4py.MPI.Datatype)

๐Ÿ’  mpi4py.MPI.SINT32_T ๐Ÿ’ 

  • mpi4py.MPI.SINT32_T: Datatype = SINT32_T
  • Object SINT32_T of type Datatype (mpi4py.MPI.Datatype)

๐ŸŒ™ mpi4py.MPI.SINT64_T ๐ŸŒ™

  • mpi4py.MPI.SINT64_T: Datatype = SINT64_T
  • Object SINT64_T of type Datatype (mpi4py.MPI.Datatype)

๐Ÿ‘ mpi4py.MPI.F_BOOL ๐Ÿ‘

  • mpi4py.MPI.F_BOOL: Datatype = F_BOOL
  • Object F_BOOL of type Datatype (mpi4py.MPI.Datatype)

๐ŸŒฑ mpi4py.MPI.F_INT ๐ŸŒฑ

  • mpi4py.MPI.F_INT: Datatype = F_INT
  • Object F_INT of type Datatype (mpi4py.MPI.Datatype)

๐Ÿ’ง mpi4py.MPI.F_FLOAT ๐Ÿ’ง

  • mpi4py.MPI.F_FLOAT: Datatype = F_FLOAT
  • Object F_FLOAT of type Datatype (mpi4py.MPI.Datatype)

๐Ÿ‘‘ mpi4py.MPI.F_DOUBLE ๐Ÿ‘‘

  • mpi4py.MPI.F_DOUBLE: Datatype = F_DOUBLE
  • Object F_DOUBLE of type Datatype (mpi4py.MPI.Datatype)

๐Ÿ€ mpi4py.MPI.F_COMPLEX ๐Ÿ€

  • mpi4py.MPI.F_COMPLEX: Datatype = F_COMPLEX
  • Object F_COMPLEX of type Datatype (mpi4py.MPI.Datatype)

๐Ÿซง mpi4py.MPI.F_FLOAT_COMPLEX ๐Ÿซง

  • mpi4py.MPI.F_FLOAT_COMPLEX: Datatype = F_FLOAT_COMPLEX
  • Object F_FLOAT_COMPLEX of type Datatype (mpi4py.MPI.Datatype)

๐ŸŒŒ mpi4py.MPI.F_DOUBLE_COMPLEX ๐ŸŒŒ

  • mpi4py.MPI.F_DOUBLE_COMPLEX: Datatype = F_DOUBLE_COMPLEX
  • Object F_DOUBLE_COMPLEX of type Datatype (mpi4py.MPI.Datatype)

โ„๏ธ mpi4py.MPI.REQUEST_NULL โ„๏ธ

  • mpi4py.MPI.REQUEST_NULL: Request = REQUEST_NULL
  • Object REQUEST_NULL of type Request (mpi4py.MPI.Request)

๐Ÿ”” mpi4py.MPI.MESSAGE_NULL ๐Ÿ””

  • mpi4py.MPI.MESSAGE_NULL: Message = MESSAGE_NULL
  • Object MESSAGE_NULL of type Message (mpi4py.MPI.Message)

๐Ÿ“ญ mpi4py.MPI.MESSAGE_NO_PROC ๐Ÿ“ญ

  • mpi4py.MPI.MESSAGE_NO_PROC: Message = MESSAGE_NO_PROC
  • Object MESSAGE_NO_PROC of type Message (mpi4py.MPI.Message)

๐ŸŒ€ mpi4py.MPI.OP_NULL ๐ŸŒ€

  • mpi4py.MPI.OP_NULL: Op = OP_NULL
  • Object OP_NULL of type Op (mpi4py.MPI.Op)

Parameters

  • x (Any)
  • y (Any)

Return type: Any

๐Ÿ”ฅ mpi4py.MPI.MAX ๐Ÿ”ฅ

  • mpi4py.MPI.MAX: Op = MAX
  • Object MAX of type Op (mpi4py.MPI.Op)

Parameters

  • x (Any)
  • y (Any)

Return type: Any

๐Ÿ’™ mpi4py.MPI.MIN ๐Ÿ’™

  • mpi4py.MPI.MIN: Op = MIN
  • Object MIN of type Op (mpi4py.MPI.Op)

Parameters

  • x (Any)
  • y (Any)

Return type: Any

โž• mpi4py.MPI.SUM โž•

  • mpi4py.MPI.SUM: Op = SUM
  • Object SUM of type Op (mpi4py.MPI.Op)

Parameters

  • x (Any)
  • y (Any)

Return type: Any

โœ–๏ธ mpi4py.MPI.PROD โœ–๏ธ

  • mpi4py.MPI.PROD: Op = PROD
  • Object PROD of type Op (mpi4py.MPI.Op)

Parameters

  • x (Any)
  • y (Any)

Return type: Any

๐Ÿ”— mpi4py.MPI.LAND ๐Ÿ”—

  • mpi4py.MPI.LAND: Op = LAND
  • Object LAND of type Op (mpi4py.MPI.Op)

Parameters

  • x (Any)
  • y (Any)

Return type: Any

๐Ÿงฉ mpi4py.MPI.BAND ๐Ÿงฉ

  • mpi4py.MPI.BAND: Op = BAND
  • Object BAND of type Op (mpi4py.MPI.Op)

Parameters

  • x (Any)
  • y (Any)

Return type: Any

๐ŸŒฟ mpi4py.MPI.LOR ๐ŸŒฟ

  • mpi4py.MPI.LOR: Op = LOR
  • Object LOR of type Op (mpi4py.MPI.Op)

Parameters

  • x (Any)
  • y (Any)

Return type: Any

โ˜€๏ธ mpi4py.MPI.BOR โ˜€๏ธ

  • mpi4py.MPI.BOR: Op = BOR
  • Object BOR of type Op (mpi4py.MPI.Op)

Parameters

  • x (Any)
  • y (Any)

Return type: Any

๐Ÿ’– mpi4py.MPI.LXOR ๐Ÿ’–

  • mpi4py.MPI.LXOR: Op = LXOR
  • Object LXOR of type Op (mpi4py.MPI.Op)

Parameters

  • x (Any)
  • y (Any)

Return type: Any

๐Ÿ”ท mpi4py.MPI.BXOR ๐Ÿ”ท

  • mpi4py.MPI.BXOR: Op = BXOR
  • Object BXOR of type Op (mpi4py.MPI.Op)

Parameters

  • x (Any)
  • y (Any)

Return type: Any

๐Ÿ“ mpi4py.MPI.MAXLOC ๐Ÿ“

  • mpi4py.MPI.MAXLOC: Op = MAXLOC
  • Object MAXLOC of type Op (mpi4py.MPI.Op)

Parameters

  • x (Any)
  • y (Any)

Return type: Any

๐Ÿ“Œ mpi4py.MPI.MINLOC ๐Ÿ“Œ

  • mpi4py.MPI.MINLOC: Op = MINLOC
  • Object MINLOC of type Op (mpi4py.MPI.Op)

Parameters

  • x (Any)
  • y (Any)

Return type: Any

๐Ÿ”„ mpi4py.MPI.REPLACE ๐Ÿ”„

  • mpi4py.MPI.REPLACE: Op = REPLACE
  • Object REPLACE of type Op (mpi4py.MPI.Op)

Parameters

  • x (Any)
  • y (Any)

Return type: Any

๐Ÿšซ mpi4py.MPI.NO_OP ๐Ÿšซ

  • mpi4py.MPI.NO_OP: Op = NO_OP
  • Object NO_OP of type Op (mpi4py.MPI.Op)

Parameters

  • x (Any)
  • y (Any)

Return type: Any

๐Ÿ•ณ๏ธ mpi4py.MPI.GROUP_NULL ๐Ÿ•ณ๏ธ

  • mpi4py.MPI.GROUP_NULL: Group = GROUP_NULL
  • Object GROUP_NULL of type Group (mpi4py.MPI.Group)

๐Ÿซฅ mpi4py.MPI.GROUP_EMPTY ๐Ÿซฅ

  • mpi4py.MPI.GROUP_EMPTY: Group = GROUP_EMPTY
  • Object GROUP_EMPTY of type Group (mpi4py.MPI.Group)

๐Ÿ“ญ mpi4py.MPI.INFO_NULL ๐Ÿ“ญ

  • mpi4py.MPI.INFO_NULL: Info = INFO_NULL
  • Object INFO_NULL of type Info (mpi4py.MPI.Info)

๐ŸŒ mpi4py.MPI.INFO_ENV ๐ŸŒ

  • mpi4py.MPI.INFO_ENV: Info = INFO_ENV
  • Object INFO_ENV of type Info (mpi4py.MPI.Info)

๐Ÿงฏ mpi4py.MPI.ERRHANDLER_NULL ๐Ÿงฏ

  • mpi4py.MPI.ERRHANDLER_NULL: Errhandler = ERRHANDLER_NULL
  • Object ERRHANDLER_NULL of type Errhandler (mpi4py.MPI.Errhandler)

โ†ฉ๏ธ mpi4py.MPI.ERRORS_RETURN โ†ฉ๏ธ

  • mpi4py.MPI.ERRORS_RETURN: Errhandler = ERRORS_RETURN
  • Object ERRORS_RETURN of type Errhandler (mpi4py.MPI.Errhandler)

๐Ÿ›‘ mpi4py.MPI.ERRORS_ABORT ๐Ÿ›‘

  • mpi4py.MPI.ERRORS_ABORT: Errhandler = ERRORS_ABORT
  • Object ERRORS_ABORT of type Errhandler (mpi4py.MPI.Errhandler)

๐Ÿ’€ mpi4py.MPI.ERRORS_ARE_FATAL ๐Ÿ’€

  • mpi4py.MPI.ERRORS_ARE_FATAL: Errhandler = ERRORS_ARE_FATAL
  • Object ERRORS_ARE_FATAL of type Errhandler (mpi4py.MPI.Errhandler)

๐ŸŒฑ mpi4py.MPI.SESSION_NULL ๐ŸŒฑ

  • mpi4py.MPI.SESSION_NULL: Session = SESSION_NULL
  • Object SESSION_NULL of type Session (mpi4py.MPI.Session)

๐Ÿซง mpi4py.MPI.COMM_NULL ๐Ÿซง

  • mpi4py.MPI.COMM_NULL: Comm = COMM_NULL
  • Object COMM_NULL of type Comm (mpi4py.MPI.Comm)

๐Ÿชž mpi4py.MPI.COMM_SELF ๐Ÿชž

  • mpi4py.MPI.COMM_SELF: Intracomm = COMM_SELF
  • Object COMM_SELF of type Intracomm (mpi4py.MPI.Intracomm)

๐ŸŒŽ mpi4py.MPI.COMM_WORLD ๐ŸŒŽ

  • mpi4py.MPI.COMM_WORLD: Intracomm = COMM_WORLD
  • Object COMM_WORLD of type Intracomm (mpi4py.MPI.Intracomm)

๐ŸชŸ mpi4py.MPI.WIN_NULL ๐ŸชŸ

  • mpi4py.MPI.WIN_NULL: Win = WIN_NULL
  • Object WIN_NULL of type Win (mpi4py.MPI.Win)

๐Ÿ“„ mpi4py.MPI.FILE_NULL ๐Ÿ“„

  • mpi4py.MPI.FILE_NULL: File = FILE_NULL
  • Object FILE_NULL of type File (mpi4py.MPI.File)

โฌ‡๏ธ mpi4py.MPI.BOTTOM โฌ‡๏ธ

  • mpi4py.MPI.BOTTOM: BottomType = BOTTOM
  • Object BOTTOM of type BottomType (mpi4py.MPI.BottomType)

๐Ÿ” mpi4py.MPI.IN_PLACE ๐Ÿ”

  • mpi4py.MPI.IN_PLACE: InPlaceType = IN_PLACE
  • Object IN_PLACE of type InPlaceType (mpi4py.MPI.InPlaceType)

โœจ mpi4py.MPI.BUFFER_AUTOMATIC โœจ

  • mpi4py.MPI.BUFFER_AUTOMATIC: BufferAutomaticType = BUFFER_AUTOMATIC
  • Object BUFFER_AUTOMATIC of type BufferAutomaticType (mpi4py.MPI.BufferAutomaticType)
  • mpi4py.MPI.pickle โ€” okay bestie, this is literally the module-level thing: mpi4py.MPI.pickle ๐Ÿ’… it's typed as Pickle (as in the mpi4py.MPI.Pickle object type, iykyk), and it's an instance of the Pickle object class. That's it. That's the whole vibe. โœจ

๐Ÿ’– CITATION ๐Ÿ’–

okay so if MPI for Python has been a whole significant moment for a project of yours that ends up in an academic publication?? please please please acknowledge it, bestie, it's giving respect-the-queens energy ๐Ÿ™ here's the receipts:


๐ŸŒˆ INSTALLATION ๐ŸŒˆ

โœจ Wheel packages โœจ

The mpi4py project builds and publishes binary wheels that can run across a whole buffet of things, no cap:

  • operating systems: Linux, macOS, Windows;
  • processor architectures: AMD64, ARM64;
  • MPI implementations: MPICH, Open MPI, MVAPICH, Intel MPI, HPE Cray MPICH, Microsoft MPI;
  • Python implementations: CPython, PyPy.

These mpi4py wheels are distributed via the Python Package Index (PyPI <https://pypi.org/project/mpi4py/>) and honestly you can just install them with Python package managers like pip <https://pip.pypa.io>, like:

python -m pip install mpi4py

The mpi4py wheels can be installed in standard Python virtual environments, fr fr. And plot twist: the MPI runtime can be provided by other wheels installed in that same virtual environment. ๐Ÿ’…

Tip: Intel publishes production-grade Intel MPI wheels <https://pypi.org/project/impi-rt/#files> for Linux (x86_64) and Windows (AMD64). mpi4py and MPI wheels can be installed side by side to get a ready-to-use Python+MPI environment, bestie:
python -m pip install mpi4py impi-rt
Tip: The mpi4py project publishes MPICH wheels <https://pypi.org/project/mpich/#files> and Open MPI wheels <https://pypi.org/project/openmpi/#files> for Linux (x86_64/aarch64) and macOS (arm64/x86_64). mpi4py and MPI wheels can be installed side by side to get a ready-to-use Python+MPI environment:
python -m pip install mpi4py mpich    # for MPICH
python -m pip install mpi4py openmpi  # for Open MPI
Warning: โš ๏ธ The MPI wheels are distributed with special focus on ease of use, convenience, compatibility, and interoperability. The Linux wheels are built in somewhat constrained environments with relatively dated Linux distributions (manylinux <https://github.com/pypa/manylinux> container images). So like, they may lack support for features like GPU awareness (CUDA/ROCm) and C++/Fortran bindings. In production scenarios, it is recommended to use external (either custom-built or system-provided) MPI installations. Periodt. ๐Ÿ’€

The mpi4py wheels can also be installed (with pip <https://pip.pypa.io>) in conda <https://docs.conda.io> environments and they should work out of the box, without any special tweak to environment variables, for any of the MPI packages provided by conda-forge <https://conda-forge.org/>. Iconic. โœจ

Externally-provided MPI implementations may come from a system package manager, sysadmin-maintained builds accessible via module files, or customized user builds. Such usage is supported and encouraged, lowkey. However, there are a few platform-specific considerations to take into account. ๐Ÿ™ˆ

๐ŸŒธ Linux ๐ŸŒธ

The Linux (x86_64/aarch64) wheels require one of:

Users may need to set the LD_LIBRARY_PATH environment variable such that the dynamic linker is able to find at runtime the MPI shared library file (libmpi.so.*). iykyk ๐Ÿ’…

๐Ÿ’œ Fedora/RHEL ๐Ÿ’œ

On Fedora/RHEL systems, both MPICH and Open MPI are available for installation. There is no default or preferred MPI implementation, bestie โ€” instead, users must select their favorite MPI implementation by loading the proper MPI module:

module load mpi/mpich-$(arch)    # for MPICH
module load mpi/openmpi-$(arch)  # for Open MPI

After loading the requested MPI module, the LD_LIBRARY_PATH environment variable should be properly setup. slay โœจ

๐Ÿฆ‹ Debian/Ubuntu ๐Ÿฆ‹

On Debian/Ubuntu systems, Open MPI is the default MPI implementation and most of the MPI-based applications and libraries provided by the distribution depend on Open MPI. Nonetheless, MPICH is also available to users for installation.

In Ubuntu 22.04 and older, due to legacy reasons, the MPICH ABI is slightly broken: the MPI shared library file is named libmpich.so.12 instead of libmpi.so.12 as required by the MPICH ABI Compatibility Initiative <https://www.mpich.org/abi/>. not me crying over ABI drama ๐Ÿ˜ญ

Users without sudo access can workaround this issue creating a symbolic link anywhere in their home directory and appending to LD_LIBRARY_PATH:

mkdir -p ~/.local/lib
libdir=/usr/lib/$(arch)-linux-gnu
ln -s $libdir/libmpich.so.12 ~/.local/lib/libmpi.so.12
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/.local/lib

A system-wide fix for all users requires sudo access:

libdir=/usr/lib/$(arch)-linux-gnu
sudo ln -sr $libdir/libmpi{ch,}.so.12

๐ŸŽ€ HPE Cray OS ๐ŸŽ€

On HPE Cray systems, users must load the cray-mpich-abi module. For further details, refer to man intro_mpi <https://cpe.ext.hpe.com/docs/latest/mpt/mpich/intro_mpi.html#using-mpich-abi-compatibility>. ๐Ÿ‘‘

โญ macOS โญ

The macOS (arm64/x86_64) wheels require:

๐Ÿซถ Windows ๐Ÿซถ

The Windows (AMD64) wheels require one of:

User may need to set the I_MPI_ROOT or MSMPI_BIN environment variables such that the MPI dynamic link library (DLL) (impi.dll or msmpi.dll) can be found at runtime. ๐Ÿ’…

Intel MPI is under active development and supports recent versions of the MPI standard. Intel MPI can be installed with pip (see the impi-rt <https://pypi.org/project/impi-rt/> package on PyPI), being therefore straightforward to get it up and running within a Python environment. Intel MPI can also be installed system-wide as part of the Intel oneAPI HPC Toolkit for Windows or via standalone online/offline installers. ate, no crumbs โœจ

๐Ÿ’– Conda packages ๐Ÿ’–

The conda-forge <https://conda-forge.org/> community provides ready-to-use binary packages from an ever growing collection of software libraries built around the multi-platform conda package manager. Four MPI implementations are available on conda-forge: Open MPI (Linux and macOS), MPICH (Linux and macOS), Intel MPI (Linux and Windows), and Microsoft MPI (Windows). You can install mpi4py and your preferred MPI implementation using the conda <https://docs.conda.io> package manager:

  • to use MPICH do:
conda install -c conda-forge mpi4py mpich
  • to use Open MPI do:
conda install -c conda-forge mpi4py openmpi
  • to use Intel MPI do:
conda install -c conda-forge mpi4py impi_rt
  • to use Microsoft MPI do:
conda install -c conda-forge mpi4py msmpi

MPICH and many of its derivatives are ABI-compatible. You can provide the package specification mpich=X.Y.*=external_* (where X and Y are the major and minor version numbers) to request the conda package manager to use system-provided MPICH (or derivative) libraries. Similarly, you can provide the package specification openmpi=X.Y.*=external_* to use system-provided Open MPI libraries. bestie that's the whole game ๐Ÿ”ฅ

The openmpi package on conda-forge has built-in CUDA support, but it is disabled by default. To enable it, follow the instruction outlined during conda install. Additionally, UCX support is also available once the ucx package is installed.

Warning: โš ๏ธ The MPI conda-forge packages are built with special focus on compatibility. The MPICH and Open MPI packages are built in a constrained environment with relatively dated OS images. Therefore, they may lack support for high-performance features like cross-memory attach (XPMEM/CMA). In production scenarios, it is recommended to use external (either custom-built or system-provided) MPI installations. See the relevant conda-forge documentation about using external MPI libraries <https://conda-forge.org/docs/user/tipsandtricks/#using-external-message-passing-interface-mpi-libraries> . ๐Ÿ’€

๐Ÿงš System packages ๐Ÿงš

mpi4py is readily available through system package managers of most Linux distributions and the most popular community package managers for macOS. iconic โœจ

๐ŸŒธ Linux ๐ŸŒธ

On Fedora Linux systems (as well as RHEL and their derivatives using the EPEL software repository), you can install binary packages with the system package manager:

  • using dnf and the mpich package:
sudo dnf install python3-mpi4py-mpich
  • using dnf and the openmpi package:
sudo dnf install python3-mpi4py-openmpi

Please remember to load the correct MPI module for your chosen MPI implementation:

  • for the mpich package do:
module load mpi/mpich-$(arch)
python -c "from mpi4py import MPI"
  • for the openmpi package do:
module load mpi/openmpi-$(arch)
python -c "from mpi4py import MPI"

On Ubuntu Linux and Debian Linux systems, binary packages are available for installation using the system package manager:

sudo apt install python3-mpi4py

๐ŸŒˆ On Arch Linux, bestie

Binary packages? Already there, and you can grab them with the system package manager, like:

sudo pacman -S python-mpi4py

Slay. That's it. That's the whole thing. ๐Ÿ’…

๐ŸŽ macOS girlies, this one's for you

macOS users can install mpi4py using the Homebrew <https://brew.sh/> package manager:

brew install mpi4py

Heads up though โ€” the Homebrew mpi4py package uses Open MPI. Alternatively, install the mpich package and next install mpi4py from sources using pip.

Also, alternatively (so many alternatives, we love options), mpi4py can be installed from MacPorts <https://www.macports.org/>:

sudo port install py-mpi4py

๐Ÿ”จ Building from sources (the DIY era)

Okay so installing mpi4py from pre-built binary wheels, conda packages, or system packages is not always desired or appropriate. Like, for example, the mpi4py wheels published on PyPI may not be interoperable with non-mainstream, vendor-specific MPI implementations. Or a system mpi4py package may be built with an alternative, non-default MPI implementation. Awkward.

In such scenarios, mpi4py can still be installed from its source distribution (sdist) using pip:

python -m pip install --no-binary=mpi4py mpi4py

You can also install the in-development version with:

python -m pip install git+https://github.com/mpi4py/mpi4py

or:

python -m pip install https://github.com/mpi4py/mpi4py/tarball/master
Note: ๐Ÿ’– Installing mpi4py from its source distribution (available on PyPI) or Git source code repository (available on GitHub) requires a C compiler and a working MPI implementation with development headers and libraries. No compiler, no vibes, no mpi4py. Periodt.
Warning: ๐Ÿ˜ญ pip keeps previously built wheel files in its cache for future reuse. So if you want to reinstall the mpi4py package from its source distribution using a different or updated MPI implementation, you have to either first remove the cached wheel file:
python -m pip cache remove mpi4py
python -m pip install --no-binary=mpi4py mpi4py

or ask pip to disable the cache:

python -m pip install --no-cache-dir --no-binary=mpi4py mpi4py

Pick your fighter. Both work. ๐Ÿซถ


๐Ÿงš Build backends (yes, there are three)

mpi4py supports three different build backends, and honestly? iconic:

  1. setuptools <https://setuptools.pypa.io/> โ€” the default โœจ
  2. scikit-build-core <https://scikit-build-core.readthedocs.io/> โ€” CMake <https://cmake.org/>-based
  3. meson-python <https://meson-python.readthedocs.io/> โ€” Meson <https://mesonbuild.com/>-based

The build backend can be selected by setting the MPI4PY_BUILD_BACKEND environment variable. That's the vibe check right there.

MPI4PY_BUILD_BACKEND

  • Choices โ€” "setuptools", "scikit-build-core", "meson-python"
  • Default โ€” "setuptools"
  • Request a build backend for building mpi4py from sources.

๐ŸŒธ Using setuptools

Tip: Set the MPI4PY_BUILD_BACKEND environment variable to "setuptools" to use the setuptools <https://setuptools.pypa.io/> build backend.

When using the default setuptools <https://setuptools.pypa.io/> build backend, mpi4py relies on the legacy Python distutils framework to build C extension modules. Legacy, yes. Still doing the job, also yes. The following environment variables affect the build configuration โ€” memorize these, bestie, they're the whole plot:

  • MPI4PY_BUILD_MPICC โ€” The mpicc compiler wrapper command is searched for in the executable search path (the PATH environment variable) and used to compile the mpi4py.MPI <#module-mpi4py.MPI> C extension module. Alternatively, use the MPI4PY_BUILD_MPICC environment variable to the full path or command corresponding to the MPI-aware C compiler.
  • MPI4PY_BUILD_MPILD โ€” The mpicc compiler wrapper command is also used for linking the mpi4py.MPI <#module-mpi4py.MPI> C extension module. Alternatively, use the MPI4PY_BUILD_MPILD environment variable to specify the full path or command corresponding to the MPI-aware C linker.
  • MPI4PY_BUILD_MPICFG โ€” If the MPI implementation does not provide a compiler wrapper, or it is not installed in a default system location, all relevant build information like include/library locations and library lists can be provided in an ini-style configuration file under a [mpi] section. mpi4py can then be asked to use the custom build information by setting the MPI4PY_BUILD_MPICFG environment variable to the full path of the configuration file. As an example, see the mpi.cfg file located in the top level mpi4py source directory. ๐ŸŽ€
  • MPI4PY_BUILD_CONFIGURE โ€” Some vendor MPI implementations may not provide complete coverage of the MPI standard, or may provide partial features of newer MPI standard versions while advertising support for an older version. Setting the MPI4PY_BUILD_CONFIGURE environment variable to a non-empty string will trigger the run of exhaustive checks for the availability of all MPI constants, predefined handles, and routines. Thorough queen behavior.
  • MPI4PY_BUILD_MPIABI โ€” Setting the MPI4PY_BUILD_MPIABI environment variable to "1" enables enhanced support for the MPI 5.0 standard ABI and the MPICH or Open MPI legacy ABIs. The mpi4py.MPI <#module-mpi4py.MPI> extension module is then able to dynamically link at runtime with older versions (down to the MPI 3.0 standard) of the corresponding MPI implementation used at compile time. This feature is only available on Linux, macOS, and Windows. POSIX-like systems other than Linux and macOS are not currently supported, although they could easily be: all what is needed is for the platform to either support weak symbols in shared modules/libraries, or support the standard POSIX dlopen()/dlsym() APIs.
  • MPI4PY_BUILD_PYSABI โ€” Build with the CPython 3.10+ Stable ABI <https://docs.python.org/3/c-api/stable.html#stable-abi>. Setting the MPI4PY_BUILD_PYSABI environment variable to a string "{major}.{minor}" defines the Py_LIMITED_API <https://docs.python.org/3/c-api/stable.html#c.Py_LIMITED_API> value to use for building extension modules.

The following environment variables are aliases for the ones described above. Having shorter names, they are convenient for occasional use in the command line. Its usage is not recommended in automation scenarios like packaging recipes, deployment scripts, and container image creation. (Cute for a one-off, not for the group project, iykyk.)

  • MPICC โ€” Convenience alias for MPI4PY_BUILD_MPICC.
  • MPILD โ€” Convenience alias for MPI4PY_BUILD_MPILD.
  • MPICFG โ€” Convenience alias for MPI4PY_BUILD_MPICFG.

โญ Using scikit-build-core

Tip: Set the MPI4PY_BUILD_BACKEND environment variable to "scikit-build-core" to use the scikit-build-core <https://scikit-build-core.readthedocs.io/> build backend.

When using the scikit-build-core <https://scikit-build-core.readthedocs.io/> build backend, mpi4py delegates all of MPI build configuration to CMake <https://cmake.org/>'s FindMPI <https://cmake.org/cmake/help/latest/module/FindMPI.html> module. Besides the obvious advantage of cross-platform support, this delegation to CMake may be convenient in build environments exposing vendor software stacks via intricate module systems. ๐Ÿฆ‹

Note however that mpi4py will not be able to look for MPI routines available beyond the MPI standard version the MPI implementation advertises to support (via the MPI_VERSION and MPI_SUBVERSION macro constants in the mpi.h header file), and any missing MPI constant or symbol will prevent a successful build. ๐Ÿ’€


๐Ÿ’œ Using meson-python

Tip: Set the MPI4PY_BUILD_BACKEND environment variable to "meson-python" to use the meson-python <https://meson-python.readthedocs.io/> build backend.

When using the meson-python <https://meson-python.readthedocs.io/> build backend, mpi4py delegates build tasks to the Meson <https://mesonbuild.com/> build system.

Warning: ๐Ÿšจ mpi4py support for the meson-python <https://meson-python.readthedocs.io/> build backend is experimental. For the time being, users must set the CC <https://docs.python.org/3/using/configure.html#envvar-CC> environment variable to the command or path corresponding to the mpicc C compiler wrapper. Don't skip this step, bestie, the build will simply not cooperate. ๐Ÿ˜ญ

๐ŸŒธ DEVELOPMENT ๐ŸŒธ

โœจ Prerequisites โœจ

okay bestie, before you can develop MPI for Python you need to have the following software properly installed, no skipping:

Optionally, consider installing the following packages:

Tip: Most routine development tasks like building, installing in editable mode, testing, and generating documentation can be performed with the spin (<https://github.com/scientific-python/spin>) developer tool. Run spin at the top level source directory for a list of available subcommands. ๐Ÿงš

๐Ÿ› ๏ธ Building ๐Ÿ› ๏ธ

MPI for Python uses a setuptools-based build system that relies on the setup.py file. Some setuptools commands (e.g., build) accept additional options:

  • --mpi= โ€” Lets you pass a section with MPI configuration within a special configuration file. Alternatively, you can use the MPICFG environment variable.
  • --mpicc= โ€” Specify the path or name of the mpicc C compiler wrapper. Alternatively, use the MPICC environment variable.
  • --mpild= โ€” Specify the full path or name for the MPI-aware C linker. Alternatively, use the MPILD environment variable. If not set, the mpicc C compiler wrapper is used for linking.
  • --configure โ€” Runs exhaustive tests for checking about missing MPI types, constants, and functions. This option should be passed in order to build MPI for Python against old MPI-1, MPI-2, or MPI-3 implementations, possibly providing a subset of MPI-4.

If you use a MPI implementation providing a mpicc C compiler wrapper (e.g., MPICH or Open MPI), it will be used for compilation and linking. This is the preferred and easiest way to build MPI for Python. ๐Ÿ‘‘

If mpicc is found in the executable search path (PATH environment variable), simply run the build command:

$ python setup.py build

If mpicc is not in your search path or the compiler wrapper has a different name, you can run the build command specifying its location, either via the --mpicc command option or using the MPICC environment variable:

$ python setup.py build --mpicc=/path/to/mpicc
$ env MPICC=/path/to/mpicc python setup.py build

Alternatively, you can provide all the relevant information about your MPI implementation by editing the mpi.cfg file located in the top level source directory. You can use the default section [mpi] or add a new custom section, for example [vendor_mpi] (see the examples provided in the mpi.cfg file as a starting point to write your own section):

[mpi]
include_dirs         = /usr/local/mpi/include
libraries            = mpi
library_dirs         = /usr/local/mpi/lib
runtime_library_dirs = /usr/local/mpi/lib

[vendor_mpi]
include_dirs         = /opt/mpi/include ...
libraries            = mpi ...
library_dirs         = /opt/mpi/lib ...
runtime_library_dirs = /opt/mpi/lib ...

...

and then run the build command specifying you custom configuration section:

$ python setup.py build --mpi=vendor_mpi
$ env MPICFG=vendor_mpi python setup.py build

๐Ÿ“ฆ Installing ๐Ÿ“ฆ

MPI for Python can be installed in editable mode:

$ python -m pip install --editable .

After modifying Cython sources, an in-place rebuild is needed:

$ python setup.py build --inplace

๐Ÿงช Testing ๐Ÿงช

To quickly test the installation:

$ mpiexec -n 5 python -m mpi4py.bench helloworld
Hello, World! I am process 0 of 5 on localhost.
Hello, World! I am process 1 of 5 on localhost.
Hello, World! I am process 2 of 5 on localhost.
Hello, World! I am process 3 of 5 on localhost.
Hello, World! I am process 4 of 5 on localhost.

$ mpiexec -n 5 python -m mpi4py.bench ringtest -l 10 -n 1048576
time for 10 loops = 0.00361614 seconds (5 processes, 1048576 bytes)

If you installed from a git clone or the source distribution, issuing at the command line:

$ mpiexec -n 5 python demo/helloworld.py

will launch a five-process run of the Python interpreter and run the demo script demo/helloworld.py from the source distribution. slay. ๐Ÿ’…

You can also run all the unittest scripts:

$ mpiexec -n 5 python test/main.py

or, if you have the pytest (<https://docs.pytest.org/>) unit testing framework installed:

$ mpiexec -n 5 pytest

๐Ÿ’… GUIDELINES ๐Ÿ’…

๐ŸŽ€ Fair play ๐ŸŽ€

Summary

This section defines Rules of Play for companies and outside developers that engage with the mpi4py project. It covers:

  • Restrictions on use of the mpi4py name.
  • How and whether to publish a modified distribution.
  • How to make us aware of patched versions.

After reading this section, companies and developers will know what kinds of behavior the mpi4py developers and contributors would like to see, and which we consider troublesome, bothersome, and unacceptable.

This document is a close adaptation of NumPy NEP 36 (<https://numpy.org/neps/nep-0036-fair-play.html>).

Motivation

Occasionally, we learn of modified mpi4py versions and binary distributions circulated by outsiders. These patched versions can cause problems to mpi4py users (see, e.g., mpi4py/mpi4py#508 โ€” <https://github.com/mpi4py/mpi4py/issues/508>). When issues like these arise, our developers waste time identifying the problematic release, locating alterations, and determining an appropriate course of action. ๐Ÿ˜ญ

In addition, packages on the Python Packaging Index are sometimes named such that users assume they are sanctioned or maintained by the mpi4py developers. We wish to reduce the number of such incidents.

Scope

This document aims to define a minimal set of rules that, when followed, will be considered good-faith efforts in line with the expectations of the mpi4py developers and contributors.

Our hope is that companies and outside developers who feel they need to modify mpi4py will first consider contributing to the project, or use alternative mechanisms for patching and extending mpi4py.

When in doubt, please talk to us first (<https://github.com/mpi4py/mpi4py/discussions/>). We may suggest an alternative; at minimum, we'll be informed and we may even grant an exception if deemed appropriate. ๐Ÿซถ

โœจ Fair play rules โœจ

  1. Do not reuse the mpi4py name for projects not affiliated with the mpi4py project.

At time of writing, there are only a handful of mpi4py-named packages developed by the mpi4py project, including mpi4py and mpi4py-fft. We ask that outside packages not include the phrase mpi4py, i.e., avoid names such as mycompany-mpi4py or mpi4py-mycompany.

To be clear, this rule only applies to modules (package names); it is perfectly acceptable to have a submodule of your own package named mycompany.mpi4py.

  1. Do not publish binary mpi4py wheels on PyPI (<https://pypi.org/>).

We ask companies and outside developers to not publish binary mpi4py wheels in the main Python Package Index (<https://pypi.org/>) under names such mpi4py-mpich, mpi4py-openmpi, or mpi4py-vendor_mpi.

The usual approaches to build binary Python wheels involve the embedding of dependent shared libraries. While such an approach may seem convenient and often is, in the particular case of MPI and mpi4py it is ultimately harmful to end users. Embedding the MPI shared libraries would prevent the use of external, system-provided MPI installations with hardware-specific optimizations and site-specific tweaks. ๐Ÿ’€

The MPI 5.0 standard features an Application Binary Interface (ABI) for MPI, see [mpi-abi-paper] and [mpi-abi-issue]. Such standardization allows for any binary dependent on the MPI library to be used with multiple MPI backends. Once MPI implementations provide support for the new MPI ABI, the mpi4py project will follow and add support to the binary wheels published on PyPI. ๐ŸŒˆ

[mpi-abi-paper] : J. Hammond, L. Dalcin, E. Schnetter, M. Pรฉrache, J. B. Besnard, J. Brown, G. Brito Gadeschi, S. Byrne, J. Schuchart, and H. Zhou. MPI Application Binary Interface Standardization. EuroMPI 2023, Bristol, UK, September 2023. <https://doi.org/10.1145/3615318.3615319>

[mpi-abi-issue] : MPI Forum GitHub Issue: MPI needs a standard ABI. <https://github.com/mpi-forum/mpi-issues/issues/751>

  1. Do not republish modified versions of mpi4py.

Modified versions of mpi4py make it very difficult for the developers to address bug reports, since we typically do not know which parts of mpi4py have been modified.

If you have to break this rule (and we implore you not to!), then make it clear in the __version__ tag that you have modified mpi4py, e.g.:

>>> print(mpi4py.__version__)
'4.0.0+mycompany.13`

We understand that minor patches are often required to make a library work inside of a package ecosystem. This is totally acceptable, but we ask that no substantive changes are made.

  1. Do not extend or modify mpi4py's API.

If you absolutely have to break the previous rule, please do not add additional functions to the namespace, or modify the API of existing functions. Having additional functions exposed in distributed versions is confusing for users and developers alike. ๐Ÿ™ˆ

๐Ÿ’– LICENSE ๐Ÿ’–

okay so before anyone panics, here's the whole legal situation, and yes it's giving โœจofficialโœจ but it's also very chill, don't worry ๐Ÿซถ

Copyright (c) 2025, Lisandro Dalcin โ€” that's the whole copyright line, bestie, keep it sacred ๐Ÿ‘‘

Here's the actual license text, verbatim, because legal stuff is the one thing you do NOT paraphrase, fr fr:

Copyright (c) 2025, Lisandro Dalcin

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

1. Redistributions of source code must retain the above copyright
   notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright
   notice, this list of conditions and the following disclaimer in the
   documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
   contributors may be used to endorse or promote products derived from
   this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS โ€œAS
ISโ€ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

so what does all that actually mean in human words? let me translate ๐Ÿ’…

  1. if you hand out the source code, you have to keep the copyright notice, the conditions list, and the disclaimer in there. no deleting receipts.
  2. if you hand out a compiled binary, same deal โ€” the copyright notice, conditions, and disclaimer gotta show up in the docs and/or other materials that ship with it.
  3. you cannot use the copyright holder's name or the contributors' names to endorse or promote stuff built from this software without asking first. no clout-leeching, periodt.

and the big all-caps bit? that's the classic "no warranties" scream ๐Ÿ—ฃ๏ธ โ€” the software comes โ€œAS ISโ€, no express or implied warranty of any kind (including merchantability or fitness for a particular purpose), and nobody's liable for any direct, indirect, incidental, special, exemplary, or consequential damages โ€” including procurement of substitute goods or services, loss of use, data, or profits, or business interruption โ€” no matter the theory of liability (contract, strict liability, or tort, including negligence or otherwise) that arises out of using this software, even if they were told it might happen. it's giving standard open-source protective energy, lowkey iconic ๐ŸŒˆ


๐Ÿ“œ CHANGES ๐Ÿ“œ

the lore. the timeline. the glow-up history. buckle up bestie, we're going chronologically backwards ๐Ÿ’–

Release 4.1.1 [2025-10-10]

  • Add MPIABI-aware import hook support. โœจ
  • Support MPI.ERR_ERRHANDLER <#mpi4py.MPI.ERR_ERRHANDLER> with Open MPI.
  • Fix Windows build issues with Intel MPI 2021.16. ๐ŸชŸ
  • Minor fixes and improvements to typing stubs.
  • Minor fixes to documentation.
  • Publish Python 3.8-3.14 and PyPy 3.11 wheels. ๐Ÿ›ž
  • PyPy 3.10 (EOL) wheels are no longer published. rest in peace ๐Ÿ’€

Release 4.1.0 [2025-06-25]

New features

  • Publish binary wheel packages on PyPI <https://pypi.org/project/mpi4py/#files> with support for multiple operating systems (Linux, macOS, Windows), processor architectures (AMD64, ARM64), MPI implementations (MPICH, Open MPI, and their ABI-compatible derivatives), and Python implementations (CPython, PyPy). likeโ€ฆ the sheer coverage?? obsessed ๐Ÿ‘‘
  • Add support for the MPI 5.0 standard.
    • MPI handle serialization with integral values.
    • Fixed-size Fortran LOGICAL datatypes.
    • Query ABI version/info and Fortran ABI info.
  • MPI.Datatype.Create_contiguous <#mpi4py.MPI.Datatype.Create_contiguous> now uses BigMPI <https://doi.org/10.1109/ExaMPI.2014.5>'s approach when using MPI implementations that do not yet support the MPI 4.0 large-count APIs.
  • Add support for MPI.FLOAT16_T <#mpi4py.MPI.FLOAT16_T> and MPI.BFLOAT16_T <#mpi4py.MPI.BFLOAT16_T> datatypes. These datatypes are not yet standard but available as extensions in MPI implementations. ๐Ÿงš
  • Add MPI.Status.tomemory <#mpi4py.MPI.Status.tomemory> to expose the status contents as a memoryview <https://docs.python.org/3/library/stdtypes.html#memoryview> object.

Enhancements

  • Support (opt-in via MPI4PY_BUILD_PYSABI <#envvar-MPI4PY_BUILD_PYSABI>) for building with Py_LIMITED_API <https://docs.python.org/3/c-api/stable.html#c.Py_LIMITED_API> under Python 3.10+ (requires Cython 3.1+).
  • Support (opt-in via MPI4PY_BUILD_MPIABI <#envvar-MPI4PY_BUILD_MPIABI>) for building with the MPI 5.0 standard ABI and the MPICH or Open MPI legacy ABIs. The MPI <#module-mpi4py.MPI> extension module will be able to dynamically link at runtime with older versions (down to the MPI 3.0 standard) of the MPI implementation used at compile time. Only available on Linux, macOS, and Windows. ๐Ÿ”ฅ
  • Support a buffersize parameter in the MPIPoolExecutor.map() <#mpi4py.futures.MPIPoolExecutor.map> and MPIPoolExecutor.starmap() <#mpi4py.futures.MPIPoolExecutor.starmap> methods to limit the number of pending tasks.
  • Improve ownership management of DLPack capsules.
  • Reimplement MPI DLL search path on Windows.
  • Minor fixes to typing stubs and documentation.

Backward-incompatible changes

โš ๏ธ heads up bestie, these will absolutely bite your old code, read carefully
  • Python 3.8+ is required. ๐Ÿ“ˆ
  • The MPI.Exception <#mpi4py.MPI.Exception> class is now a heap type.
  • The types of the MPI.BOTTOM <#mpi4py.MPI.BOTTOM>, MPI.IN_PLACE <#mpi4py.MPI.IN_PLACE>, and MPI.BUFFER_AUTOMATIC <#mpi4py.MPI.BUFFER_AUTOMATIC> are no longer subclasses of int <https://docs.python.org/3/library/functions.html#int>. yeah. that one. ๐Ÿ˜ญ

Release 4.0.3 [2025-02-13]

  • Fix DLPack v1.0 support. ๐Ÿฉน

Release 4.0.2 [2025-02-01]

  • Support MPI-4 features within Intel MPI 2021.14.
  • Various fixes and updates to tests.
  • Minor fixes to typing support.
  • Minor fix to documentation.

Release 4.0.1 [2024-10-11]

  • Update support for Python 3.13:
    • Enable Cython 3.1 support for free-threaded CPython. ๐Ÿงต
    • Allow compiling Cython-generated C sources with the full Python C-API.
    • Fix MPI DLL path workarounds on Windows after changes to locals().
  • Enhancements to test suite:
    • Support XML reports via unittest-xml-reporting.
    • Add command line options to exclude tests by patterns and files.
    • Refactor Python 2 code to use Python 3 constructs using pyupgrade.
  • Miscellaneous:
    • Minor and mostly inconsequential subclass fix in mpi4py.util.pkl5.
    • Update compatibility workarounds for legacy MPICH 3.0 release.

Release 4.0.0 [2024-07-28]

New features

  • Add support for the MPI-4.0 standard.
    • Use large count MPI-4 routines.
    • Add persistent collective communication.
    • Add partitioned point-to-point communication.
    • Add new communicator constructors.
    • Add the Session class and its methods.
  • Add support for the MPI-4.1 standard.
    • Add non-destructive completion test for multiple requests.
    • Add value-index datatype constructor.
    • Add communicator/session buffer attach/detach/flush.
    • Support for removal of error classes/codes/strings.
    • Support for querying hardware resource information.
  • Add preliminary support for the upcoming MPI-5.0 standard.
    • User-level failure mitigation (ULFM). ๐Ÿ’€โžก๏ธโœจ
  • mpi4py.util.pool: New drop-in replacement for multiprocessing.pool.
  • mpi4py.util.sync: New synchronization utilities.
  • Add runtime check for mismatch between mpiexec and MPI library. ๐Ÿ•ต๏ธ
  • Support scikit-build-core <https://scikit-build.readthedocs.io/> as an alternative build backend.
  • Support meson-python <https://meson-python.readthedocs.io/> as an alternative build backend.

Enhancements

  • mpi4py.futures: Support for parallel tasks.
  • mpi4py.futures: Report exception tracebacks in workers.
  • mpi4py.util.pkl5: Add support for collective communication.
  • Add methods Datatype.fromcode(), Datatype.tocode() and attributes Datatype.typestr, Datatype.typechar to simplify NumPy interoperability for simple cases.
  • Add methods Comm.Create_errhandler(), Win.Create_errhandler(), and File.Create_errhandler() to create custom error handlers.
  • Add support for pickle serialization of instances of MPI types. All instances of Datatype, Info, and Status can be serialized. Instances of Op can be serialized only if created through mpi4py by calling Op.Create(). Instances of other MPI types can be serialized only if they reference predefined handles.
  • Add handle attribute and fromhandle() class method to MPI classes to ease interoperability with external code. The handle value is an unsigned integer guaranteed to fit on the platform's uintptr_t C type.
  • Add lowercase free() method to MPI classes to ease MPI object deallocation and cleanup. This method eventually attempts to call Free(), but only if the object's MPI handle is not a null or predefined handle, and such call is allowed within the World Model init/finalize. ๐Ÿงน

Backward-incompatible changes

โš ๏ธ this is the big one, the era shift, the before-and-after
  • Python 2 is no longer supported, Python 3.6+ is required, but typing stubs are supported for Python 3.8+. ๐Ÿ‘‹ bye python 2
  • The Intracomm.Create_group() method is no longer defined in the base Comm class.
  • Group.Compare() and Comm.Compare() are no longer class methods but instance methods. Existing codes using the former class methods are expected to continue working.
  • Group.Translate_ranks() is no longer a class method but an instance method. Existing codes using the former class method are expected to continue working.
  • The LB and UB datatypes are no longer available, use Datatype.Create_resized() instead.
  • The HOST predefined attribute key is no longer available.
  • The MPI.memory class has been renamed to MPI.buffer. The old name is still available as an alias to the new name. ๐Ÿ’…
  • The mpi4py.dl module is no longer available.
  • The mpi4py.get_config function returns an empty dictionary.

Miscellaneous

  • The project is now licensed under the BSD-3-Clause license. This change is fairly inconsequential for users and distributors. It simply adds an additional clause against using contributor names for promotional purposes without their consent.
  • Add a new guidelines section to documentation laying out new fair play rules. These rules ask companies and outside developers to refrain from reusing the mpi4py name in unaffiliated projects, publishing binary mpi4py wheels on the main Python Package Index (PyPI), and distributing modified versions with incompatible or extended API changes. The primary motivation of these rules is to avoid fragmentation and end-user confusion. ๐Ÿซถ

Release 3.1.6 [2024-04-14]

โš ๏ธ This is the last release supporting Python 2.
  • Fix various build issues. ๐Ÿ”ง

Release 3.1.5 [2023-10-04]

โš ๏ธ This is the last release supporting Python 2.
  • Rebuild C sources with Cython 0.29.36 to support Python 3.12.

Release 3.1.4 [2022-11-02]

โš ๏ธ This is the last release supporting Python 2.
  • Rebuild C sources with Cython 0.29.32 to support Python 3.11.
  • Fix contiguity check for DLPack and CAI buffers.
  • Workaround build failures with setuptools v60.

Release 3.1.3 [2021-11-25]

โš ๏ธ This is the last release supporting Python 2.
  • Add missing support for MPI.BOTTOM to generalized all-to-all collectives.

Release 3.1.2 [2021-11-04]

โš ๏ธ This is the last release supporting Python 2.

  • mpi4py.futures: add a _max_workers property to MPIPoolExecutor. yes bestie, you can finally peek at it ๐Ÿ’…
  • mpi4py.util.dtlib: fix the computation of alignment for predefined datatypes.
  • mpi4py.util.pkl5: fix a deadlock when using ssend() + mprobe(). (not the fun kind of deadlock, there is no fun kind of deadlock ๐Ÿ˜ญ)
  • mpi4py.util.pkl5: add environment variable MPI4PY_PICKLE_THRESHOLD.
  • mpi4py.rc: interpret "y" and "n" strings as boolean values. slay, lowercase rights ๐Ÿซถ
  • Fix/add typemap/typestr for MPI.WCHAR/MPI.COUNT datatypes.
  • Minor fixes and additions to documentation.
  • Minor fixes to typing support.
  • Support for local version identifier (PEP-440).

๐ŸŽ€ Release 3.1.1 [2021-08-14]

Warning: This is the last release supporting Python 2. ๐Ÿซก pour one out
  • Fix typo in Requires-Python package metadata.
  • Regenerate C sources with Cython 0.29.24.

๐ŸŒธ Release 3.1.0 [2021-08-12]

Warning: This is the last release supporting Python 2. (yes, again, it's giving final-season energy ๐Ÿ’€)
  • New features:
    • mpi4py.util: a whole new package collecting miscellaneous utilities. it's giving โœจutility drawerโœจ
  • Enhancements:
    • Add pickle-based Request.waitsome() and Request.testsome().
    • Add lowercase methods Request.get_status() and Request.cancel().
    • Support for passing Python GPU arrays compliant with the DLPack <https://github.com/dmlc/dlpack> data interchange mechanism (link <https://data-apis.org/array-api/latest/design_topics/data_interchange.html>) and the __cuda_array_interface__ (CAI) standard (link <https://numba.readthedocs.io/en/stable/cuda/cuda_array_interface.html>) to uppercase methods. This support requires that mpi4py is built against CUDA-aware MPI <https://developer.nvidia.com/blog/introduction-cuda-aware-mpi/> implementations. This feature is currently experimental and subject to future changes. โš ๏ธ experimental means experimental, bestie, don't build your whole thesis on it
    • mpi4py.futures: add support for initializers and canceling futures at shutdown. Environment variables names now follow the pattern MPI4PY_FUTURES_*, the previous MPI4PY_* names are deprecated. (deprecated = still works, still judging you ๐Ÿ’…)
    • Add type annotations to Cython code. The first line of the docstring of functions and methods displays a signature including type annotations.
    • Add companion stub files to support type checkers. your IDE is gonna be so normal about this fr fr
    • Support for weak references.
  • Miscellaneous:

๐Ÿฆ‹ Release 3.0.3 [2019-11-04]

  • Regenerate Cython wrappers to support Python 3.8.

โญ Release 3.0.2 [2019-06-11]

  • Bug fixes:
    • Fix handling of readonly buffers in support for Python 2 legacy buffer interface. The issue triggers only when using a buffer-like object that is readonly and does not export the new Python 3 buffer interface.
    • Fix build issues with Open MPI 4.0.x series related to removal of many MPI-1 symbols deprecated in MPI-2 and removed in MPI-3.
    • Minor documentation fixes.

๐Ÿ’œ Release 3.0.1 [2019-02-15]

  • Bug fixes:
    • Fix Comm.scatter() and other collectives corrupting input send list. Add safety measures to prevent related issues in global reduction operations. (your input list said not today ๐Ÿ™ˆ)
    • Fix error-checking code for counts in Op.Reduce_local().
  • Enhancements:
    • Map size-specific Python/NumPy typecodes to MPI datatypes.
    • Allow partial specification of target list/tuple arguments in the various Win RMA methods.
    • Workaround for removal of MPI_{LB|UB} in Open MPI 4.0.
    • Support for Microsoft MPI v10.0.

๐Ÿ“ Release 3.0.0 [2017-11-08]

  • New features:
    • mpi4py.futures: execute computations asynchronously using a pool of MPI processes. This package is based on concurrent.futures from the Python standard library.
    • mpi4py.run: run Python code and abort execution in case of unhandled exceptions to prevent deadlocks.
    • mpi4py.bench: run basic MPI benchmarks and tests.
  • Enhancements:
    • Lowercase, pickle-based collective communication calls are now thread-safe through the use of fine-grained locking. ๐Ÿ”’
    • The MPI module now exposes a memory type which is a lightweight variant of the builtin memoryview type, but exposes both the legacy Python 2 and the modern Python 3 buffer interface under a Python 2 runtime.
    • The MPI.Comm.Alltoallw() method now uses count=1 and displ=0 as defaults, assuming that messages are specified through user-defined datatypes.
    • The Request.Wait[all]() methods now return True to match the interface of Request.Test[all]().
    • The Win class now implements the Python buffer interface.
  • Backward-incompatible changes:
    • The buf argument of the MPI.Comm.recv() method is deprecated, passing anything but None emits a warning.
    • The MPI.Win.memory property was removed, use the MPI.Win.tomemory() method instead.
    • Executing python -m mpi4py in the command line is now equivalent to python -m mpi4py.run. For the former behavior, use python -m mpi4py.bench.
    • Python 2.6 and 3.2 are no longer supported. The mpi4py.MPI module may still build and partially work, but other pure-Python modules under the mpi4py namespace will not.
    • Windows: remove support for legacy MPICH2, Open MPI, and DeinoMPI.

๐Ÿงš Release 2.0.0 [2015-10-18]

  • Support for MPI-3 features.
    • Matched probes and receives.
    • Nonblocking collectives.
    • Neighborhood collectives.
    • New communicator constructors.
    • Request-based RMA operations.
    • New RMA communication and synchronisation calls.
    • New window constructors.
    • New datatype constructor.
    • New C++ boolean and floating complex datatypes.
  • Support for MPI-2 features not included in previous releases.
    • Generalized All-to-All collective (Comm.Alltoallw())
    • User-defined data representations (Register_datarep())
  • New scalable implementation of reduction operations for Python objects. This code is based on binomial tree algorithms using point-to-point communication and duplicated communicator contexts. To disable this feature, use mpi4py.rc.fast_reduce = False.
  • Backward-incompatible changes:
    • Python 2.4, 2.5, 3.0 and 3.1 are no longer supported.
    • Default MPI error handling policies are overridden. After import, mpi4py sets the ERRORS_RETURN error handler in COMM_SELF and COMM_WORLD, as well as any new Comm, Win, or File instance created through mpi4py, thus effectively ignoring the MPI rules about error handler inheritance. This way, MPI errors translate to Python exceptions. To disable this behavior and use the standard MPI error handling rules, use mpi4py.rc.errors = 'default'.
    • Change signature of all send methods, dest is a required argument.
    • Change signature of all receive and probe methods, source defaults to ANY_SOURCE, tag defaults to ANY_TAG.
    • Change signature of send lowercase-spelling methods, obj arguments are not mandatory.
    • Change signature of recv lowercase-spelling methods, renamed 'obj' arguments to 'buf'.
    • Change Request.Waitsome() and Request.Testsome() to return None or list.
    • Change signature of all lowercase-spelling collectives, sendobj arguments are now mandatory, recvobj arguments were removed.
    • Reduction operations MAXLOC and MINLOC are no longer special-cased in lowercase-spelling methods Comm.[all]reduce() and Comm.[ex]scan(), the input object must be specified as a tuple (obj, location).
    • Change signature of name publishing functions. The new signatures are Publish_name(service_name, port_name, info=INFO_NULL) and Unpublish_name(service_name, port_name, info=INFO_NULL).
    • Win instances now cache Python objects exposing memory by keeping references instead of using MPI attribute caching.
    • Change signature of Win.Lock(). The new signature is Win.Lock(rank, lock_type=LOCK_EXCLUSIVE, assertion=0).
    • Move Cartcomm.Map() to Intracomm.Cart_map().
    • Move Graphcomm.Map() to Intracomm.Graph_map().
    • Remove the mpi4py.MPE module.
    • Rename the Cython definition file for use with cimport statement from mpi_c.pxd to libmpi.pxd.

๐ŸŒˆ Release 1.3.1 [2013-08-07]

  • Regenerate C wrappers with Cython 0.19.1 to support Python 3.3.
  • Install *.pxd files in <site-packages>/mpi4py to ease the support for Cython's cimport statement in code requiring to access mpi4py internals.
  • As a side-effect of using Cython 0.19.1, ancient Python 2.3 is no longer supported. If you really need it, you can install an older Cython and run python setup.py build_src --force.

๐Ÿ’– Release 1.3 [2012-01-20]

  • Now Comm.recv() accept a buffer to receive the message.
  • Add Comm.irecv() and Request.{wait|test}[any|all]().
  • Add Intracomm.Spawn_multiple().
  • Better buffer handling for PEP 3118 and legacy buffer interfaces.
  • Add support for attribute attribute caching on communicators, datatypes and windows.
  • Install MPI-enabled Python interpreter as <path>/mpi4py/bin/python-mpi.
  • Windows: support for building with Open MPI.

๐ŸŽ€ Release 1.2.2 [2010-09-13]

  • Add mpi4py.get_config() to retrieve information (compiler wrappers, includes, libraries, etc) about the MPI implementation employed to build mpi4py.
  • Workaround Python libraries with missing GILState-related API calls in case of non-threaded Python builds.
  • Windows: look for MPICH2, DeinoMPI, Microsoft HPC Pack at their default install locations under %ProgramFiles.
  • MPE: fix hacks related to old API's, these hacks are broken when MPE is built with a MPI implementations other than MPICH2.
  • HP-MPI: fix for missing Fortran datatypes, use dlopen() to load the MPI shared library before MPI_Init()
  • Many distutils-related fixes, cleanup, and enhancements, better logics to find MPI compiler wrappers.
  • Support for pip install mpi4py.

๐Ÿซถ Release 1.2.1 [2010-02-26]

  • Fix declaration in Cython include file. This declaration, while valid for Cython, broke the simple-minded parsing used in conf/mpidistutils.py to implement configure-tests for availability of MPI symbols.
  • Update SWIG support and make it compatible with Python 3. Also generate an warning for SWIG < 1.3.28.
  • Fix distutils-related issues in Mac OS X. Now ARCHFLAGS environment variable is honored of all Python's config/Makefile variables.
  • Fix issues with Open MPI < 1.4.2 related to error checking and MPI_XXX_NULL handles.

Release 1.2 [2009-12-29] ๐ŸŽ€

  • Automatic MPI datatype discovery for NumPy arrays and PEP-3118 buffers. So now buffer-like objects can be messaged directly โ€” you don't have to spell out a 2/3-list/tuple like [data, MPI.DOUBLE] or [data, count, MPI.DOUBLE] anymore. Only basic types get this treatment tho: all C/C99-native signed/unsigned integral types, plus single/double precision real/complex floating types. Massive thanks to Eilif Muller for the initial feedback ๐Ÿ’–
  • Nonblocking send of pickled Python objects. Huge thanks to Andreas Kloeckner for the initial patch and the genuinely enlightening discussion about this glow-up ๐Ÿ™Œ
  • Request instances now hold a reference to the Python object exposing the buffer involved in point-to-point communication or parallel I/O. Again, ty Andreas Kloeckner for the initial feedback โœจ
  • Support for logging of user-defined states and events using MPE <https://www.mcs.anl.gov/research/projects/perfvis/>. Runtime (like, without requiring a recompile!) activation of logging of all MPI calls is supported on POSIX platforms implementing dlopen(). Obsessed ๐Ÿซถ
  • Support for all the new features in MPI-2.2: new C99 and F90 datatypes, distributed graph topology, local reduction operation, and other minor enhancements. Periodt ๐Ÿ’…
  • Fix for the annoying issues related to Open MPI and Python dynamic loading of extension modules on platforms supporting dlopen(). finally ๐Ÿ˜ญ
  • Fix for SLURM dynamic loading issues on SiCortex. Many thanks to Ian Langmore for providing me shell access ๐Ÿš

Release 1.1.0 [2009-06-06] ๐Ÿฆ‹

  • Fix bug in Comm.Iprobe() that caused segfaults, because Python C-API calls were being issued with the GIL released (issue #2). not the segfault bestie ๐Ÿ’€
  • Add Comm.bsend() and Comm.ssend() for buffered and synchronous send semantics when communicating general Python objects.
  • Now the call Info.Get(key) returns a single value (like, instead of a 2-tuple). That value is None if key is not in the Info object, or a string otherwise. Previously the call redundantly returned (None, False) for missing key-value pairs โ€” None is enough to signal a missing entry, we don't need the extra drama.
  • Add support for parametrized Fortran datatypes โœจ
  • Add support for decoding user-defined datatypes.
  • Add support for user-defined reduction operations on memory buffers. However, at most 16 user-defined reduction operations can be created. Ask the author for more room if you need it ๐Ÿ‘€

Release 1.0.0 [2009-03-20] ๐Ÿ‘‘

This is the first release of the all-new, Cython-based implementation of MPI for Python. Unfortunately, this implementation is not backward-compatible with the previous one ๐Ÿ˜ญ. The list below summarizes the more important changes that can impact user codes.

  • Some communication calls had overloaded functionality. Now there's a clear distinction between communication of general Python objects with pickle, and (fast, near C-speed) communication of buffer-like objects (e.g., NumPy arrays).
    • for communicating general Python objects, you have to use all-lowercase methods, like send(), recv(), bcast(), etc.
    • for communicating array data, you have to use Send(), Recv(), Bcast(), etc. methods. Buffer arguments to these calls must be explicitly specified by using a 2/3-list/tuple like [data, MPI.DOUBLE], or [data, count, MPI.DOUBLE] (the former one uses the byte-size of data and the extent of the MPI datatype to define the count).
  • Indexing a communicator with an integer returned a special object associating the communication with a target rank, alleviating you from specifying source/destination/root arguments in point-to-point and collective communications. This functionality is no longer available, so expressions like:
MPI.COMM_WORLD[0].Send(...)
MPI.COMM_WORLD[0].Recv(...)
MPI.COMM_WORLD[0].Bcast(...)

have to be replaced by:

MPI.COMM_WORLD.Send(..., dest=0)
MPI.COMM_WORLD.Recv(..., source=0)
MPI.COMM_WORLD.Bcast(..., root=0)
  • Automatic MPI initialization (i.e., at import time) requests the maximum level of MPI thread support (i.e., it is done by calling MPI_Init_thread() and passing MPI_THREAD_MULTIPLE). In case you need to change this behavior, you can tweak the contents of the mpi4py.rc module.
  • In order to obtain the values of predefined attributes attached to the world communicator, now you have to use the Get_attr() method on the MPI.COMM_WORLD instance:
tag_ub = MPI.COMM_WORLD.Get_attr(MPI.TAG_UB)
  • In the previous implementation, MPI.COMM_WORLD and MPI.COMM_SELF were associated to duplicates of the (C-level) MPI_COMM_WORLD and MPI_COMM_SELF predefined communicator handles. Now this is no longer the case โ€” MPI.COMM_WORLD and MPI.COMM_SELF proxy the actual MPI_COMM_WORLD and MPI_COMM_SELF handles. glow-up fr fr โœจ
  • Convenience aliases MPI.WORLD and MPI.SELF were removed. Use instead MPI.COMM_WORLD and MPI.COMM_SELF.
  • Convenience constants MPI.WORLD_SIZE and MPI.WORLD_RANK were removed. Use instead MPI.COMM_WORLD.Get_size() and MPI.COMM_WORLD.Get_rank().

Author ๐ŸŒˆ

Lisandro Dalcin

2026, Lisandro Dalcin


and that's a wrap on the whole page bestie!! ๐ŸŽ‰ this was Release 4.1, dated March 20, 2026 โ€” that's the version and date stamped at the bottom of the manual page (MPI4PY(3)), and yes I'm putting it in the sign-off instead of copying the footer line, because we're cute like that ๐Ÿ’…๐ŸŒธ go forth and parallelize, you absolute icon ๐Ÿซถโœจ

๐Ÿ“ฆ where this page comes from