[MPICH] MPI-IO, vector dataype

Rajeev Thakur thakur at mcs.anl.gov
Thu May 3 15:44:23 CDT 2007


> Question about running multiple procs on a single
> machine.  There appears to be no way to do this
> with mpd, and from what I gather, gforker is the
> right way to go but requires rebuilding mpi and
> setting up some path munging scripts to differentiate
> between mpd and gforker mpiexec bins.  Is that
> correct?

It is easy to run on a single machine. With MPD, all you need to do is
% mpd &
% mpiexec -n 2 a.out 

> Just to see if I understand, let me see if
> I can summarize your explanation below.
> 
> Rajeev Thakur wrote:
> >> Given (just the relevant code snippets)
> >>     nprocs = 2, FILESIZE = 256,  INTS_PER_BLK = 4,
> >>     bufsize(FILESIZE/nprocs), nints(bufsize/sizeof(int)),
> >>
> >>    filetype.Create_vector(nints/INTS_PER_BLK, INTS_PER_BLK,
> >>                           INTS_PER_BLK * nprocs);
> >>
> >>    which works out to  Create_vector(4, 8, 16)  (intrinsic 
> >> type MPI_INT)
> > 
> > Should be (8, 4, 8)
> 
> So we want to write a file of 256 bytes/64 ints, by
> having 2 procs write 32 ints in 4 blocks of 8 ints each,
> each proc writing into alternating blocks.

I just plugged in the values you have defined into the expressions above,
which gives (8,4,8). Note that it is not 4 blocks of 8 ints each; it is 8
blocks of 4 ints each because you have defined INTS_PER_BLK=4.
 
> So the "count" argument is the total number of blocks
> written by all of the procs?

No, just one process.
 
> The prototype indicates the arguments are (int count, int blocklength,
> int stride)
> 
> >  
> >>    f.Set_view(INTS_PER_BLK*sizeof(int)*myrank, MPI_INT,
> >>                     filetype, "native", MPI_INFO_NULL);
> >>
> >>    which works out to Set_view(32 or 0 bytes, ...)
> 
> > Should be (16 or 0 bytes, ...)
> 
> If the blocksize is 8, and the displacement is in bytes 
> "(Always bytes!)",
> and we want the procs to write alternate blocks, so that the 
> rank 1 proc
> first writes into the second block, how can the displacement 
> be anything
> other than 32/0?

Since INTS_PER_BLK is 4, rank 0 wants to skip 0, and rank 1 wants to skip
rank 0's block of size 4 = 16 bytes.

Rajeev




More information about the mpich-discuss mailing list