[mpich-commits] r10799 - in mpich2/trunk/src: glue/romio include mpi/datatype mpi/romio/adio/include mpi/romio/mpi-io

goodell at mcs.anl.gov goodell at mcs.anl.gov
Thu Dec 20 20:18:49 CST 2012


Author: goodell
Date: 2012-12-20 20:18:49 -0600 (Thu, 20 Dec 2012)
New Revision: 10799

Modified:
   mpich2/trunk/src/glue/romio/glue_romio.c
   mpich2/trunk/src/include/glue_romio.h.in
   mpich2/trunk/src/mpi/datatype/typeutil.c
   mpich2/trunk/src/mpi/romio/adio/include/adioi_error.h
   mpich2/trunk/src/mpi/romio/mpi-io/mpioimpl.h
   mpich2/trunk/src/mpi/romio/mpi-io/set_view.c
Log:
ROMIO: check whether datatypes are committed

This only works when ROMIO is built with MPICH.

Based on patch 0001 from the second round of IBM's error checking
patches.  Replaces 0008 from the first round.

Modified: mpich2/trunk/src/glue/romio/glue_romio.c
===================================================================
--- mpich2/trunk/src/glue/romio/glue_romio.c	2012-12-20 21:09:42 UTC (rev 10798)
+++ mpich2/trunk/src/glue/romio/glue_romio.c	2012-12-21 02:18:49 UTC (rev 10799)
@@ -49,4 +49,30 @@
     MPIU_THREAD_CS_EXIT(ALLFUNC,);
 }
 
+/* will consider MPI_DATATYPE_NULL to be an error */
+#undef FUNCNAME
+#define FUNCNAME MPIR_Ext_datatype_iscommitted
+#undef FCNAME
+#define FCNAME MPIU_QUOTE(FUNCNAME)
+int MPIR_Ext_datatype_iscommitted(MPI_Datatype datatype)
+{
+    int mpi_errno = MPI_SUCCESS;
 
+    MPIR_ERRTEST_DATATYPE(datatype, "datatype", mpi_errno);
+    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+
+    if (HANDLE_GET_KIND(datatype) != HANDLE_KIND_BUILTIN) {
+        MPID_Datatype *datatype_ptr = NULL;
+        MPID_Datatype_get_ptr(datatype, datatype_ptr);
+
+        MPID_Datatype_valid_ptr(datatype_ptr, mpi_errno);
+        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+
+        MPID_Datatype_committed_ptr(datatype_ptr, mpi_errno);
+        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    }
+
+fn_fail:
+    return mpi_errno;
+}
+

Modified: mpich2/trunk/src/include/glue_romio.h.in
===================================================================
--- mpich2/trunk/src/include/glue_romio.h.in	2012-12-20 21:09:42 UTC (rev 10798)
+++ mpich2/trunk/src/include/glue_romio.h.in	2012-12-21 02:18:49 UTC (rev 10799)
@@ -53,6 +53,9 @@
 void MPIR_Ext_cs_enter_allfunc(void);
 void MPIR_Ext_cs_exit_allfunc(void);
 
+/* to facilitate error checking */
+int MPIR_Ext_datatype_iscommitted(MPI_Datatype datatype);
+
 /* prototypes for the mem tracing routines */
 void *MPIU_trmalloc(size_t a, int lineno, const char fname[]);
 void MPIU_trfree(void *a_ptr, int line, const char fname[]);

Modified: mpich2/trunk/src/mpi/datatype/typeutil.c
===================================================================
--- mpich2/trunk/src/mpi/datatype/typeutil.c	2012-12-20 21:09:42 UTC (rev 10798)
+++ mpich2/trunk/src/mpi/datatype/typeutil.c	2012-12-21 02:18:49 UTC (rev 10799)
@@ -324,3 +324,4 @@
 			  MPIR_FINALIZE_CALLBACK_PRIO-1);
     }
 }
+

Modified: mpich2/trunk/src/mpi/romio/adio/include/adioi_error.h
===================================================================
--- mpich2/trunk/src/mpi/romio/adio/include/adioi_error.h	2012-12-20 21:09:42 UTC (rev 10798)
+++ mpich2/trunk/src/mpi/romio/adio/include/adioi_error.h	2012-12-21 02:18:49 UTC (rev 10799)
@@ -58,16 +58,23 @@
     goto fn_exit;                                               \
 }
 
