Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MPI-3.0 errata: Correcting Fortran _CPTR interface descriptions #390

Closed
mpiforumbot opened this issue Jul 24, 2016 · 9 comments
Closed

MPI-3.0 errata: Correcting Fortran _CPTR interface descriptions #390

mpiforumbot opened this issue Jul 24, 2016 · 9 comments

Comments

@mpiforumbot
Copy link
Collaborator

mpiforumbot commented Jul 24, 2016

Originally by RolfRabenseifner on 2013-08-20 03:51:32 -0500


Description

MPI-3.0 page 598, lines 29-31 tell

Section 17.1.2 through 17.1.4 define the Fortran support methods.
The Fortran interfaces of each MPI routine are shorthands.
Section 17.1.5 defines the corresponding full interface specification ...

This was not fulfilled in existing Section 17.1.5.
It will be fulfilled in new Section 17.1.5 as proposed in errata-ticket #388,
except for the special cases of the overloaded Fortran routines in the mpi module
and mpif.h:

  • MPI_ALLOC_MEM and MPI_ALLOC_MEM_CPTR
  • MPI_WIN_ALLOCATE and MPI_WIN_ALLOCATE_CPTR
  • MPI_WIN_ALLOCATE_SHARED and MPI_WIN_ALLOCATE_SHARED_CPTR
  • MPI_WIN_SHARED_QUERY and MPI_WIN_SHARED_QUERY_CPTR

This can be easily corrected by correcting the existing description
of these four routines. This does not change the existing standard.
It is only a clarification, i.e., describing it now with a correct syntax.

For example at MPI_ALLOC_MEM:

  • page 339, line 44,
    "following interface" must be substituted by
    "following generic interface", and
  • page 340, lines 1-8 must include syntactically correctly
    the original interface page 339, lines 40-42.
    The same is valid for all four routines.

These errata additionally fix the missing IMPORT::MPI_ADDRESS_KIND
statements in the interface definitions.

Extended Scope

MPI-3.0 errata.

History

Detected by Bill Long.

Proposed Solution (as MPI-3.0 errata)

The original text includes already the change of "linker name"
into "specific procedure name", as proposed in ticket #388.

  • MPI-3.0, Sect. 8.2, page 339 lines 44-47, and page 407 line 47 - page 408 line 2, and page 409 lines 30-33, and page 411 lines 11-14 read

    If the Fortran compiler provides TYPE(C_PTR), then the following
    interface must be provided in the mpi module and should be provided
    in mpif.h through overloading, i.e., with
    the same routine name as the routine with
    INTEGER(KIND=MPI_ADDRESS_KIND) BASEPTR,
    but with a different specific procedure name:

    -but should read (the underlining is only for showing the new word)*

    If the Fortran compiler provides TYPE(C_PTR), then the following
    generic
    interface must be provided in the mpi module and should be provided
    in mpif.h through overloading, i.e., with
    the same routine name as the routine with
    INTEGER(KIND=MPI_ADDRESS_KIND) BASEPTR,
    but with a different specific procedure name:

  • '''MPI-3.0, Sect. 8.2, page 340 lines 1-8, and
    Annex A.4.6, page 772, lines 38-46 read'''

  INTERFACE MPI_ALLOC_MEM
      SUBROUTINE MPI_ALLOC_MEM_CPTR(SIZE, INFO, BASEPTR, IERROR)
          USE, INTRINSIC :: ISO_C_BINDING, ONLY : C_PTR
          INTEGER :: INFO, IERROR
          INTEGER(KIND=MPI_ADDRESS_KIND) :: SIZE
          TYPE(C_PTR) :: BASEPTR
      END SUBROUTINE
  END INTERFACE

