[mpich-commits] [mpich] MPICH primary repository branch, master, updated. v3.1.3-139-g16fbce5

Service Account noreply at mpich.org
Wed Nov 5 16:53:21 CST 2014


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "MPICH primary repository".

The branch, master has been updated
       via  16fbce5e976bd9f6345036bb86abfd01446400c2 (commit)
       via  01add58a5e63b5fd0dd42b39d645b4edd2d06f9e (commit)
       via  5c6023830533660877d58ef57d0a9cfbfb7a4722 (commit)
       via  6e9fcbf1d9196c4d3c36ced5e6e857b7fcac5082 (commit)
      from  e3c310e88ba4d08717609b6256c59ab335fbaf36 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.mpich.org/mpich.git/commitdiff/16fbce5e976bd9f6345036bb86abfd01446400c2

commit 16fbce5e976bd9f6345036bb86abfd01446400c2
Author: Junchao Zhang <jczhang at mcs.anl.gov>
Date:   Tue Oct 28 20:19:08 2014 -0500

    Add C/Fortran tests for MPI_Aint_add/diff
    
    The F77/90 test is marked as xfail for a bug at
    https://trac.mpich.org/projects/mpich/ticket/1877
    
    Signed-off-by: Wesley Bland <wbland at anl.gov>

diff --git a/test/mpi/f08/rma/Makefile.am b/test/mpi/f08/rma/Makefile.am
index 4588779..d12e47a 100644
--- a/test/mpi/f08/rma/Makefile.am
+++ b/test/mpi/f08/rma/Makefile.am
@@ -27,7 +27,8 @@ noinst_PROGRAMS = \
     c2f2cwinf08     \
     baseattrwinf08  \
     winattrf08      \
-    winattr2f08
+    winattr2f08	    \
+    aintf08
 ## this test was commented out in the simplemake version...
 ##    allocmem
 
diff --git a/test/mpi/f08/rma/aintf08.f90 b/test/mpi/f08/rma/aintf08.f90
new file mode 100644
index 0000000..96ddedd
--- /dev/null
+++ b/test/mpi/f08/rma/aintf08.f90
@@ -0,0 +1,76 @@
+! -*- Mode: Fortran; -*-
+!
+!
+!  (C) 2014 by Argonne National Laboratory.
+!      See COPYRIGHT in top-level directory.
+!
+
+! This program tests MPI_Aint_add/diff in MPI-3.1.
+! The two functions are often used in RMA code.
+! See https://svn.mpi-forum.org/trac/mpi-forum-web/ticket/349
+
+program main
+    use mpi_f08
+    integer :: rank, nproc
+    integer :: ierr, errs
+    integer :: array(0:1023)
+    integer :: val, target_rank;
+    integer(kind=MPI_ADDRESS_KIND) :: bases(0:1), disp, offset
+    integer(kind=MPI_ADDRESS_KIND) :: winsize
+    type(MPI_WIN) :: win
+    integer :: intsize
+
+    errs = 0
+    call mtest_init(ierr);
+    call MPI_Comm_rank(MPI_COMM_WORLD, rank, ierr)
+    call MPI_Comm_size(MPI_COMM_WORLD, nproc, ierr)
+
+    if (rank == 0 .and. nproc /= 2) then
+      print *, 'Must run with 2 ranks'
+      call MPI_Abort(MPI_COMM_WORLD, 1, ierr)
+    endif
+
+! Get the base address in the middle of the array
+    if (rank == 0) then
+      target_rank = 1
+      array(0) = 1234
+      call MPI_Get_address(array(512), bases(0), ierr)
+    else if (rank == 1) then
+      target_rank = 0
+      array(1023) = 1234
+      call MPI_Get_address(array(512), bases(1), ierr)
+    endif
+
+! Exchange bases
+    call MPI_Type_size(MPI_INT, intsize, ierr);
+    call MPI_Allgather(MPI_IN_PLACE, 0, MPI_DATATYPE_NULL, bases, 1, MPI_AINT, MPI_COMM_WORLD, ierr)
+    call MPI_Win_create_dynamic(MPI_INFO_NULL, MPI_COMM_WORLD, win, ierr)
+
+    winsize = intsize*1024
+    call MPI_Win_attach(win, array, winsize, ierr)
+
+! Do MPI_Aint addressing arithmetic
+    if (rank == 0) then
+        disp = intsize*511
+        offset = MPIX_Aint_add(bases(1), disp) ! offset points to array(1023)
+    else if (rank == 1) then
+        disp = intsize*512
+        offset = MPIX_Aint_diff(bases(0), disp) ! offset points to array(0)
+    endif
+
+! Get value and verify it
+    call MPI_Win_fence(MPI_MODE_NOPRECEDE, win, ierr)
+    call MPI_Get(val, 1, MPI_INT, target_rank, offset, 1, MPI_INT, win, ierr)
+    call MPI_Win_fence(MPI_MODE_NOSUCCEED, win, ierr)
+
+    if (val /= 1234) then
+      errs = errs + 1
+      print *, rank, ' -- Got', val, 'expected 1234'
+    endif
+
+    call MPI_Win_detach(win, array, ierr)
+    call MPI_Win_free(win, ierr)
+
+    call MTest_Finalize(errs)
+    call MPI_Finalize(ierr);
+end
diff --git a/test/mpi/f08/rma/testlist b/test/mpi/f08/rma/testlist
index fee7fb4..a1f3d01 100644
--- a/test/mpi/f08/rma/testlist
+++ b/test/mpi/f08/rma/testlist
@@ -10,3 +10,4 @@ c2f2cwinf08 1
 baseattrwinf08 1
 winattrf08 1
 winattr2f08 1
