This implements parallel file I/O using MPI file I/O with collective file access (all processors must participate in file access) for unstructured data where processes have different amount of data elements and the ordering of the data elements in the file is not important. The file format comes with a header including additional information about the data distribution across processes. This information may be important, e.g., for checkpoint files in case one wants to restart the simulation in the exact same state.
The code takes one argument, which defines the target number of double precision values held in a 1D array on each processor, the default value is 100,000 However, the final number of elements per process will be determined randomly around this value. The array value for entry i on process p is i + p + 0.1. This data is written & read to/from file data.mpiio
The program reports the time for processes to write and read data to/from the file.