-but should read*

  INTERFACE MPI_ALLOC_MEM
      SUBROUTINE MPI_ALLOC_MEM(SIZE, INFO, BASEPTR, IERROR)
          IMPORT :: MPI_ADDRESS_KIND
          INTEGER INFO, IERROR
          INTEGER(KIND=MPI_ADDRESS_KIND) SIZE, BASEPTR
      END SUBROUTINE
      SUBROUTINE MPI_ALLOC_MEM_CPTR(SIZE, INFO, BASEPTR, IERROR)
          USE, INTRINSIC :: ISO_C_BINDING, ONLY : C_PTR
          IMPORT :: MPI_ADDRESS_KIND
          INTEGER :: INFO, IERROR
          INTEGER(KIND=MPI_ADDRESS_KIND) :: SIZE
          TYPE(C_PTR) :: BASEPTR
      END SUBROUTINE
  END INTERFACE
  • '''MPI-3.0, Sect. 11.2.2, page 408, lines 4-12, and
    Annex A.4.9, page 777, lines 31-40 read'''
  INTERFACE MPI_WIN_ALLOCATE
      SUBROUTINE MPI_WIN_ALLOCATE_CPTR(SIZE, DISP_UNIT, INFO, COMM, BASEPTR, &
              WIN, IERROR)
          USE, INTRINSIC :: ISO_C_BINDING, ONLY : C_PTR
          INTEGER :: DISP_UNIT, INFO, COMM, WIN, IERROR
          INTEGER(KIND=MPI_ADDRESS_KIND) :: SIZE
          TYPE(C_PTR) :: BASEPTR
      END SUBROUTINE
  END INTERFACE

-but should read*

  INTERFACE MPI_WIN_ALLOCATE
      SUBROUTINE MPI_WIN_ALLOCATE(SIZE, DISP_UNIT, INFO, COMM, BASEPTR, &
              WIN, IERROR)
          IMPORT :: MPI_ADDRESS_KIND
          INTEGER DISP_UNIT, INFO, COMM, WIN, IERROR
          INTEGER(KIND=MPI_ADDRESS_KIND) SIZE, BASEPTR          
      END SUBROUTINE
      SUBROUTINE MPI_WIN_ALLOCATE_CPTR(SIZE, DISP_UNIT, INFO, COMM, BASEPTR, &
              WIN, IERROR)
          USE, INTRINSIC :: ISO_C_BINDING, ONLY : C_PTR
          IMPORT :: MPI_ADDRESS_KIND
          INTEGER :: DISP_UNIT, INFO, COMM, WIN, IERROR
          INTEGER(KIND=MPI_ADDRESS_KIND) :: SIZE
          TYPE(C_PTR) :: BASEPTR
      END SUBROUTINE
  END INTERFACE
  • '''MPI-3.0, Sect. 11.2.3, page 409, lines 35-43, and
    Annex A.4.9, page 777, line 46 - page 778, line 6 read'''
  INTERFACE MPI_WIN_ALLOCATE_SHARED
      SUBROUTINE MPI_WIN_ALLOCATE_SHARED_CPTR(SIZE, DISP_UNIT, INFO, COMM, &
              BASEPTR, WIN, IERROR)
          USE, INTRINSIC :: ISO_C_BINDING, ONLY : C_PTR
          INTEGER :: DISP_UNIT, INFO, COMM, WIN, IERROR
          INTEGER(KIND=MPI_ADDRESS_KIND) :: SIZE
          TYPE(C_PTR) :: BASEPTR
      END SUBROUTINE
  END INTERFACE

-but should read*

  INTERFACE MPI_WIN_ALLOCATE_SHARED
      SUBROUTINE MPI_WIN_ALLOCATE_SHARED(SIZE, DISP_UNIT, INFO, COMM, &
              BASEPTR, WIN, IERROR)
          IMPORT :: MPI_ADDRESS_KIND
          INTEGER DISP_UNIT, INFO, COMM, WIN, IERROR
          INTEGER(KIND=MPI_ADDRESS_KIND) SIZE, BASEPTR
      END SUBROUTINE
      SUBROUTINE MPI_WIN_ALLOCATE_SHARED_CPTR(SIZE, DISP_UNIT, INFO, COMM, &
              BASEPTR, WIN, IERROR)
          USE, INTRINSIC :: ISO_C_BINDING, ONLY : C_PTR
          IMPORT :: MPI_ADDRESS_KIND
          INTEGER :: DISP_UNIT, INFO, COMM, WIN, IERROR
          INTEGER(KIND=MPI_ADDRESS_KIND) :: SIZE
          TYPE(C_PTR) :: BASEPTR
      END SUBROUTINE
  END INTERFACE
  • '''MPI-3.0, Sect. 11.2.3, page 411, lines 16-24, and
    Annex A.4.9, page 779, lines 12-20 read'''
  INTERFACE MPI_WIN_SHARED_QUERY
      SUBROUTINE MPI_WIN_SHARED_QUERY_CPTR(WIN, RANK, SIZE, DISP_UNIT, &
              BASEPTR, IERROR)
          USE, INTRINSIC :: ISO_C_BINDING, ONLY : C_PTR
          INTEGER :: WIN, RANK, DISP_UNIT, IERROR
          INTEGER(KIND=MPI_ADDRESS_KIND) :: SIZE
          TYPE(C_PTR) :: BASEPTR
      END SUBROUTINE
  END INTERFACE

