[mpich-commits] [mpich] MPICH primary repository branch, master, updated. v3.1.1-114-gdd5c24d

Service Account noreply at mpich.org
Fri Jul 18 09:16:51 CDT 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  dd5c24d7a3c3e90081be65e2e1424c46cdf18586 (commit)
       via  67aa8e6a387de0e31982b57ba5099e12c78eb92e (commit)
      from  cb1fa5f8e843dddceed61d886d382c126f198ac3 (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/dd5c24d7a3c3e90081be65e2e1424c46cdf18586

commit dd5c24d7a3c3e90081be65e2e1424c46cdf18586
Author: Junchao Zhang <jczhang at mcs.anl.gov>
Date:   Fri Jul 11 10:40:55 2014 -0500

    Added a test for MPI_T cvar read and write
    
    See #2128
    
    Signed-off-by: Huiwei Lu <huiweilu at mcs.anl.gov>

diff --git a/test/mpi/.gitignore b/test/mpi/.gitignore
index 5966d8f..3a62aca 100644
--- a/test/mpi/.gitignore
+++ b/test/mpi/.gitignore
@@ -892,6 +892,7 @@
 /manual/testconnectserial
 /mpi_t/mpi_t_str
 /mpi_t/mpit_vars
+/mpi_t/cvarwrite
 /perf/allredtrace
 /perf/commcreatep
 /perf/dtpack
diff --git a/test/mpi/mpi_t/Makefile.am b/test/mpi/mpi_t/Makefile.am
index 7e0b5b7..95088d7 100644
--- a/test/mpi/mpi_t/Makefile.am
+++ b/test/mpi/mpi_t/Makefile.am
@@ -14,4 +14,5 @@ EXTRA_DIST = testlist
 ## correctly
 noinst_PROGRAMS =     \
     mpi_t_str   \
-    mpit_vars
+    mpit_vars   \
+    cvarwrite
diff --git a/test/mpi/mpi_t/cvarwrite.c b/test/mpi/mpi_t/cvarwrite.c
new file mode 100644
index 0000000..aaf84d2
--- /dev/null
+++ b/test/mpi/mpi_t/cvarwrite.c
@@ -0,0 +1,107 @@
+/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
+/*
+ *  (C) 2014 by Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+#include "mpi.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "mpitest.h"
+#include "mpitestconf.h"
+
+#define MAX_STR_CVAR_LEN 512
+#define MAX_VAR_NAME_LEN 128
+
+int main(int argc, char* argv[])
+{
+    int i;
+    int required, provided;
+    int num_cvar;
+    char name[MAX_VAR_NAME_LEN];
+    int namelen, verbosity, datatype, desclen, binding, scope, count;
+    MPI_T_enum enumtype = MPI_T_ENUM_NULL;
+    int iin, iout, iold;
+    unsigned uin, uout, uold;
+    unsigned long ulin, ulout, ulold;
+    unsigned long long ullin, ullout, ullold;
+    char cin[MAX_STR_CVAR_LEN], cout[MAX_STR_CVAR_LEN], cold[MAX_STR_CVAR_LEN];
+    MPI_T_cvar_handle chandle;
+    int errs = 0;
+
+    required = MPI_THREAD_SINGLE;
+    namelen = sizeof(name);
+
+    MTest_Init(&argc, &argv);
+    MPI_T_init_thread(required, &provided);
+
+    MPI_T_cvar_get_num(&num_cvar);
+    MTestPrintfMsg(10, "Total %d MPI control variables\n", num_cvar);
+
+    for (i = 0; i < num_cvar; i++) {
+        MPI_T_cvar_get_info(i, name, &namelen, &verbosity, &datatype, &enumtype,
+            NULL /* desc is intentionly ignored to test NULL input */, &desclen, &binding, &scope);
+        if (binding != MPI_T_BIND_NO_OBJECT) continue;
+
+        MPI_T_cvar_handle_alloc(i, NULL, &chandle, &count);
+        if (count == 1 || (datatype == MPI_CHAR && count < sizeof(cin))) {
+            switch (datatype) {
+                case MPI_INT:
+                    iin = 123;
+                    iout = 456;
+                    MPI_T_cvar_read(chandle, &iold); /* Read the old value */
+                    MPI_T_cvar_write(chandle, &iin); /* Write an arbitrary value */
+                    MPI_T_cvar_read(chandle, &iout); /* Read the value again */
+                    MPI_T_cvar_write(chandle, &iold); /* Restore the old value */
+                    if (iin != iout) errs++;
+                    break;
+                case MPI_UNSIGNED:
+                    uin = 133;
+                    uout = 986;
+                    MPI_T_cvar_read(chandle, &uold);
+                    MPI_T_cvar_write(chandle, &uin);
+                    MPI_T_cvar_read(chandle, &uout);
+                    MPI_T_cvar_write(chandle, &uold);
+                    if (uin != uout) errs++;
+                    break;
+                case MPI_UNSIGNED_LONG:
+                    ulin = 1830;
+                    ulout = 2014;
+                    MPI_T_cvar_read(chandle, &ulold);
+                    MPI_T_cvar_write(chandle, &ulin);
+                    MPI_T_cvar_read(chandle, &ulout);
+                    MPI_T_cvar_write(chandle, &ulold);
+                    if (ulin != ulout) errs++;
+                    break;
+                case MPI_UNSIGNED_LONG_LONG:
+                    ullin = 11930;
+                    ullout = 52014;
+                    MPI_T_cvar_read(chandle, &ullold);
+                    MPI_T_cvar_write(chandle, &ullin);
+                    MPI_T_cvar_read(chandle, &ullout);
+                    MPI_T_cvar_write(chandle, &ullold);
+                    if (ullin != ullout) errs++;
+                    break;
+                case MPI_CHAR:
+                    strcpy(cin,  "GARBAGE MPI_CHAR CVAR VALUE");
+                    strcpy(cout, "TEMPORARY MPI_CHAR CVAR VALUE");
+                    MPI_T_cvar_read(chandle, cold);
+                    MPI_T_cvar_write(chandle, cin);
+                    MPI_T_cvar_read(chandle, cout);
+                    MPI_T_cvar_write(chandle, cold);
+                    /* printf("%s = %s\n", name, cold); */
+                    if (strcmp(cin, cout)) errs++;
+                    break;
+                default:
+                    break;
+            }
+        }
+
+        MPI_T_cvar_handle_free(&chandle);
+    }
+
+    MPI_T_finalize();
+    MTest_Finalize(errs);
+    MPI_Finalize();
+    return 0;
+}
diff --git a/test/mpi/mpi_t/testlist b/test/mpi/mpi_t/testlist
index 69fcab4..f6e3e6a 100644
--- a/test/mpi/mpi_t/testlist
+++ b/test/mpi/mpi_t/testlist
@@ -1,2 +1,3 @@
 mpi_t_str 1 mpiversion=3.0
 mpit_vars 1 mpiversion=3.0