+aintf08 2 strict=false
diff --git a/test/mpi/f77/rma/Makefile.am b/test/mpi/f77/rma/Makefile.am
index b0c820b..6c82c44 100644
--- a/test/mpi/f77/rma/Makefile.am
+++ b/test/mpi/f77/rma/Makefile.am
@@ -25,7 +25,8 @@ noinst_PROGRAMS = \
     c2f2cwinf     \
     baseattrwinf  \
     winattrf      \
-    winattr2f
+    winattr2f	  \
+    aintf
 ## this test was commented out in the simplemake version...
 ##    allocmem
 
diff --git a/test/mpi/f77/rma/aintf.f b/test/mpi/f77/rma/aintf.f
new file mode 100644
index 0000000..f7d67df
--- /dev/null
+++ b/test/mpi/f77/rma/aintf.f
@@ -0,0 +1,85 @@
+! -*- Mode: Fortran; -*-
+!
+!
+!  (C) 2014 by Argonne National Laboratory.
+!      See COPYRIGHT in top-level directory.
+!
+
+! This program tests MPI_Aint_add/diff in MPI-3.1.
+! The two functions are often used in RMA code.
+! See https://svn.mpi-forum.org/trac/mpi-forum-web/ticket/349
+
+      program main
+      implicit none
+      include 'mpif.h'
+      integer :: rank, nproc
+      integer :: ierr, errs
+      integer :: array(0:1023)
+      integer :: val, target_rank;
+      integer(kind=MPI_ADDRESS_KIND) :: bases(0:1), disp, offset
+      integer(kind=MPI_ADDRESS_KIND) :: winsize
+      integer :: win
+      integer :: intsize
+
+      integer(kind=MPI_ADDRESS_KIND), external :: MPIX_Aint_add
+      integer(kind=MPI_ADDRESS_KIND), external :: MPIX_Aint_diff
+
+      errs = 0
+      call mtest_init(ierr);
+      call MPI_Comm_rank(MPI_COMM_WORLD, rank, ierr)
+      call MPI_Comm_size(MPI_COMM_WORLD, nproc, ierr)
+
+      if (rank == 0 .and. nproc /= 2) then
+        print *, 'Must run with 2 ranks'
+        call MPI_Abort(MPI_COMM_WORLD, 1, ierr)
+      endif
+
+! Get the base address in the middle of the array
+      if (rank == 0) then
+        target_rank = 1
+        array(0) = 1234
+        call MPI_Get_address(array(512), bases(0), ierr)
+      else if (rank == 1) then
+        target_rank = 0
+        array(1023) = 1234
+        call MPI_Get_address(array(512), bases(1), ierr)
+      endif
+
+! Exchange bases
+      call MPI_Type_size(MPI_INT, intsize, ierr);
+
+      call MPI_Allgather(MPI_IN_PLACE, 0, MPI_DATATYPE_NULL, bases,
+     &                   1, MPI_AINT, MPI_COMM_WORLD, ierr)
+
+      call MPI_Win_create_dynamic(MPI_INFO_NULL,
+     &                            MPI_COMM_WORLD, win, ierr)
+
+      winsize = intsize*1024
+      call MPI_Win_attach(win, array, winsize, ierr)
+
+! Do MPI_Aint addressing arithmetic
+      if (rank == 0) then
+        disp = intsize*511
+        offset = MPIX_Aint_add(bases(1), disp)
+      else if (rank == 1) then
+        disp = intsize*512
+        offset = MPIX_Aint_diff(bases(0), disp)
+      endif
+
+! Get value and verify it
+      call MPI_Win_fence(MPI_MODE_NOPRECEDE, win, ierr)
+      call MPI_Get(val, 1, MPI_INT, target_rank,
+     &             offset, 1, MPI_INT, win, ierr)
+      call MPI_Win_fence(MPI_MODE_NOSUCCEED, win, ierr)
+
+      if (val /= 1234) then
+        errs = errs + 1
+        print *, rank, ' -- Got', val, 'expected 1234'
+      endif
+
+      call MPI_Win_detach(win, array, ierr)
+      call MPI_Win_free(win, ierr)
+
+      call MTest_Finalize(errs)
+      call MPI_Finalize(ierr);
+      end
diff --git a/test/mpi/f77/rma/testlist b/test/mpi/f77/rma/testlist
index 047c812..20112b8 100644
--- a/test/mpi/f77/rma/testlist
+++ b/test/mpi/f77/rma/testlist
@@ -10,3 +10,4 @@ c2f2cwinf 1
 baseattrwinf 1
 winattrf 1
 winattr2f 1
+aintf 2 strict=false xfail=ticket1877
diff --git a/test/mpi/rma/Makefile.am b/test/mpi/rma/Makefile.am
index e370fbf..c1c4d36 100644
--- a/test/mpi/rma/Makefile.am
+++ b/test/mpi/rma/Makefile.am
@@ -139,7 +139,8 @@ noinst_PROGRAMS =          \
     get-struct             \
     rput_local_comp        \
     racc_local_comp        \