-but should read*

  INTERFACE MPI_WIN_SHARED_QUERY
      SUBROUTINE MPI_WIN_SHARED_QUERY(WIN, RANK, SIZE, DISP_UNIT, &
              BASEPTR, IERROR)
          IMPORT :: MPI_ADDRESS_KIND
          INTEGER WIN, RANK, DISP_UNIT, IERROR
          INTEGER (KIND=MPI_ADDRESS_KIND) SIZE, BASEPTR
      END SUBROUTINE
      SUBROUTINE MPI_WIN_SHARED_QUERY_CPTR(WIN, RANK, SIZE, DISP_UNIT, &
              BASEPTR, IERROR)
          USE, INTRINSIC :: ISO_C_BINDING, ONLY : C_PTR
          IMPORT :: MPI_ADDRESS_KIND
          INTEGER :: WIN, RANK, DISP_UNIT, IERROR
          INTEGER(KIND=MPI_ADDRESS_KIND) :: SIZE
          TYPE(C_PTR) :: BASEPTR
      END SUBROUTINE
  END INTERFACE

Impact on Implementations

None, if it is implemented correctly.

Impact on Applications / Users

None.

Alternative Solutions

None.

Entry for the Change Log

None.

Voting category

This is a simple correction of an inconsistency.[[BR]]
Therefore single reading+vote is recommended.

@mpiforumbot
Copy link
Collaborator Author

Originally by RolfRabenseifner on 2013-08-22 03:05:32 -0500


On p399:44, p407:47, p409:30, and p411:11, "interface" changed to "generic interface".

@mpiforumbot
Copy link
Collaborator Author

Originally by RolfRabenseifner on 2013-08-23 11:56:01 -0500


A few corrections based on a detailed reading by Bill Long.

@mpiforumbot
Copy link
Collaborator Author

Originally by longb on 2013-08-23 14:38:28 -0500


I reviewed the changes proposed in this ticket and agree it is a correct solution for a defect in the current MPI-3.0 spec. This exposition also makes it clearer that both specifics are required in the case of TYPE(C_PTR) support.

I created a test module of the form:

module t390

MPI_ADDRESS_KIND = 8

end module t390

where is replaced by a copy/paste of the four blocks of replacement code in the ticket, and is INTEGER,PARAMETER :: . This compiles cleanly, so I believe that there are no syntax errors in the proposed edits.

@mpiforumbot
Copy link
Collaborator Author

Originally by RolfRabenseifner on 2013-08-25 23:08:50 -0500


After Bill Long's test, I set the implementation status to "complete".

Review:

  • The ticket touches all locations of _CPTR overloading.
  • It was needed due to the incomplete (and therefore incorrect) description
    in MPI-3.0
  • It is correct for both Fortran support methods with _CPTR overloading
    (i.e., mpi module and mpif.h), as shown with Bill's test.

@mpiforumbot
Copy link
Collaborator Author

Originally by rasmus on 2013-08-26 18:21:14 -0500


I've reviewed the changes and they are fine.

@mpiforumbot
Copy link
Collaborator Author

Originally by jsquyres on 2013-08-27 07:24:35 -0500


Reviewed ok by Jeff Sq.

@mpiforumbot
Copy link
Collaborator Author

Originally by RolfRabenseifner on 2013-08-27 07:47:45 -0500


Also reviewed and okay (needed, correct, and complete).

With this 4th review, I switch the ticket's priority to "Proposal reviewed".

@mpiforumbot
Copy link
Collaborator Author

Originally by jhammond on 2013-08-27 15:59:09 -0500


I reviewed this proposal and find it acceptable.

@mpiforumbot
Copy link
Collaborator Author

Originally by jsquyres on 2014-05-15 09:05:32 -0500


I sent around a PDF and diffs to be reviewed: http://lists.mpi-forum.org/mpiwg-fortran/2014/05/1495.php

Once they're reviewed, I'll commit the text to SVN.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant