To: Hubert Ritzdorf cc: mpi-core@XXXXXXXXXXX Subject: Re: Question to MPI/IO Date: Tue, 02 Feb 1999 10:55:12 -0800 From: Bill Nitzberg Sender: owner-mpi-core@XXXXXXXXXXX I agree with Jean-Pierre and John, version (i) is correct. - bill Bill Nitzberg, PhD Work: nitzberg@XXXXXXXXXXXX MRJ Technology Solutions Tel: (650) 604-4513 NASA Ames Research Center, M/S 258-6 FAX: (650) 966-8669 Moffett Field, CA 94035-1000 Personal: nitzberg@XXXXXXXXXX Jean-Pierre Prost replied: > Version (i) is the version intended by the standard, which says: > "The function must begin copying at the location in userbuf specified > by position into the (tiled) datatype." > Note that your note was confusing, because the descriptions of the two > alternatives before the code and within the code are opposite. The > right description is the one given within the code. Instead of saying > "the user must find...", I would rather say "the user defined conversion > routine must determine..." John May replied:> I agree with Jean-Pierre that version (i) is correct. Version > (ii) would not be as simple as it looks because the user might > call MPI_File_write with complex derived data type, and the > first call to the conversion function might return after > traversing only part of the type. Having the MPI implementation > figure out the right buffer location for the second call would > be pretty complicated, but the user function can just cache > this information somewhere when it finishes the first call and > then pick it up when it starts the second call. > > Since you're working on the datarep converters, you might be > interested in a test code we posted on the web at > http://www.llnl.gov/sccd/lc/piop/ . Look for the links at > the end of the MPI-IO section. Hubert Ritzdorf wrote:> > I am implementing MPI for NEC SX computers and I have a question to > Datarep Conversion functions (chapter 9.5.3 of the MPI-2 document) > > (*) If MPI cannot allocate a (file) buffer large enough to hold all the > the data to be converted, the standard says: > > For the first call, MPI will call the (conversion) function with > ``position'' set to zero. ... > Then in subsequent calls to the conversion function, > MPI will increment the value in ``position'' by the ``count'' > of items converted in the previous call. > > My question is: > Is the user buffer ``buf'' incremented correspondingly > in the second call (and further calls) of the conversion function > (cf. Version i below) or > must the user find the correct position in the user buffer ``buf'' > within the conversion function (cf. Version ii below)? > > i.e. > > /* first call */ > position = 0; > write_fn (buf, datatype, count, filebuf, position, extra_state); > > /* write filebuf to the file */ > > write (.., filebuf, count*datarep_size); > > > > /* (Version i) > second call, the user must find the correct position in buf */ > > position = count; > write_fn (buf, datatype, count, filebuf, position, extra_state); > > > or > > /* (Version ii) > second call, MPI transfers the new user buffer location */ > > position = count; > next_buf = (char *) buf + count * native_size; > write_fn (next_buf, datatype, count, filebuf, position, > extra_state); > /* write filebuf to the file */ > > write (.., filebuf, count*datarep_size); >