No, this is not true.
MPI I/O directly supports reading and writing files which contain
data of any combination of types in at least three different ways:
the etype, the filetype, and by changing the file view after the
file is opened.
Both the etype and filetype are completely general MPI datatypes
and can be structured types (such as (index, value) pairs) in addition
to the simple types like integers and floats. Even more general
file data is supported by changing the file view (via the
old MPI_File_control or new MPI_View routines).
For example, a file with a 100 character header followed by some
number of index/value pairs:
header etype-1 etype-2
| | | | |
char [100], int, int, int, double, int, int, int, double, ...
| | | | |
"run 27A" x y z temp x y z temp
This would be defined in MPI I/O by the following (pardon the
pseudo-syntax):
/*
* Create an etype to represent an (x,y,z,temp)
*/
MPI_Datatype etype;
int blocklengths[] = {1, 1};
MPI_Aint displacements[] = {0, 3*sizeof(int)};
MPI_Datatype types[2];
MPI_Type_contiguous(3, MPI_INT, &types[0]);
types[1] = MPI_DOUBLE;
MPI_Type_struct(1, blocklengths, displacements, types, &etype);
/*
* Create filetype which partitions etypes onto processes
*/
MPI_Datatype filetype;
...
/*
* Open the file
*/
MPI_Open(comm, "file", MPI_RDONLY, info, &fh);
MPI_View(fh, 100*sizeof(char), etype, filetype, info);
/*
* Read the first (x,y,z,temp)
*/
MPI_Status status;
struct point {
int x, y, z;
double temp;
} point;
MPI_Read_next(fh, &point, etype, 1, &status);
...