[mpich-commits] [mpich] MPICH primary repository branch, master, updated. v3.1.2-106-g0ddd808
Service Account
noreply at mpich.org
Fri Aug 22 12:55:09 CDT 2014
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "MPICH primary repository".
The branch, master has been updated
via 0ddd8086a842302d296f4bdb719b36a33ba284d6 (commit)
via a4868b873705cd5f13ed14e773f5a6e53c0b5b08 (commit)
via bb7661e18a2842c879ad5bbd45509e1ae6264eb0 (commit)
from 6dff3b96066195508406bea51ee551060a4f6fad (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.mpich.org/mpich.git/commitdiff/0ddd8086a842302d296f4bdb719b36a33ba284d6
commit 0ddd8086a842302d296f4bdb719b36a33ba284d6
Author: Rob Latham <robl at mcs.anl.gov>
Date: Wed Aug 13 15:12:42 2014 -0500
scalable system-hints processing
instead of every process reading and processing the hint config file,
one process will read and broadcast, then everyone will process. Yay!
fewer file system calls!
Signed-off-by: Paul Coffman <pkcoff at us.ibm.com>
diff --git a/src/mpi/romio/adio/common/ad_init.c b/src/mpi/romio/adio/common/ad_init.c
index cec6219..88e75a5 100644
--- a/src/mpi/romio/adio/common/ad_init.c
+++ b/src/mpi/romio/adio/common/ad_init.c
@@ -78,11 +78,6 @@ void ADIO_Init(int *argc, char ***argv, int *error_code)
else ADIOI_Direct_write = 0;
#endif
- /* Assume system-wide hints won't change between runs: move hint processing
- * from ADIO_Open to here */
- /* FIXME should be checking error code from MPI_Info_create here */
- MPI_Info_create(&ADIOI_syshints);
- ADIOI_process_system_hints(ADIOI_syshints);
#ifdef ADIOI_MPE_LOGGING
{
diff --git a/src/mpi/romio/adio/common/ad_open.c b/src/mpi/romio/adio/common/ad_open.c
index e6b96c4..67eb125 100644
--- a/src/mpi/romio/adio/common/ad_open.c
+++ b/src/mpi/romio/adio/common/ad_open.c
@@ -88,6 +88,24 @@ MPI_File ADIO_Open(MPI_Comm orig_comm,
fd->hints->initialized = 0;
fd->info = MPI_INFO_NULL;
+ /* move system-wide hint processing *back* into open, but this time the
+ * hintfile reader will do a scalable read-and-broadcast. The global
+ * ADIOI_syshints will get initialized at first open. subsequent open
+ * calls will just use result from first open.
+ *
+ * We have two goals here:
+ * 1: avoid processing the hintfile multiple times
+ * 2: have all processes participate in hintfile processing (so we can read-and-broadcast)
+ *
+ * a code might do an "initialize from 0", so we can only skip hint
+ * processing once everyone has particpiated in hint processing */
+ int dummy_info;
+ MPI_Allreduce(&ADIOI_syshints, &dummy_info, 1, MPI_INT, MPI_MIN, fd->comm);
+ if ((MPI_Info)dummy_info== MPI_INFO_NULL) {
+ MPI_Info_create(&ADIOI_syshints);
+ ADIOI_process_system_hints(fd, ADIOI_syshints);
+ }
+
ADIOI_incorporate_system_hints(info, ADIOI_syshints, &dupinfo);
ADIO_SetInfo(fd, dupinfo, &err);
if (dupinfo != MPI_INFO_NULL) {
diff --git a/src/mpi/romio/adio/common/system_hints.c b/src/mpi/romio/adio/common/system_hints.c
index a527a26..0a2c642 100644
--- a/src/mpi/romio/adio/common/system_hints.c
+++ b/src/mpi/romio/adio/common/system_hints.c
@@ -85,8 +85,11 @@ static int find_file(void)
* alone on the assumption that the caller knows best.
*
* because MPI-IO hints are optional, we can get away with limited error
- * reporting. */
-static int file_to_info(int fd, MPI_Info info)
+ * reporting.
+ *
+ * for better scalability, the config file will be read on one processor and
+ * broadcast to all others */
+static int file_to_info_all(int fd, MPI_Info info, int rank, MPI_Comm comm)
{
char *buffer, *token, *key, *val, *garbage;
char *pos1=NULL, *pos2=NULL;
@@ -97,11 +100,19 @@ static int file_to_info(int fd, MPI_Info info)
/* assumption: config files will be small */
#define HINTFILE_MAX_SIZE 1024*4
buffer = (char *)ADIOI_Calloc(HINTFILE_MAX_SIZE, sizeof (char));
- if (buffer == NULL) return -1;
- ret = read(fd, buffer, HINTFILE_MAX_SIZE);
- if (ret < 0) return -1;
+ if (rank == 0) {
+ ret = read(fd, buffer, HINTFILE_MAX_SIZE);
+ /* any error: bad/nonexistent fd, no perms, anything: set up a null
+ * buffer and the subsequent string parsing will quit immediately */
+ if (ret == -1)
+ buffer[0] = '\0';
+ }
+ MPI_Bcast(buffer, HINTFILE_MAX_SIZE, MPI_BYTE, 0, comm);
+
token = strtok_r(buffer, "\n", &pos1);
+ if (token == NULL)
+ goto fn_exit;
do {
if ( (key = strtok_r(token, " \t", &pos2)) == NULL)
/* malformed line: found no items */
@@ -125,23 +136,25 @@ static int file_to_info(int fd, MPI_Info info)
if (flag == 1) continue;
ADIOI_Info_set(info, key, val);
} while ((token = strtok_r(NULL, "\n", &pos1)) != NULL);
+
+fn_exit:
ADIOI_Free(buffer);
return 0;
}
-void ADIOI_process_system_hints(MPI_Info info)
+void ADIOI_process_system_hints(ADIO_File fd, MPI_Info info)
{
- int hintfd;
+ int hintfd=-1, rank;
- hintfd = find_file();
- if (hintfd < 0) {
-#ifdef SYSHINT_DEBUG
- perror("ADIOI_process_system_hints");
-#endif
- return;
+ MPI_Comm_rank(fd->comm, &rank);
+ if (rank == 0) {
+ hintfd = find_file();
}
- file_to_info(hintfd, info);
- close(hintfd);
+ /* hintfd only significant on rank 0. -1 (on rank 0) means no hintfile found */
+ file_to_info_all(hintfd, info, rank, fd->comm);
+
+ if (hintfd != -1)
+ close(hintfd);
}
/* given 'info', incorporate any hints in 'sysinfo' that are not already set
diff --git a/src/mpi/romio/adio/include/adioi.h b/src/mpi/romio/adio/include/adioi.h
index 65e2bcd..e3f9a16 100644
--- a/src/mpi/romio/adio/include/adioi.h
+++ b/src/mpi/romio/adio/include/adioi.h
@@ -340,7 +340,7 @@ void ADIOI_Get_position(ADIO_File fd, ADIO_Offset *offset);
void ADIOI_Get_eof_offset(ADIO_File fd, ADIO_Offset *eof_offset);
void ADIOI_Get_byte_offset(ADIO_File fd, ADIO_Offset offset,
ADIO_Offset *disp);
-void ADIOI_process_system_hints(MPI_Info info);
+void ADIOI_process_system_hints(ADIO_File fd, MPI_Info info);
void ADIOI_incorporate_system_hints(MPI_Info info, MPI_Info sysinfo,
MPI_Info *new_info);
void ADIOI_Info_print_keyvals(MPI_Info info);
http://git.mpich.org/mpich.git/commitdiff/a4868b873705cd5f13ed14e773f5a6e53c0b5b08
commit a4868b873705cd5f13ed14e773f5a6e53c0b5b08
Author: Rob Latham <robl at mcs.anl.gov>
Date: Wed Aug 13 10:28:13 2014 -0500
systemwide-hints: no need for stat
We'll just over-allocate enough space for a bunch of hints, instead of
trying to get it exactly right.
Signed-off-by: Paul Coffman <pkcoff at us.ibm.com>
diff --git a/src/mpi/romio/adio/common/system_hints.c b/src/mpi/romio/adio/common/system_hints.c
index 665c79e..a527a26 100644
--- a/src/mpi/romio/adio/common/system_hints.c
+++ b/src/mpi/romio/adio/common/system_hints.c
@@ -21,9 +21,6 @@
#ifdef HAVE_STRING_H
#include <string.h>
#endif
-#ifdef HAVE_SYS_STAT_H
-#include <sys/stat.h>
-#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
@@ -96,15 +93,13 @@ static int file_to_info(int fd, MPI_Info info)
int flag;
ssize_t ret;
char dummy;
- struct stat statbuf;
- /* assumption: config files will be small (less than 1MB) */
- fstat(fd, &statbuf);
- /* add 1 to size to make room for NULL termination */
- buffer = (char *)ADIOI_Calloc(statbuf.st_size + 1, sizeof (char));
+ /* assumption: config files will be small */
+#define HINTFILE_MAX_SIZE 1024*4
+ buffer = (char *)ADIOI_Calloc(HINTFILE_MAX_SIZE, sizeof (char));
if (buffer == NULL) return -1;
- ret = read(fd, buffer, statbuf.st_size);
+ ret = read(fd, buffer, HINTFILE_MAX_SIZE);
if (ret < 0) return -1;
token = strtok_r(buffer, "\n", &pos1);
do {
http://git.mpich.org/mpich.git/commitdiff/bb7661e18a2842c879ad5bbd45509e1ae6264eb0
commit bb7661e18a2842c879ad5bbd45509e1ae6264eb0
Author: Rob Latham <robl at mcs.anl.gov>
Date: Tue Aug 12 18:58:30 2014 -0500
deferred open refinement: sync from only aggs
There is no need for the non-aggregators to immediately open the file
before calling sync -- if they have not opened the file, they will have
no data to flush.
Signed-off-by: Paul Coffman <pkcoff at us.ibm.com>
diff --git a/src/mpi/romio/adio/common/ad_flush.c b/src/mpi/romio/adio/common/ad_flush.c
index 61a9ed4..3ace677 100644
--- a/src/mpi/romio/adio/common/ad_flush.c
+++ b/src/mpi/romio/adio/common/ad_flush.c
@@ -16,16 +16,20 @@ void ADIOI_GEN_Flush(ADIO_File fd, int *error_code)
int err;
static char myname[] = "ADIOI_GEN_FLUSH";
- err = fsync(fd->fd_sys);
- /* --BEGIN ERROR HANDLING-- */
- if (err == -1) {
- *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
- myname, __LINE__, MPI_ERR_IO,
- "**io",
- "**io %s", strerror(errno));
- return;
+ /* the deferred-open optimization may mean that a file has not been opened
+ * on this processor */
+ if (fd->is_open > 0) {
+ err = fsync(fd->fd_sys);
+ /* --BEGIN ERROR HANDLING-- */
+ if (err == -1) {
+ *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
+ myname, __LINE__, MPI_ERR_IO,
+ "**io",
+ "**io %s", strerror(errno));
+ return;
+ }
+ /* --END ERROR HANDLING-- */
}
- /* --END ERROR HANDLING-- */
*error_code = MPI_SUCCESS;
}
diff --git a/src/mpi/romio/mpi-io/fsync.c b/src/mpi/romio/mpi-io/fsync.c
index d9ffe3f..0e4f1b9 100644
--- a/src/mpi/romio/mpi-io/fsync.c
+++ b/src/mpi/romio/mpi-io/fsync.c
@@ -60,8 +60,6 @@ int MPI_File_sync(MPI_File fh)
MPIO_CHECK_WRITABLE(fh, myname, error_code);
/* --END ERROR HANDLING-- */
- ADIOI_TEST_DEFERRED(adio_fh, "MPI_File_sync", &error_code);
-
ADIO_Flush(adio_fh, &error_code);
/* --BEGIN ERROR HANDLING-- */
if (error_code != MPI_SUCCESS)
-----------------------------------------------------------------------
Summary of changes:
src/mpi/romio/adio/common/ad_flush.c | 22 +++++++-----
src/mpi/romio/adio/common/ad_init.c | 5 ---
src/mpi/romio/adio/common/ad_open.c | 18 ++++++++++
src/mpi/romio/adio/common/system_hints.c | 54 +++++++++++++++++-------------
src/mpi/romio/adio/include/adioi.h | 2 +-
src/mpi/romio/mpi-io/fsync.c | 2 -
6 files changed, 63 insertions(+), 40 deletions(-)
hooks/post-receive
--
MPICH primary repository
More information about the commits
mailing list