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

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


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

Modified:
   mpich2/trunk/src/mpi/romio/adio/include/adioi_error.h
   mpich2/trunk/src/mpi/romio/mpi-io/open.c
   mpich2/trunk/src/mpi/romio/mpi-io/set_info.c
   mpich2/trunk/src/mpi/romio/mpi-io/set_view.c
Log:
ROMIO: error checking for MPI_Comm and MPI_Info objects

1). There was error checking on the comm object in
    MPI_Comm_test_inter(comm, &flag); So if the return value of
    MPI_Comm_test_inter is not MPI_SUCCESS, then the comm is either an
    invalid MPI_Comm handle or intercommunicator handle.
2). A new macro MPIO_CHECK_INFO is added into adioi_error.h. It will
    call MPI_Info_dup, unless there is no more memory space left , as
    long as the info object is valid, this function will return
    MPI_SUCCESS; or it will return an error code. So by checking the
    return value of MPI_Info_dup, we could achieve the purpose of
    checking MPI_Info handles.

Based on patch 0006 from the second round of IBM's error checking
patches.  Replaces 0009 from the first round and augments r10637.

Modified: mpich2/trunk/src/mpi/romio/adio/include/adioi_error.h
===================================================================
--- mpich2/trunk/src/mpi/romio/adio/include/adioi_error.h	2012-12-21 02:18:52 UTC (rev 10800)
+++ mpich2/trunk/src/mpi/romio/adio/include/adioi_error.h	2012-12-21 02:18:56 UTC (rev 10801)
@@ -160,3 +160,14 @@
 #define ADIOI_TEST_DEFERRED(fh, myname, error_code)\
     if(! (fh)->is_open ) {\
 	    ADIO_ImmediateOpen((fh), (error_code)); }
+
+/* Check MPI_Info object by calling MPI_Info_dup, if the info object is valid
+then the dup operation will succeed */
+#define MPIO_CHECK_INFO(info, error_code) {     \
+    MPI_Info dupinfo;                           \
+    error_code = MPI_Info_dup(info, &dupinfo);  \
+    if(error_code != MPI_SUCCESS) goto fn_fail; \
+    if (dupinfo != MPI_INFO_NULL) {             \
+        MPI_Info_free(&dupinfo);                \
+    }                                           \
+}

Modified: mpich2/trunk/src/mpi/romio/mpi-io/open.c
===================================================================
--- mpich2/trunk/src/mpi/romio/mpi-io/open.c	2012-12-21 02:18:52 UTC (rev 10800)
+++ mpich2/trunk/src/mpi/romio/mpi-io/open.c	2012-12-21 02:18:56 UTC (rev 10801)
@@ -46,7 +46,7 @@
 int MPI_File_open(MPI_Comm comm, const char *filename, int amode,
                   MPI_Info info, MPI_File *fh)
 {
-    int error_code, file_system, flag, tmp_amode=0, rank;
+    int error_code = MPI_SUCCESS, file_system, flag, tmp_amode=0, rank;
     char *tmp;
     MPI_Comm dupcomm;
     ADIOI_Fns *fsops;
@@ -61,13 +61,15 @@
 
     /* --BEGIN ERROR HANDLING-- */
     MPIO_CHECK_COMM(comm, myname, error_code);
+    if(info != MPI_INFO_NULL)
+        MPIO_CHECK_INFO(info, error_code);
     /* --END ERROR HANDLING-- */
 
-    MPI_Comm_test_inter(comm, &flag);
+    error_code = MPI_Comm_test_inter(comm, &flag);
     /* --BEGIN ERROR HANDLING-- */
-    if (flag)
+    if (error_code || flag)
     {
-	error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
+	error_code = MPIO_Err_create_code(error_code, MPIR_ERR_RECOVERABLE,
 					  myname, __LINE__, MPI_ERR_COMM, 
 					  "**commnotintra", 0);
 	goto fn_fail;

Modified: mpich2/trunk/src/mpi/romio/mpi-io/set_info.c
===================================================================
--- mpich2/trunk/src/mpi/romio/mpi-io/set_info.c	2012-12-21 02:18:52 UTC (rev 10800)
+++ mpich2/trunk/src/mpi/romio/mpi-io/set_info.c	2012-12-21 02:18:56 UTC (rev 10801)
@@ -44,6 +44,7 @@
 
     /* --BEGIN ERROR HANDLING-- */
     MPIO_CHECK_FILE_HANDLE(adio_fh, myname, error_code);
+    MPIO_CHECK_INFO(info, error_code);
     /* --END ERROR HANDLING-- */
 
     /* set new info */
@@ -58,4 +59,6 @@
     MPIU_THREAD_CS_EXIT(ALLFUNC,);
 
     return error_code;
+fn_fail:
+    goto fn_exit;
 }

Modified: mpich2/trunk/src/mpi/romio/mpi-io/set_view.c
===================================================================
--- mpich2/trunk/src/mpi/romio/mpi-io/set_view.c	2012-12-21 02:18:52 UTC (rev 10800)
+++ mpich2/trunk/src/mpi/romio/mpi-io/set_view.c	2012-12-21 02:18:56 UTC (rev 10801)
@@ -106,6 +106,9 @@
 	error_code = MPIO_Err_return_file(adio_fh, error_code);
 	goto fn_exit;
     }
+    if(info != MPI_INFO_NULL){
+        MPIO_CHECK_INFO(info, error_code);
+    }
     /* --END ERROR HANDLING-- */
 
     MPI_Type_size(filetype, &filetype_size);
@@ -191,4 +194,9 @@
     MPIU_THREAD_CS_EXIT(ALLFUNC,);
 
     return error_code;
+fn_fail:
+	/* --BEGIN ERROR HANDLING-- */
+	error_code = MPIO_Err_return_file(fh, error_code);
+	goto fn_exit;
+	/* --END ERROR HANDLING-- */
 }



More information about the commits mailing list