-    at_complete
+    at_complete            \
+    aint
 
 strided_acc_indexed_LDADD       = $(LDADD) -lm
 strided_acc_onelock_LDADD       = $(LDADD) -lm
diff --git a/test/mpi/rma/aint.c b/test/mpi/rma/aint.c
new file mode 100644
index 0000000..9eba621
--- /dev/null
+++ b/test/mpi/rma/aint.c
@@ -0,0 +1,80 @@
+/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
+/*
+ *
+ *  (C) 2014 by Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+/*
+ * This program tests MPI_Aint_add/diff in MPI-3.1.
+ * The two functions are often used in RMA code.
+ * See https://svn.mpi-forum.org/trac/mpi-forum-web/ticket/349
+ */
+
+#include <stdio.h>
+#include <mpi.h>
+#include "mpitest.h"
+
+int main(int argc, char **argv)
+{
+    int rank, nproc;
+    int errs = 0;
+    int array[1024];
+    int val = 0;
+    int target_rank;
+    MPI_Aint bases[2];
+    MPI_Aint disp, offset;
+    MPI_Win  win;
+
+    MTest_Init(&argc, &argv);
+
+    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+    MPI_Comm_size(MPI_COMM_WORLD, &nproc);
+
+    if (rank == 0 && nproc != 2) {
+        MTestError("Must run with 2 ranks\n");
+    }
+
+    /* Get the base address in the middle of the array */
+    if (rank == 0) {
+        target_rank = 1;
+        array[0] = 1234;
+        MPI_Get_address(&array[512], &bases[0]);
+    } else if (rank == 1) {
+        target_rank = 0;
+        array[1023] = 1234;
+        MPI_Get_address(&array[512], &bases[1]);
+    }
+
+    /* Exchange bases */
+    MPI_Allgather(MPI_IN_PLACE, 0, MPI_DATATYPE_NULL, bases, 1, MPI_AINT, MPI_COMM_WORLD);
+
+    MPI_Win_create_dynamic(MPI_INFO_NULL, MPI_COMM_WORLD, &win);
+    MPI_Win_attach(win, array, sizeof(int)*1024);
+
+    /* Do MPI_Aint addressing arithmetic */
+    if (rank == 0) {
+        disp = sizeof(int)*511;
+        offset = MPIX_Aint_add(bases[1], disp); /* offset points to array[1023]*/
+    } else if (rank == 1) {
+        disp = sizeof(int)*512;
+        offset = MPIX_Aint_diff(bases[0], disp); /* offset points to array[0] */
+    }
+
+    /* Get val and verify it */
+    MPI_Win_fence(MPI_MODE_NOPRECEDE, win);
+    MPI_Get(&val, 1, MPI_INT, target_rank, offset, 1, MPI_INT, win);
+    MPI_Win_fence(MPI_MODE_NOSUCCEED, win);
+
+    if (val != 1234) {
+        errs++;
+        printf("%d -- Got %d, expected 1234\n", rank, val);
+    }
+
+    MPI_Win_detach(win, array);
+    MPI_Win_free(&win);
+
+    MTest_Finalize(errs);
+    MPI_Finalize();
+    return 0;
+}
diff --git a/test/mpi/rma/testlist.in b/test/mpi/rma/testlist.in
index cb60752..d5d35dc 100644
--- a/test/mpi/rma/testlist.in
+++ b/test/mpi/rma/testlist.in
@@ -124,6 +124,7 @@ win_shared_zerobyte 4 mpiversion=3.0
 win_shared_put_flush_get 4 mpiversion=3.0
 get-struct 2
 at_complete 2
+aint 2 strict=false
 
 ## This test is not strictly correct.  This was meant to test out the
 ## case when MPI_Test is not nonblocking.  However, we ended up

http://git.mpich.org/mpich.git/commitdiff/01add58a5e63b5fd0dd42b39d645b4edd2d06f9e

commit 01add58a5e63b5fd0dd42b39d645b4edd2d06f9e
Author: Junchao Zhang <jczhang at mcs.anl.gov>
Date:   Mon Oct 27 15:22:38 2014 -0500

    Add F08 bindings for MPI_Aint_add/diff
    
    Signed-off-by: Pavan Balaji <balaji at anl.gov>

