MPI Glossary
This document describes some of the routines available in the MPI
library. This version of the document assumes that the user's
program is written in FORTRAN77 or FORTRAN90.
Process versus processor. We think of parallel processing as involving separate
computers working together, with each computer having one, or sometimes a few processors. However,
in MPI, the important item is a process. We may think of a process as one thread of execution,
typically corresponding to a particular processor. However, it is possible for a single processor
to be in charge of multiple processes; this is handy, for instance, just in practicing the
use of MPI when you only have one computer. The important thing about a process is that it
has its own process id, its own local memory, its own copy of the common program and a pointer
to where it is in that program, and its own set of communication channels to other processes.
The MPI datatypes are, in some sense, just integers that indicate to
various MPI routines what data you are sending. In some implementations
of MPI, it is possible to use the name of a different datatype with the
same number of bytes, or to pass a datatype of MPI_BYTE, say, and multiply
the count by the appropriate value.
It may also be possible to use either the C name
or FORTRAN name for a given piece of data.
Neither practice is explicitly allowed by the standard; although you might
be able to get away with them in some implementations, they are not recommended!
The built-in MPI datatypes usable by FORTRAN programs are as follows:
| MPI Datatype | Fortran Type |
| MPI_BYTE | |
| MPI_CHARACTER | character |
| MPI_COMPLEX | complex |
| MPI_DOUBLE_PRECISION | double precision |
| MPI_INTEGER | integer |
| MPI_LOGICAL | logical |
| MPI_PACKED | (see MPI_Pack) |
| MPI_REAL | real |
| MPI_2DOUBLE_PRECISION | a pair of double precision values |
| MPI_2INTEGER | a pair of integers |
| MPI_2REAL | a pair of real values |
The "paired" datatypes MPI_2DOUBLEPRECISION, MPI_2INTEGER and MPI_2REAL
are necessary when using the MPI_MAXLOC or MPI_MINLOC
reduction operations
with MPI_Reduce.
Users may create additional datatypes, for example, by using
MPI_Type_vector.
Almost every MPI routine returns an error code, and almost nobody looks at them.
However, if you wish to check the value of an error return code, MPI has some
predefined values that can help you in handling the condition:
The built-in MPI datatypes are as follows:
| MPI Error Code | Meaning |
| MPI_SUCCESS | no error was detected; |
| MPI_ERR_ARG | |
|
| MPI_ERR_BUFFER | |
| MPI_ERR_COMM | a communicator argument was illegal; |
| MPI_ERR_COUNT | a count argument was illegal; |
| MPI_ERR_DIMS | a dims (dimensions) argument was illegal; |
| MPI_ERR_GROUP | a group argument was illegal; |
| MPI_ERR_IN_STATUS | |
| MPI_ERR_INTERN | an internal MPI error occurred; |
| MPI_ERR_LASTCODE | |
|
| MPI_ERR_OP | an op (reduction operation) argument was illegal; |
| MPI_ERR_OTHER | |
| MPI_ERR_RANK | a rank argument was illegal; |
| MPI_ERR_REQUEST | a request argument was illegal; |
| MPI_ERR_ROOT | |
| MPI_ERR_TAG | a tag argument was illegal; |
| MPI_ERR_TOPOLOGY | |
| MPI_ERR_TRUNCATE | |
| MPI_ERR_TYPE | a datatype argument was illegal; |
| MPI_ERR_UNKNOWN | an error of unknown type occurred; |
| MPI_PENDING | |
| Name | Usage |
| MPI_ANY_SOURCE | indicates that the receiving process will accept input from any source; |
| MPI_ANY_TAG | indicates that the receiving process will accept input messages with any tag; |
| MPI_COMM_NULL | the null communicator, including no processes; |
| MPI_COMM_WORLD | the communicator of all processes; |
| MPI_CONGRUENT | indicates two communicators or groups have the same processes and ranks but different contexts; |
| MPI_DATATYPE_NULL | the null datatype; |
| MPI_DUP_FN | duplicates a communicator by copying each attribute; |
| MPI_ERRHANDLER_NULL | the null error handler; |
| MPI_GROUP_EMPTY | the empty group; |
| MPI_GROUP_NULL | the null group; |
| MPI_IDENT | indicates that two communicators or groups are identical; |
| MPI_KEYVAL_INVALID | the value assigned to uninitialized attributes; |
| MPI_NULL_COPY_FN | indicates that no special action should be taken to copy attributes; |
| MPI_NULL_DELETE_FN | indicates that no special action should be taken to delete attributes; |
| MPI_OP_NULL | the null reduction operation; |
| MPI_PROC_NULL | the null process; |
| MPI_REQUEST_NULL | the null request; |
| MPI_SIMILAR | indicates that two communicators or groups have the same underlying processes, but different ranks; |
| MPI_SOURCE | the index within the stat array of the message source; |
| MPI_STATUS_SIZE | the required dimension of the stat array; |
| MPI_TAG | the index within the stat array of the message tag; |
| MPI_UNDEFINED | indicates that a value has not been defined for this quantity; |
| MPI_UNEQUAL | indicates two communicators or groups are not similar; |
There are a set of predefined symbolic constants used to indicate that
the MPI processes should cooperate in a specific computation. These
constants are used as a flag to routines such as
MPI_Reduce. New reduction operations can be defined
by calling MPI_Op_create.
| Name | Usage |
| MPI_BAND | the bitwise AND of a set of data; |
| MPI_BOR | the bitwise OR of a set of data; |
| MPI_BXOR | the bitwise exclusive OR of a set of data; |
| MPI_LAND | the logical AND of a set of data; |
| MPI_LOR | the logical OR of a set of data; |
| MPI_LXOR | the logical exclusive OR of a set of data; |
| MPI_MAX | the maximum entry in a set of data; |
| MPI_MAXLOC | the maximum entry AND the process on which it occurred; |
| MPI_MIN | the minimum entry in a set of data; |
| MPI_MINLOC | the minimum entry AND the process on which it occurred; |
| MPI_PROD | the product of a set of data; |
| MPI_SUM | determines the sum of a set of data; |
Note that MPI_MAXLOC and MPI_MINLOC return a pair of values; the
second one is always a process ID, but the type of the first one depends
on the type of the input vector. To avoid problems, the process ID is
converted to the same type as the input vector. Thus, a if the minimum
entry of a real vector as value 43.2 and occurs on process 17, the
values returned are the real pair (43.2,17.0). The appropriate
datatype is a special MPI datatype of MPI_2DOUBLE_PRECISION, MPI_2INTEGER,
or MPI_2REAL.
-
Call:
-
subroutine MPI_Abort ( communicator, ierr )
-
Purpose:
-
MPI_Abort shuts down all the processes in a given communicator and returns an error code
to the invoking environment.
-
Discussion:
-
The behavior of this routine is actually implementation-dependent. It may simply
shut down all processes and terminate execution with the error code.
-
Arguments:
-
-
Input, integer communicator:
-
The communicator whose processes are to be shut down.
-
Input, integer ierr:
-
The error code to be returned.
-
Call:
-
subroutine MPI_Address ( data, address )
-
Purpose:
-
MPI_Address returns the address of an item of data.
-
Discussion:
-
One use for this routine might be to determine the addresses or displacements
of various quantities, as required by
MPI_Type_hindexed or
MPI_Type_hvector.
-
Arguments:
-
-
Input, integer data:
-
An item of data.
-
Output, integer address:
-
The address of the item. Note that addresses are determined in terms of bytes.
-
Call:
-
subroutine MPI_Allgather ( send_data, send_count, send_datatype, recv_data, recv_count, recv_datatype,
communicator, ierr )
-
Purpose:
-
MPI_Allgather gathers data from all the processes in a communicator, given each process
a copy of the total information.
-
Discussion:
-
Each of the processes is assumed to have a set of data. This call collects a copy
of each set of data into a single big vector, which is given to every process.
The data is stored in process rank order; that is, the data from process 0 is stored first,
followed by that from process 1, and so on.
To only gather the data onto one process, see MPI_Gather.
-
Arguments:
-
-
Input, send_datatype send_data(send_count):
-
the data residing on the local process.
-
Input, integer send_count:
-
The number of items in send_data.
-
Input, integer send_datatype:
-
The type of the information in send_data. The value of send_type should be a
standard MPI datatype or else a derived datatype.
-
Output, recv_datatype recv_data(*):
-
is the array used to receive the gathered data. Note that the actual
dimension required for recv_data is num_procs * send_count.
-
Input, integer recv_count:
-
The number of items expected from each process. Normally, this would be the same as
send_count.
-
Input, integer recv_datatype:
-
The type of the information in recv_data. Normally, this would be the same as
send_datatype.
-
Input, integer communicator:
-
The communicator that includes all the processes.
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Allgatherv ( send_data, send_count, send_datatype, recv_data, recv_count,
displs, recv_datatype, communicator, ierr )
-
Purpose:
-
MPI_Allgatherv gathers data from all the processes in a communicator, given each process
a copy of the total information. This routine does not assume that each process
starts out with the same amount of data.
-
Discussion:
-
Each of the processes is assumed to have a set of data, of a size that may vary from process
to process. This call collects a copy of each set of data into a single big vector, which is
given to every process.
The data is stored in process rank order; that is, the data from process 0 is stored first,
followed by that from process 1, and so on.
-
Arguments:
-
-
Input, send_datatype send_data(send_count):
-
the data residing on the local process.
-
Input, integer send_count:
-
The number of items in send_data.
-
Input, integer send_datatype:
-
The type of the information in send_data. The value of send_type should be a
standard MPI datatype or else a derived datatype.
-
Output, recv_datatype recv_data(*):
-
is the array used to receive the gathered data. Note that the actual
dimension required for recv_data is num_procs * send_count.
-
Input, integer recv_count(num_procs):
-
The number of items expected from each process.
-
Input, integer displs(num_procs):
-
displs(i) is the index in recv_data where the first item from process
i should be stored. Note that we use 0-based indexing here, so a FORTRAN programmer
should think of these as offsets from 1, the location of the first entry of recv_data.
-
Input, integer recv_datatype:
-
The type of the information in recv_data. Normally, this would be the same as
send_datatype.
-
Input, integer communicator:
-
The communicator that includes all the processes.
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Allreduce ( local_data, global_data, count, datatype, operation,
communicator, ierr )
-
Purpose:
-
MPI_Allreduce carries out a reduction operation (such as sum, maximum, or product),
with all processes receiving the result.
-
Discussion:
-
The first two arguments must not overlap or share memory in any way.
Compare this routine with MPI_Reduce, in which only
one process receives the final result.
Note that this routine essentially synchronizes the processes within its communicator.
No process can exit from this call until all processes have entered the call.
-
Arguments:
-
-
Input, datatype local_data(count):
-
A scalar or vector, whose type and size will be specified. The value of local_data
at every process is to be used as part of a reduction operation.
-
Output, datatype global_data:
-
The value of global_data is to be determined by applying the indicated reduction
operation to the values of local_data collected from the processes. Note that
the value of global_data will be available to all processes in the communicator.
-
Input, integer count:
-
The number of items within local_data.
-
Input, integer datatype:
-
The type of the information in local_data and global_data. The value of datatype
should be a standard MPI datatype or else a derived datatype.
-
Input, integer operation:
-
specifies the reduction operation to be carried out, and should have a value of one
of the predefined MPI operations.
-
Input, integer communicator:
-
The communicator, containing the processes within which the reduction computation
is to be carried out.
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Alltoall ( send_buf, send_count, send_datatype, recv_buf, recv_count, recv_datatype,
communicator, ierr )
-
Purpose:
-
MPI_Alltoall sends a distinct message from every process to every other process.
-
Discussion:
-
Each process has a send buffer containing all the data to be sent. The first
chunk is sent to the first process and so on. The data received from the first
process is stored in the first chunk of the receive buffer, and so on.
-
Arguments:
-
-
Input, datatype send_buf(send_count*num_procs):
-
The data to be sent.
-
Input, integer send_count:
-
The number of items to be sent to a single process.
-
Input, integer send_datatype:
-
The type of the information in send_buf.
-
Output, datatype recv_buf(recv_count*num_procs):
-
the data received.
-
Input, integer recv_count;
-
the number of items to be received from a single process.
-
Input, integer recv_datatype:
-
The type of the information in recv_buf.
-
Input, integer communicator:
-
The communicator containing the processes.
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Alltoallv ( send_buf, send_counts, send_displs, send_datatype, recv_buf,
recv_counts, recv_displs, recv_datatype, communicator, ierr )
-
Purpose:
-
MPI_Alltoallv sends a distinct message from every process to every other process. The
messages can vary in size and displacement.
-
Discussion:
-
Each process has a send buffer containing all the data to be sent. Each message
are defined by a displacement from the first index of the buffer, and a size.
The data received is similarly given a specific displacement for storage in the receive buffer.
-
Arguments:
-
-
Input, datatype send_buf(*):
-
The data to be sent.
-
Input, integer send_counts(num_procs):
-
The number of items to be sent to each single process.
-
Input, integer send_displs(num_procs):
-
The displacement for each message, that is, the number of positions past the first
entry of send_buf, at which the message starts.
-
Input, integer send_datatype:
-
The type of the information in send_buf.
-
Output, datatype recv_buf(*):
-
the data received.
-
Input, integer recv_counts(num_procs);
-
the number of items to be received from each process.
-
Input, integer recv_displs(num_procs):
-
The displacement for each message, that is, the number of positions past the first
entry of recv_buf, at which the message is to be stored.
-
Input, integer recv_datatype:
-
The type of the information in recv_buf.
-
Input, integer communicator:
-
The communicator containing the processes.
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Attr_delete ( communicator, keyval, ierr )
-
Purpose:
-
MPI_Attr_delete deletes an attribute that had been associated with a communicator.
-
Arguments:
-
-
Input, integer communicator:
-
The identifier of the communicator.
-
Input, integer keyval:
-
The key for the attribute, that was returned from a call to
MPI_Keyval_create.
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Attr_get ( communicator, keyval, attribute_val, flag, ierr )
-
Purpose:
-
MPI_Attr_get retrieves an attribute value by key.
-
Discussion:
-
An attribute is assigned a value by a call to
MPI_Attr_put.
-
Arguments:
-
-
Input, integer communicator:
-
The identifier of the communicator.
-
Input, integer keyval:
-
The key for the attribute.
-
Output, integer attribute_val:
-
The value of the attribute (if there was one).
-
Output, logical flag:
-
FALSE if there was no value assigned to the attribute; TRUE if
the attribute had a value.
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Attr_put ( communicator, keyval, attribute_val, ierr )
-
Purpose:
-
MPI_Attr_put stores an attribute value by key.
-
Arguments:
-
-
Input, integer communicator:
-
The identifier of the communicator.
-
Input, integer keyval:
-
The key for the attribute.
-
Input, integer attribute_val:
-
The value to be assigned the attribute.
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Barrier ( communicator, ierr )
-
Purpose:
-
MPI_Barrier forces all processes within the communicator to wait until they have all
reached the barrier.
-
Discussion:
-
One use of MPI_Barrier is to reliably time a portion of your code.
-
Arguments:
-
-
Input, integer communicator:
-
The communicator containing the processes which are to "meet" at the barrier.
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Bcast ( data, count, datatype, sender, communicator, ierr )
-
Purpose:
-
MPI_Bcast broadcasts data from one process to all others within a communicator.
-
Discussion:
-
It is not possible to receive a broadcast message by calling other
routines, such as MPI_Recv.
Messages send by a broadcast do not have a tag; if several messages are transmitted in this
way, they are simply received in the order sent.
This is a collective communication, so all the processes in the communicator must
issue and participate in the command.
-
Arguments:
-
-
Input, datatype data(count):
-
A scalar or vector, whose type and size will be specified. The value of data,
as determined by the sending process, is to be passed to all other processes
within the communicator.
-
Input, integer count:
-
The number of items within data.
-
Input, integer datatype:
-
The type of the information in data. The value of datatype should be a
standard MPI datatype or else a derived datatype.
-
Input, integer sender;
-
The "id" of the process that is to send the value of data; the value of
sender must be the rank of the process within the specified communicator.
-
Input, integer communicator:
-
The communicator within which the data is to be broadcast. This is often simply
MPI_COMM_WORLD, the communicator of all processes.
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Bsend ( data, count, datatype, receiver, tag, communicator, ierr )
-
Purpose:
-
MPI_Bsend sends data from one process to another within a communicator, using buffering.
-
Discussion:
-
MPI_Send and other data transmittal routines may fail if
a process is not ready to receive the data (and if there is no system buffer to
hold the message). By using this routine, the user guarantees that data can be
sent without error, being stored in a user-supplied buffer area until a process
is ready to receive it. The user-supplied buffer area must be set up with a
call to MPI_Buffer_attach.
The process receiving the data should call
MPI_Recv .
Notice that the calling sequence here is identical to that for
MPI_Send; the difference is behind the scenes, in the
existence of the user buffer!
-
Arguments:
-
-
Input, datatype data(count):
-
A scalar or vector, whose type and size will be specified. The value of data,
as determined by the sending process, is to be passed to the receiving process.
-
Input, integer count:
-
The number of items within data.
-
Input, integer datatype:
-
The type of the information in data. The value of datatype should be a
standard MPI datatype or else a derived datatype.
-
Input, integer receiver;
-
The "id" of the process that is to receive the value of data; the value of
receiver must be the rank of the process within the specified communicator.
Both the sending and receiving process must be part of the communicator.
-
Input, integer tag;
-
The "tag" for the message. The sender and receiver need to agree on the meaning of
tags, or to ignore them.
-
Input, integer communicator:
-
The communicator, of which both the sender and receiver are members. This is often simply
MPI_COMM_WORLD, the communicator of all processes.
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Buffer_attach ( buffer, size, ierr )
-
Purpose:
-
MPI_Buffer_attach sets up a buffer for data transmission via MPI_Bsend.
-
Discussion:
-
A process that calls MPI_Bsend one or more times must first
have called this routine to set up a buffer. The buffer must be sufficiently large
to hold, at one time, all the data that has been sent but not ret received.
-
Arguments:
-
-
Input, mpi_type buffer(*):
-
an array of sufficient size to store all the data that could have been sent by this
process, but not yet received by another process, at any time during execution.
-
Input, integer size:
-
The total size of buffer measured in bytes. Typically, real and integer data
will require 4 bytes per item, and double precision data 8 bytes. Thus, if you mean to
have no more than 1,000 real values "in the air" at one time, then size should be
specified as 4,000!
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Buffer_detach ( buffer, size, ierr )
-
Purpose:
-
MPI_Buffer_detach frees up the memory associated with a buffer that had been set
up by a call to MPI_Buffer_attach.
-
Discussion:
-
The memory we are freeing here is simply internal MPI memory, not the memory
represented by buffer itself. If you're using FORTRAN 90, you can
make buffer allocatable, and deallocate it after calling this routine.
-
Arguments:
-
-
Input, mpi_type buffer(*):
-
the buffer array.
-
Input, integer size:
-
The total size of buffer measured in bytes.
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Cancel ( request, ierr )
-
Purpose:
-
MPI_Cancel marks the operation associated with a request for cancellation.
-
Arguments:
-
-
Input, integer request:
-
the ID of the request to be cancelled.
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Cart_coords ( communicator, rank, maxdims, coords, ierr )
-
Purpose:
-
MPI_Cart_coords returns the Cartesian "coordinates" of any process given its rank.
-
Comments:
-
To get the rank, you might first call MPI_Comm_rank.
Using this routine, a process can inquire about its own coordinates. By inputting
the rank of another process, a calling process can find out the coordinates of
other processes as well. Compare the routine MPI_Cart_get.
-
Arguments:
-
-
Input, integer communicator:
-
The communicator associated with the Cartesian topology.
-
Input, integer rank:
-
The rank or "id" of the process. Normally, the calling process would supply its own
rank, but it can actually inquire about any process by giving the appropriate rank.
-
Input, integer maxdims:
-
The maximum number of Cartesian dimensions; this simply has to be at least as big
as ndims;
-
Output, integer coords(ndims):
-
contains the coordinates of this process in the Cartesian topology;
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Cart_create ( old_communicator, ndims, dims, periodic, reorder, new_communicator, ierr )
-
Purpose:
-
MPI_Cart_create creates a communicator for a Cartesian topology.
-
Comments:
-
This routine is used when the processes need to be arranged in a Cartesian grid (whether
1D, 2D, 3D or higher dimension). Other routines then make it easy to pass data to
neighboring processes
-
Arguments:
-
-
Input, integer old_communicator:
-
The communicator, containing the processes that will form the new communicator.
-
Input, integer ndims:
-
The number of dimensions in the Cartesian topology.
-
Input, integer dims(ndims):
-
The number of processes in each Cartesian direction.
-
Input, logical periodic(ndims):
-
In each dimension, the corresponding entry of periodic is true if the last
and first processes should also be connected; in 1D, for instance, this allows a line
of processes to become connected like a circle.
-
Input, logical reorder:
-
Is true if MPI is free to reorder the processes from the default ordering
that would normally be used. It's usually safe to choose this option.
-
Output, integer new_communicator:
-
The new communicator that should be used when the corresponding processes are to
be thought of as a Cartesian grid.
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Cart_get ( communicator, maxdims, dims, periodic, coords, ierr )
-
Purpose:
-
MPI_Cart_get returns the "coordinates" of the calling process within the Cartesian topology.
-
Comments:
-
In a Cartesian topology, it is less useful to have the rank of a process, and more
useful to have its Cartesian coordinates. Note that this routine can only supply
information to the calling process about itself. To find out the coordinates of
a different process, you might want to use MPI_Cart_coords.
-
Arguments:
-
-
Input, integer communicator:
-
The communicator associated with the Cartesian topology.
-
Input, integer maxdims:
-
The maximum number of Cartesian dimensions; this simply has to be at least as big
as ndims;
-
Output, integer dims(ndims):
-
the dimensions of the Cartesian topology;
-
Output, logical periodic(ndims):
-
is true for each dimension in which the Cartesian topology is to be periodic;
-
Output, integer coords(ndims):
-
contains the coordinates of this process in the Cartesian topology;
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Cart_rank ( communicator, coords, rank, ierr )
-
Purpose:
-
MPI_Cart_rank returns the rank of the calling process within the Cartesian topology.
-
Arguments:
-
-
Input, integer coords(ndims):
-
The grid coordinates of the process.
-
Output, integer rank:
-
The rank of the process
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Cart_shift ( communicator, dim, shift, source, destination, ierr )
-
Purpose:
-
MPI_Cart_shift finds the destination and source for shifts in a Cartesian topology.
-
Comments:
-
In a Cartesian topology, a common operation is for every process to send data to a neighbor
process, say the process to the left. This routine allows each process to determine
destination, the process to which it will send data, and source, the process
from which it may expect data.
-
Arguments:
-
-
Input, integer communicator:
-
The communicator associated with the Cartesian topology.
-
Input, integer dim:
-
The Cartesian dimension along which the shift will take place;
warning: zero-based arithmetic is used here! The first dimension is dimension 0 and so on!
-
Input, integer shift:
-
The size of the shift; in 1D, +1 means go one process to the right, -2 means
go two processes to the left, and so on;
-
Output, integer source:
-
the identifier of the process which will send data to this process;
if there is none (because of boundary conditions), then source will be set to
MPI_PROC_NULL.
-
Output, integer destination:
-
the identifier of the process to which this process will send data;
if there is none (because of boundary conditions), then destination will be set to
MPI_PROC_NULL.
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Cart_sub ( old_communicator, free_coords, new_communicator, ierr )
-
Purpose:
-
MPI_Cart_sub partitions a Cartesian grid into grids of lower dimension.
-
Comments:
-
This is one way to set up communicators for each row of a 2D array, for instance.
The single call creates a communicator for each instance of a subgrid. The subgrids
are indexed by the coordinates that are left free. Thus, to make a set of communicators
for the rows, we say that the row index is free, and that the column index is fixed.
-
Arguments:
-
-
Input, integer old_communicator:
-
The communicator associated with the Cartesian topology.
-
Input, logical free_coords(ndims):
-
contains FALSE for each coordinate that is not free, and TRUE for each coordinate that is free;
-
Input, integer new_communicator:
-
The new communicator.
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Comm_compare ( communicator1, communicator2, result, ierr )
-
Purpose:
-
MPI_Comm_compare compares two communicators.
-
Discussion:
-
The result of the comparison is:
-
MPI_IDENT if the groups and contexts are identical;
-
MPI_CONGRUENT if the groups are identical, but the contexts are different;
-
MPI_SIMILAR if the groups contain the same processes, but with different ranking;
-
MPI_UNEQUAL if the communicators are not similar;
-
Arguments:
-
-
Input, integer communicator1:
-
The first communicator.
-
Input, integer communicator2:
-
The second communicator.
-
Output, integer result:
-
The result of the comparison.
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Comm_create ( old_communicator, group, new_communicator, ierr )
-
Purpose:
-
MPI_Comm_create creates a new communicator from a given group of processes.
-
Discussion:
-
To create a new communicator from an old one, you must first find the identifier
for the group of processes in the old communicator, then perform some operation
such as exclusion to create a new group, and then you may call this routine
with the identifier for the new group, to get the identifier for the new communicator.
-
Arguments:
-
-
Input, integer old_communicator:
-
The communicator shared by the processes.
-
Input, integer group:
-
The identifier for the group of processes that will form the new communicator.
-
Input, integer new_communicator:
-
The new communicator formed by the group of processes.
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Comm_dup ( old_communicator, new_communicator, ierr )
-
Purpose:
-
MPI_Comm_dup makes a new communicator which has the same attributes as
an already existing communicator.
-
Arguments:
-
-
Input, integer old_communicator:
-
The identifier of the already existing communicator.
-
Output, integer new_communicator:
-
The identifier of the new communicator.
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Comm_free ( communicator, ierr )
-
Purpose:
-
MPI_Comm_free "frees" a communicator, that is, ends the association between a
group of processes and a communicator identifier.
-
Arguments:
-
-
Input, integer communicator:
-
The identifier of the communicator.
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Comm_group ( communicator, group, ierr )
-
Purpose:
-
MPI_Comm_group creates a communicator for a given group of processes.
-
Arguments:
-
-
Output, integer communicator:
-
The communicator created by this call.
-
Input, integer group:
-
The identifier for the group, which must have been created by a call to a routine
such as
MPI_Group_excl or
MPI_Group_incl.
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Comm_rank ( communicator, id, ierr )
-
Purpose:
-
MPI_Comm_rank reports the rank of the calling process.
-
Arguments:
-
-
Input, integer communicator:
-
The communicator within which the rank is desired. This is often simply
MPI_COMM_WORLD, the communicator of all processes.
-
Output, integer id:
-
The rank of the calling process within the given communicator. Ranks start at 0.
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Comm_size ( communicator, num_procs, ierr )
-
Purpose:
-
MPI_Comm_size reports the number of processes in a communicator.
-
Arguments:
-
-
Input, integer communicator:
-
The communicator whose size (number of processes) is desired. This is often simply
MPI_COMM_WORLD, the communicator of all processes.
-
Output, integer num_procs:
-
The number of processes within the given communicator.
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Comm_split ( old_communicator, split_key, rank_key, new_communicator, ierr )
-
Purpose:
-
MPI_Comm_split splits up a communicator, creating a number of communicators with the
same ID, but with different values of a "split key".
-
Discussion:
-
Normally, every time you creat a new communicator you think up a new name for it.
But in some cases, you want to make a lot of communicators, and you don't even know
beforehand how many. This can happen, for instance, if you have an M by N array
of processes, and you want to make a communicator for each row. MPI_Comm_split
essentially allows you to use the same communicator name for all the new communicators,
with the value of the split key working as an index to keep track of which
new communicator you really want.
MPI_Comm_split is a collective function, so all processes in the communicator must
issue and participate in the command.
-
Arguments:
-
-
Input, integer old_communicator:
-
The communicator whose processes are to be split up into new communicators.
-
Input, integer split_key:
-
The key which acts as an index, determining which version of the new communicator
to assign this process to. If a particular process is not to be associated with
a new communicator, then set split_key to MPI_UNDEFINED in this case;
-
Input, integer rank_key:
-
The rank of this process in the old communicator.
-
Output, integer new_communicator:
-
The communicator created by this call, which actually represents many communicators
of the same name, but with different values of split_key. Those processes
for which split_key was set to MPI_UNDEFINED will have new_communicator
returned as MPI_COMM_NULL.
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Dims_create ( num_procs, ndims, dims, ierr )
-
Purpose:
-
MPI_Dims_create is used to set up a balanced Cartesian grid with any number of dimensions.
-
Discussion:
-
This routine requires that the product of the dimensions
in dims be exactly equal to num_procs. This means, for instance, that
you wouldn't want to use a prime value for num_procs, and that many suitable
decompositions will be ignored because they don't use all the processes. Thus,
17 processes might be divided into a 17*1*1*1 "grid" instead of the more balanced
"2*2*2*2" grid that leaves 1 process left out.
-
Arguments:
-
-
Input, integer num_procs:
-
The number of processes.
-
Input, integer ndims:
-
The number of spatial dimensions.
-
Input/output, integer dims(ndims);
-
On input, if any entry of dims is set to a positive value, then the routine will
not change it; in this way, the user can force some elements of dims to have a
particular value. Only those entries whose values are 0 will be altered. Negative
input values will cause an error.
On output, the cartesian dimensions, that is, a suitable arrangement of the processes. The entries
of dims are set to be as close to each other in size as possible, and their product
is equal to num_procs.
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Finalize ( ierr )
-
Purpose:
-
MPI_Finalize shuts down the MPI library. It must be the last MPI routine called.
-
Arguments:
-
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Gather ( send_data, send_count, send_datatype, recv_data, recv_count, recv_datatype,
root, communicator, ierr )
-
Purpose:
-
MPI_Gather gathers data from all the processes in a communicator.
-
Discussion:
-
Each of the processes is assumed to have a set of data. This call collects a copy
of each set of data into a single big vector, on the root process.
The data is stored in process rank order; that is, the data from process 0 is stored first,
followed by that from process 1, and so on.
This is a collective communication, so all processes must issue the command and participate.
The inverse operation is MPI_Scatter.
-
Arguments:
-
-
Input, send_datatype send_data(send_count):
-
the data residing on the local process which is to be sent to the root process.
-
Input, integer send_count:
-
The number of items in send_data.
-
Input, integer send_datatype:
-
The type of the information in send_data. The value of send_type should be a
standard MPI datatype or else a derived datatype.
-
Output, recv_datatype recv_data(*):
-
is used on the root process, to receive the gathered data. Note that the actual
dimension required for recv_data is num_procs * send_count.
-
Input, integer recv_count:
-
The number of items expected from each process. Normally, this would be the same as
send_count.
-
Input, integer recv_datatype:
-
The type of the information in recv_data. Normally, this would be the same as
send_datatype.
-
Input, integer root;
-
The process that is to receive the values of recv_data
-
Input, integer communicator:
-
The communicator that includes all the processes (including root).
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Gatherv ( send_data, send_count, send_datatype, recv_data, recv_counts, displs,
recv_datatype, root, communicator, ierr )
-
Purpose:
-
MPI_Gatherv gathers messages of varying size from all the processes in a communicator.
-
Discussion:
-
Each of the processes is assumed to have a message for process root. These
messages may be of varying size. This call collects a copy
of each set of data into a single big vector, on the root process.
This is a collective communication, so all processes must issue the command and participate.
The inverse operation is MPI_Scatter.
-
Arguments:
-
-
Input, send_datatype send_data(send_count):
-
the data residing on the local process which is to be sent to the root process.
-
Input, integer send_count:
-
The number of items in send_data.
-
Input, integer send_datatype:
-
The type of the information in send_data. The value of send_type should be a
standard MPI datatype or else a derived datatype.
-
Output, recv_datatype recv_data(*):
-
is used on the root process, to receive the gathered data.
-
Input, integer recv_counts(num_procs):
-
The number of items expected from each process. Note that this quantity can vary
from one process to the next.
-
Input, integer displs(num_procs):
-
The displacements for each message, measure from the first entry of recv_data.
The message from process I should be stored starting in location recv_data(1+displ(I)).
-
Input, integer recv_datatype:
-
The type of the information in recv_data. Normally, this would be the same as
send_datatype.
-
Input, integer root;
-
The process that is to receive the values of recv_data
-
Input, integer communicator:
-
The communicator that includes all the processes (including root).
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Get_count ( status, datatype, count, ierr )
-
Purpose:
-
MPI_Get_count reports the actual number of items transmitted in a communication.
-
Arguments:
-
-
Input, integer status(MPI_STATUS_SIZE):
-
the status vector returned from the communication call.
-
Input, integer datatype:
-
The type of the information that was transferred
-
Output, integer count;
-
the number of items of the given datatype that were transferred.
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Group_compare ( group1, group2, result, ierr )
-
Purpose:
-
MPI_Group_compare compares two groups.
-
Discussion:
-
The result of the comparison is:
-
MPI_IDENT if the groups and contexts are identical;
-
MPI_CONGRUENT if the groups are identical, but the contexts are different;
-
MPI_SIMILAR if the groups contain the same processes, but with different ranking;
-
MPI_UNEQUAL if the groups are not similar;
-
Arguments:
-
-
Input, integer group1:
-
the identifier of group1;
-
Input, integer group2:
-
the identifier of group2.
-
Output, integer result:
-
the result of the comparison.
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Group_difference ( group1, group2, new_group, ierr )
-
Purpose:
-
MPI_Group_difference creates a new group of processes from those which are in group1
but not in group2.
-
Arguments:
-
-
Input, integer group1:
-
the identifier of group1;
-
Input, integer group2:
-
the identifier of group2.
-
Output, integer new_group:
-
the processes of a new group, comprising all the processes that are in group1 but
not in group2;
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Group_excl ( old_group, n, exclude, new_group, ierr )
-
Purpose:
-
MPI_Group_excl creates a new group of processes from an old group by exclusion.
-
Arguments:
-
-
Input, integer old_group:
-
The identifier of the old group, which may have been reported by
MPI_Comm_group.
-
Input, integer n:
-
The number of processes in the old group that are to be excluded
in the new group.
-
Input, integer exclude(n):
-
The processes of the old group that are to be excluded from the new group.
-
Output, integer new_group:
-
The identifier for the new group.
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Group_free ( group, ierr )
-
Purpose:
-
MPI_Group_free "frees" a group, that is, ends the association between a set of
processes and a group identifier.
-
Arguments:
-
-
Input, integer group:
-
The identifier of the group.
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Group_incl ( old_group, n, include, new_group, ierr )
-
Purpose:
-
MPI_Group_incl creates a new group of processes from an old group by inclusion.
-
Arguments:
-
-
Input, integer old_group:
-
The identifier of the old group, which may have been reported by
MPI_Comm_group.
-
Input, integer n:
-
The number of processes in the old group that are to be included
in the new group.
-
Input, integer include(n):
-
The processes of the old group that are to be included in the new group.
-
Output, integer new_group:
-
The identifier for the new group.
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Group_intersection ( group1, group2, new_group, ierr )
-
Purpose:
-
MPI_Group_intersection creates a new group of processes from the intersection of
two groups.
-
Arguments:
-
-
Input, integer group1:
-
the identifier of group1;
-
Input, integer group2:
-
the identifier of group2.
-
Output, integer new_group:
-
the processes of a new group, comprising all the processes that are in both group1 and
group2;
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Group_rank ( group, rank, ierr )
-
Purpose:
-
MPI_Group_rank returns the rank of the calling process in a group.
-
Arguments:
-
-
Input, integer group:
-
The identifier of the group.
-
Output, integer rank:
-
the rank of the calling process in the group.
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Group_size ( group, size, ierr )
-
Purpose:
-
MPI_Group_size returns the number of processes in a group.
-
Arguments:
-
-
Input, integer group:
-
The identifier of the group.
-
Output, integer size:
-
the number of processes in the group.
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Group_union ( group1, group2, new_group, ierr )
-
Purpose:
-
MPI_Group_union creates a new group of processes from the union of
two groups.
-
Arguments:
-
-
Input, integer group1:
-
the identifier of group1;
-
Input, integer group2:
-
the identifier of group2.
-
Output, integer new_group:
-
the processes of a new group, comprising all the processes that are in either group1 or
group2;
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Ibsend ( data, count, datatype, receiver, tag, communicator, request, ierr )
-
Purpose:
-
MPI_Ibsend is a buffered non-blocking send of data.
-
Discussion:
-
The user-supplied buffer area must be set up with a call to
MPI_Buffer_attach. The routine returns immediately,
without checking to see if the data has been received.
MPI_Bsend is the blocking version of this routine.
-
Arguments:
-
-
Input, datatype data(count):
-
A scalar or vector, whose type and size will be specified. The value of data,
as determined by the sending process, is to be passed to the receiving process.
-
Input, integer count:
-
The number of items within data.
-
Input, integer datatype:
-
The type of the information in data. The value of datatype should be a
standard MPI datatype or else a derived datatype.
-
Input, integer receiver;
-
The "id" of the process that is to receive the value of data; the value of
receiver must be the rank of the process within the specified communicator.
Both the sending and receiving process must be part of the communicator.
-
Input, integer tag;
-
The "tag" for the message. The sender and receiver need to agree on the meaning of
tags, or to ignore them.
-
Input, integer communicator:
-
The communicator, of which both the sender and receiver are members. This is often simply
MPI_COMM_WORLD, the communicator of all processes.
-
Output, integer request:
-
a handle, which can be used to determine if the data has been received yet. Simply
call MPI_Test or MPI_Wait, and include
the request handle.
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Init ( ierr )
-
Purpose:
-
MPI_Init initializes the MPI library. It must be the first MPI routine called.
-
Arguments:
-
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Initialized ( flag, ierr )
-
Purpose:
-
MPI_Initialized reports whether MPI has been initialized by a call to
MPI_Init.
-
Arguments:
-
-
Output, logical flag:
-
is TRUE if MPI has been initialized, and FALSE otherwise.
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Irecv ( data, count, datatype, sender, tag, communicator, request, ierr )
-
Purpose:
-
MPI_Irecv receives data from another process within a communicator.
-
Discussion:
-
The data should have been sent by a call to MPI_Isend,
which is a non-blocking send. MPI_Irecv returns "immediately", whether or not
the data has been received yet. Thus, it is up to the user to use the
request argument to determine if the data has been received, and if not,
to wait at some point. Routines such as MPI_Wait and
MPI_Test can be used for this task.
-
Arguments:
-
-
Input, datatype data(count):
-
A scalar or vector, whose type and size will be specified. The value of data,
as determined by the sending process, is to be passed to the receiving process.
-
Input, integer count:
-
The number of items within data.
-
Input, integer datatype:
-
The type of the information in data. The value of datatype should be a
standard MPI datatype or else a derived datatype.
-
Input, integer sender;
-
The "id" of the process that is to send the value of data; the value of
sender must be the rank of the process within the specified communicator.
Both the sending and receiving process must be part of the communicator. If
sender is given the value MPI_ANY_SOURCE then no source checking is done.
-
Input, integer tag;
-
The "tag" for the message. There may be many messages directed to this process,
but the routine will only accept a message that has the specified tag. If
tag is given the value MPI_ANY_TAG then no tag checking is done.
-
Input, integer communicator:
-
The communicator, of which both the sender and receiver are members. This is often simply
MPI_COMM_WORLD, the communicator of all processes.
-
Output, integer request:
-
a handle, which can be used to determine if the data has been received yet. Simply
call MPI_Test or MPI_Wait, and include
the request handle.
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Irsend ( data, count, datatype, receiver, tag, communicator, request, ierr )
-
Purpose:
-
MPI_Irsend is a non-blocking "ready send" of data.
-
Discussion:
-
The "ready send" option can be used on certain machines, such as the Intel Paragon and
the TMC CM-5, in which the communication protocol is greatly simplified when the sending
process can be certain that the receiving process has already posted its receive request.
On other machines, the MPI implementation may treat this as a call to "MPI_Isend".
The blocking version of this routine is MPI_Rsend.
-
Arguments:
-
-
Input, datatype data(count):
-
A scalar or vector, whose type and size will be specified. The value of data,
as determined by the sending process, is to be passed to the receiving process.
-
Input, integer count:
-
The number of items within data.
-
Input, integer datatype:
-
The type of the information in data. The value of datatype should be a
standard MPI datatype or else a derived datatype.
-
Input, integer receiver;
-
The "id" of the process that is to receive the value of data; the value of
receiver must be the rank of the process within the specified communicator.
Both the sending and receiving process must be part of the communicator.
-
Input, integer tag;
-
The "tag" for the message. The sender and receiver need to agree on the meaning of
tags, or to ignore them.
-
Input, integer communicator:
-
The communicator, of which both the sender and receiver are members. This is often simply
MPI_COMM_WORLD, the communicator of all processes.
-
Output, integer request:
-
a handle, which can be used to determine if the data has been received yet. Simply
call MPI_Test or MPI_Wait, and include
the request handle.
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Isend ( data, count, datatype, receiver, tag, communicator, request, ierr )
-
Purpose:
-
MPI_Isend is a nonblocking send of data.
-
Discussion:
-
MPI_Isend uses nonblocking communication. In other words, the routine sends
the data, and does not wait to see if the intended recipient has started to receive it,
but instead, returns immediately. Thus, the user must use the
request argument to determine if the data has been received, and if not,
to wait at some point. Routines such as MPI_Wait and
MPI_Test can be used for this task. The program can do some
other work while waiting, but it must not overwrite the data being transferred until
it has been received! The receiving process should call MPI_Irecv.
-
Arguments:
-
-
Input, datatype data(count):
-
A scalar or vector, whose type and size will be specified. The value of data,
as determined by the sending process, is to be passed to the receiving process.
Note that the quantities in data should not be altered until the receiving
process has received them, an event which cannot be guaranteed to have happened
at the time that MPI_Isend returns to the calling process!
-
Input, integer count:
-
The number of items within data.
-
Input, integer datatype:
-
The type of the information in data. The value of datatype should be a
standard MPI datatype or else a derived datatype.
-
Input, integer receiver;
-
The "id" of the process that is to receive the value of data; the value of
receiver must be the rank of the process within the specified communicator.
Both the sending and receiving process must be part of the communicator.
-
Input, integer tag;
-
The "tag" for the message. The sender and receiver need to agree on the meaning of
tags, or to ignore them.
-
Input, integer communicator:
-
The communicator, of which both the sender and receiver are members. This is often simply
MPI_COMM_WORLD, the communicator of all processes.
-
Output, integer request:
-
a handle, which can be used to determine if the data has been received yet. Simply
call MPI_Test or MPI_Wait, and include
the request handle.
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Issend ( data, count, datatype, receiver, tag, communicator, request, ierr )
-
Purpose:
-
MPI_Issend is a synchronous non-blocking send of data.
-
Discussion:
-
Using synchronous mode, the send operation can begin whether or not the matching
receive operation has been posted yet. Until the matching receive operation is posted,
however, the send operation will not complete, and the routine will not return.
The blocking version of this routine is MPI_Ssend.
-
Arguments:
-
-
Input, datatype data(count):
-
A scalar or vector, whose type and size will be specified. The value of data,
as determined by the sending process, is to be passed to the receiving process.
-
Input, integer count:
-
The number of items within data.
-
Input, integer datatype:
-
The type of the information in data. The value of datatype should be a
standard MPI datatype or else a derived datatype.
-
Input, integer receiver;
-
The "id" of the process that is to receive the value of data; the value of
receiver must be the rank of the process within the specified communicator.
Both the sending and receiving process must be part of the communicator.
-
Input, integer tag;
-
The "tag" for the message. The sender and receiver need to agree on the meaning of
tags, or to ignore them.
-
Input, integer communicator:
-
The communicator, of which both the sender and receiver are members. This is often simply
MPI_COMM_WORLD, the communicator of all processes.
-
Output, integer request:
-
a handle, which can be used to determine if the data has been received yet. Simply
call MPI_Test or MPI_Wait, and include
the request handle.
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Keyval_create ( copy_fn, delete_fn, key_ptr, extra_arg, ierr )
-
Purpose:
-
MPI_Keyval_create creates a key (or handle) for a new attribute to be associated with
a communicator.
-
Discussion:
-
You may want to associate some attribute with a communicator, such as the rank of the
special process that you have assigned to do I/O. This call allows you to set up
such an attribute.
-
Arguments:
-
-
Input, external copy_fn:
-
the attribute copy function to be used to copy
the data if the communicator is duplicated (in which
case the attribute will have to be copied too);
-
Input, external delete_fn:
-
the attribute delete function used to free
up memory associated with the attribute, if the communicator is freed.
-
Output, integer keyval:
-
a handle for the attribute.
-
Input, integer extra_state:
-
an extra argument used by the copy and delete functions.
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Op_create ( op_fun, commutes, op_id, ierr )
-
Purpose:
-
MPI_Op_create allows the user to get an ID for a new reduction operation.
-
Discussion:
-
Once an ID has been acquired, the newly defined reduction operation can be
carried out by routines like MPI_Reduce.
The operation must be associative, as, for example with addition, where:
( A + B ) + C = A + ( B + C )
-
Arguments:
-
-
Input, external op_fun:
-
the reduction operation routine, defined by the
user, that carries out the operation.
-
Input, logical commutes:
-
is TRUE if the operation is commutative (as in A+B = B+A), and FALSE if it is
not commutative (as in A/B /= B/A). If the operation is not commutative, then
it will be carried out in strict process-rank order.
-
Output, integer op_id:
-
an ID, or handle, for the operation, which should be used as the operation-defining
argument to any MPI reduction routine;
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Op_free ( op_id, ierr )
-
Purpose:
-
MPI_Op_free frees the memory associated with a user-defined reduction operation.
-
Discussion:
-
This call discards the memory that had been set aside for the definition
of a user-defined reduction operation by a call to
MPI_Op_create.
-
Arguments:
-
-
Input, integer op_id:
-
the ID, or handle, for the operation;
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Pack ( data, count, datatype, buffer, buffer_size, buffer_position, communicator, ierr )
-
Purpose:
-
MPI_Pack packs data into a buffer.
-
Discussion:
-
Once all the data has been packed, it may be transmitted by any routine, such as
MPI_Send, using an
MPI Datatype of MPI_PACKED.
A routine that receives packed data must unpack it by calling MPI_Unpack.
-
Arguments:
-
-
Input, datatype data(count):
-
Information that is to be packed into the buffer.
-
Input, integer count:
-
The number of items within data.
-
Input, integer datatype:
-
The type of the information in data. The value of datatype should be a
standard MPI datatype or else a derived datatype.
-
Input/output, integer buffer(buffer_size/4);
-
is an array into which the data is to be packed. FORTRAN will expect buffer
to be declared with a standard type, so you can declare it as an integer variable
of a given size. MPI_Pack will want to know the size of this array, as measured
in bytes. Integers are normally equivalent to 4 bytes.
-
Input, integer buffer_size;
-
the size of the buffer, as measured in bytes.
-
Input/output, integer buffer_position;
-
a pointer to the next free location in the buffer. On first call, you would normally set
buffer_position=0. Each time the routine is called to pack more data into the buffer, the
pointer is updated. So the only thing you have to do is reset the value to 0 if you
have transmitted your data, and want to pack some new things into the buffer.
-
Input, integer communicator:
-
The communicator which will be using the buffer to transmit the packed data.
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Pack_size ( count, datatype, communicator, size, ierr )
-
Purpose:
-
MPI_Pack_size reports the size of the buffer needed to hold a set of packed data.
-
Discussion:
-
Often the user will pack data of several different datatypes into one buffer. Simply
call MPI_Pack_size once for each datatype to be packed (along with the number of items
of that datatype), and add up the resulting sizes. The total will be the size in bytes
needed to pack all the data at one time.
-
Arguments:
-
-
Input, integer count:
-
The number of items of the given datatype to be packed.
-
Input, integer datatype:
-
The datatype of the information. The value of datatype should be a
standard MPI datatype or else a derived datatype.
-
Input, integer communicator:
-
The communicator which will be using the buffer to transmit the packed data.
-
Output, integer size;
-
the size of the buffer, measured in bytes, necessary to pack the given amount of data.
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Probe ( sender, tag, communicator, status, ierr )
-
Purpose:
-
MPI_Probe allows you to check whether a message has been sent, and is ready to
be received, without actually receiving it yet.
-
Discussion:
-
There are situations where you want to know if a message is ready to be received,
and the amount of data coming, so that you can set aside space for it before
you go ahead and receive it. You can do this with a combination of MPI_Probe
(to get the status array) and
MPI_Get_count(to examine the status array
and tell you how many items are in the message). Then you can allocate space
and call MPI_Recv.
-
Arguments:
-
-
Input, integer sender;
-
The "id" of the process that is to send the value of data; the value of
sender must be the rank of the process within the specified communicator.
Both the sending and receiving process must be part of the communicator. If
sender is given the value MPI_ANY_SOURCE then no source checking is done.
-
Input, integer tag;
-
The "tag" for the message. There may be many messages directed to this process,
but the routine will only accept a message that has the specified tag. If
tag is given the value MPI_ANY_TAG then no tag checking is done.
-
Input, integer communicator:
-
The communicator, of which both the sender and receiver are members. This is often simply
MPI_COMM_WORLD, the communicator of all processes.
-
Output, integer status(MPI_STATUS_SIZE):
-
Returns information about the message received, useful if MPI_ANY_SOURCE
or MPI_ANY_TAG was specified:
-
status(MPI_TAG) is the actual tag of the message received;
-
status(MPI_SOURCE) is the actual sending process of the message received;
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Recv ( data, count, datatype, sender, tag, communicator, status, ierr )
-
Purpose:
-
MPI_Recv receives data from another process within a communicator.
-
Discussion:
-
The data should have been sent by a call to MPI_Send.
-
Arguments:
-
-
Input, datatype data(count):
-
A scalar or vector, whose type and size will be specified. The value of data,
as determined by the sending process, is to be passed to the receiving process.
-
Input, integer count:
-
The number of items within data.
-
Input, integer datatype:
-
The type of the information in data. The value of datatype should be a
standard MPI datatype or else a derived datatype.
-
Input, integer sender;
-
The "id" of the process that is to send the value of data; the value of
sender must be the rank of the process within the specified communicator.
Both the sending and receiving process must be part of the communicator. If
sender is given the value MPI_ANY_SOURCE then no source checking is done.
-
Input, integer tag;
-
The "tag" for the message. There may be many messages directed to this process,
but the routine will only accept a message that has the specified tag. If
tag is given the value MPI_ANY_TAG then no tag checking is done.
-
Input, integer communicator:
-
The communicator, of which both the sender and receiver are members. This is often simply
MPI_COMM_WORLD, the communicator of all processes.
-
Output, integer status(MPI_STATUS_SIZE):
-
Returns information about the message received, useful if MPI_ANY_SOURCE
or MPI_ANY_TAG was specified:
-
status(MPI_TAG) is the actual tag of the message received;
-
status(MPI_SOURCE) is the actual sending process of the message received;
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Reduce ( local_data, global_data, count, datatype, operation, receiver,
communicator, ierr )
-
Purpose:
-
MPI_Reduce carries out a reduction operation (such as sum, maximum, or product).
-
Comments:
-
The first two arguments must not overlap or share memory in any way.
Compare this routine with MPI_Allreduce, in which all
processes receive the final result.
-
Arguments:
-
-
Input, datatype local_data(count):
-
A scalar or vector, whose type and size will be specified. The value of local_data
at every process is to be used as part of a reduction operation.
-
Output (to receiver), datatype global_data:
-
The value of global_data is to be determined by applying the indicated reduction
operation to the values of local_data collected from the processes. Note that
the value of global_data will only be available on the receiver process.
-
Input, integer count:
-
The number of items within local_data.
-
Input, integer datatype:
-
The type of the information in local_data and global_data. The value of datatype
should be a standard MPI datatype or else a derived datatype.
-
Input, integer operation:
-
specifies the reduction operation to be carried out, and should have a value of one
of the predefined MPI operations.
-
Input, integer receiver;
-
The "id" of the process that is to collect the values of local_data, and to
form the value of global_data; receiver must be a process within the
specified communicator.
-
Input, integer communicator:
-
The communicator, containing the processes within which the reduction computation
is to be carried out.
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Reduce_scatter ( send_buf, recv_buf, recv_counts, datatype, operation,
communicator, ierr )
-
Purpose:
-
MPI_Reduce_scatter collects a message of the same length from each process. These
might be thought of as columns of a 2D array. It then applies a reduction operation
to each row of the array. The resulting column of data is scattered across the
processes in rank order, with each process getting a user-specified number of the entries.
Note that there is no distinguished or special process in this call; all processes
are treated equally.
-
Comments:
-
The first two arguments must not overlap or share memory in any way.
-
Arguments:
-
-
Input, datatype send_buf(send_count):
-
the data which each process contributes. The value of send_count, the number
of items in send_buf is determined implicitly as the sum of the entries
of recv_counts. It is the same on all processes.
-
Output, datatype recv_buf(recv_count(i)):
-
the data returned from the reduction operation. Process I receives recv_count(I)
values.
-
Input, integer recv_count(num_procs):
-
The number of items of the reduced data that are to be sent to each process.
-
Input, integer datatype:
-
The type of the information. The value of datatype
should be a standard MPI datatype or else a derived datatype.
-
Input, integer operation:
-
specifies the reduction operation to be carried out, and should have a value of one
of the predefined MPI operations.
-
Input, integer communicator:
-
The communicator, containing the processes within which the reduction computation
is to be carried out.
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Request_free ( request, ierr )
-
Purpose:
-
MPI_Request_free releases the memory associated with a request.
-
Arguments:
-
-
Input/output, integer request:
-
On input, the ID of the request to be freed up. On output, the ID has been
set to that of MPI_REQUEST_NULL.
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Rsend ( data, count, datatype, receiver, tag, communicator, ierr )
-
Purpose:
-
MPI_Rsend "ready sends" data from one process to another within a communicator.
-
Discussion:
-
The "ready send" option can be used on certain machines, such as the Intel Paragon and
the TMC CM-5, in which the communication protocol is greatly simplified when the sending
process can be certain that the receiving process has already posted its receive request.
On other machines, the MPI implementation may treat this as a normal "MPI_Send".
-
Arguments:
-
-
Input, datatype data(count):
-
A scalar or vector, whose type and size will be specified. The value of data,
as determined by the sending process, is to be passed to the receiving process.
-
Input, integer count:
-
The number of items within data.
-
Input, integer datatype:
-
The type of the information in data. The value of datatype should be a
standard MPI datatype or else a derived datatype.
-
Input, integer receiver;
-
The "id" of the process that is to receive the value of data; the value of
receiver must be the rank of the process within the specified communicator.
Both the sending and receiving process must be part of the communicator.
-
Input, integer tag;
-
The "tag" for the message. The sender and receiver need to agree on the meaning of
tags, or to ignore them.
-
Input, integer communicator:
-
The communicator, of which both the sender and receiver are members. This is often simply
MPI_COMM_WORLD, the communicator of all processes.
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Scan ( send_buf, recv_buf, count, datatype, operation,
communicator, ierr )
-
Purpose:
-
MPI_Scan carries out a parallel prefix reduction operation on distributed data.
-
Comments:
-
All processes supply data for the reduction operation. The results are computed
as follows:
-
process 0 stores the reduction of the data from process 0;
-
process 1 stores the reduction of the data from processes 0 and 1;
-
...
-
process num_procs-1 stores the reduction of the data from processes 0, 1, ...,
num_procs-1
This is a collective communication routine, so all processes in the communicator
must issue the command and participate.
-
Arguments:
-
-
Input, datatype send_buf(count):
-
The local data.
-
Output, datatype recv_buf(count):
-
Each entry of recv_buf is determined by (some) of the values of the corresponding
entries of send_buf. Process I stores the reduction of the data from processes
0 through I.
-
Input, integer count:
-
The number of items within send_buf.
-
Input, integer datatype:
-
The type of the information in send_buf and recv_buf. The value of datatype
should be a standard MPI datatype or else a derived datatype.
-
Input, integer operation:
-
specifies the reduction operation to be carried out, and should have a value of one
of the predefined MPI operations.
-
Input, integer communicator:
-
The communicator, containing the processes within which the reduction computation
is to be carried out.
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Scatter ( send_data, send_count, send_datatype, recv_data, recv_count, recv_datatype,
root, communicator, ierr )
-
Purpose:
-
MPI_Scatter distributes data from one process to all processes in a communicator.
-
Discussion:
-
The root process is assumed to have a large set of data. The scatter command divides
this data into segments, sending the first to process 0, the second to process 1 and so on.
This is a collective command, so all processes in the communicator must
issue and participate.
The inverse operation is MPI_Gather.
-
Arguments:
-
-
Input, send_datatype send_data(*):
-
the data residing on the root process which is to be divided up and sent to the processes
in the communicator. The dimension of send_data would need to be at least
num_procs * send_count.
-
Input, integer send_count:
-
The number of items in each individual segment of send_data.
-
Input, integer send_datatype:
-
The type of the information in send_data. The value of send_type should be a
standard MPI datatype or else a derived datatype.
-
Output, recv_datatype recv_data(*):
-
contains the data received from the root process.
-
Input, integer recv_count:
-
The number of items expected from the root process. Normally, this would be the same as
send_count.
-
Input, integer recv_datatype:
-
The type of the information in recv_data. Normally, this would be the same as
send_datatype.
-
Input, integer root;
-
The process that is to send the data;
-
Input, integer communicator:
-
The communicator that includes all the processes (including root).
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Scatterv ( send_data, send_counts, displs, send_datatype, recv_data, recv_count,
recv_datatype, root, communicator, ierr )
-
Purpose:
-
MPI_Scatterv distributes messages of varying size from one process to all processes in a communicator.
-
Discussion:
-
The root process is assumed to have messages to send to each process. The messages
may be of varying size and displacement.
This is a collective command, so all processes in the communicator must
issue and participate.
The inverse operation is MPI_Gatherv.
-
Arguments:
-
-
Input, send_datatype send_data(*):
-
the data residing on the root process which is to be divided up and sent to the processes
in the communicator.
-
Input, integer send_counts(num_procs):
-
For each process in the communicator, the number of items to be sent.
-
Input, integer displs(num_procs):
-
For each process in the communicator, the displacement of the first item to be sent, as
counted from the first item in send_data. To send the first entry of send_data
set the displacement to 0.
-
Input, integer send_datatype:
-
The type of the information in send_data. The value of send_type should be a
standard MPI datatype or else a derived datatype.
-
Output, recv_datatype recv_data(*):
-
contains the data received from the root process.
-
Input, integer recv_count:
-
The number of items expected from the root process. Normally, this would be the same as
send_count.
-
Input, integer recv_datatype:
-
The type of the information in recv_data. Normally, this would be the same as
send_datatype.
-
Input, integer root;
-
The process that is to send the data;
-
Input, integer communicator:
-
The communicator that includes all the processes (including root).
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Send ( data, count, datatype, receiver, tag, communicator, ierr )
-
Purpose:
-
MPI_Send sends data from one process to another within a communicator.
-
Discussion:
-
The process receiving the data should call
MPI_Recv.
-
Arguments:
-
-
Input, datatype data(count):
-
A scalar or vector, whose type and size will be specified. The value of data,
as determined by the sending process, is to be passed to the receiving process.
-
Input, integer count:
-
The number of items within data.
-
Input, integer datatype:
-
The type of the information in data. The value of datatype should be a
standard MPI datatype or else a derived datatype.
-
Input, integer receiver;
-
The "id" of the process that is to receive the value of data; the value of
receiver must be the rank of the process within the specified communicator.
Both the sending and receiving process must be part of the communicator.
-
Input, integer tag;
-
The "tag" for the message. The sender and receiver need to agree on the meaning of
tags, or to ignore them.
-
Input, integer communicator:
-
The communicator, of which both the sender and receiver are members. This is often simply
MPI_COMM_WORLD, the communicator of all processes.
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Sendrecv ( send_buf, send_count, send_datatype, receiver, send_tag, recv_buf,
recv_count, recv_datatype, source, recv_tag, communicator, status, ierr )
-
Purpose:
-
MPI_Sendrecv sends and receives data between processes, without worrying about
deadlock from a lack of buffering. A typical use of this routine would occur
when all the processes want to send data to the process "to their left" and receive
data from the process "to their right". Using two calls, a send followed
by a receive, may cause deadlock because all the processes are trying to send and
no one is prepared to received. By contrast, using MPI_Sendrecv for this
task means that a process can simultaneously be sending data and prepared to receive
it as well.
-
Arguments:
-
-
Input, send_datatype send_buf(send_count):
-
Data that the calling process wants to send to the receiving process.
-
Input, integer send_count:
-
The number of items in send_buf.
-
Input, integer send_datatype:
-
The type of the information in send_buf. The value of send_datatype should be a
standard MPI datatype or else a derived datatype.
-
Input, integer receiver;
-
The "id" of the process that is to receive the value of send_buf; the value of
receiver must be the rank of the process within the specified communicator.
Both the sending and receiving process must be part of the communicator.
-
Input, integer send_tag;
-
The "tag" for the message being sent.
-
Output, recv_datatype recv_buf(recvcount):
-
Data that the calling process receives from another process.
-
Input, integer recv_count:
-
The number of items (expected) in recv_buf.
-
Input, integer recv_datatype:
-
The type of the information in recv_buf. The value of recv_datatype should be a
standard MPI datatype or else a derived datatype.
-
Input, integer sender;
-
The "id" of the process that is to send the value of recv_buf; the value of
sender must be the rank of the process within the specified communicator.
A value of MPI_ANY_SOURCE accepts a message from any process within the communicator.
-
Input, integer recv_tag;
-
The "tag" for the message being sent. A value of MPI_ANY_TAG accepts a message
with any tag.
-
Input, integer communicator:
-
The communicator, of which the calling process, the sender and the receiver are members.
This is often simply MPI_COMM_WORLD, the communicator of all processes.
-
Output, integer status(MPI_STATUS_SIZE):
-
Returns information about the message received, useful if MPI_ANY_SOURCE
or MPI_ANY_TAG was specified:
-
status(MPI_TAG) is the actual tag of the message received;
-
status(MPI_SOURCE) is the actual sending process of the message received;
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Sendrecv_replace ( buffer, count, datatype, dest, send_tag,
source, recv_tag, communicator, status, ierr )
-
Purpose:
-
MPI_Sendrecv_replace sends to one process and then receives data from another, with the
new data overwriting the old.
-
Arguments:
-
-
Input/output, datatype buffer(count):
-
On input, the data to be sent to process dest; on output, the data received
from process source.
-
Input, integer count:
-
The number of items in buffer.
-
Input, integer datatype:
-
The type of the information in buffer. The value of datatype should be a
standard MPI datatype or else a derived datatype.
-
Input, integer dest;
-
The "id" of the process that is to receive the value of buffer.
-
Input, integer send_tag;
-
The "tag" for the message being sent.
-
Input, integer source;
-
The "id" of the process that is to send data to this process.
-
Input, integer recv_tag;
-
The "tag" for the message being received from source. A value of MPI_ANY_TAG
accepts a message with any tag.
-
Input, integer communicator:
-
The communicator, of which the calling process, the sender and the receiver are members.
This is often simply MPI_COMM_WORLD, the communicator of all processes.
-
Output, integer status(MPI_STATUS_SIZE):
-
Returns information about the message received, useful if MPI_ANY_SOURCE
or MPI_ANY_TAG was specified:
-
status(MPI_TAG) is the actual tag of the message received;
-
status(MPI_SOURCE) is the actual sending process of the message received;
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Ssend ( data, count, datatype, receiver, tag, communicator, ierr )
-
Purpose:
-
MPI_Ssend sends data from one process to another within a communicator, in synchronous mode.
-
Discussion:
-
Using synchronous mode, the send operation can begin whether or not the matching
receive operation has been posted yet. Until the matching receive operation is posted,
however, the send operation will not complete, and the routine will not return.
-
Arguments:
-
-
Input, datatype data(count):
-
A scalar or vector, whose type and size will be specified. The value of data,
as determined by the sending process, is to be passed to the receiving process.
-
Input, integer count:
-
The number of items within data.
-
Input, integer datatype:
-
The type of the information in data. The value of datatype should be a
standard MPI datatype or else a derived datatype.
-
Input, integer receiver;
-
The "id" of the process that is to receive the value of data; the value of
receiver must be the rank of the process within the specified communicator.
Both the sending and receiving process must be part of the communicator.
-
Input, integer tag;
-
The "tag" for the message. The sender and receiver need to agree on the meaning of
tags, or to ignore them.
-
Input, integer communicator:
-
The communicator, of which both the sender and receiver are members. This is often simply
MPI_COMM_WORLD, the communicator of all processes.
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Test ( request, flag, status, ierr )
-
Purpose:
-
MPI_Test tests to see if a particular I/O request has been completed.
-
Discussion:
-
MPI_Test is most often used when a message has been transferred using
nonblocking communication, as between
MPI_Isend and MPI_Irecv.
These routines return immediately, without a guarantee that the data has
been sent or received. While the calling process may be able to do some
other work, at some point, it is necessary to verify that the communication
is completed. MPI_Test may be used for this purpose. It simply tests whether
the I/O operation has been completed yet, and returns immediately.
MPI_Wait may also be used for this purpose.
-
Arguments:
-
-
Input, integer request:
-
the handle for the I/O operation, which was returned by
MPI_Isend, or MPI_Irecv,
or some other similar routine.
-
Output, logical flag:
-
has the value true if the I/O operation has been completed.
-
Output, integer status(MPI_STATUS_SIZE):
-
Returns information about the message, if the operation has been completed.
-
status(MPI_TAG) is the actual tag of the message received;
-
status(MPI_SOURCE) is the actual sending process of the message received;
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Testall ( count, requests, flag, statuses, ierr )
-
Purpose:
-
MPI_Testall tests to see if all of a set of I/O requests have been completed.
-
Arguments:
-
-
Input, integer count:
-
the number of I/O operations to be checked.
-
Input, integer requests(count):
-
the handles for the I/O operations, returned by
MPI_Isend, or MPI_Irecv,
or some other similar routine.
-
Output, logical flag:
-
has the value true if all the I/O operations have been completed.
-
Output, integer statuses(MPI_STATUS_SIZE,count):
-
For each I/O operation, returns information about the message, if the operation has been completed.
-
statuses(MPI_TAG,I) is the actual tag of message I;
-
statuses(MPI_SOURCE,I) is the actual sending process of message I;
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Type_commit ( datatype, ierr )
-
Purpose:
-
MPI_Type_commit is used to "register" a new datatype set up by
MPI_Type_vector.
-
Discussion:
-
Once a new datatype has been described by the use of MPI_Type_vector,
it must be "registered" by calling MPI_Type_commit before the datatype may actually be used.
Once the datatype is no longer to be used at all, the MPI memory set aside for it may be
freed up by calling MPI_Type_free.
-
Arguments:
-
-
Input, integer datatype:
-
the identifier for the new datatype, as returned by MPI_Type_vector;
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Type_contiguous ( count, old_datatype, new_datatype, ierr )
-
Purpose:
-
MPI_Type_contiguous defines a new MPI datatype comprising a given number of contiguous
values of an already defined MPI datatype.
-
Discussion:
-
Once a new datatype has been described by the use of this routine, it must be "registered"
by calling MPI_Type_commit before the datatype may actually be used.
Once the datatype is no longer to be used at all, the MPI memory set aside for it may be
freed up by calling MPI_Type_free.
Use MPI_Type_vector if you can't guarantee that the
pieces of data will be contiguous, but only that they will be regularly spaced.
-
Arguments:
-
-
Input, integer count:
-
the number of contiguous items of the old datatype to be used.
-
Input, integer old_datatype:
-
the identifier for the old datatype;
-
Output, integer new_datatype:
-
the identifier for the new datatype;
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Type_extent ( datatype, extent, ierr )
-
Purpose:
-
MPI_Type_extent returns the extent of any MPI datatype.
-
Discussion:
-
The extent of a datatype is (roughly) the number of bytes needed to store one
copy of the item, or more exactly, the number of bytes from the first to the last byte,
rounded upwards for any alignment requirements (such as a possible requirement that
data occupy multiples of a whole word).
-
Arguments:
-
-
Input, integer datatype:
-
the identifier for the datatype;
-
Output, integer extent:
-
the extent of the datatype;
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Type_free ( datatype, ierr )
-
Purpose:
-
MPI_Type_free is used to free the MPI memory associated with a new datatype that is no longer needed.
-
Discussion:
-
The new datatype was been described by MPI_Type_vector,
and registered by calling MPI_Type_commit. This routine
may be called to free up the MPI memory associated with the new datatype once it is no
longer needed.
-
Arguments:
-
-
Input, integer datatype:
-
the identifier for the datatype, as returned by MPI_Type_vector;
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Type_hindexed ( count, blocklengths, displacements, old_datatype, new_datatype, ierr )
-
Purpose:
-
MPI_Type_hindexed creates a new datatype by indexing (blocks of) elements of an set of data,
with the displacments measured in bytes.
-
Discussion:
-
MPI_Type_hindexed is appropriate when the user wishes to pass data that is a subset of
some array, but which is not contiguous nor regularly spaced.
After MPI_Type_hindexed is called to name and define the new datatype, you must call
MPI_Type_commit before using the new datatype.
Compare the related routine MPI_Type_indexed, which
does not measure displacements in bytes.
-
Arguments:
-
-
Input, integer count:
-
the number of blocks; each block is a string of contiguous entries, the number
of which may vary from block to block;
-
Input, integer blocklengths(count):
-
the number of items of type oldtype, in each block; this is typically 1.
-
Input, integer displacements(count):
-
the offset from the beginning of the array to the first element of each block,
measured in bytes.
-
Input, integer old_datatype:
-
the MPI datatype of the items in the blocks;
-
Output, integer new_datatype;
-
an identifier for this new datatype, which may be used, just like a predefined MPI datatype,
when passing data as messages.
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Type_hvector ( count, blocklength, stride, old_datatype, new_datatype, ierr )
-
Purpose:
-
MPI_Type_hvector can create a new datatype that is a vector of noncontiguous data,
with strides measured in bytes.
-
Discussion:
-
MPI_Type_hvector is appropriate when the user wishes to pass data that is not contiguous.
In Fortran, this includes cases where the data is one or more rows of a 2D array.
After MPI_Type_hvector is called to name and define the new datatype, you must call
MPI_Type_commit before using the new datatype.
Compare the related routine MPI_Type_vector, which
does not measure strides in bytes.
-
Arguments:
-
-
Input, integer count:
-
the number of blocks; each block is assumed to comprise blocklength contiguous
items of data;
-
Input, integer blocklength:
-
the number of items of type oldtype, in each block; this is typically 1. But if we were
passing, say, three consecutive rows of any array, then blocklength would be 3.
-
Input, integer stride:
-
the distance between the first items of consecutive blocks. This distance is measured
in bytes.
-
Input, integer old_datatype:
-
the MPI datatype of the items in the blocks;
-
Output, integer new_datatype;
-
an identifier for this new datatype, which may be used, just like a predefined MPI datatype,
when passing data as messages.
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Type_indexed ( count, blocklengths, displacements, old_datatype, new_datatype, ierr )
-
Purpose:
-
MPI_Type_indexed creates a new datatype by indexing (blocks of) elements of an set of data.
-
Discussion:
-
MPI_Type_indexed is appropriate when the user wishes to pass data that is a subset of
some array, but which is not contiguous nor regularly spaced. An interesting example
of such a case is the lower triangle of a matrix.
After MPI_Type_indexed is called to name and define the new datatype, you must call
MPI_Type_commit before using the new datatype.
-
Arguments:
-
-
Input, integer count:
-
the number of blocks; each block is a string of contiguous entries, the number
of which may vary from block to block;
-
Input, integer blocklengths(count):
-
the number of items of type oldtype, in each block; this is typically 1. But if we were
passing the lower triangle of a 4 by 4 matrix, this would be (/ 4, 3, 2, 1 /);
-
Input, integer displacements(count):
-
the offset from the first element of the original array to the first element of each block.
This is essentially the (zero-based) index of the first element of each block. In the lower triangle
example, assuming that the 4 by 4 array is stored compactly, the displacement vector
would be (/ 0, 5, 10, 15 /).
-
Input, integer old_datatype:
-
the MPI datatype of the items in the blocks;
-
Output, integer new_datatype;
-
an identifier for this new datatype, which may be used, just like a predefined MPI datatype,
when passing data as messages.
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Type_struct ( count, blocklengths, displacements, old_datatypes, new_datatype, ierr )
-
Purpose:
-
MPI_Type_struct creates a new datatype by indexing (blocks of) elements of data of varying
datatypes.
-
Discussion:
-
MPI_Type_struct is appropriate when the user wishes to set up a datatype that represents
a collection of data of different types.
After MPI_Type_indexed is called to name and define the new datatype, you must call
MPI_Type_commit before using the new datatype.
-
Arguments:
-
-
Input, integer count:
-
the number of blocks; each block is a string of contiguous entries of the same datatype;
-
Input, integer blocklengths(count):
-
the number of items of type oldtype, in each block; this is typically 1. But if we were
passing the lower triangle of a 4 by 4 matrix, this would be (/ 4, 3, 2, 1 /);
-
Input, integer displacements(count):
-
the offset from the first element of the original array to the first element of each block.
This is essentially the (zero-based) index of the first element of each block. In the lower triangle
example, assuming that the 4 by 4 array is stored compactly, the displacement vector
would be (/ 0, 5, 10, 15 /).
-
Input, integer old_datatypes(count):
-
for each block, the MPI datatype shared by all the items in the block;
-
Output, integer new_datatype;
-
an identifier for this new datatype, which may be used, just like a predefined MPI datatype,
when passing data as messages.
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Type_vector ( count, blocklength, stride, old_datatype, new_datatype, ierr )
-
Purpose:
-
MPI_Type_vector can create a new datatype that is a vector of noncontiguous data.
-
Discussion:
-
MPI_Type_vector is appropriate when the user wishes to pass data that is not contiguous.
In Fortran, this includes cases where the data is one or more rows of a 2D array.
After MPI_Type_vector is called to name and define the new datatype, you must call
MPI_Type_commit before using the new datatype.
-
Arguments:
-
-
Input, integer count:
-
the number of blocks; each block is assumed to comprise blocklength contiguous
items of data;
-
Input, integer blocklength:
-
the number of items of type oldtype, in each block; this is typically 1. But if we were
passing, say, three consecutive rows of any array, then blocklength would be 3.
-
Input, integer stride:
-
the distance between the first items of consecutive blocks. This distance is measured
in terms of the type oldtype. Again, if we were passing a row of an array,
stride would be the leading or first dimension of the array.
-
Input, integer old_datatype:
-
the MPI datatype of the items in the blocks;
-
Output, integer new_datatype;
-
an identifier for this new datatype, which may be used, just like a predefined MPI datatype,
when passing data as messages.
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Unpack ( buffer, buffer_size, buffer_position, data, count, datatype, communicator, ierr )
-
Purpose:
-
MPI_Unpack unpacks data from a buffer.
-
Discussion:
-
The data was presumably packed by another process, using MPI_Pack.
-
Arguments:
-
-
Input, integer buffer(buffer_size/4);
-
the array into which the data was packed. FORTRAN will expect buffer
to be declared with a standard type, so you can declare it as an integer variable
of a given size. MPI_Unpack will want to know the size of this array, as measured
in bytes. Integers are normally equivalent to 4 bytes.
-
Input, integer buffer_size;
-
the size of the buffer, as measured in bytes.
-
Input/output, integer buffer_position;
-
a pointer to the next location in the buffer. On first call, you would normally set
buffer_position=0. Each time the routine is called to unpack more data from the buffer, the
pointer is updated. So the only thing you have to do is reset the value to 0 if you
have read your data, and expect to receive new data into the buffer that will again
have to be unpacked.
-
Output, datatype data(count):
-
Information that was unpacked from the buffer.
-
Input, integer count:
-
The number of items within data.
-
Input, integer datatype:
-
The type of the information in data. The value of datatype should be a
standard MPI datatype or else a derived datatype.
-
Input, integer communicator:
-
The communicator used to transmit the packed data.
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Wait ( request, status, ierr )
-
Purpose:
-
MPI_Wait waits for an I/O request to complete.
-
Discussion:
-
MPI_Wait is most often used when a message has been transferred using
nonblocking communication, as between
MPI_Isend and MPI_Irecv.
These routines return immediately, without a guarantee that the data has
been sent or received. While the calling process may be able to do some
other work, at some point, it is necessary to verify that the communication
is completed. MPI_Wait may be used for this purpose.
MPI_Test may also be used for this purpose.
-
Arguments:
-
-
Input, integer request:
-
the handle for the I/O operation, which was returned by
MPI_Isend, or MPI_Irecv,
or some other similar routine.
-
Output, integer status(MPI_STATUS_SIZE):
-
Returns information about the message received, useful if MPI_ANY_SOURCE
or MPI_ANY_TAG was specified:
-
status(MPI_TAG) is the actual tag of the message received;
-
status(MPI_SOURCE) is the actual sending process of the message received;
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Waitall ( count, request_array, status_array, ierr )
-
Purpose:
-
MPI_Waitall waits until all I/O requests have completed.
-
Discussion:
-
MPI_Waitall is a generalization of MPI_Wait.
-
Arguments:
-
-
Input, integer count:
-
the number of I/O requests to be monitored.
-
Input, integer request_array(count):
-
the handles for the I/O operations, returned by
MPI_Isend, or MPI_Irecv,
or some other similar routine.
-
Output, integer status_array(MPI_STATUS_SIZE,count):
-
Returns information about the I/O operations, useful if MPI_ANY_SOURCE
or MPI_ANY_TAG was specified:
-
status_array(MPI_TAG,i) is the actual tag of message i;
-
status_array(MPI_SOURCE,i) is the actual sending process of message i;
-
Output, integer ierr:
-
The error status.
-
Call:
-
subroutine MPI_Waitany ( count, request_array, status_array, ierr )
-
Purpose:
-
MPI_Waitany waits until one I/O requests has completed.
-
Discussion:
-
MPI_Waitany is a generalization of MPI_Wait.
-
Arguments:
-
-
Input, integer count:
-
the number of I/O requests to be monitored.
-
Input, integer request_array(count):
-
the handles for the I/O operations, returned by
MPI_Isend, or MPI_Irecv,
or some other similar routine.
-
Output, integer status_array(MPI_STATUS_SIZE,count):
-
Returns information about the I/O operations, useful if MPI_ANY_SOURCE
or MPI_ANY_TAG was specified:
-
status_array(MPI_TAG,i) is the actual tag of message i;
-
status_array(MPI_SOURCE,i) is the actual sending process of message i;
-
Output, integer ierr:
-
The error status.
-
Call:
-
function MPI_Wtick ( )
-
Purpose:
-
MPI_Wtick returns the time between successive ticks of the real time clock.
-
Arguments:
-
-
Output, double precision MPI_Wtick:
-
the time, in seconds, between succesive ticks of the real time clock.
-
Call:
-
function MPI_Wtime ( )
-
Purpose:
-
MPI_Wtime returns the current reading of the real time clock.
-
Arguments:
-
-
Output, double precision MPI_Wtime:
-
the current reading of the real time clock, in seconds.
Certain MPI routines allow the user to write an auxilliary routine to carry
out certain operations. In FORTRAN, these routines must be declared EXTERNAL
so that their names can be passed in as arguments. The routines include:
Although MPI provides a set of symbolic names for reduction operations,
such as MPI_SUM, the user may define a new reduction operation using
MPI_Op_create. As part of this call, the user
must define an external function that performs a step of the reduction. The
specifications for that function are given here, the function given the dummy
name of op_fun:
-
Call:
-
subroutine op_fun ( in_vector, out_vector, len_vector, MPI_datatype )
-
Purpose:
-
op_fun is a user-defined function that applies one step of reduction to a set of data.
-
Arguments:
-
-
Input, datatype in_vector(len_vector):
-
the data to be reduced, that is, added or summed in some way with the running totals (here
we are pretending that the reduction operation is addition!).
-
Input/output, datatype out_vector(len_vector):
-
the "running totals", that hold that reduced data. On output, the values of in_vector
have been combined with the input values of out_vector.
-
Input, integer MPI_datatype:
-
the MPI datatype of the data.
If the user wishes to cache attributes with a communicator, then the attribute must
be declared with a call to MPI_Keyval_create, and
a routine must be supplied which may be used to copy the attribute if the communicator
is duplicated.
(The user can avoid specifying this routine by supplying the symbolic
value MPI_DUP_FN or MPI_NULL_COPY_FN.)
The specifications for that function are given here, the function given the dummy
name of copy_fun:
-
Call:
-
function copy_fun ( communicator, keyval, extra_state, attribute_value_in,
attribute_value_out, flag )
-
Purpose:
-
copy_fun is a user-defined function that copies a cached attribute.
-
Arguments:
-
-
Input, integer communicator:
-
the communicator whose attribute is to be copied.
-
Input, integer keyval:
-
the key value or handle assigned to the attribute.
-
Input, integer extra_state:
-
the extra argument that was supplied with the definition of the copy function.
-
Input, integer attribute_value_in:
-
the attribute to be copied.
-
Output, integer attribute_value_out:
-
the copy of the attribute.
-
Output, logical flag:
-
is TRUE if the attribute has been copied and FALSE otherwise.
-
Output, integer copy_fun:
-
should return 0 if the copy was a success, or a nonzero value if there was an error.
The MPE library is an auxiliary library which includes locally written routines
that augment MPI. There is, in particular, a set of MPE routines available with
the MPICH implementation of MPI. Use of MPE routines is non-portable, since the
contents of the MPE library will vary from one installation to the next.
Because some of the routines are discussed or used in the MPI references, we list
a few of them here.
-
Call:
-
subroutine MPE_Decomp1d ( m, n, rank, s, e )
-
Purpose:
-
MPE_Decomp1d returns a "chunk" of work for one process to work on.
-
Discussion:
-
This routine is used for load balancing. It divides a set of
M tasks among N processes, so that each process gets about the
same amount of work and its tasks are consecutive. That's
handy if the tasks correspond to data, which should be contiguous.
If M is exactly divisible by N, then each process gets M/N consecutive tasks.
Otherwise, if there is a remainder of P, then the first P processes get
(M/N)+1 tasks, and the last (N-P) processes get M/N tasks.
-
Example:
-
( M = 27, N = 10, so P = 7 )
| rank | S | E |
| 0 | 1 | 3 |
| 1 | 4 | 6 |
| 2 | 7 | 9 |
| 3 | 10 | 12 |
| 4 | 13 | 15 |
| 5 | 16 | 18 |
| 6 | 19 | 21 |
| 7 | 22 | 23 |
| 8 | 24 | 25 |
| 9 | 26 | 27 |
-
Arguments:
-
-
Input, integer m:
-
the number of items of work.
-
Input, integer n:
-
the number of processes among which the work is to be divided.
-
Input, integer rank:
-
the rank of this process, between 0 and n-1.
-
Output, integer s, e:
-
the first and last items of work for this process. The minimum value of s is 1,
and the maximum value of e is m.
-
Call:
-
subroutine MPE_Ibcast ( data, count, datatype, sender, communicator, request, ierr )
-
Purpose:
-
MPE_Ibcast broadcasts data from one process to all others within a communicator, using
nonblocking communication.
-
Discussion:
-
This routine performs the same function as MPI_Bcast except
that it is nonblocking. Therefore, it returns a request handle that must be explicitly
checked by a call to a routine such as MPI_Test or
MPI_Wait,
Messages send by a broadcast do not have a tag; if several messages are transmitted in this
way, they are simply received in the order sent.
This is a collective communication, so all the processes in the communicator must
issue and participate in the command.
This routine is an IBM extension available on the SP series.
-
Arguments:
-
-
Input, datatype data(count):
-
A scalar or vector, whose type and size will be specified. The value of data,
as determined by the sending process, is to be passed to all other processes
within the communicator.
-
Input, integer count:
-
The number of items within data.
-
Input, integer datatype:
-
The type of the information in data. The value of datatype should be a
standard MPI datatype or else a derived datatype.
-
Input, integer sender;
-
The "id" of the process that is to send the value of data; the value of
sender must be the rank of the process within the specified communicator.
-
Input, integer communicator:
-
The communicator within which the data is to be broadcast. This is often simply
MPI_COMM_WORLD, the communicator of all processes.
-
Output, integer request:
-
a handle, which can be used to determine if the data has been received yet. Simply
call MPI_Test or MPI_Wait, and include
the request handle.
-
Output, integer ierr:
-
The error status.
-
Parallel Programming with MPI,
Peter Pacheco,
Morgan Kaufman, 1996.
-
High Performance Computing and the Art of Parallel Programming:
an Introduction for Geographers, Social Scientists, and Engineers,
Stan Openshaw and Ian Turton,
Routledge, 2000.
-
Using MPI: Portable Parallel Programming with the Message-Passing Interface,
William Gropp, Ewing Lusk, Anthony Skjellum,
Second Edition, MIT Press, 1999,
Available as
an online e-book.
-
Using MPI-2: Advanced Features of the Message-Passing Interface,
William Gropp, Ewing Lusk, Rajiv Thakur,
Second Edition, MIT Press, 1999,
Available as
an online e-book.
-
The MPI web site at Argonne National Lab:
http://www-unix.mcs.anl.gov/mpi/
-
MPI: The Complete Reference,
Volume I: The MPI Core,
Marc Snir, Steve Otto, Steven Huss-Lederman, David Walker, Jack Dongarra,
Second Edition, MIT Press, 1998,
Available as
an online e-book.
-
MPI: The Complete Reference,
Volume II: The MPI-2 Extensions,
William Gropp, Steven Huss-Lederman, Andrew Lumsdaine, Ewing Lusk, Bill Nitzberg,
William Saphir, Marc Snir,
Second Edition, MIT Press, 1998,
Available as
an online e-book.
-
MPI: A Message Passing Interface Standard,
The Message Passing Interface Forum, 1995,
Available online from the MPI Forum.
-
MPI-2: Extensions to the Message Passing Interface,
The Message Passing Interface Forum, 1997,
Available online from the MPI Forum.
-
RS/600 SP: Practical MPI Programming,
Scott Vetter, Yukiya Aoyama, Jun Nakano,
IBM Redbooks, 1999
ISBN: 0738413658
Available online from
IBM Redbooks.
You can return to the
HTML web page.
Last revised on 15 September 2005.