summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/H5Dcontig.c5
-rw-r--r--src/H5Distore.c4
-rw-r--r--src/H5FDmpio.c8
-rw-r--r--src/H5FDmpiposix.c11
-rw-r--r--src/H5Fcontig.c5
-rw-r--r--src/H5Fistore.c4
-rw-r--r--src/H5Fpkg.h1
-rw-r--r--src/H5Fprivate.h5
8 files changed, 15 insertions, 28 deletions
diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c
index 82ee74a..6445d19 100644
--- a/src/H5Dcontig.c
+++ b/src/H5Dcontig.c
@@ -139,7 +139,6 @@ H5F_contig_fill(H5F_t *f, hid_t dxpl_id, struct H5O_layout_t *layout,
MPI_Comm mpi_comm=MPI_COMM_NULL; /* MPI communicator for file */
int mpi_rank=(-1); /* This process's rank */
int mpi_size=(-1); /* Total # of processes */
- int mpi_round=0; /* Current process responsible for I/O */
int mpi_code; /* MPI return code */
unsigned blocks_written=0; /* Flag to indicate that chunk was actually written */
unsigned using_mpi=0; /* Flag to indicate that the file is being accessed with an MPI-capable file driver */
@@ -266,12 +265,10 @@ H5F_contig_fill(H5F_t *f, hid_t dxpl_id, struct H5O_layout_t *layout,
/* Check if this file is accessed with an MPI-capable file driver */
if(using_mpi) {
/* Round-robin write the chunks out from only one process */
- if(mpi_round==mpi_rank) {
+ if(H5_PAR_META_WRITE==mpi_rank) {
if (H5F_contig_write(f, (hsize_t)size, addr, size, dxpl_id, buf)<0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to write fill value to dataset");
} /* end if */
- ++mpi_round;
- mpi_round %= mpi_size;
/* Indicate that blocks are being written */
blocks_written=1;
diff --git a/src/H5Distore.c b/src/H5Distore.c
index 4847948..acb871d 100644
--- a/src/H5Distore.c
+++ b/src/H5Distore.c
@@ -2159,7 +2159,6 @@ H5F_istore_allocate(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout,
MPI_Comm mpi_comm=MPI_COMM_NULL; /* MPI communicator for file */
int mpi_rank=(-1); /* This process's rank */
int mpi_size=(-1); /* Total # of processes */
- int mpi_round=0; /* Current process responsible for I/O */
int mpi_code; /* MPI return code */
unsigned blocks_written=0; /* Flag to indicate that chunk was actually written */
unsigned using_mpi=0; /* Flag to indicate that the file is being accessed with an MPI-capable file driver */
@@ -2355,11 +2354,10 @@ H5F_istore_allocate(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout,
/* Check if this file is accessed with an MPI-capable file driver */
if(using_mpi) {
/* Round-robin write the chunks out from only one process */
- if(mpi_round==mpi_rank) {
+ if(H5_PAR_META_WRITE==mpi_rank) {
if (H5F_block_write(f, H5FD_MEM_DRAW, udata.addr, udata.key.nbytes, dxpl_id, chunk)<0)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to write raw data to file");
} /* end if */
- mpi_round = (mpi_round+1)%mpi_size;
/* Indicate that blocks are being written */
blocks_written=1;
diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c
index 59e2c83..7a32a2b 100644
--- a/src/H5FDmpio.c
+++ b/src/H5FDmpio.c
@@ -60,7 +60,6 @@ typedef struct H5FD_mpio_t {
MPI_Info info; /*file information */
int mpi_rank; /* This process's rank */
int mpi_size; /* Total number of processes */
- int mpi_round; /* Current round robin process (for metadata I/O) */
haddr_t eof; /*end-of-file marker */
haddr_t eoa; /*end-of-address marker */
haddr_t last_eoa; /* Last known end-of-address marker */
@@ -1883,7 +1882,7 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr,
/* Only p<round> will do the actual write if all procs in comm write same metadata */
if (H5_mpi_1_metawrite_g) {
- if (file->mpi_rank != file->mpi_round) {
+ if (file->mpi_rank != H5_PAR_META_WRITE) {
#ifdef H5FDmpio_DEBUG
if (H5FD_mpio_Debug[(int)'w']) {
fprintf(stdout,
@@ -1975,11 +1974,8 @@ done:
if(ret_value!=FAIL) {
/* if only p<round> writes, need to broadcast the ret_value to other processes */
if ((type!=H5FD_MEM_DRAW) && H5_mpi_1_metawrite_g) {
- if (MPI_SUCCESS != (mpi_code=MPI_Bcast(&ret_value, sizeof(ret_value), MPI_BYTE, file->mpi_round, file->comm)))
+ if (MPI_SUCCESS != (mpi_code=MPI_Bcast(&ret_value, sizeof(ret_value), MPI_BYTE, H5_PAR_META_WRITE, file->comm)))
HMPI_GOTO_ERROR(FAIL, "MPI_Bcast failed", mpi_code);
-
- /* Round-robin rotate to the next process */
- file->mpi_round = (file->mpi_round+1)%file->mpi_size;
} /* end if */
} /* end if */
diff --git a/src/H5FDmpiposix.c b/src/H5FDmpiposix.c
index 65f4ec1..a56a18d 100644
--- a/src/H5FDmpiposix.c
+++ b/src/H5FDmpiposix.c
@@ -83,7 +83,6 @@ typedef struct H5FD_mpiposix_t {
MPI_Comm comm; /*communicator */
int mpi_rank; /* This process's rank */
int mpi_size; /* Total number of processes */
- int mpi_round; /* Current round robin process (for metadata I/O) */
haddr_t eof; /*end-of-file marker */
haddr_t eoa; /*end-of-address marker */
haddr_t last_eoa; /* Last known end-of-address marker */
@@ -936,7 +935,6 @@ H5FD_mpiposix_open(const char *name, unsigned flags, hid_t fapl_id,
file->comm = comm_dup;
file->mpi_rank = mpi_rank;
file->mpi_size = mpi_size;
- file->mpi_round = 0; /* Start metadata writes with process 0 */
/* Reset the last file I/O operation */
file->pos = HADDR_UNDEF;
@@ -1422,7 +1420,7 @@ H5FD_mpiposix_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr,
/* Only p<round> will do the actual write if all procs in comm write same metadata */
if (H5_mpiposix_1_metawrite_g)
- if (file->mpi_rank != file->mpi_round)
+ if (file->mpi_rank != H5_PAR_META_WRITE)
HGOTO_DONE(SUCCEED) /* skip the actual write */
} /* end if */
@@ -1497,11 +1495,8 @@ done:
else {
/* if only p<round> writes, need to broadcast the ret_value to other processes */
if ((type!=H5FD_MEM_DRAW) && H5_mpiposix_1_metawrite_g) {
- if (MPI_SUCCESS != (mpi_code= MPI_Bcast(&ret_value, sizeof(ret_value), MPI_BYTE, file->mpi_round, file->comm)))
+ if (MPI_SUCCESS != (mpi_code= MPI_Bcast(&ret_value, sizeof(ret_value), MPI_BYTE, H5_PAR_META_WRITE, file->comm)))
HMPI_GOTO_ERROR(FAIL, "MPI_Bcast failed", mpi_code);
-
- /* Round-robin rotate to the next process */
- file->mpi_round = (file->mpi_round+1)%file->mpi_size;
} /* end if */
} /* end else */
@@ -1543,7 +1538,7 @@ H5FD_mpiposix_flush(H5FD_t *_file, hid_t UNUSED dxpl_id, unsigned UNUSED closing
/* Extend the file to make sure it's large enough */
if(file->eoa>file->last_eoa) {
/* Use the round-robin process to truncate (extend) the file */
- if(file->mpi_rank == file->mpi_round) {
+ if(file->mpi_rank == H5_PAR_META_WRITE) {
#ifdef WIN32
/* Map the posix file handle to a Windows file handle */
filehandle = _get_osfhandle(fd);
diff --git a/src/H5Fcontig.c b/src/H5Fcontig.c
index 82ee74a..6445d19 100644
--- a/src/H5Fcontig.c
+++ b/src/H5Fcontig.c
@@ -139,7 +139,6 @@ H5F_contig_fill(H5F_t *f, hid_t dxpl_id, struct H5O_layout_t *layout,
MPI_Comm mpi_comm=MPI_COMM_NULL; /* MPI communicator for file */
int mpi_rank=(-1); /* This process's rank */
int mpi_size=(-1); /* Total # of processes */
- int mpi_round=0; /* Current process responsible for I/O */
int mpi_code; /* MPI return code */
unsigned blocks_written=0; /* Flag to indicate that chunk was actually written */
unsigned using_mpi=0; /* Flag to indicate that the file is being accessed with an MPI-capable file driver */
@@ -266,12 +265,10 @@ H5F_contig_fill(H5F_t *f, hid_t dxpl_id, struct H5O_layout_t *layout,
/* Check if this file is accessed with an MPI-capable file driver */
if(using_mpi) {
/* Round-robin write the chunks out from only one process */
- if(mpi_round==mpi_rank) {
+ if(H5_PAR_META_WRITE==mpi_rank) {
if (H5F_contig_write(f, (hsize_t)size, addr, size, dxpl_id, buf)<0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to write fill value to dataset");
} /* end if */
- ++mpi_round;
- mpi_round %= mpi_size;
/* Indicate that blocks are being written */
blocks_written=1;
diff --git a/src/H5Fistore.c b/src/H5Fistore.c
index 4847948..acb871d 100644
--- a/src/H5Fistore.c
+++ b/src/H5Fistore.c
@@ -2159,7 +2159,6 @@ H5F_istore_allocate(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout,
MPI_Comm mpi_comm=MPI_COMM_NULL; /* MPI communicator for file */
int mpi_rank=(-1); /* This process's rank */
int mpi_size=(-1); /* Total # of processes */
- int mpi_round=0; /* Current process responsible for I/O */
int mpi_code; /* MPI return code */
unsigned blocks_written=0; /* Flag to indicate that chunk was actually written */
unsigned using_mpi=0; /* Flag to indicate that the file is being accessed with an MPI-capable file driver */
@@ -2355,11 +2354,10 @@ H5F_istore_allocate(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout,
/* Check if this file is accessed with an MPI-capable file driver */
if(using_mpi) {
/* Round-robin write the chunks out from only one process */
- if(mpi_round==mpi_rank) {
+ if(H5_PAR_META_WRITE==mpi_rank) {
if (H5F_block_write(f, H5FD_MEM_DRAW, udata.addr, udata.key.nbytes, dxpl_id, chunk)<0)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to write raw data to file");
} /* end if */
- mpi_round = (mpi_round+1)%mpi_size;
/* Indicate that blocks are being written */
blocks_written=1;
diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h
index 78dcf14..5bd2ec3 100644
--- a/src/H5Fpkg.h
+++ b/src/H5Fpkg.h
@@ -185,6 +185,7 @@ struct H5F_t {
};
#ifdef H5_HAVE_PARALLEL
+/* Whether a single process writes metadata */
H5_DLLVAR hbool_t H5_mpi_1_metawrite_g;
H5_DLLVAR hbool_t H5_mpiposix_1_metawrite_g;
#endif /* H5_HAVE_PARALLEL */
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index 53dc8ad..6c81e21 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -368,6 +368,11 @@ typedef struct H5F_t H5F_t;
#define H5F_MNT_SYM_LOCAL_SIZE sizeof(hbool_t)
#define H5F_MNT_SYM_LOCAL_DEF FALSE
+#ifdef H5_HAVE_PARALLEL
+/* Which process writes metadata */
+#define H5_PAR_META_WRITE 0
+#endif /* H5_HAVE_PARALLEL */
+
/* Forward declarations for prototype arguments */
struct H5B_class_t;
union H5D_storage_t;