+cvarwrite 1 mpiversion=3.0

http://git.mpich.org/mpich.git/commitdiff/67aa8e6a387de0e31982b57ba5099e12c78eb92e

commit 67aa8e6a387de0e31982b57ba5099e12c78eb92e
Author: Junchao Zhang <jczhang at mcs.anl.gov>
Date:   Tue Jul 8 13:54:03 2014 -0500

    Added the missing const to the buf arg in MPI_T_pvar/cvar_write
    
    Fixes #2128
    
    Signed-off-by: Huiwei Lu <huiweilu at mcs.anl.gov>

diff --git a/src/include/mpi.h.in b/src/include/mpi.h.in
index 72bbf04..bd047ce 100644
--- a/src/include/mpi.h.in
+++ b/src/include/mpi.h.in
@@ -1501,7 +1501,7 @@ int MPI_T_cvar_handle_alloc(int cvar_index, void *obj_handle, MPI_T_cvar_handle
                             int *count);
 int MPI_T_cvar_handle_free(MPI_T_cvar_handle *handle);
 int MPI_T_cvar_read(MPI_T_cvar_handle handle, void *buf);
-int MPI_T_cvar_write(MPI_T_cvar_handle handle, void *buf);
+int MPI_T_cvar_write(MPI_T_cvar_handle handle, const void *buf);
 int MPI_T_pvar_get_num(int *num_pvar);
 int MPI_T_pvar_get_info(int pvar_index, char *name, int *name_len, int *verbosity, int *var_class,
                         MPI_Datatype *datatype, MPI_T_enum *enumtype, char *desc, int *desc_len,
@@ -1514,7 +1514,7 @@ int MPI_T_pvar_handle_free(MPI_T_pvar_session session, MPI_T_pvar_handle *handle
 int MPI_T_pvar_start(MPI_T_pvar_session session, MPI_T_pvar_handle handle);
 int MPI_T_pvar_stop(MPI_T_pvar_session session, MPI_T_pvar_handle handle);
 int MPI_T_pvar_read(MPI_T_pvar_session session, MPI_T_pvar_handle handle, void *buf);
-int MPI_T_pvar_write(MPI_T_pvar_session session, MPI_T_pvar_handle handle, void *buf);
+int MPI_T_pvar_write(MPI_T_pvar_session session, MPI_T_pvar_handle handle, const void *buf);
 int MPI_T_pvar_reset(MPI_T_pvar_session session, MPI_T_pvar_handle handle);
 int MPI_T_pvar_readreset(MPI_T_pvar_session session, MPI_T_pvar_handle handle, void *buf);
 int MPI_T_category_get_num(int *num_cat);
@@ -2136,7 +2136,7 @@ int PMPI_T_cvar_handle_alloc(int cvar_index, void *obj_handle, MPI_T_cvar_handle
                              int *count);
 int PMPI_T_cvar_handle_free(MPI_T_cvar_handle *handle);
 int PMPI_T_cvar_read(MPI_T_cvar_handle handle, void *buf);
-int PMPI_T_cvar_write(MPI_T_cvar_handle handle, void *buf);
+int PMPI_T_cvar_write(MPI_T_cvar_handle handle, const void *buf);
 int PMPI_T_pvar_get_num(int *num_pvar);
 int PMPI_T_pvar_get_info(int pvar_index, char *name, int *name_len, int *verbosity, int *var_class,
                          MPI_Datatype *datatype, MPI_T_enum *enumtype, char *desc, int *desc_len,
@@ -2149,7 +2149,7 @@ int PMPI_T_pvar_handle_free(MPI_T_pvar_session session, MPI_T_pvar_handle *handl
 int PMPI_T_pvar_start(MPI_T_pvar_session session, MPI_T_pvar_handle handle);
 int PMPI_T_pvar_stop(MPI_T_pvar_session session, MPI_T_pvar_handle handle);
 int PMPI_T_pvar_read(MPI_T_pvar_session session, MPI_T_pvar_handle handle, void *buf);
-int PMPI_T_pvar_write(MPI_T_pvar_session session, MPI_T_pvar_handle handle, void *buf);
+int PMPI_T_pvar_write(MPI_T_pvar_session session, MPI_T_pvar_handle handle, const void *buf);
 int PMPI_T_pvar_reset(MPI_T_pvar_session session, MPI_T_pvar_handle handle);
 int PMPI_T_pvar_readreset(MPI_T_pvar_session session, MPI_T_pvar_handle handle, void *buf);
 int PMPI_T_category_get_num(int *num_cat);
diff --git a/src/include/mpiimpl.h b/src/include/mpiimpl.h
index ccbe9a7..b07f448 100644
--- a/src/include/mpiimpl.h
+++ b/src/include/mpiimpl.h
@@ -4214,7 +4214,7 @@ int MPIR_Ialltoallw_inter(const void *sendbuf, const int *sendcounts, const int
 /* begin impl functions for MPI_T (MPI_T_ right now) */
 int MPIR_T_cvar_handle_alloc_impl(int cvar_index, void *obj_handle, MPI_T_cvar_handle *handle, int *count);
 int MPIR_T_cvar_read_impl(MPI_T_cvar_handle handle, void *buf);
-int MPIR_T_cvar_write_impl(MPI_T_cvar_handle handle, void *buf);
+int MPIR_T_cvar_write_impl(MPI_T_cvar_handle handle, const void *buf);
 int MPIR_T_pvar_session_create_impl(MPI_T_pvar_session *session);
 int MPIR_T_pvar_session_free_impl(MPI_T_pvar_session *session);
 int MPIR_T_pvar_handle_alloc_impl(MPI_T_pvar_session session, int pvar_index, void *obj_handle, MPI_T_pvar_handle *handle, int *count);
@@ -4222,7 +4222,7 @@ int MPIR_T_pvar_handle_free_impl(MPI_T_pvar_session session, MPI_T_pvar_handle *
 int MPIR_T_pvar_start_impl(MPI_T_pvar_session session, MPI_T_pvar_handle handle);
 int MPIR_T_pvar_stop_impl(MPI_T_pvar_session session, MPI_T_pvar_handle handle);
 int MPIR_T_pvar_read_impl(MPI_T_pvar_session session, MPI_T_pvar_handle handle, void *buf);
-int MPIR_T_pvar_write_impl(MPI_T_pvar_session session, MPI_T_pvar_handle handle, void *buf);
+int MPIR_T_pvar_write_impl(MPI_T_pvar_session session, MPI_T_pvar_handle handle, const void *buf);
 int MPIR_T_pvar_reset_impl(MPI_T_pvar_session session, MPI_T_pvar_handle handle);
 int MPIR_T_pvar_readreset_impl(MPI_T_pvar_session session, MPI_T_pvar_handle handle, void *buf);
 int MPIR_T_category_get_cvars_impl(int cat_index, int len, int indices[]);
diff --git a/src/mpi_t/cvar_write.c b/src/mpi_t/cvar_write.c
index b88959e..fb57a47 100644
--- a/src/mpi_t/cvar_write.c
+++ b/src/mpi_t/cvar_write.c
@@ -30,7 +30,7 @@ int MPI_T_cvar_write(MPI_T_cvar_handle handle, void *buf) __attribute__((weak,al
 #define FUNCNAME MPIR_T_cvar_write_impl
 #undef FCNAME
 #define FCNAME MPIU_QUOTE(FUNCNAME)
-int MPIR_T_cvar_write_impl(MPI_T_cvar_handle handle, void *buf)
+int MPIR_T_cvar_write_impl(MPI_T_cvar_handle handle, const void *buf)
 {
     int mpi_errno = MPI_SUCCESS;
     int i, count;
@@ -108,7 +108,7 @@ Input Parameters:
 .N MPI_T_ERR_CVAR_SET_NOT_NOW
 .N MPI_T_ERR_CVAR_SET_NEVER
 @*/
-int MPI_T_cvar_write(MPI_T_cvar_handle handle, void *buf)
+int MPI_T_cvar_write(MPI_T_cvar_handle handle, const void *buf)
 {
     int mpi_errno = MPI_SUCCESS;
 
diff --git a/src/mpi_t/pvar_write.c b/src/mpi_t/pvar_write.c
index 23ff0e2..ca3997b 100644
--- a/src/mpi_t/pvar_write.c
+++ b/src/mpi_t/pvar_write.c
@@ -30,7 +30,7 @@ int MPI_T_pvar_write(MPI_T_pvar_session session, MPI_T_pvar_handle handle, void
 #define FUNCNAME MPIR_T_pvar_write_impl
 #undef FCNAME
 #define FCNAME MPIU_QUOTE(FUNCNAME)
-int MPIR_T_pvar_write_impl(MPI_T_pvar_session session, MPI_T_pvar_handle handle, void *buf)
+int MPIR_T_pvar_write_impl(MPI_T_pvar_session session, MPI_T_pvar_handle handle, const void *buf)
 {
     /* This function should never be called */
     return MPI_ERR_INTERN;
@@ -70,7 +70,7 @@ MPI_T_pvar_write().
 .N MPI_T_ERR_INVALID_HANDLE
 .N MPI_T_ERR_PVAR_NO_WRITE
 @*/
-int MPI_T_pvar_write(MPI_T_pvar_session session, MPI_T_pvar_handle handle, void *buf)
+int MPI_T_pvar_write(MPI_T_pvar_session session, MPI_T_pvar_handle handle, const void *buf)
 {
     int mpi_errno = MPI_SUCCESS;
 

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

Summary of changes:
 src/include/mpi.h.in       |    8 ++--
 src/include/mpiimpl.h      |    4 +-
 src/mpi_t/cvar_write.c     |    4 +-
 src/mpi_t/pvar_write.c     |    4 +-
 test/mpi/.gitignore        |    1 +
 test/mpi/mpi_t/Makefile.am |    3 +-
 test/mpi/mpi_t/cvarwrite.c |  107 ++++++++++++++++++++++++++++++++++++++++++++
 test/mpi/mpi_t/testlist    |    1 +
 8 files changed, 121 insertions(+), 11 deletions(-)
 create mode 100644 test/mpi/mpi_t/cvarwrite.c


hooks/post-receive
-- 
MPICH primary repository


More information about the commits mailing list