diff --git a/src/binding/fortran/use_mpi_f08/mpi_c_interface_nobuf.F90 b/src/binding/fortran/use_mpi_f08/mpi_c_interface_nobuf.F90
index d1676b8..38bfaf5 100644
--- a/src/binding/fortran/use_mpi_f08/mpi_c_interface_nobuf.F90
+++ b/src/binding/fortran/use_mpi_f08/mpi_c_interface_nobuf.F90
@@ -2523,5 +2523,21 @@ function MPIR_Comm_spawn_multiple_c(count, array_of_commands, array_of_argv, arr
     integer(c_int) :: ierror
 end function MPIR_Comm_spawn_multiple_c
 
+function  MPIR_Aint_add_c(base, disp) &
+    bind(C, name="PMPIX_Aint_add") result(res)
+    use :: mpi_f08_compile_constants, only : MPI_ADDRESS_KIND
+    implicit none
+    integer(MPI_ADDRESS_KIND), value, intent(in) :: base, disp
+    integer(MPI_ADDRESS_KIND) :: res
+end function MPIR_Aint_add_c
+
+function  MPIR_Aint_diff_c(addr1, addr2) &
+    bind(C, name="PMPIX_Aint_diff") result(res)
+    use :: mpi_f08_compile_constants, only : MPI_ADDRESS_KIND
+    implicit none
+    integer(MPI_ADDRESS_KIND), value, intent(in) :: addr1, addr2
+    integer(MPI_ADDRESS_KIND) :: res
+end function MPIR_Aint_diff_c
+
 end interface
 end module mpi_c_interface_nobuf
diff --git a/src/binding/fortran/use_mpi_f08/mpi_f08.F90 b/src/binding/fortran/use_mpi_f08/mpi_f08.F90
index bd4c52d..7a36ff3 100644
--- a/src/binding/fortran/use_mpi_f08/mpi_f08.F90
+++ b/src/binding/fortran/use_mpi_f08/mpi_f08.F90
@@ -4103,4 +4103,22 @@ interface MPI_Wtime
     end function MPI_Wtime_f08
 end interface MPI_Wtime
 
+interface MPIX_Aint_add
+    function MPIX_Aint_add_f08(base, disp) result(res)
+        use :: mpi_f08_compile_constants, only : MPI_ADDRESS_KIND
+        implicit none
+        integer(MPI_ADDRESS_KIND), intent(in) :: base, disp
+        integer(MPI_ADDRESS_KIND) :: res
+    end function MPIX_Aint_add_f08
+end interface MPIX_Aint_add
+
+interface MPIX_Aint_diff
+    function MPIX_Aint_diff_f08(addr1, addr2) result(res)
+        use :: mpi_f08_compile_constants, only : MPI_ADDRESS_KIND
+        implicit none
+        integer(MPI_ADDRESS_KIND), intent(in) :: addr1, addr2
+        integer(MPI_ADDRESS_KIND) :: res
+    end function MPIX_Aint_diff_f08
+end interface MPIX_Aint_diff
+
 end module mpi_f08
diff --git a/src/binding/fortran/use_mpi_f08/wrappers_f/aint_add_f08ts.F90 b/src/binding/fortran/use_mpi_f08/wrappers_f/aint_add_f08ts.F90
new file mode 100644
index 0000000..cf6ef8f
--- /dev/null
+++ b/src/binding/fortran/use_mpi_f08/wrappers_f/aint_add_f08ts.F90
@@ -0,0 +1,14 @@
+!   -*- Mode: Fortran; -*-
+!
+!   (C) 2014 by Argonne National Laboratory.
+!   See COPYRIGHT in top-level directory.
+!
+function MPIX_Aint_add_f08(base, disp) result(res)
+    use :: mpi_f08_compile_constants, only : MPI_ADDRESS_KIND
+    use :: mpi_c_interface_nobuf, only : MPIR_Aint_add_c
+    implicit none
+    integer(MPI_ADDRESS_KIND), intent(in) :: base, disp
+    integer(MPI_ADDRESS_KIND) :: res
+
+    res = MPIR_Aint_add_c(base, disp)
+end function MPIX_Aint_add_f08
\ No newline at end of file
diff --git a/src/binding/fortran/use_mpi_f08/wrappers_f/aint_diff_f08ts.F90 b/src/binding/fortran/use_mpi_f08/wrappers_f/aint_diff_f08ts.F90
new file mode 100644
index 0000000..7c20dec
--- /dev/null
+++ b/src/binding/fortran/use_mpi_f08/wrappers_f/aint_diff_f08ts.F90
@@ -0,0 +1,14 @@
+!   -*- Mode: Fortran; -*-
+!
+!   (C) 2014 by Argonne National Laboratory.
+!   See COPYRIGHT in top-level directory.
+!
+function MPIX_Aint_diff_f08(addr1, addr2) result(res)
+    use :: mpi_f08_compile_constants, only : MPI_ADDRESS_KIND
+    use :: mpi_c_interface_nobuf, only : MPIR_Aint_diff_c
+    implicit none
+    integer(MPI_ADDRESS_KIND), intent(in) :: addr1, addr2
+    integer(MPI_ADDRESS_KIND) :: res
+
+    res = MPIR_Aint_diff_c(addr1, addr2)
+end function MPIX_Aint_diff_f08

http://git.mpich.org/mpich.git/commitdiff/5c6023830533660877d58ef57d0a9cfbfb7a4722

commit 5c6023830533660877d58ef57d0a9cfbfb7a4722
Author: Junchao Zhang <jczhang at mcs.anl.gov>
Date:   Mon Oct 27 14:11:27 2014 -0500

    Add F77/90 bindings for MPI_Aint_add/diff
    
    Signed-off-by: Pavan Balaji <balaji at anl.gov>

diff --git a/src/binding/fortran/mpif_h/buildiface b/src/binding/fortran/mpif_h/buildiface
index 5498459..f6803fe 100755
--- a/src/binding/fortran/mpif_h/buildiface
+++ b/src/binding/fortran/mpif_h/buildiface
@@ -364,6 +364,7 @@ foreach $_ (@ARGV) {
 #
 # The Type_create_f90_xxx routines are only available as part of the
 # extended Fortran support, and are excluded from the f77 routines.
+# Aint_add/diff do not have the ierror argument
 %special_routines = ( 'Init' => 1, 'Init_thread' => 1, 'Pcontrol' => '1',
 		      'Address' => 1, 'Get_address' => 1,
 		      'Keyval_create' => 1, 'Status_f2c' => 1,
@@ -371,6 +372,8 @@ foreach $_ (@ARGV) {
 		      'Type_create_f90_integer' => 1,
 		      'Type_create_f90_real' => 1,
 		      'Type_create_f90_complex' => 1,
+		      'Aint_add' => 1,
+		      'Aint_diff' => 1,
 		      );
 
 # Some routines have special needs and must call a different routine.  For
@@ -4340,6 +4343,55 @@ sub build_specials {
     }
     $returnType = "void";
 
+    # MPIX_Aint_add/diff do not have the ierror argument.
+    $OUTFD = "AINTADD";
+    $filename = "aint_addf.c";
+    open( $OUTFD, ">$filename.new" ) || die "Cannot open $filename.new\n";
+    $files[$#files+1] = $filename;
+    $returnType = "MPI_Aint";
+    &set_weak_decl( "MPIX_Aint_add", "MPI_Aint *, MPI_Aint *", "MPI_Aint" );
+    &set_weak_decl( "PMPIX_Aint_add", "MPI_Aint *, MPI_Aint *", "MPI_Aint" );
+    &print_header( "mpix_", "MPIX_Aint_add", "aint_add", "MPI_Aint *, MPI_Aint *");
+    &print_routine_type_decl( $OUTFD, "mpix_", "aint_add" );
+    print $OUTFD "(MPI_Aint *base, MPI_Aint *disp)\n";
+    print $OUTFD "{\n";
+    print $OUTFD "    return MPIX_Aint_add(*base, *disp);\n";
+    print $OUTFD "}\n";
+    close ($OUTFD);
+    &ReplaceIfDifferent( $filename, $filename . ".new" );
+    if ($build_prototypes) {
+        print PROTOFD "extern ";
+        &print_routine_type_decl( PROTOFD, "mpix_", "aint_add" );
+        print PROTOFD "( MPI_Aint *, MPI_Aint * )";
+        &print_attr( PROTOFD, "mpix_"."aint_add_" );
+        print PROTOFD ";\n";
+    }
+    $returnType = "void";
+
+    $OUTFD = "AINTDIFF";
+    $filename = "aint_difff.c";
+    open( $OUTFD, ">$filename.new" ) || die "Cannot open $filename.new\n";
+    $files[$#files+1] = $filename;
+    $returnType = "MPI_Aint";
+    &set_weak_decl( "MPIX_Aint_diff", "MPI_Aint *, MPI_Aint *", "MPI_Aint" );
+    &set_weak_decl( "PMPIX_Aint_diff", "MPI_Aint *, MPI_Aint *", "MPI_Aint" );
+    &print_header( "mpix_", "MPIX_Aint_diff", "aint_diff", "MPI_Aint *, MPI_Aint *");
+    &print_routine_type_decl( $OUTFD, "mpix_", "aint_diff" );
+    print $OUTFD "(MPI_Aint *addr1, MPI_Aint *addr2)\n";
+    print $OUTFD "{\n";
+    print $OUTFD "    return MPIX_Aint_diff(*addr1, *addr2);\n";
+    print $OUTFD "}\n";
+    close ($OUTFD);
+    &ReplaceIfDifferent( $filename, $filename . ".new" );
+    if ($build_prototypes) {
+        print PROTOFD "extern ";
+        &print_routine_type_decl( PROTOFD, "mpix_", "aint_diff" );
+        print PROTOFD "( MPI_Aint *, MPI_Aint * )";
+        &print_attr( PROTOFD, "mpix_"."aint_diff_" );
+        print PROTOFD ";\n";
+    }
+    $returnType = "void";
+
     $OUTFD = "KEYVALCREATEF";
     $filename = "keyval_createf.c";
     open ($OUTFD, ">$filename.new" ) || die "Cannot open $filename.new\n";

http://git.mpich.org/mpich.git/commitdiff/6e9fcbf1d9196c4d3c36ced5e6e857b7fcac5082

commit 6e9fcbf1d9196c4d3c36ced5e6e857b7fcac5082
Author: Junchao Zhang <jczhang at mcs.anl.gov>
Date:   Mon Oct 27 11:00:38 2014 -0500

    Add MPI_Aint arithmetic MPI_Aint_add/diff
    
    These two functions will be included in MPI-3.1 and hence are implemented as MPIX.
    See more about this MPI-Forum ticket at https://svn.mpi-forum.org/trac/mpi-forum-web/ticket/349
    
    Fixes #2134, #2136
    
    Signed-off-by: Pavan Balaji <balaji at anl.gov>

diff --git a/src/include/mpi.h.in b/src/include/mpi.h.in
index 33e1181..b2963d1 100644
--- a/src/include/mpi.h.in
+++ b/src/include/mpi.h.in
@@ -1541,6 +1541,9 @@ int MPIX_Comm_revoke(MPI_Comm comm);
 int MPIX_Comm_shrink(MPI_Comm comm, MPI_Comm *newcomm);
 int MPIX_Comm_agree(MPI_Comm comm, int *flag);
 
+/* MPI_Aint addressing arithmetic */
+MPI_Aint MPIX_Aint_add(MPI_Aint base, MPI_Aint disp);
+MPI_Aint MPIX_Aint_diff(MPI_Aint addr1, MPI_Aint addr2);
 
 /* End Prototypes */
 #endif /* MPICH_SUPPRESS_PROTOTYPES */
@@ -2181,6 +2184,9 @@ int PMPIX_Comm_revoke(MPI_Comm comm);
 int PMPIX_Comm_shrink(MPI_Comm comm, MPI_Comm *newcomm);
 int PMPIX_Comm_agree(MPI_Comm comm, int *flag);
 
+/* MPI_Aint addressing arithmetic */
+MPI_Aint PMPIX_Aint_add(MPI_Aint base, MPI_Aint disp);
+MPI_Aint PMPIX_Aint_diff(MPI_Aint addr1, MPI_Aint addr2);
 
 #endif  /* MPI_BUILD_PROFILING */
 /* End of MPI bindings */
diff --git a/src/include/mpiimpl.h b/src/include/mpiimpl.h
index 99918ad..40389f5 100644
--- a/src/include/mpiimpl.h
+++ b/src/include/mpiimpl.h
@@ -3393,6 +3393,30 @@ int MPID_Cancel_send(MPID_Request *);
   @*/
 int MPID_Cancel_recv(MPID_Request *);
 
+/*@
+  MPID_Aint_add - Returns the sum of base and disp
+
+  Input Parameters:
++ base - base address (integer)
+- disp - displacement (integer)
+
+  Return value:
+  Sum of the base and disp argument
+  @*/
+MPI_Aint MPID_Aint_add(MPI_Aint base, MPI_Aint disp);
+
+/*@
+  MPID_Aint_diff - Returns the difference between addr1 and addr2
+
+  Input Parameters:
++ addr1 - minuend address (integer)
+- addr2 - subtrahend address (integer)
+
+  Return value:
+  Difference between addr1 and addr2
+  @*/
+MPI_Aint MPID_Aint_diff(MPI_Aint addr1, MPI_Aint addr2);
+
 /* MPI-2 RMA Routines */
 
 int MPID_Win_create(void *, MPI_Aint, int, MPID_Info *, MPID_Comm *,
diff --git a/src/mpi/misc/Makefile.mk b/src/mpi/misc/Makefile.mk
index b5528a8..7ce8e9d 100644
--- a/src/mpi/misc/Makefile.mk
+++ b/src/mpi/misc/Makefile.mk
@@ -9,4 +9,6 @@ mpi_sources +=              \
     src/mpi/misc/getpname.c \
     src/mpi/misc/pcontrol.c \
     src/mpi/misc/version.c  \
-    src/mpi/misc/library_version.c
+    src/mpi/misc/library_version.c \
+    src/mpi/misc/aint_add.c \
+    src/mpi/misc/aint_diff.c
diff --git a/src/mpi/misc/aint_add.c b/src/mpi/misc/aint_add.c
new file mode 100644
index 0000000..bcc8c82
--- /dev/null
+++ b/src/mpi/misc/aint_add.c
@@ -0,0 +1,68 @@
+/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
+/*
+ *
+ *  (C) 2014 by Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#include "mpiimpl.h"
+
+/* -- Begin Profiling Symbol Block for routine MPIX_Aint_add */
+#if defined(HAVE_PRAGMA_WEAK)
+#pragma weak MPIX_Aint_add = PMPIX_Aint_add
+#elif defined(HAVE_PRAGMA_HP_SEC_DEF)
+#pragma _HP_SECONDARY_DEF PMPIX_Aint_add  MPIX_Aint_add
+#elif defined(HAVE_PRAGMA_CRI_DUP)
+#pragma _CRI duplicate MPIX_Aint_add as PMPIX_Aint_add
+#elif defined(HAVE_WEAK_ATTRIBUTE)
+MPI_Aint MPIX_Aint_add(MPI_Aint base, MPI_Aint disp) __attribute__((weak,alias("PMPIX_Aint_add")));
+#endif
+/* -- End Profiling Symbol Block */
+
+/* Define MPICH_MPI_FROM_PMPI if weak symbols are not supported to build
+   the MPI routines */
+#ifndef MPICH_MPI_FROM_PMPI
+#undef MPIX_Aint_add
+#define MPIX_Aint_add PMPIX_Aint_add
+
+#endif
+
+#undef FUNCNAME
+#define FUNCNAME MPIX_Aint_add
+
+/*@
+MPIX_Aint_add - Returns the sum of base and disp
+
+Input Parameters:
++ base - base address (integer)
+- disp - displacement (integer)
+
+Return value:
+Sum of the base and disp argument
+
+Notes:
+MPIX_Aint_Add produces a new MPI_Aint value that is equivalent to the sum of the
+base and disp arguments, where base represents a base address returned by a call
+to MPI_GET_ADDRESS and disp represents a signed integer displacement. The resulting
+address is valid only at the process that generated base, and it must correspond
+to a location in the same object referenced by base. The addition is performed in
+a manner that results in the correct MPI_Aint representation of the output address,
+as if the process that originally produced base had called:
+    MPI_Get_address((char *) base + disp, &result)
+
+.seealso: MPIX_Aint_diff
+@*/
+
+MPI_Aint MPIX_Aint_add(MPI_Aint base, MPI_Aint disp)
+{
+    MPI_Aint result;
+    MPID_MPI_STATE_DECL(MPID_STATE_MPIX_AINT_ADD);
+
+    MPIR_ERRTEST_INITIALIZED_ORDIE();
+
+    MPID_MPI_FUNC_ENTER(MPID_STATE_MPIX_AINT_ADD);
+    result = MPID_Aint_add(base, disp);
+    MPID_MPI_FUNC_EXIT(MPID_STATE_MPIX_AINT_ADD);
+
+    return result;
+}
diff --git a/src/mpi/misc/aint_diff.c b/src/mpi/misc/aint_diff.c
new file mode 100644
index 0000000..5c2e5cd
--- /dev/null
+++ b/src/mpi/misc/aint_diff.c
@@ -0,0 +1,69 @@
+/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
+/*
+ *
+ *  (C) 2014 by Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#include "mpiimpl.h"
+
+/* -- Begin Profiling Symbol Block for routine MPIX_Aint_diff */
+#if defined(HAVE_PRAGMA_WEAK)
+#pragma weak MPIX_Aint_diff = PMPIX_Aint_diff
+#elif defined(HAVE_PRAGMA_HP_SEC_DEF)
+#pragma _HP_SECONDARY_DEF PMPIX_Aint_diff  MPIX_Aint_diff
+#elif defined(HAVE_PRAGMA_CRI_DUP)
+#pragma _CRI duplicate MPIX_Aint_diff as PMPIX_Aint_diff
+#elif defined(HAVE_WEAK_ATTRIBUTE)
+MPI_Aint MPIX_Aint_diff(MPI_Aint addr1, MPI_Aint addr2) __attribute__((weak,alias("PMPIX_Aint_diff")));
+#endif
+/* -- End Profiling Symbol Block */
+
+/* Define MPICH_MPI_FROM_PMPI if weak symbols are not supported to build
+   the MPI routines */
+#ifndef MPICH_MPI_FROM_PMPI
+#undef MPIX_Aint_diff
+#define MPIX_Aint_diff PMPIX_Aint_diff
+
+#endif
+
+#undef FUNCNAME
+#define FUNCNAME MPIX_Aint_diff
+
+/*@
+MPIX_Aint_diff - Returns the difference between addr1 and addr2
+
+Input Parameters:
++ addr1 - minuend address (integer)
+- addr2 - subtrahend address (integer)
+
+Return value:
+Difference between addr1 and addr2
+
+Notes:
+MPIX_Aint_diff produces a new MPI_Aint value that is equivalent to the difference
+between addr1 and addr2 arguments, where addr1 and addr2 represent addresses
+returned by calls to MPI_GET_ADDRESS. The resulting address is valid only at the
+process that generated addr1 and addr2, and addr1 and addr2 must correspond to
+locations in the same object in the same process. The difference is calculated
+in a manner that results the signed difference from addr1 to addr2, as if the
+process that originally produced the addresses had called
+    (char *) addr1 - (char *) addr2
+on the addresses initially passed to MPI_GET_ADDRESS.
+
+.seealso: MPIX_Aint_add
+@*/
+
+MPI_Aint MPIX_Aint_diff(MPI_Aint addr1, MPI_Aint addr2)
+{
+    MPI_Aint result;
+    MPID_MPI_STATE_DECL(MPID_STATE_MPIX_AINT_DIFF);
+
+    MPIR_ERRTEST_INITIALIZED_ORDIE();
+
+    MPID_MPI_FUNC_ENTER(MPID_STATE_MPIX_AINT_DIFF);
+    result = MPID_Aint_diff(addr1, addr2);
+    MPID_MPI_FUNC_EXIT(MPID_STATE_MPIX_AINT_DIFF);
+
+    return result;
+}
diff --git a/src/mpid/ch3/src/Makefile.mk b/src/mpid/ch3/src/Makefile.mk
index c121985..970535b 100644
--- a/src/mpid/ch3/src/Makefile.mk
+++ b/src/mpid/ch3/src/Makefile.mk
@@ -59,6 +59,7 @@ mpi_core_sources +=                          \
     src/mpid/ch3/src/mpid_vc.c                             \
     src/mpid/ch3/src/mpid_rma.c                            \
     src/mpid/ch3/src/mpidi_rma.c                           \
+    src/mpid/ch3/src/mpid_aint.c                           \
     src/mpid/ch3/src/mpidi_isend_self.c                    \
     src/mpid/ch3/src/mpidi_pg.c                            \
     src/mpid/ch3/src/mpidi_printf.c
diff --git a/src/mpid/ch3/src/mpid_aint.c b/src/mpid/ch3/src/mpid_aint.c
new file mode 100644
index 0000000..ca4c00b
--- /dev/null
+++ b/src/mpid/ch3/src/mpid_aint.c
@@ -0,0 +1,61 @@
+/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
+/*
+ *  (C) 2014 by Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#include "mpidimpl.h"
+
+/*
+  Input Parameters:
++ base - base address (integer)
+- disp - displacement (integer)
+
+  Return value:
+  A new MPI_Aint value that is equivalent to the sum of the base and disp
+  arguments, where base represents a base address returned by a call
+  to MPI_GET_ADDRESS and disp represents a signed integer displacement.
+*/
+#undef FUNCNAME
+#define FUNCNAME MPID_Aint_add
+#undef FCNAME
+#define FCNAME MPIDI_QUOTE(FUNCNAME)
+MPI_Aint MPID_Aint_add(MPI_Aint base, MPI_Aint disp)
+{
+    MPI_Aint result;
+
+    MPIDI_STATE_DECL(MPID_STATE_MPID_AINT_ADD);
+    MPIDI_FUNC_ENTER(MPID_STATE_MPID_AINT_ADD);
+
+    result =  MPI_VOID_PTR_CAST_TO_MPI_AINT ((char*)MPI_AINT_CAST_TO_VOID_PTR(base) + disp);
+
+    MPIDI_FUNC_EXIT(MPID_STATE_MPID_AINT_ADD);
+    return result;
+}
+
+/*
+  Input Parameters:
++ addr1 - minuend address (integer)
+- addr2 - subtrahend address (integer)
+
+  Return value:
+  A new MPI_Aint value that is equivalent to the difference between addr1 and
+  addr2 arguments, where addr1 and addr2 represent addresses returned by calls
+  to MPI_GET_ADDRESS.
+*/
+#undef FUNCNAME
+#define FUNCNAME MPID_Aint_diff
+#undef FCNAME
+#define FCNAME MPIDI_QUOTE(FUNCNAME)
+MPI_Aint MPID_Aint_diff(MPI_Aint addr1, MPI_Aint addr2)
+{
+    MPI_Aint result;
+
+    MPIDI_STATE_DECL(MPID_STATE_MPID_AINT_DIFF);
+    MPIDI_FUNC_ENTER(MPID_STATE_MPID_AINT_DIFF);
+
+    result =  MPI_PTR_DISP_CAST_TO_MPI_AINT ((char*)MPI_AINT_CAST_TO_VOID_PTR(addr1) - (char*)MPI_AINT_CAST_TO_VOID_PTR(addr2));
+
+    MPIDI_FUNC_EXIT(MPID_STATE_MPID_AINT_DIFF);
+    return result;
+}
diff --git a/src/mpid/pamid/include/mpidimpl.h b/src/mpid/pamid/include/mpidimpl.h
index 7f9e9ad..ffd1cf7 100644
--- a/src/mpid/pamid/include/mpidimpl.h
+++ b/src/mpid/pamid/include/mpidimpl.h
@@ -181,4 +181,14 @@ static inline pami_endpoint_t MPIDI_Task_to_endpoint(pami_task_t task, size_t of
 int
 MPIDI_Win_set_info(MPID_Win *win,
 	           MPID_Info *info);
+
+static inline MPI_Aint MPID_Aint_add(MPI_Aint base, MPI_Aint disp)
+{
+    return  MPI_VOID_PTR_CAST_TO_MPI_AINT ((char*)MPI_AINT_CAST_TO_VOID_PTR(base) + disp);
+}
+
+static inline MPI_Aint MPID_Aint_diff(MPI_Aint addr1, MPI_Aint addr2)
+{
+    return MPI_PTR_DISP_CAST_TO_MPI_AINT ((char*)MPI_AINT_CAST_TO_VOID_PTR(addr1) - (char*)MPI_AINT_CAST_TO_VOID_PTR(addr2));
+}
 #endif

-----------------------------------------------------------------------

Summary of changes:
 src/binding/fortran/mpif_h/buildiface              |   52 ++++++++++++
 .../fortran/use_mpi_f08/mpi_c_interface_nobuf.F90  |   16 ++++
 src/binding/fortran/use_mpi_f08/mpi_f08.F90        |   18 ++++
 .../use_mpi_f08/wrappers_f/aint_add_f08ts.F90      |   14 +++
 .../use_mpi_f08/wrappers_f/aint_diff_f08ts.F90     |   14 +++
 src/include/mpi.h.in                               |    6 ++
 src/include/mpiimpl.h                              |   24 ++++++
 src/mpi/misc/Makefile.mk                           |    4 +-
 src/mpi/misc/aint_add.c                            |   68 ++++++++++++++++
 src/mpi/misc/aint_diff.c                           |   69 ++++++++++++++++
 src/mpid/ch3/src/Makefile.mk                       |    1 +
 src/mpid/ch3/src/mpid_aint.c                       |   61 ++++++++++++++
 src/mpid/pamid/include/mpidimpl.h                  |   10 +++
 test/mpi/f08/rma/Makefile.am                       |    3 +-
 test/mpi/f08/rma/aintf08.f90                       |   76 +++++++++++++++++
 test/mpi/f08/rma/testlist                          |    1 +
 test/mpi/f77/rma/Makefile.am                       |    3 +-
 test/mpi/f77/rma/aintf.f                           |   85 ++++++++++++++++++++
 test/mpi/f77/rma/testlist                          |    1 +
 test/mpi/rma/Makefile.am                           |    3 +-
 test/mpi/rma/aint.c                                |   80 ++++++++++++++++++
 test/mpi/rma/testlist.in                           |    1 +
 22 files changed, 606 insertions(+), 4 deletions(-)
 create mode 100644 src/binding/fortran/use_mpi_f08/wrappers_f/aint_add_f08ts.F90
 create mode 100644 src/binding/fortran/use_mpi_f08/wrappers_f/aint_diff_f08ts.F90
 create mode 100644 src/mpi/misc/aint_add.c
 create mode 100644 src/mpi/misc/aint_diff.c
 create mode 100644 src/mpid/ch3/src/mpid_aint.c
 create mode 100644 test/mpi/f08/rma/aintf08.f90
 create mode 100644 test/mpi/f77/rma/aintf.f
 create mode 100644 test/mpi/rma/aint.c


hooks/post-receive
-- 
MPICH primary repository


More information about the commits mailing list