We suppose the reader familiar with rudiments of MPI. We comment only
the functions of I/O data management of the codes that follow. The
description of instructions comes from http://www.mpi-forum.org.
Please, refer also to
http://www.mpi-forum.org/docs/mpi-20-html/node171.htm#Node171
for the complete documentation about I/Os: some concepts has not been
covered in the book, so reader is invited to read whole the
documentation before programming suggested exercices.
int MPI_Type_struct( count, blocklens, indices, old_types, newtype ) int count; int blocklens[]; MPI_Aint indices[]; MPI_Datatype old_types[]; MPI_Datatype *newtype; Input Parameters count - number of blocks (integer) -- also number of entries in arrays array_of_types , array_of_displacements and array_of_blocklengths blocklens - number of elements in each block (array) indices - byte displacement of each block (array) old_types - type of elements in each block (array of handles to datatype objects) Output Parameter newtype - new datatype (handle)
MPI_FILE_SET_VIEW(fh, disp, etype, filetype, datarep, info) [ INOUT fh] file handle (handle) [ IN disp] displacement (integer) [ IN etype] elementary datatype (handle) [ IN filetype] filetype (handle) [ IN datarep] data representation (string) [ IN info] info object (handle) The MPI_FILE_SET_VIEW routine changes the process's view of the data in the file. The start of the view is set to disp; the type of data is set to etype; the distribution of data to processes is set to filetype; and the representation of data in the file is set to datarep. In addition, MPI_FILE_SET_VIEW resets the individual file pointers and the shared file pointer to zero. MPI_FILE_SET_VIEW is collective; the values for datarep and the extents of etype in the file data representation must be identical on all processes in the group; values for disp, filetype, and info may vary. The datatypes passed in etype and filetype must be committed. The etype always specifies the data layout in the file. If etype is a portable datatype (see Section Semantic Terms), the extent of etype is computed by scaling any displacements in the datatype to match the file data representation. If etype is not a portable datatype, no scaling is done when computing the extent of etype. The user must be careful when using nonportable etypes in heterogeneous environments; see Section Datatypes for File Interoperability for further details.
MPI_FILE_READ_AT(fh, offset, buf, count, datatype, status) [ IN fh] file handle (handle) [ IN offset] file offset (integer) [ OUT buf] initial address of buffer (choice) [ IN count] number of elements in buffer (integer) [ IN datatype] datatype of each buffer element (handle) [ OUT status] status object (Status) MPI_FILE_READ_AT_ALL(fh, offset, buf, count, datatype, status) [ IN fh] file handle (handle) [ IN offset] file offset (integer) [ OUT buf] initial address of buffer (choice) [ IN count] number of elements in buffer (integer) [ IN datatype] datatype of each buffer element (handle) [ OUT status] status object (Status) MPI_FILE_READ_AT_ALL is a collective version of the blocking MPI_FILE_READ_AT interface. MPI_FILE_WRITE_AT(fh, offset, buf, count, datatype, status) [ INOUT fh] file handle (handle) [ IN offset] file offset (integer) [ IN buf] initial address of buffer (choice) [ IN count] number of elements in buffer (integer) [ IN datatype] datatype of each buffer element (handle) [ OUT status] status object (Status)
MPI_TYPE_CREATE_SUBARRAY(ndims, array_of_sizes, array_of_subsizes, array_of_starts, order, oldtype, newtype) IN ndims number of array dimensions (positive integer) IN array_of_sizes number of elements of type oldtype in each dimension of the full array (array of positive integers) IN array_of_subsizes number of elements of type oldtype in each dimension of the subarray (array of positive integers) IN array_of_starts starting coordinates of the subarray in each dimension (array of nonnegative integers) IN order array storage order flag (state) IN oldtype array element datatype (handle) OUT newtype new datatype (handle) The subarray type constructor creates an MPI datatype describing an n-dimensional subarray of an n-dimensional array. The subarray may be situated anywhere within the full array, and may be of any nonzero size up to the size of the larger array as long as it is confined within this array. This type constructor facilitates creating filetypes to access arrays distributed in blocks among processes to a single file that contains the global array. This type constructor can handle arrays with an arbitrary number of dimensions and works for both C and Fortran ordered matrices (i.e., row-major or column-major). Note that a C program may use Fortran order and a Fortran program may use C order. The ndims parameter specifies the number of dimensions in the full data array and gives the number of elements in array_of_sizes, array_of_subsizes, and array_of_starts. The number of elements of type oldtype in each dimension of the n-dimensional array and the requested subarray are specified by array_of_sizes and array_of_subsizes, respectively. For any dimension i, it is erroneous to specify array_of_subsizes[i] < 1 or array_of_subsizes[i] > array_of_sizes[i]. The array_of_starts contains the starting coordinates of each dimension of the subarray. Arrays are assumed to be indexed starting from zero. For any dimension i, it is erroneous to specify array_of_starts[i] < 0 or array_of_starts[i] > ( array_of_sizes[i] - array_of_subsizes[i]).