Hi, for the following code:
#include <mpi.h> int main() { MPI_Init(NULL, NULL); int world_rank, world_size; MPI_Comm_rank(MPI_COMM_WORLD, &world_rank); MPI_Comm_size(MPI_COMM_WORLD, &world_size); MPI_Offset offset; MPI_Status status; MPI_File fh; MPI_File_open(MPI_COMM_WORLD, "myfile", MPI_MODE_CREATE | MPI_MODE_WRONLY, MPI_INFO_NULL, &fh); offset = world_rank * sizeof(int); if (world_rank == 3) { MPI_File_write_at(fh, offset, &world_rank, 1, MPI_INT, &status); } MPI_File_close(&fh); MPI_Finalize(); return 0; } I get the following output using hexdump -C myfile: 00000000 00 00 00 00 00 00 00 00 00 00 00 00 03 00 00 00 |................| 00000010 My question is, can I assume that when skipping the beginning of the file that MPI will fill up with zeros? Or is it implementation dependent? I have read the standard, but I could not found anything meaningful expected for: "Initially, all processes view the file as a linear byte stream, and each process views data in its own native representation (no data representation conversion is performed). (POSIX files are linear byte streams in the native representation.) The file view can be changed via the MPI_FILE_SET_VIEW routine." which I am not sure is actually relevant or not. Thanks a lot