-#define MPIO_CHECK_DATATYPE(fh, datatype, myname, error_code)   \
-if (datatype == MPI_DATATYPE_NULL) {				\
-    error_code = MPIO_Err_create_code(MPI_SUCCESS,		\
-				      MPIR_ERR_RECOVERABLE,	\
-				      myname, __LINE__,		\
-				      MPI_ERR_TYPE, 		\
-				      "**dtypenull", 0);	\
-    error_code = MPIO_Err_return_file(fh, error_code);		\
-    goto fn_exit;                                               \
-}
+#define MPIO_CHECK_DATATYPE(fh, datatype, myname, error_code)       \
+    do {                                                            \
+        if (datatype == MPI_DATATYPE_NULL) {                        \
+            error_code = MPIO_Err_create_code(MPI_SUCCESS,          \
+                                              MPIR_ERR_RECOVERABLE, \
+                                              myname, __LINE__,     \
+                                              MPI_ERR_TYPE,         \
+                                              "**dtypenull", 0);    \
+        }                                                           \
+        else {                                                      \
+            MPIO_DATATYPE_ISCOMMITTED(datatype, error_code);        \
+        }                                                           \
+        if (error_code != MPI_SUCCESS) {                            \
+            error_code = MPIO_Err_return_file(fh, error_code);      \
+            goto fn_exit;                                           \
+        }                                                           \
+    } while (0)
 
 #define MPIO_CHECK_READABLE(fh, myname, error_code)		\
 if (fh->access_mode & ADIO_WRONLY) {			\

Modified: mpich2/trunk/src/mpi/romio/mpi-io/mpioimpl.h
===================================================================
--- mpich2/trunk/src/mpi/romio/mpi-io/mpioimpl.h	2012-12-20 21:09:42 UTC (rev 10798)
+++ mpich2/trunk/src/mpi/romio/mpi-io/mpioimpl.h	2012-12-21 02:18:49 UTC (rev 10799)
@@ -24,6 +24,12 @@
 #define MPIU_THREAD_CS_ENTER_ALLFUNC(ctx_) MPIR_Ext_cs_enter_allfunc()
 #define MPIU_THREAD_CS_EXIT_ALLFUNC(ctx_) MPIR_Ext_cs_exit_allfunc()
 
+/* committed datatype checking support in ROMIO */
+#define MPIO_DATATYPE_ISCOMMITTED(dtype_, err_)        \
+    do {                                               \
+        err_ =  MPIR_Ext_datatype_iscommitted(dtype_); \
+    } while (0)
+
 #else /* not ROMIO_INSIDE_MPICH */
 /* Any MPI implementation that wishes to follow the thread-safety and
    error reporting features provided by MPICH must implement these 
@@ -31,6 +37,7 @@
    of correct programs */
 #define MPIU_THREAD_CS_ENTER(x,y)
 #define MPIU_THREAD_CS_EXIT(x,y)
+#define MPIO_DATATYPE_ISCOMMITTED(dtype_, err_) do {} while (0)
 #ifdef HAVE_WINDOWS_H
 #define MPIU_UNREFERENCED_ARG(a) a
 #else

Modified: mpich2/trunk/src/mpi/romio/mpi-io/set_view.c
===================================================================
--- mpich2/trunk/src/mpi/romio/mpi-io/set_view.c	2012-12-20 21:09:42 UTC (rev 10798)
+++ mpich2/trunk/src/mpi/romio/mpi-io/set_view.c	2012-12-21 02:18:49 UTC (rev 10799)
@@ -68,6 +68,11 @@
 	error_code = MPIO_Err_return_file(adio_fh, error_code);
 	goto fn_exit;
     }
+    MPIO_DATATYPE_ISCOMMITTED(etype, error_code);
+    if (error_code != MPI_SUCCESS) {
+        error_code = MPIO_Err_return_file(adio_fh, error_code);
+        goto fn_exit;
+    }
 
     if (filetype == MPI_DATATYPE_NULL) {
 	error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
@@ -76,6 +81,11 @@
 	error_code = MPIO_Err_return_file(adio_fh, error_code);
 	goto fn_exit;
     }
+    MPIO_DATATYPE_ISCOMMITTED(filetype, error_code);
+    if (error_code != MPI_SUCCESS) {
+        error_code = MPIO_Err_return_file(adio_fh, error_code);
+        goto fn_exit;
+    }
 
     if ((adio_fh->access_mode & MPI_MODE_SEQUENTIAL) &&
 	(disp != MPI_DISPLACEMENT_CURRENT))
@@ -102,7 +112,7 @@
     MPI_Type_size(etype, &etype_size);
 
     /* --BEGIN ERROR HANDLING-- */
-    if (filetype_size % etype_size != 0)
+    if (etype_size != 0 && filetype_size % etype_size != 0)
     {
 	error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
 					  myname, __LINE__, MPI_ERR_ARG,



More information about the commits mailing list