[mpich-commits] r10639 - mpich2/trunk/src/mpi/romio/adio/common

goodell at mcs.anl.gov goodell at mcs.anl.gov
Tue Nov 20 16:20:57 CST 2012


Author: goodell
Date: 2012-11-20 16:20:57 -0600 (Tue, 20 Nov 2012)
New Revision: 10639

Modified:
   mpich2/trunk/src/mpi/romio/adio/common/ad_hints.c
   mpich2/trunk/src/mpi/romio/adio/common/ad_open.c
   mpich2/trunk/src/mpi/romio/adio/common/cb_config_list.c
Log:
handle ENOMEM errors in ADIO

Contributed by IBM.  Based on patch 0011 from code discussions.

Modified: mpich2/trunk/src/mpi/romio/adio/common/ad_hints.c
===================================================================
--- mpich2/trunk/src/mpi/romio/adio/common/ad_hints.c	2012-11-20 22:20:57 UTC (rev 10638)
+++ mpich2/trunk/src/mpi/romio/adio/common/ad_hints.c	2012-11-20 22:20:57 UTC (rev 10639)
@@ -40,7 +40,13 @@
 
     value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char));
     if (value == NULL) {
-	/* NEED TO HANDLE ENOMEM */
+        *error_code = MPIO_Err_create_code(*error_code,
+                                           MPIR_ERR_RECOVERABLE,
+                                           myname,
+                                           __LINE__,
+                                           MPI_ERR_OTHER,
+                                           "**nomem2",0);
+        return;
     }
 
     /* initialize info and hints to default values if they haven't been
@@ -484,7 +490,13 @@
 		len = (strlen(value)+1) * sizeof(char);
 		fd->hints->cb_config_list = ADIOI_Malloc(len);
 		if (fd->hints->cb_config_list == NULL) {
-		    /* NEED TO HANDLE ENOMEM */
+                    *error_code = MPIO_Err_create_code(*error_code,
+                                                       MPIR_ERR_RECOVERABLE,
+                                                       myname,
+                                                       __LINE__,
+                                                       MPI_ERR_OTHER,
+                                                       "**nomem2",0);
+                    return;
 		}
 		ADIOI_Strncpy(fd->hints->cb_config_list, value, len);
 	    }
@@ -517,7 +529,13 @@
 	len = (strlen(ADIOI_CB_CONFIG_LIST_DFLT)+1) * sizeof(char);
 	fd->hints->cb_config_list = ADIOI_Malloc(len);
 	if (fd->hints->cb_config_list == NULL) {
-	    /* NEED TO HANDLE ENOMEM */
+            *error_code = MPIO_Err_create_code(*error_code,
+                                               MPIR_ERR_RECOVERABLE,
+                                               myname,
+                                               __LINE__,
+                                               MPI_ERR_OTHER,
+                                               "**nomem2",0);
+            return;
 	}
 	ADIOI_Strncpy(fd->hints->cb_config_list, ADIOI_CB_CONFIG_LIST_DFLT, len);
     }

Modified: mpich2/trunk/src/mpi/romio/adio/common/ad_open.c
===================================================================
--- mpich2/trunk/src/mpi/romio/adio/common/ad_open.c	2012-11-20 22:20:57 UTC (rev 10638)
+++ mpich2/trunk/src/mpi/romio/adio/common/ad_open.c	2012-11-20 22:20:57 UTC (rev 10639)
@@ -75,7 +75,13 @@
 /* create and initialize info object */
     fd->hints = (ADIOI_Hints *)ADIOI_Calloc(1, sizeof(struct ADIOI_Hints_struct));
     if (fd->hints == NULL) {
-	/* NEED TO HANDLE ENOMEM ERRORS */
+	*error_code = MPIO_Err_create_code(*error_code,
+					   MPIR_ERR_RECOVERABLE,
+					   myname,
+					   __LINE__,
+					   MPI_ERR_OTHER,
+					   "**nomem2",0);
+	goto fn_exit;
     }
     fd->hints->cb_config_list = NULL;
     fd->hints->ranklist = NULL;
@@ -254,7 +260,13 @@
     if (rank == 0) {
 	tmp_ranklist = (int *) ADIOI_Malloc(sizeof(int) * procs);
 	if (tmp_ranklist == NULL) {
-	    /* NEED TO HANDLE ENOMEM ERRORS */
+	    *error_code = MPIO_Err_create_code(*error_code,
+					       MPIR_ERR_RECOVERABLE,
+					       myname,
+					       __LINE__,
+					       MPI_ERR_OTHER,
+					       "**nomem2",0);
+	    return 0;
 	}
 
 	rank_ct = ADIOI_cb_config_list_parse(fd->hints->cb_config_list, 

Modified: mpich2/trunk/src/mpi/romio/adio/common/cb_config_list.c
===================================================================
--- mpich2/trunk/src/mpi/romio/adio/common/cb_config_list.c	2012-11-20 22:20:57 UTC (rev 10638)
+++ mpich2/trunk/src/mpi/romio/adio/common/cb_config_list.c	2012-11-20 22:20:57 UTC (rev 10639)
@@ -66,6 +66,8 @@
 {
     int my_rank;
     char *value;
+	int error_code = MPI_SUCCESS;
+	static char myname[] = "ADIOI_cb_bcast_rank_map";
 
     MPI_Bcast(&(fd->hints->cb_nodes), 1, MPI_INT, 0, fd->comm);
     if (fd->hints->cb_nodes > 0) {
@@ -73,7 +75,13 @@
 	if (my_rank != 0) {
 	    fd->hints->ranklist = ADIOI_Malloc(fd->hints->cb_nodes*sizeof(int));
 	    if (fd->hints->ranklist == NULL) {
-		/* NEED TO HANDLE ENOMEM */
+                error_code = MPIO_Err_create_code(error_code,
+                                                  MPIR_ERR_RECOVERABLE,
+                                                  myname,
+                                                  __LINE__,
+                                                  MPI_ERR_OTHER,
+                                                  "**nomem2",0);
+                return error_code;
 	    }
 	}
 	MPI_Bcast(fd->hints->ranklist, fd->hints->cb_nodes, MPI_INT, 0, 



More information about the commits mailing list