On Wed, Dec 15, 2010 at 01:21:35PM -0800, Tom Rosmond wrote: > I want to implement an MPI-IO solution for some of the IO in a large > atmospheric data assimilation system. Years ago I got some small > demonstration Fortran programs ( I think from Bill Gropp) that seem to > be good candidate prototypes for what I need. Two of them are attached > as part of simple shell script wrappers (writea, writeb). Both programs > are doing equivalent things to write a small test file, but using > different MPI functions. Specifically, 'writea' does multiple writes > into the file using the 'MPI_FILE_SEEK', while 'writeb' does one write > call using 'MPI_TYPE_CREATE_SUBARRAY', and 'MPI_FILE_SET_VIEW'. My > problem is that while 'writea' works correctly, ' writeb' fails with an > IO_ERROR error code returned from the final 'MPI_FILE_WRITE' call. I > have look at the code carefully and studied the MPI standard for the > functions used, and can't see what is wrong with the failing call, but I > must be missing something. I seem to remember the program running > correctly years ago, but that was on another platform and MPI > environment.
My test environment isn't that different from yours, though I am running on a single node (laptop). Both MPICH2-1.3.1 and OpenMPI-1.4 pass the test. Some observations: - writeb leaks a datatype (you do not free the subarray type) - in writea you don't really need to seek and then write. You could call MPI_FILE_WRITE_AT_ALL. - You use collective I/O in writea (good for you!) but use independent I/O in writeb. Especially for a 2d subarray, you'll likely see better performance with MPI_FILE_WRITE_ALL. ==rob -- Rob Latham Mathematics and Computer Science Division Argonne National Lab, IL USA