mpi-parallel-io
Table of Contents
MPI Parallel I/O
Parallel I/O lets multiple processes write to the same file with explicit offsets. MPI_File_open and MPI_File_write_at_all coordinate without file position races.
MPI_File fh; MPI_File_open(MPI_COMM_WORLD, "output.bin", MPI_MODE_CREATE | MPI_MODE_WRONLY, MPI_INFO_NULL, &fh); MPI_Offset offset = (MPI_Offset)rank * N * sizeof(double); MPI_File_write_at_all(fh, offset, local_data, N, MPI_DOUBLE, MPI_STATUS_IGNORE); MPI_File_close(&fh);
File views (MPI_File_set_view) let each process define its portion of the file using a derived datatype so that subsequent read/write calls use a logical offset within the view rather than raw byte offsets. This is the standard approach for writing distributed arrays: each process defines a view covering its slice of the global array, then calls MPI_File_write as if writing a contiguous local buffer.
mpi-parallel-io.md · Last modified: by 127.0.0.1
