summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlbert Cheng <acheng@hdfgroup.org>2002-05-16 13:51:48 (GMT)
committerAlbert Cheng <acheng@hdfgroup.org>2002-05-16 13:51:48 (GMT)
commitde3af15daf44ae1de2474e1c75ba971640741cb6 (patch)
tree32afff6b187c2d45ff91dd0691004889bda3c682
parent19650b0460f9a817b87c9128978b80c51f48b7c6 (diff)
downloadhdf5-de3af15daf44ae1de2474e1c75ba971640741cb6.zip
hdf5-de3af15daf44ae1de2474e1c75ba971640741cb6.tar.gz
hdf5-de3af15daf44ae1de2474e1c75ba971640741cb6.tar.bz2
[svn-r5426] Purpose:
Folded the added feature of setting MPI Info object from v1.4 to this branch. Platforms tested: modi4
-rw-r--r--perform/pio_engine.c54
-rw-r--r--perform/pio_perf.c53
-rw-r--r--perform/pio_perf.h1
3 files changed, 79 insertions, 29 deletions
diff --git a/perform/pio_engine.c b/perform/pio_engine.c
index abc0668..bf2d30c 100644
--- a/perform/pio_engine.c
+++ b/perform/pio_engine.c
@@ -54,35 +54,12 @@
} \
} while(0)
-#ifndef HDopen
-# ifdef O_BINARY
-# define HDopen(S,F,M) open(S,F|_O_BINARY,M)
-# else /* O_BINARY */
-# define HDopen(S,F,M) open(S,F,M)
-# endif /* !O_BINARY */
-#endif /* !HDopen */
-
-#ifndef HDclose
-# define HDclose(F) close(F)
-#endif /* !HDclose */
-
-#ifndef HDseek
-# define HDseek(F,L,W) lseek(F,L,W)
-#endif /* !HDseek */
-
-#ifndef HDwrite
-# define HDwrite(F,B,S) write(F,B,S)
-#endif /* !HDwrite */
-
-#ifndef HDread
-# define HDread(F,B,S) read(F,B,S)
-#endif /* !HDread */
/* Raw I/O macros */
#define RAWCREATE(fn) HDopen(fn, O_CREAT|O_TRUNC|O_RDWR, 0600)
#define RAWOPEN(fn, F) HDopen(fn, F, 0600)
#define RAWCLOSE(F) HDclose(F)
-#define RAWSEEK(F,L) HDseek(F,(off_t) L,SEEK_SET)
+#define RAWSEEK(F,L) HDlseek(F, L, SEEK_SET)
#define RAWWRITE(F,B,S) HDwrite(F,B,S)
#define RAWREAD(F,B,S) HDread(F,B,S)
@@ -167,6 +144,25 @@ do_pio(parameters param)
/* Sanity check parameters */
+ /* debug */
+ if (pio_debug_level>=4) {
+ if (pio_info_g==MPI_INFO_NULL){
+ printf("INFO object is MPI_INFO_NULL\n");
+ }
+ else {
+ char value[128];
+ int flag;
+ MPI_Info_get(pio_info_g, "IBM_largeblock_io", 127, value, &flag);
+ printf("after MPI_Info_get, flag=%d\n", flag);
+ if (flag){
+ printf("found IBM_largeblock_io=%s, in info object\n", value);
+ }else{
+ printf("could not find IBM_largeblock_io in info object\n");
+ }
+
+ }
+ }
+
/* IO type */
iot = param.io_type;
@@ -952,9 +948,9 @@ do_fopen(iotype iot, char *fname, file_descr *fd /*out*/, int flags)
case MPIO:
if (flags & (PIO_CREATE | PIO_WRITE)) {
- MPI_File_delete(fname, MPI_INFO_NULL);
+ MPI_File_delete(fname, pio_info_g);
mrc = MPI_File_open(pio_comm_g, fname, MPI_MODE_CREATE | MPI_MODE_RDWR,
- MPI_INFO_NULL, &fd->mpifd);
+ pio_info_g, &fd->mpifd);
if (mrc != MPI_SUCCESS) {
fprintf(stderr, "MPI File Open failed(%s)\n", fname);
@@ -971,7 +967,7 @@ do_fopen(iotype iot, char *fname, file_descr *fd /*out*/, int flags)
}
} else {
mrc = MPI_File_open(pio_comm_g, fname, MPI_MODE_RDONLY,
- MPI_INFO_NULL, &fd->mpifd);
+ pio_info_g, &fd->mpifd);
if (mrc != MPI_SUCCESS) {
fprintf(stderr, "MPI File Open failed(%s)\n", fname);
@@ -989,7 +985,7 @@ do_fopen(iotype iot, char *fname, file_descr *fd /*out*/, int flags)
GOTOERROR(FAIL);
}
- hrc = H5Pset_fapl_mpio(acc_tpl, pio_comm_g, MPI_INFO_NULL);
+ hrc = H5Pset_fapl_mpio(acc_tpl, pio_comm_g, pio_info_g);
if (hrc < 0) {
fprintf(stderr, "HDF5 Property List Set failed\n");
@@ -1101,7 +1097,7 @@ do_cleanupfile(iotype iot, char *fname)
break;
case MPIO:
case PHDF5:
- MPI_File_delete(fname, MPI_INFO_NULL);
+ MPI_File_delete(fname, pio_info_g);
break;
}
}
diff --git a/perform/pio_perf.c b/perform/pio_perf.c
index f9cac10..81ba8da 100644
--- a/perform/pio_perf.c
+++ b/perform/pio_perf.c
@@ -82,6 +82,7 @@
FILE *output; /* output file */
int comm_world_rank_g; /* my rank in MPI_COMM_RANK */
int comm_world_nprocs_g;/* num. of processes of MPI_COMM_WORLD */
+MPI_Info pio_info_g=MPI_INFO_NULL;/* MPI INFO object to run the PIO */
MPI_Comm pio_comm_g; /* Communicator to run the PIO */
int pio_mpi_rank_g; /* MPI rank of pio_comm_g */
int pio_mpi_nprocs_g; /* Number of processes of pio_comm_g */
@@ -233,6 +234,7 @@ static int destroy_comm_world(void);
static void output_report(const char *fmt, ...);
static void print_indent(register int indent);
static void usage(const char *prog);
+static int parse_environment(void);
/*
* Function: main
@@ -282,6 +284,7 @@ main(int argc, char **argv)
pio_comm_g = MPI_COMM_WORLD;
+ parse_environment();
opts = parse_command_line(argc, argv);
if (!opts) {
@@ -1041,6 +1044,56 @@ usage(const char *prog)
}
}
+/*
+ * Function: parse_environment
+ * Purpose: Process all environment variables setting.
+ * Return: 0 if all is fine; otherwise non-zero.
+ * Programmer: Albert Cheng, 15 May 2002.
+ * Modifications:
+ */
+static int
+parse_environment(void)
+{
+ char *envp; /* environment pointer */
+ char *envendp; /* end of environment string */
+ char *namep, *valp; /* name, value pointers */
+ int mpi_err;
+ int ret_value=0;
+
+ /* handle any MPI INFO hints via $HDF5_MPI_INFO */
+ if ((envp = getenv("HDF5_MPI_INFO")) != NULL){
+ envp = HDstrdup(envp);
+ envendp = HDstrchr(envp, NULL); /* remember end of string */
+
+ /* create an INFO object if not created yet */
+ if (pio_info_g==MPI_INFO_NULL)
+ MPI_Info_create (&pio_info_g);
+
+ /* parse only one setting. Need to extend it to handle multiple */
+ /* settings. LATER */
+ namep=envp;
+ valp=HDstrchr(namep, '=');
+ if (valp != NULL){
+ /* change '=' to NULL, move valp down one */
+ *valp++ = NULL;
+ if (MPI_SUCCESS!=MPI_Info_set(pio_info_g, namep, valp)){
+ printf("MPI_Info_set failed\n");
+ ret_value = -1;
+ }else{
+ /* will not print because debug option is not parsed yet? */
+ if (pio_debug_level>=4){
+ printf("MPI_Info_set with %s=%s.\n", namep, valp);
+ }
+ }
+
+ }
+ }
+
+ if (envp)
+ HDfree(envp);
+ return(ret_value);
+}
+
#else /* H5_HAVE_PARALLEL */
/*
diff --git a/perform/pio_perf.h b/perform/pio_perf.h
index d14c419..bea92f4 100644
--- a/perform/pio_perf.h
+++ b/perform/pio_perf.h
@@ -44,6 +44,7 @@ extern FILE *output; /* output file */
extern pio_time *timer_g; /* timer: global for stub functions */
extern int comm_world_rank_g; /* my rank in MPI_COMM_RANK */
extern int comm_world_nprocs_g;/* num. of processes of MPI_COMM_WORLD */
+extern MPI_Info pio_info_g; /* MPI INFO object to run the PIO */
extern MPI_Comm pio_comm_g; /* Communicator to run the PIO */
extern int pio_mpi_rank_g; /* MPI rank of pio_comm_g */
extern int pio_mpi_nprocs_g; /* number of processes of pio_comm_g */