program mpi_io_hint implicit none include "mpif.h" integer rank, info, err, fp, cmode, mpistatus integer buf(10) call MPI_Init(err) call MPI_Comm_rank(MPI_COMM_WORLD, rank, err) ! create and set MPI-IO hint, romio_no_indep_rw call MPI_Info_create(info, err) call check(err, "MPI_Info_create") call MPI_Info_set(info, 'romio_no_indep_rw', 'true', err) call check(err, "MPI_Info_set") ! create file cmode = IOR(MPI_MODE_RDWR, MPI_MODE_CREATE) call MPI_File_open(MPI_COMM_WORLD, 'testfile', cmode, + info, fp, err) call check(err, "MPI_File_open") ! free the info object call MPI_Info_free(info, err) call check(err, "MPI_Info_free") ! Only root writes to the file using independent call if (rank .EQ. 0) then call MPI_File_write(fp, buf, 10, MPI_INTEGER, mpistatus, err) call check(err, "MPI_File_write") endif call MPI_File_close(fp, err) call check(err, "MPI_File_close") call MPI_Finalize(err) end subroutine check(err, func) implicit none include "mpif.h" integer err character func*(*) ! local variables integer ierr, err_len, errorclass character(LEN=MPI_MAX_ERROR_STRING) err_string if (err .NE. MPI_SUCCESS) then call MPI_Error_class(err, errorclass, ierr) call MPI_Error_string(err, err_string, err_len, ierr) print*,'Error at ', trim(func),' ',trim(err_string) endif end ! subroutine check