[MPIWG Fortran] Profiling for MPI_SIZEOF?

Bill Long longb at cray.com
Thu May 15 15:46:09 CDT 2014

On May 15, 2014, at 3:38 PM, Jeff Squyres (jsquyres) <jsquyres at cisco.com> wrote:

>> That said, the optimal implementation would be to write all of the specific versions (I’m seeing 10) for a generic named MPI_SIZEOF.  For each specific version, the executed code reduces to
>>  size = storage_size(x)/8
>> which the compiler will evaluate at compile time based on the type of x. 
> No, there's 10 * 7 versions, right?  One for each type (10), and then 1 for each rank.
> The language in the MPI spec explicitly allows you to pass an array as the argument of x (although it does say that it will return the size of the base element -- not the array).

You are right.  I just looked at one of the example specifics:

  subroutine MPI_Sizeof_xint8 (x, size, ierror)
       use,intrinsic :: iso_fortran_env, only: int8
       integer(int8),dimension(..) :: x
       INTEGER, intent(out) :: size
       INTEGER, optional,  intent(out) :: ierror

       size = storage_size(x)/8
       if (present(ierror)) ierror = 0
  end subroutine MPI_Sizeof_xint8

which is declared assumed-rank, but specific type (which is the interesting thing here).  That’s how I got 10.  To get them all without assumed-rank, you need 10*15 (the Fortran standard allows array ranks  up to 15 now). All the more reason for no intercepting.


Bill Long                                                                       longb at cray.com
Fortran Technical Suport  &                                  voice:  651-605-9024
Bioinformatics Software Development                     fax:  651-605-9142
Cray Inc./ Cray Plaza, Suite 210/ 380 Jackson St./ St. Paul, MN 55101

More information about the mpiwg-fortran mailing list