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 f4a63c1bb1f90b122264cf37af08e13e3271dcde (commit) via 17821d558694e4f4e27882b9f21cdd0da0cf95e0 (commit) via 7d8aba5d2a3ea392fe1b6b05e86f266ed9627709 (commit) from 055abbd3fe7d0239611dd7f70c508a4a546c63aa (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/f4a63c1bb1f90b122264cf37af08e13e32... commit f4a63c1bb1f90b122264cf37af08e13e3271dcde Author: Ken Raffenetti <[email protected]> Date: Wed Mar 12 10:37:15 2014 -0500 add test for Op::Reduce_local Test the use of Reduce_local in C++. Use multiple built-in datatypes, as well as a derived vector. diff --git a/test/mpi/cxx/coll/Makefile.am b/test/mpi/cxx/coll/Makefile.am index 3a6f7cb..75a0fd8 100644 --- a/test/mpi/cxx/coll/Makefile.am +++ b/test/mpi/cxx/coll/Makefile.am @@ -14,6 +14,7 @@ noinst_PROGRAMS = \ uallredx \ uallreduce \ ureduce \ + ureducelocal \ uscan \ uexscan \ icbcastx \ @@ -35,6 +36,7 @@ arcomplex_SOURCES = arcomplex.cxx uallredx_SOURCES = uallredx.cxx uallreduce_SOURCES = uallreduce.cxx ureduce_SOURCES = ureduce.cxx +ureducelocal_SOURCES = ureducelocal.cxx uscan_SOURCES = uscan.cxx uexscan_SOURCES = uexscan.cxx icbcastx_SOURCES = icbcastx.cxx diff --git a/test/mpi/cxx/coll/testlist b/test/mpi/cxx/coll/testlist index 2c0b9e1..b4a1eaa 100644 --- a/test/mpi/cxx/coll/testlist +++ b/test/mpi/cxx/coll/testlist @@ -2,6 +2,7 @@ arcomplex 4 uallredx 5 uallreduce 5 ureduce 5 +ureducelocal 5 uscan 5 uexscan 5 alltoallw2x 10 diff --git a/test/mpi/cxx/coll/ureducelocal.cxx b/test/mpi/cxx/coll/ureducelocal.cxx new file mode 100644 index 0000000..97aaae8 --- /dev/null +++ b/test/mpi/cxx/coll/ureducelocal.cxx @@ -0,0 +1,128 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ +/* + * + * (C) 2003 by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ +#include "mpi.h" +#include "mpitestconf.h" +#ifdef HAVE_IOSTREAM +// Not all C++ compilers have iostream instead of iostream.h +#include <iostream> +#ifdef HAVE_NAMESPACE_STD +// Those that do often need the std namespace; otherwise, a bare "cout" +// is likely to fail to compile +using namespace std; +#endif +#else +#include <iostream.h> +#endif +#include "mpitestcxx.h" + +static MPI::Datatype my_datatype; +static int real_count; + +void uop(const void *invec, void *inoutvec, int count, const MPI::Datatype & datatype) +{ + int i; + + if (datatype == my_datatype) + count = real_count; + + for (i = 0; i < count; i++) { + if (datatype == MPI::INT) + ((int *)inoutvec)[i] = ((int *)invec)[i] + ((int *)inoutvec)[i]; + else if (datatype == MPI::DOUBLE || datatype == my_datatype) + ((double *)inoutvec)[i] = ((double *)invec)[i] + ((double *)inoutvec)[i]; + else + return; + } +} + +int main(int argc, char **argv) +{ + MPI::Op sumop; + MPI::Intracomm comm = MPI::COMM_WORLD; + int errs = 0; + int size, i, count, root, rank; + int *vin, *vout; + double *dvin, *dvout; + + MTest_Init(); + + sumop.Init(uop, true); + size = comm.Get_size(); + rank = comm.Get_rank(); + + for (count = 1; count < 66000; count = count * 2) { + /* MPI::INT */ + vin = new int[count]; + vout = new int[count]; + + for (root = 0; root < size; root++) { + for (i = 0; i < count; i++) { + vin[i] = i; + vout[i] = -1; + } + sumop.Reduce_local(vin, vout, count, MPI::INT); + for (i = 0; i < count; i++) { + if (vout[i] != i - 1) { + errs++; + if (errs < 10) + cerr << "vout[" << i << "] = " << vout[i] << endl; + } + } + } + delete[]vin; + delete[]vout; + + /* MPI::DOUBLE */ + dvin = new double[count]; + dvout = new double[count]; + for (root = 0; root < size; root++) { + for (i = 0; i < count; i++) { + dvin[i] = i; + dvout[i] = -1; + } + sumop.Reduce_local(dvin, dvout, count, MPI::DOUBLE); + for (i = 0; i < count; i++) { + if (dvout[i] != i - 1) { + errs++; + if (errs < 10) + cerr << "dvout[" << i << "] = " << dvout[i] << endl; + } + } + } + delete[]dvin; + delete[]dvout; + + /* A vector of MPI::DOUBLEs */ + dvin = new double[count]; + dvout = new double[count]; + my_datatype = MPI::DOUBLE.Create_vector(count/2, 1, 2); + my_datatype.Commit(); + real_count = count; + for (root = 0; root < size; root++) { + for (i = 0; i < count; i++) { + dvin[i] = i; + dvout[i] = -1; + } + sumop.Reduce_local(dvin, dvout, 1, my_datatype); + for (i = 0; i < count; i += 2) { + if (dvout[i] != i - 1) { + errs++; + if (errs < 10) + cerr << "dvout[" << i << "] = " << dvout[i] << endl; + } + } + } + delete[]dvin; + delete[]dvout; + my_datatype.Free(); + } + + sumop.Free(); + MTest_Finalize(errs); + MPI::Finalize(); + return 0; +} http://git.mpich.org/mpich.git/commitdiff/17821d558694e4f4e27882b9f21cdd0da0... commit 17821d558694e4f4e27882b9f21cdd0da0cf95e0 Author: Ken Raffenetti <[email protected]> Date: Fri Mar 21 08:52:29 2014 -0500 add missing consts to MPI::Op methods diff --git a/src/binding/cxx/cxxdecl3.dat b/src/binding/cxx/cxxdecl3.dat index 9a41931..4244bd7 100644 --- a/src/binding/cxx/cxxdecl3.dat +++ b/src/binding/cxx/cxxdecl3.dat @@ -248,7 +248,8 @@ dtype-Pack_size int (, ,in:constref:Comm ,return) const # op-Init requires special handling #op-Init void (,User_function* function ,in:bool ) op-Free void () -op-Reduce_local void (in:const, , ,in:constref:Datatype, ,) +op-Is_commutative () const +op-Reduce_local void (in:const, , ,in:constref:Datatype, ,) const #intra-Allreduce void (in:const , , ,in:constref:Datatype ,in:constref:Op ) const #intra-Reduce_scatter void (in:const , , ,in:constref:Datatype ,in:constref:Op ) const intra-Scan void (in:const , , ,in:constref:Datatype ,in:constref:Op ) const http://git.mpich.org/mpich.git/commitdiff/7d8aba5d2a3ea392fe1b6b05e86f266ed9... commit 7d8aba5d2a3ea392fe1b6b05e86f266ed9627709 Author: Junchao Zhang <[email protected]> Date: Tue Mar 4 10:22:08 2014 -0600 Add const& to Datatype of MPI::Op::Reduce_local Fixes #2014 Signed-off-by: Ken Raffenetti <[email protected]> diff --git a/src/binding/cxx/buildiface b/src/binding/cxx/buildiface index 7c1ff1b..53589da 100755 --- a/src/binding/cxx/buildiface +++ b/src/binding/cxx/buildiface @@ -521,7 +521,7 @@ $specialReturnType{"intra-Dup"} = "Intracomm"; ); %class_mpi2op = ( 'Is_commutative' => '2;bool', - 'Reduce_local' => '0', + 'Reduce_local' => '0:4', ); %class_mpi2preq = (); %class_mpi2req = (); diff --git a/src/binding/cxx/cxxdecl3.dat b/src/binding/cxx/cxxdecl3.dat index 9cbf2f9..9a41931 100644 --- a/src/binding/cxx/cxxdecl3.dat +++ b/src/binding/cxx/cxxdecl3.dat @@ -248,6 +248,7 @@ dtype-Pack_size int (, ,in:constref:Comm ,return) const # op-Init requires special handling #op-Init void (,User_function* function ,in:bool ) op-Free void () +op-Reduce_local void (in:const, , ,in:constref:Datatype, ,) #intra-Allreduce void (in:const , , ,in:constref:Datatype ,in:constref:Op ) const #intra-Reduce_scatter void (in:const , , ,in:constref:Datatype ,in:constref:Op ) const intra-Scan void (in:const , , ,in:constref:Datatype ,in:constref:Op ) const ----------------------------------------------------------------------- Summary of changes: src/binding/cxx/buildiface | 2 +- src/binding/cxx/cxxdecl3.dat | 2 + test/mpi/cxx/coll/Makefile.am | 2 + test/mpi/cxx/coll/testlist | 1 + test/mpi/cxx/coll/ureducelocal.cxx | 128 ++++++++++++++++++++++++++++++++++++ 5 files changed, 134 insertions(+), 1 deletions(-) create mode 100644 test/mpi/cxx/coll/ureducelocal.cxx hooks/post-receive -- MPICH primary repository