MPI Module
Contents
MPI Module
MPI Module Overview
The HIPP::MPI module includes high-level OOP APIs that encapsulates Standard Message Passing Interface
(MPI) library.
It also provides non-standard extensions of MPI, which are useful in synchronization, task management and
task distribution, etc.
Although the high-level APIs are always preferred to use, sometimes, user may need to go back to the oringinal MPI calls, possibly due to the demands of better performance or more flexible and detailed control of the communication behavior. The intermediate-level APIs, which is only semi-OOP, therefore provide convient tools for this purpose.
All the definitions in the MPI module can be accessed by including the header file <hippmpi.h>.
Classes, functions and variables are all defined within the HIPP::MPI namespace.
Code that uses the MPI module would be like
/* src.cpp */
#include <hippmpi.h> // include all definitions in HIPP MPI
int main(int argc, char const *argv[]){
HIPP::MPI::Env env; // initialize the MPI environment
auto world = env.world(); // the communication world object
// use HIPP MPI to make communications
}
To generate the executable binary, the links to “libhippmpi.so” and “libhippcntl.so” are necessary. The compiling command in an Unix-like system would be like
$ mpicxx -std=c++17 src.cpp -lhippmpi -lhippcntl
To avoid confusion, we list the conventions used in this API reference:
The term Standard means the MPI standard APIs (types, functions, variables, macros, etc.) defined by the MPI Forum . E.g. The Standard call
MPI_Init()is the entrance of (almost) all Standard MPI applications.The HIPP MPI library has three components: the High-level API, the MPI Extensions and the Intermediate-level API (see below for the detail API references of each component). Therefore, when we say “high-level” class communicator, we mean the class
HIPP::MPI::Commin the high-level API, and when we say “extension” class Mutex, we mean the classHIPP::MPI::Mutexin the extension API.The documentation text of one definition would probably refer to other definitions. If they are in the same namespace (
HIPP::MPIhere), we drop the namespace specifiers for clarity (e.g., classCommmeans classHIPP::MPI::Comm).The example code that uses C++ standard library may ignore the
std::namespace specifier (namely, assume a globalusing namespace stdis used). This is not good in practice, but makes the example code more compact.
List of Module Components
All functions and classes avaiable in the HIPP MPI module is listed below. The “Standard MPI counterpart” gives the MPI type defined by the MPI standard on the top of which HIPP is built.
Functions / Classes |
Standard MPI counterpart |
Details |
|---|---|---|
MPI environment manager. |
||
Exception that is thrown on the MPI-related error. |
||
|
Communicator. |
|
|
Process group. |
|
|
Handler for non-blocking commnications. |
|
|
Return status of commnications. |
|
|
Data type which describes the data layout and representation. |
|
Data buffer descriptor. |
||
Buffers for packing/unpacking operations. |
||
Buffers for canonical packing/unpacking operations. |
||
|
Reduction operation on data item. |
|
Operation descriptor. |
||
|
One-side commnication window. |
|
|
Parallel IO handler. |
|
|
Message object returned by probing operation. |
|
|
Hints to the implementation. |
|
Spin locks for synchronization. |
||
Mutual exclusion locks for synchronization. |
||
Defining operations to be sequentially executed on processes. |
||
Work decomposition functions. |
||
|
Memory allocation. |
|
|
Memory deallocation. |
|
|
Buffer attachment for buffer sending mode. |
|
|
Buffer detachment for buffer sending mode. |
|
|
Clock. |
|
|
Clock interval. |
API References
High-level API
MPI Extensions
Intermediate-level API
References
- MPIForum-STDv31
Message Passing Interface Forum, MPI: A Message Passing Interface Standard (version 3.1).
- GroppW-UMPIv3
William Gropp, Ewing Lusk, and Anthony Skjellum, Using MPI - Portable Parallel Programming with the Message-Passing Interface (3ed).
- GroppW-UAMPI
William Gropp, Torsten Hoefler, Rajeev Thakur, Ewing Lusk, Using Advanced MPI - Modern Features of the Message-Passing Interface.
- DuZH-MPIv2001
Zhihui Du, 高性能计算之并行编程技术 - MPI并行程序设计 (2001年版).