- •Contents
- •List of Figures
- •List of Tables
- •Acknowledgments
- •Introduction to MPI
- •Overview and Goals
- •Background of MPI-1.0
- •Background of MPI-1.1, MPI-1.2, and MPI-2.0
- •Background of MPI-1.3 and MPI-2.1
- •Background of MPI-2.2
- •Who Should Use This Standard?
- •What Platforms Are Targets For Implementation?
- •What Is Included In The Standard?
- •What Is Not Included In The Standard?
- •Organization of this Document
- •MPI Terms and Conventions
- •Document Notation
- •Naming Conventions
- •Semantic Terms
- •Data Types
- •Opaque Objects
- •Array Arguments
- •State
- •Named Constants
- •Choice
- •Addresses
- •Language Binding
- •Deprecated Names and Functions
- •Fortran Binding Issues
- •C Binding Issues
- •C++ Binding Issues
- •Functions and Macros
- •Processes
- •Error Handling
- •Implementation Issues
- •Independence of Basic Runtime Routines
- •Interaction with Signals
- •Examples
- •Point-to-Point Communication
- •Introduction
- •Blocking Send and Receive Operations
- •Blocking Send
- •Message Data
- •Message Envelope
- •Blocking Receive
- •Return Status
- •Passing MPI_STATUS_IGNORE for Status
- •Data Type Matching and Data Conversion
- •Type Matching Rules
- •Type MPI_CHARACTER
- •Data Conversion
- •Communication Modes
- •Semantics of Point-to-Point Communication
- •Buffer Allocation and Usage
- •Nonblocking Communication
- •Communication Request Objects
- •Communication Initiation
- •Communication Completion
- •Semantics of Nonblocking Communications
- •Multiple Completions
- •Non-destructive Test of status
- •Probe and Cancel
- •Persistent Communication Requests
- •Send-Receive
- •Null Processes
- •Datatypes
- •Derived Datatypes
- •Type Constructors with Explicit Addresses
- •Datatype Constructors
- •Subarray Datatype Constructor
- •Distributed Array Datatype Constructor
- •Address and Size Functions
- •Lower-Bound and Upper-Bound Markers
- •Extent and Bounds of Datatypes
- •True Extent of Datatypes
- •Commit and Free
- •Duplicating a Datatype
- •Use of General Datatypes in Communication
- •Correct Use of Addresses
- •Decoding a Datatype
- •Examples
- •Pack and Unpack
- •Canonical MPI_PACK and MPI_UNPACK
- •Collective Communication
- •Introduction and Overview
- •Communicator Argument
- •Applying Collective Operations to Intercommunicators
- •Barrier Synchronization
- •Broadcast
- •Example using MPI_BCAST
- •Gather
- •Examples using MPI_GATHER, MPI_GATHERV
- •Scatter
- •Examples using MPI_SCATTER, MPI_SCATTERV
- •Example using MPI_ALLGATHER
- •All-to-All Scatter/Gather
- •Global Reduction Operations
- •Reduce
- •Signed Characters and Reductions
- •MINLOC and MAXLOC
- •All-Reduce
- •Process-local reduction
- •Reduce-Scatter
- •MPI_REDUCE_SCATTER_BLOCK
- •MPI_REDUCE_SCATTER
- •Scan
- •Inclusive Scan
- •Exclusive Scan
- •Example using MPI_SCAN
- •Correctness
- •Introduction
- •Features Needed to Support Libraries
- •MPI's Support for Libraries
- •Basic Concepts
- •Groups
- •Contexts
- •Intra-Communicators
- •Group Management
- •Group Accessors
- •Group Constructors
- •Group Destructors
- •Communicator Management
- •Communicator Accessors
- •Communicator Constructors
- •Communicator Destructors
- •Motivating Examples
- •Current Practice #1
- •Current Practice #2
- •(Approximate) Current Practice #3
- •Example #4
- •Library Example #1
- •Library Example #2
- •Inter-Communication
- •Inter-communicator Accessors
- •Inter-communicator Operations
- •Inter-Communication Examples
- •Caching
- •Functionality
- •Communicators
- •Windows
- •Datatypes
- •Error Class for Invalid Keyval
- •Attributes Example
- •Naming Objects
- •Formalizing the Loosely Synchronous Model
- •Basic Statements
- •Models of Execution
- •Static communicator allocation
- •Dynamic communicator allocation
- •The General case
- •Process Topologies
- •Introduction
- •Virtual Topologies
- •Embedding in MPI
- •Overview of the Functions
- •Topology Constructors
- •Cartesian Constructor
- •Cartesian Convenience Function: MPI_DIMS_CREATE
- •General (Graph) Constructor
- •Distributed (Graph) Constructor
- •Topology Inquiry Functions
- •Cartesian Shift Coordinates
- •Partitioning of Cartesian structures
- •Low-Level Topology Functions
- •An Application Example
- •MPI Environmental Management
- •Implementation Information
- •Version Inquiries
- •Environmental Inquiries
- •Tag Values
- •Host Rank
- •IO Rank
- •Clock Synchronization
- •Memory Allocation
- •Error Handling
- •Error Handlers for Communicators
- •Error Handlers for Windows
- •Error Handlers for Files
- •Freeing Errorhandlers and Retrieving Error Strings
- •Error Codes and Classes
- •Error Classes, Error Codes, and Error Handlers
- •Timers and Synchronization
- •Startup
- •Allowing User Functions at Process Termination
- •Determining Whether MPI Has Finished
- •Portable MPI Process Startup
- •The Info Object
- •Process Creation and Management
- •Introduction
- •The Dynamic Process Model
- •Starting Processes
- •The Runtime Environment
- •Process Manager Interface
- •Processes in MPI
- •Starting Processes and Establishing Communication
- •Reserved Keys
- •Spawn Example
- •Manager-worker Example, Using MPI_COMM_SPAWN.
- •Establishing Communication
- •Names, Addresses, Ports, and All That
- •Server Routines
- •Client Routines
- •Name Publishing
- •Reserved Key Values
- •Client/Server Examples
- •Ocean/Atmosphere - Relies on Name Publishing
- •Simple Client-Server Example.
- •Other Functionality
- •Universe Size
- •Singleton MPI_INIT
- •MPI_APPNUM
- •Releasing Connections
- •Another Way to Establish MPI Communication
- •One-Sided Communications
- •Introduction
- •Initialization
- •Window Creation
- •Window Attributes
- •Communication Calls
- •Examples
- •Accumulate Functions
- •Synchronization Calls
- •Fence
- •General Active Target Synchronization
- •Lock
- •Assertions
- •Examples
- •Error Handling
- •Error Handlers
- •Error Classes
- •Semantics and Correctness
- •Atomicity
- •Progress
- •Registers and Compiler Optimizations
- •External Interfaces
- •Introduction
- •Generalized Requests
- •Examples
- •Associating Information with Status
- •MPI and Threads
- •General
- •Initialization
- •Introduction
- •File Manipulation
- •Opening a File
- •Closing a File
- •Deleting a File
- •Resizing a File
- •Preallocating Space for a File
- •Querying the Size of a File
- •Querying File Parameters
- •File Info
- •Reserved File Hints
- •File Views
- •Data Access
- •Data Access Routines
- •Positioning
- •Synchronism
- •Coordination
- •Data Access Conventions
- •Data Access with Individual File Pointers
- •Data Access with Shared File Pointers
- •Noncollective Operations
- •Collective Operations
- •Seek
- •Split Collective Data Access Routines
- •File Interoperability
- •Datatypes for File Interoperability
- •Extent Callback
- •Datarep Conversion Functions
- •Matching Data Representations
- •Consistency and Semantics
- •File Consistency
- •Random Access vs. Sequential Files
- •Progress
- •Collective File Operations
- •Type Matching
- •Logical vs. Physical File Layout
- •File Size
- •Examples
- •Asynchronous I/O
- •I/O Error Handling
- •I/O Error Classes
- •Examples
- •Subarray Filetype Constructor
- •Requirements
- •Discussion
- •Logic of the Design
- •Examples
- •MPI Library Implementation
- •Systems with Weak Symbols
- •Systems Without Weak Symbols
- •Complications
- •Multiple Counting
- •Linker Oddities
- •Multiple Levels of Interception
- •Deprecated Functions
- •Deprecated since MPI-2.0
- •Deprecated since MPI-2.2
- •Language Bindings
- •Overview
- •Design
- •C++ Classes for MPI
- •Class Member Functions for MPI
- •Semantics
- •C++ Datatypes
- •Communicators
- •Exceptions
- •Mixed-Language Operability
- •Problems With Fortran Bindings for MPI
- •Problems Due to Strong Typing
- •Problems Due to Data Copying and Sequence Association
- •Special Constants
- •Fortran 90 Derived Types
- •A Problem with Register Optimization
- •Basic Fortran Support
- •Extended Fortran Support
- •The mpi Module
- •No Type Mismatch Problems for Subroutines with Choice Arguments
- •Additional Support for Fortran Numeric Intrinsic Types
- •Language Interoperability
- •Introduction
- •Assumptions
- •Initialization
- •Transfer of Handles
- •Status
- •MPI Opaque Objects
- •Datatypes
- •Callback Functions
- •Error Handlers
- •Reduce Operations
- •Addresses
- •Attributes
- •Extra State
- •Constants
- •Interlanguage Communication
- •Language Bindings Summary
- •Groups, Contexts, Communicators, and Caching Fortran Bindings
- •External Interfaces C++ Bindings
- •Change-Log
- •Bibliography
- •Examples Index
- •MPI Declarations Index
- •MPI Function Index
Chapter 9
The Info Object
Many of the routines in MPI take an argument info. info is an opaque object with a handle of type MPI_Info in C, MPI::Info in C++, and INTEGER in Fortran. It stores an unordered set of (key,value) pairs (both key and value are strings). A key can have only one value. MPI reserves several keys and requires that if an implementation uses a reserved key, it must provide the speci ed functionality. An implementation is not required to support these keys and may support any others not reserved by MPI.
An implementation must support info objects as caches for arbitrary (key, value) pairs, regardless of whether it recognizes the key. Each function that takes hints in the form of an MPI_Info must be prepared to ignore any key it does not recognize. This description of info objects does not attempt to de ne how a particular function should react if it recognizes a key but not the associated value. MPI_INFO_GET_NKEYS, MPI_INFO_GET_NTHKEY,
MPI_INFO_GET_VALUELEN, and MPI_INFO_GET must retain all (key,value) pairs so that layered functionality can also use the Info object.
Keys have an implementation-de ned maximum length of MPI_MAX_INFO_KEY, which is at least 32 and at most 255. Values have an implementation-de ned maximum length of MPI_MAX_INFO_VAL. In Fortran, leading and trailing spaces are stripped from both. Returned values will never be larger than these maximum lengths. Both key and value are case sensitive.
Rationale. Keys have a maximum length because the set of known keys will always be nite and known to the implementation and because there is no reason for keys to be complex. The small maximum size allows applications to declare keys of size MPI_MAX_INFO_KEY. The limitation on value sizes is so that an implementation is not forced to deal with arbitrarily long strings. (End of rationale.)
Advice to users. MPI_MAX_INFO_VAL might be very large, so it might not be wise to declare a string of that size. (End of advice to users.)
When it is an argument to a nonblocking routine, info is parsed before that routine returns, so that it may be modi ed or freed immediately after return.
When the descriptions refer to a key or value as being a boolean, an integer, or a list, they mean the string representation of these types. An implementation may de ne its own rules for how info value strings are converted to other types, but to ensure portability, every implementation must support the following representations. Legal values for a boolean must include the strings \true" and \false" (all lowercase). For integers, legal values must include
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
299
300 |
CHAPTER 9. THE INFO OBJECT |
1string representations of decimal values of integers that are within the range of a standard
2integer type in the program. (However it is possible that not every legal integer is a legal
3value for a given key.) On positive numbers, + signs are optional. No space may appear
4between a + or sign and the leading digit of a number. For comma separated lists, the
5string must contain legal elements separated by commas. Leading and trailing spaces are
6stripped automatically from the types of info values described above and for each element of
7a comma separated list. These rules apply to all info values of these types. Implementations
8are free to specify a di erent interpretation for values of other info keys.
9
10 |
|
|
|
11 |
MPI_INFO_CREATE(info) |
|
|
12 |
OUT |
info |
info object created (handle) |
|
|||
13 |
|
|
|
14
int MPI_Info_create(MPI_Info *info)
15
16MPI_INFO_CREATE(INFO, IERROR)
17INTEGER INFO, IERROR
18
fstatic MPI::Info MPI::Info::Create() (binding deprecated, see Section 15.2) g
19
20MPI_INFO_CREATE creates a new info object. The newly created object contains no
21key/value pairs.
22
23
24
25
26
27
28
29
MPI_INFO_SET(info, key, value)
INOUT |
info |
info object (handle) |
IN |
key |
key (string) |
IN |
value |
value (string) |
30 int MPI_Info_set(MPI_Info info, char *key, char *value)
31
MPI_INFO_SET(INFO, KEY, VALUE, IERROR)
32
INTEGER INFO, IERROR
33
CHARACTER*(*) KEY, VALUE
34
35 fvoid MPI::Info::Set(const char* key, const char* value) (binding deprecated, see Section 15.2) g
MPI_INFO_SET adds the (key,value) pair to info, and overrides the value if a value for the same key was previously set. key and value are null-terminated strings in C. In Fortran, leading and trailing spaces in key and value are stripped. If either key or value are larger
40
than the allowed maximums, the errors MPI_ERR_INFO_KEY or MPI_ERR_INFO_VALUE are
41
raised, respectively.
42
43
44 |
MPI_INFO_DELETE(info, key) |
|
45
46
47
48
INOUT |
info |
info object (handle) |
IN |
key |
key (string) |
301
int MPI_Info_delete(MPI_Info info, char *key)
MPI_INFO_DELETE(INFO, KEY, IERROR)
INTEGER INFO, IERROR
CHARACTER*(*) KEY
fvoid MPI::Info::Delete(const char* key) (binding deprecated, see Section 15.2) g
MPI_INFO_DELETE deletes a (key,value) pair from info. If key is not de ned in info, the call raises an error of class MPI_ERR_INFO_NOKEY.
MPI_INFO_GET(info, key, valuelen, value, ag)
IN |
info |
info object (handle) |
IN |
key |
key (string) |
IN |
valuelen |
length of value arg (integer) |
OUT |
value |
value (string) |
OUT |
ag |
true if key de ned, false if not (boolean) |
int MPI_Info_get(MPI_Info info, char *key, int valuelen, char *value, int *flag)
MPI_INFO_GET(INFO, KEY, VALUELEN, VALUE, FLAG, IERROR)
INTEGER INFO, VALUELEN, IERROR
CHARACTER*(*) KEY, VALUE
LOGICAL FLAG
fbool MPI::Info::Get(const char* key, int valuelen, char* value) const
(binding deprecated, see Section 15.2) g
This function retrieves the value associated with key in a previous call to MPI_INFO_SET. If such a key exists, it sets ag to true and returns the value in value, otherwise it sets ag to false and leaves value unchanged. valuelen is the number of characters available in value. If it is less than the actual size of the value, the value is truncated. In C, valuelen should be one less than the amount of allocated space to allow for the null terminator.
If key is larger than MPI_MAX_INFO_KEY, the call is erroneous.
MPI_INFO_GET_VALUELEN(info, key, valuelen, ag)
IN |
info |
info object (handle) |
IN |
key |
key (string) |
OUT |
valuelen |
length of value arg (integer) |
OUT |
ag |
true if key de ned, false if not (boolean) |
int MPI_Info_get_valuelen(MPI_Info info, char *key, int *valuelen, int *flag)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
302 |
CHAPTER 9. THE INFO OBJECT |
1MPI_INFO_GET_VALUELEN(INFO, KEY, VALUELEN, FLAG, IERROR)
2
3
4
5
INTEGER INFO, VALUELEN, IERROR
LOGICAL FLAG
CHARACTER*(*) KEY
6fbool MPI::Info::Get_valuelen(const char* key, int& valuelen) const (binding
7 |
deprecated, see Section 15.2) g |
8Retrieves the length of the value associated with key. If key is de ned, valuelen is set
9to the length of its associated value and ag is set to true. If key is not de ned, valuelen is
10not touched and ag is set to false. The length returned in C or C++ does not include the
11end-of-string character.
12If key is larger than MPI_MAX_INFO_KEY, the call is erroneous.
13
14
15
16
17
18
19
MPI_INFO_GET_NKEYS(info, nkeys)
IN |
info |
info object (handle) |
OUT |
nkeys |
number of de ned keys (integer) |
20 int MPI_Info_get_nkeys(MPI_Info info, int *nkeys)
21
MPI_INFO_GET_NKEYS(INFO, NKEYS, IERROR)
22
INTEGER INFO, NKEYS, IERROR
23
24
25
26
27
fint MPI::Info::Get_nkeys() const (binding deprecated, see Section 15.2) g
MPI_INFO_GET_NKEYS returns the number of currently de ned keys in info.
28 |
MPI_INFO_GET_NTHKEY(info, n, key) |
|
29
30
31
32
33
34
35
IN |
info |
info object (handle) |
IN |
n |
key number (integer) |
OUT |
key |
key (string) |
int MPI_Info_get_nthkey(MPI_Info info, int n, char *key)
36 |
MPI_INFO_GET_NTHKEY(INFO, N, KEY, IERROR) |
37 |
INTEGER INFO, N, IERROR |
38 |
CHARACTER*(*) KEY |
39 |
fvoid MPI::Info::Get_nthkey(int n, char* key) const (binding deprecated, see |
40 |
|
41 |
Section 15.2) g |
42 |
This function returns the nth de ned key in info. Keys are numbered 0 : : : N 1 where |
43 |
N is the value returned by MPI_INFO_GET_NKEYS. All keys between 0 and N 1 are |
44guaranteed to be de ned. The number of a given key does not change as long as info is not
45modi ed with MPI_INFO_SET or MPI_INFO_DELETE.
46
47
48
303
MPI_INFO_DUP(info, newinfo)
IN |
info |
info object (handle) |
OUT |
newinfo |
info object (handle) |
int MPI_Info_dup(MPI_Info info, MPI_Info *newinfo)
MPI_INFO_DUP(INFO, NEWINFO, IERROR)
INTEGER INFO, NEWINFO, IERROR
fMPI::Info MPI::Info::Dup() const (binding deprecated, see Section 15.2) g
MPI_INFO_DUP duplicates an existing info object, creating a new object, with the same (key,value) pairs and the same ordering of keys.
MPI_INFO_FREE(info)
INOUT info |
info object (handle) |
int MPI_Info_free(MPI_Info *info)
MPI_INFO_FREE(INFO, IERROR)
INTEGER INFO, IERROR
fvoid MPI::Info::Free() (binding deprecated, see Section 15.2) g
This function frees info and sets it to MPI_INFO_NULL. The value of an info argument is interpreted each time the info is passed to a routine. Changes to an info after return from a routine do not a ect that interpretation.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
304 |
CHAPTER 9. THE INFO OBJECT |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48