[mpich-commits] r10641 - in mpich2/trunk/src/mpi/romio/adio: common include

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


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

Modified:
   mpich2/trunk/src/mpi/romio/adio/common/ad_close.c
   mpich2/trunk/src/mpi/romio/adio/common/ad_delete.c
   mpich2/trunk/src/mpi/romio/adio/include/adioi.h
Log:
only one task should actually delete in ADIO_Close

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

Modified: mpich2/trunk/src/mpi/romio/adio/common/ad_close.c
===================================================================
--- mpich2/trunk/src/mpi/romio/adio/common/ad_close.c	2012-11-20 22:20:58 UTC (rev 10640)
+++ mpich2/trunk/src/mpi/romio/adio/common/ad_close.c	2012-11-20 22:20:59 UTC (rev 10641)
@@ -14,7 +14,8 @@
 
 void ADIO_Close(ADIO_File fd, int *error_code)
 {
-    int i, j, k, combiner, myrank, err, is_contig;
+    int err = MPI_SUCCESS;
+    int i, j, k, combiner, myrank, is_contig;
     static char myname[] = "ADIO_CLOSE";
 
     if (fd->async_count) {
@@ -47,14 +48,21 @@
     }
 
     if (fd->access_mode & ADIO_DELETE_ON_CLOSE) {
+        int is_agg_ldr = 0;
+        ADIOI_IS_AGG_LEADER(fd, &is_agg_ldr);
 	/* if we are doing aggregation and deferred open, then it's possible
 	 * that rank 0 does not have access to the file. make sure only an
 	 * aggregator deletes the file.*/
 	MPI_Comm_rank(fd->comm, &myrank);
-	if (myrank == fd->hints->ranklist[0]) {
-		ADIO_Delete(fd->filename, &err);
+	if (is_agg_ldr) {
+            ADIO_Delete(fd->filename, &err);
 	}
 	MPI_Barrier(fd->comm);
+	MPI_Bcast(&err, 1, MPI_INT, fd->hints->ranklist[0], fd->comm);
+	if (err != MPI_SUCCESS) {
+            *error_code = err;
+            return;
+	}
     }
 
     if (fd->fortran_handle != -1) {

Modified: mpich2/trunk/src/mpi/romio/adio/common/ad_delete.c
===================================================================
--- mpich2/trunk/src/mpi/romio/adio/common/ad_delete.c	2012-11-20 22:20:58 UTC (rev 10640)
+++ mpich2/trunk/src/mpi/romio/adio/common/ad_delete.c	2012-11-20 22:20:59 UTC (rev 10641)
@@ -18,9 +18,7 @@
 
     err = unlink(filename);
     if (err == -1) {
-	*error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
-					   myname, __LINE__, MPI_ERR_IO, "**io",
-					   "**io %s", strerror(errno));
+	*error_code = ADIOI_Err_create_code(myname, filename, errno);
 	return;
     }
     else *error_code = MPI_SUCCESS;

Modified: mpich2/trunk/src/mpi/romio/adio/include/adioi.h
===================================================================
--- mpich2/trunk/src/mpi/romio/adio/include/adioi.h	2012-11-20 22:20:58 UTC (rev 10640)
+++ mpich2/trunk/src/mpi/romio/adio/include/adioi.h	2012-11-20 22:20:59 UTC (rev 10641)
@@ -78,6 +78,13 @@
 
 };
 
+#define ADIOI_IS_AGG_LEADER(fh_, is_agg_p_)              \
+    do {                                                 \
+        int rank_;                                       \
+        MPI_Comm_rank((fh_)->comm, &rank_);              \
+        *(is_agg_p_) = ((fh_)->hints->ranklist[0] == 0); \
+    } while (0)
+
 typedef struct ADIOI_Datarep {
     char *name;
     void *state;



More information about the commits mailing list