[MPIWG Fortran] "small count" variants of RMA functions
William Gropp
wgropp at illinois.edu
Sat Nov 27 13:14:50 CST 2021
I agree with Jeff here. This is a good enhancement; I believe the only reason that we hadn’t done this before is that we’ve stuck closely to the original Fortran look-and-feel - which was pre-Fortran 90. We could have done this earlier, and now that there are explicit interfaces that are only available in Fortran08, there is no reason not to do this.
Bill
William Gropp
Director, NCSA
Thomas M. Siebel Chair in Computer Science
University of Illinois Urbana-Champaign
IEEE-CS President-Elect
> On Nov 25, 2021, at 4:42 AM, Jeff Hammond via mpiwg-fortran <mpiwg-fortran at lists.mpi-forum.org> wrote:
>
> RMA absolutely did the right thing with MPI_Aint size and displacement arguments.
>
> In C, it is no problem to pass 32b integers to these arguments when AINT is 64b, because C type promotion rules just work.
>
> In Fortran, I cannot do this, because an integer literal is not compatible with an AINT argument. I find it tedious to have to declare a variable just for this, or to explicitly cast with integer(100,MPI_ADDRESS_KIND).
>
> Since Fortran does polymorphism right and can have subroutine declarations for both default integer and AINT integer scalar arguments, is there a good reason not to add the former?
>
> This proposal applies not to just MPI_Win_allocate but any RMA function that uses AINT scalar arguments.
>
> Thanks,
>
> Jeff
>
> % mpifort y.F90
> y.F90:20:60:
>
> 20 | call MPI_Win_allocate(100, 1, MPI_INFO_NULL, comm, XA, WA)
> | 1
> Error: There is no specific subroutine for the generic 'mpi_win_allocate' at (1)
>
> % cat y.F90
> ! USE mpi_f08
> ! MPI_Win_allocate(size, disp_unit, info, comm, baseptr, win, ierror)
> ! USE, INTRINSIC :: ISO_C_BINDING, ONLY : C_PTR
> ! INTEGER(KIND=MPI_ADDRESS_KIND), INTENT(IN) :: size
> ! INTEGER, INTENT(IN) :: disp_unit
> ! TYPE(MPI_Info), INTENT(IN) :: info
> ! TYPE(MPI_Comm), INTENT(IN) :: comm
> ! TYPE(C_PTR), INTENT(OUT) :: baseptr
> ! TYPE(MPI_Win), INTENT(OUT) :: win
> ! INTEGER, OPTIONAL, INTENT(OUT) :: ierror
> program main
> use iso_fortran_env
> use mpi_f08
> implicit none
> integer(kind=MPI_ADDRESS_KIND) :: as = 100
> type(c_ptr) :: XA
> type(MPI_Win) :: WA
> TYPE(MPI_Comm) :: comm = MPI_COMM_WORLD
> call MPI_Win_allocate(as, 1, MPI_INFO_NULL, comm, XA, WA)
> call MPI_Win_allocate(100, 1, MPI_INFO_NULL, comm, XA, WA)
> end program main
>
> % mpicc y.c && echo SUCCESS
> SUCCESS
>
> % cat y.c
> #include <mpi.h>
> int main(void)
> {
> MPI_Aint as = 100;
> int * XA;
> MPI_Win WA;
> MPI_Win_allocate(as, 1, MPI_INFO_NULL, MPI_COMM_WORLD, XA, &WA);
> MPI_Win_allocate(100, 1, MPI_INFO_NULL, MPI_COMM_WORLD, XA, &WA);
> }
>
>
> --
> Jeff Hammond
> jeff.science at gmail.com <mailto:jeff.science at gmail.com>
> http://jeffhammond.github.io/ <https://urldefense.com/v3/__http://jeffhammond.github.io/__;!!DZ3fjg!rCl1MJjLBm7CR4j1i2TYIuosrHBzzhChv0RVTrxnOAOtUZyYsqrBQtmV0jab6YK9fw$>_______________________________________________
> mpiwg-fortran mailing list
> mpiwg-fortran at lists.mpi-forum.org
> https://urldefense.com/v3/__https://lists.mpi-forum.org/mailman/listinfo/mpiwg-fortran__;!!DZ3fjg!rCl1MJjLBm7CR4j1i2TYIuosrHBzzhChv0RVTrxnOAOtUZyYsqrBQtmV0jZut-fk-w$
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mpi-forum.org/pipermail/mpiwg-fortran/attachments/20211127/12cc3b0d/attachment-0001.html>
More information about the mpiwg-fortran
mailing list