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);
}