[MPI3 Fortran] MPI_SIZEOF question

Rolf Rabenseifner rabenseifner at hlrs.de
Wed Jun 1 03:23:20 CDT 2011


MPI_SIZEOF can be used only for (MPI-2.2, page 494, line 41):

   <type> X   ! a Fortran variable of numeric intrinsic type

(Note that all other MPI routines with buffers are always declared 
 with
   <type> BUF(*)
 which should mean the same as the new TYPE(*),DIMENSION(..).
 Based on this, it is clear that MPI_SIZEOF is provided only 
 for non-arrays.)

MPI-2.2, page 496, line 40 shows that it can be uused also 
for arrays, but with the meaning of using only one element.

Example
 INTEGER :: size, ierror
 INTEGER :: xtype1, xtype2 ! storage for a MPI derived datatype handle
 REAL(SELECT_REAL_KIND(2,5)) :: x(100)
 CALL MPI_SIZEOF(x, size, ierror)
 CALL MPI_TYPE_MATCH_SIZE(MPI_CLASS_REAL, size, xtype1, ierror) 

should return a datatype handle that has locally the same 
meaning as

 CALL MPI_TYPE_CREATE_F90_REAL(2,5, xtype2, ierror)

The matching rules for xtype1 and xtype2 are different:
- xtype1 handles in two different MPI processes match 
  if the size is identical in these two processes.
- xtype2 handles in two different MPI processes match 
  if the arguments 2,5 are identical in these two processes;´
  the internal presentation in a heterogenous system
  may be different, i.e., one node may provide internally
  REAL*2 and size is 2, and on another node only
  REAL*4 is provided and size is 4.

I propose, not to touch this part of the standard as long as
Fortran does not provide an exactly same intrinsic SIZEOF
function.

Rolf


----- Original Message -----
> From: "Craig E Rasmussen" <rasmussn at lanl.gov>
> To: "MPI-3 Fortran working group" <mpi3-fortran at lists.mpi-forum.org>
> Sent: Tuesday, May 31, 2011 8:50:35 PM
> Subject: Re: [MPI3 Fortran] MPI_SIZEOF question
> STORAGE_SIZE returns the size in bits so I'm not sure it is
> appropriate. I think C_SIZEOF would be better although it only works
> with interoperable types which I think is OK for MPI-3. But if the
> object is an array, C_SIZEOF returns the length (in bytes) of the
> entire array. I'm not sure what value MPI_SIZEOF is supposed to
> provide. Is it related to C?
> 
> -craig
> 
> 
> On May 23, 2011, at 12:16 PM, Jeff Squyres wrote:
> 
> > On May 23, 2011, at 10:47 AM, Bill Long wrote:
> >
> >> Ultimately, I'd be inclined to just scrap the routine as redundant.
> >
> > This function has been there since 1996 (i.e., MPI-2).
> >
> > Is it now obsolete? I.e., the Fortran instrinsic STORAGE_SIZE
> > suitable? If so, we can deprecate the old MPI_SIZEOF function and
> > not put it in the new MPI-3 fortran module... but it still has to be
> > implemented in the existing MPI-2 fortran "use mpi" module (even if
> > it's deprecated).
> >
> > Can you answer Rolf's questions? I'm particularly interested in the
> > fortran wrapper questions.
> >
> > --
> > Jeff Squyres
> > jsquyres at cisco.com
> > For corporate legal information go to:
> > http://www.cisco.com/web/about/doing_business/legal/cri/
> >
> >
> > _______________________________________________
> > mpi3-fortran mailing list
> > mpi3-fortran at lists.mpi-forum.org
> > http://lists.mpi-forum.org/mailman/listinfo.cgi/mpi3-fortran
> 
> 
> _______________________________________________
> mpi3-fortran mailing list
> mpi3-fortran at lists.mpi-forum.org
> http://lists.mpi-forum.org/mailman/listinfo.cgi/mpi3-fortran

-- 
Dr. Rolf Rabenseifner . . . . . . . . . .. email rabenseifner at hlrs.de
High Performance Computing Center (HLRS) . phone ++49(0)711/685-65530
University of Stuttgart . . . . . . . . .. fax ++49(0)711 / 685-65832
Head of Dpmt Parallel Computing . . . www.hlrs.de/people/rabenseifner
Nobelstr. 19, D-70550 Stuttgart, Germany . (Office: Allmandring 30)




More information about the mpiwg-fortran mailing list