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 2b6133164dee31a58feaefdd4db1e47daf15eedf (commit) via 634a7c857e5a1200778dbfba259ee2f68a0d89c2 (commit) from dcd7ee6cd5fd0933651f1dc5a26637a33aff1112 (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/2b6133164dee31a58feaefdd4db1e47daf... commit 2b6133164dee31a58feaefdd4db1e47daf15eedf Author: Xin Zhao <[email protected]> Date: Thu Nov 6 13:57:35 2014 -0600 Remove unused variable in examples/ircpi.c. Signed-off-by: Ken Raffenetti <[email protected]> diff --git a/examples/ircpi.c b/examples/ircpi.c index 30c1ed2..6e42c5b 100644 --- a/examples/ircpi.c +++ b/examples/ircpi.c @@ -11,7 +11,7 @@ int main(int argc, char *argv[]) { - int n, myid, numprocs, i, ierr; + int n, myid, numprocs, i; double PI25DT = 3.141592653589793238462643; double mypi, pi, h, sum, x; MPI_Win nwin, piwin; @@ -36,7 +36,7 @@ int main(int argc, char *argv[]) if (myid == 0) { fprintf(stdout, "Enter the number of intervals: (0 quits) "); fflush(stdout); - ierr=scanf("%d",&n); + scanf("%d",&n); pi = 0.0; } MPI_Win_fence(0, nwin); http://git.mpich.org/mpich.git/commitdiff/634a7c857e5a1200778dbfba259ee2f68a... commit 634a7c857e5a1200778dbfba259ee2f68a0d89c2 Author: Xin Zhao <[email protected]> Date: Thu Nov 6 13:31:12 2014 -0600 Move ircpi.c from test/mpi/rma to examples. ircpi.c is an interactive test, which is never triggered in RMA test suite. It is better to put it under examples. Signed-off-by: Ken Raffenetti <[email protected]> diff --git a/examples/Makefile.am b/examples/Makefile.am index 72d593a..40d4cff 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -57,7 +57,7 @@ noinst_PROGRAMS = cpi # pmandel requires a separate set of socket calls (its a long story) # and may not build on most platforms EXTRA_PROGRAMS = pmandel pmandel_spawn pmandel_service pmandel_spaserv \ - pmandel_fence hellow icpi parent child srtest \ + pmandel_fence hellow icpi ircpi parent child srtest \ spawn_merge_parent spawn_merge_child1 spawn_merge_child2 # LIBS includes -lmpich and other libraries (e.g., -lpmpich if @@ -82,6 +82,8 @@ cpi_LDFLAGS = $(AM_LDFLAGS) $(mpich_libtool_static_flag) icpi_SOURCES = icpi.c icpi_LDADD = -lm +ircpi_SOURCES = ircpi.c +ircpi_LDADD = -lm pmandel_SOURCES = pmandel.c pmandel_LDADD = -lm pmandel_spawn_SOURCES = pmandel_spawn.c diff --git a/examples/ircpi.c b/examples/ircpi.c new file mode 100644 index 0000000..30c1ed2 --- /dev/null +++ b/examples/ircpi.c @@ -0,0 +1,71 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ +/* + * (C) 2001 by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ +#include "mpi.h" +#include "stdio.h" +#include <math.h> + +/* From Using MPI-2 */ + +int main(int argc, char *argv[]) +{ + int n, myid, numprocs, i, ierr; + double PI25DT = 3.141592653589793238462643; + double mypi, pi, h, sum, x; + MPI_Win nwin, piwin; + + MPI_Init(&argc,&argv); + MPI_Comm_size(MPI_COMM_WORLD,&numprocs); + MPI_Comm_rank(MPI_COMM_WORLD,&myid); + + if (myid == 0) { + MPI_Win_create(&n, sizeof(int), 1, MPI_INFO_NULL, + MPI_COMM_WORLD, &nwin); + MPI_Win_create(&pi, sizeof(double), 1, MPI_INFO_NULL, + MPI_COMM_WORLD, &piwin); + } + else { + MPI_Win_create(MPI_BOTTOM, 0, 1, MPI_INFO_NULL, + MPI_COMM_WORLD, &nwin); + MPI_Win_create(MPI_BOTTOM, 0, 1, MPI_INFO_NULL, + MPI_COMM_WORLD, &piwin); + } + while (1) { + if (myid == 0) { + fprintf(stdout, "Enter the number of intervals: (0 quits) "); + fflush(stdout); + ierr=scanf("%d",&n); + pi = 0.0; + } + MPI_Win_fence(0, nwin); + if (myid != 0) + MPI_Get(&n, 1, MPI_INT, 0, 0, 1, MPI_INT, nwin); + MPI_Win_fence(0, nwin); + if (n == 0) + break; + else { + h = 1.0 / (double) n; + sum = 0.0; + for (i = myid + 1; i <= n; i += numprocs) { + x = h * ((double)i - 0.5); + sum += (4.0 / (1.0 + x*x)); + } + mypi = h * sum; + MPI_Win_fence( 0, piwin); + MPI_Accumulate(&mypi, 1, MPI_DOUBLE, 0, 0, 1, MPI_DOUBLE, + MPI_SUM, piwin); + MPI_Win_fence(0, piwin); + if (myid == 0) { + fprintf(stdout, "pi is approximately %.16f, Error is %.16f\n", + pi, fabs(pi - PI25DT)); + fflush(stdout); + } + } + } + MPI_Win_free(&nwin); + MPI_Win_free(&piwin); + MPI_Finalize(); + return 0; +} diff --git a/test/mpi/rma/Makefile.am b/test/mpi/rma/Makefile.am index c1c4d36..10ab17c 100644 --- a/test/mpi/rma/Makefile.am +++ b/test/mpi/rma/Makefile.am @@ -14,7 +14,6 @@ EXTRA_DIST = testlist ## correctly noinst_PROGRAMS = \ allocmem \ - ircpi \ test1 \ test2 \ test2_shm \ @@ -216,5 +215,3 @@ mutex_bench_shm_ordered_SOURCES = mutex_bench.c mcs-mutex.c mcs-mutex.h linked_list_bench_lock_shr_nocheck_SOURCES = linked_list_bench_lock_shr.c linked_list_bench_lock_shr_nocheck_CPPFLAGS = -DUSE_MODE_NOCHECK $(AM_CPPFLAGS) - -ircpi_LDADD = $(LDADD) -lm diff --git a/test/mpi/rma/ircpi.c b/test/mpi/rma/ircpi.c deleted file mode 100644 index 99a83ed..0000000 --- a/test/mpi/rma/ircpi.c +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ -/* - * (C) 2001 by Argonne National Laboratory. - * See COPYRIGHT in top-level directory. - */ -#include "mpi.h" -#include "stdio.h" -#include <math.h> - -/* From Using MPI-2 */ - -int main(int argc, char *argv[]) -{ - int n, myid, numprocs, i, ierr; - double PI25DT = 3.141592653589793238462643; - double mypi, pi, h, sum, x; - MPI_Win nwin, piwin; - - MPI_Init(&argc,&argv); - MPI_Comm_size(MPI_COMM_WORLD,&numprocs); - MPI_Comm_rank(MPI_COMM_WORLD,&myid); - - if (myid == 0) { - MPI_Win_create(&n, sizeof(int), 1, MPI_INFO_NULL, - MPI_COMM_WORLD, &nwin); - MPI_Win_create(&pi, sizeof(double), 1, MPI_INFO_NULL, - MPI_COMM_WORLD, &piwin); - } - else { - MPI_Win_create(MPI_BOTTOM, 0, 1, MPI_INFO_NULL, - MPI_COMM_WORLD, &nwin); - MPI_Win_create(MPI_BOTTOM, 0, 1, MPI_INFO_NULL, - MPI_COMM_WORLD, &piwin); - } - while (1) { - if (myid == 0) { - fprintf(stdout, "Enter the number of intervals: (0 quits) "); - fflush(stdout); - ierr=scanf("%d",&n); - pi = 0.0; - } - MPI_Win_fence(0, nwin); - if (myid != 0) - MPI_Get(&n, 1, MPI_INT, 0, 0, 1, MPI_INT, nwin); - MPI_Win_fence(0, nwin); - if (n == 0) - break; - else { - h = 1.0 / (double) n; - sum = 0.0; - for (i = myid + 1; i <= n; i += numprocs) { - x = h * ((double)i - 0.5); - sum += (4.0 / (1.0 + x*x)); - } - mypi = h * sum; - MPI_Win_fence( 0, piwin); - MPI_Accumulate(&mypi, 1, MPI_DOUBLE, 0, 0, 1, MPI_DOUBLE, - MPI_SUM, piwin); - MPI_Win_fence(0, piwin); - if (myid == 0) { - fprintf(stdout, "pi is approximately %.16f, Error is %.16f\n", - pi, fabs(pi - PI25DT)); - fflush(stdout); - } - } - } - MPI_Win_free(&nwin); - MPI_Win_free(&piwin); - MPI_Finalize(); - return 0; -} ----------------------------------------------------------------------- Summary of changes: examples/Makefile.am | 4 ++- examples/ircpi.c | 71 ++++++++++++++++++++++++++++++++++++++++++++++ test/mpi/rma/Makefile.am | 3 -- test/mpi/rma/ircpi.c | 71 ---------------------------------------------- 4 files changed, 74 insertions(+), 75 deletions(-) create mode 100644 examples/ircpi.c delete mode 100644 test/mpi/rma/ircpi.c hooks/post-receive -- MPICH primary repository