summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlbert Cheng <acheng@hdfgroup.org>2002-05-21 18:28:55 (GMT)
committerAlbert Cheng <acheng@hdfgroup.org>2002-05-21 18:28:55 (GMT)
commitccc766f50fd5d672573b17865295fb5b5f0c1e1b (patch)
treee77af1a7784df7107e2162ddd6dec31454fbc522
parent7d9ace29524008b8f7dfb76c4b44018a9777dcc4 (diff)
downloadhdf5-ccc766f50fd5d672573b17865295fb5b5f0c1e1b.zip
hdf5-ccc766f50fd5d672573b17865295fb5b5f0c1e1b.tar.gz
hdf5-ccc766f50fd5d672573b17865295fb5b5f0c1e1b.tar.bz2
[svn-r5445] Purpose:
Feature Description: moved the routines of setting up and dumping MPI-info object to test library so that it is avaiable for all tests too. Platforms tested: modi4(pp), eirene (serial)
-rw-r--r--perform/pio_engine.c17
-rw-r--r--perform/pio_perf.c52
-rw-r--r--test/h5test.c87
-rw-r--r--test/h5test.h7
4 files changed, 95 insertions, 68 deletions
diff --git a/perform/pio_engine.c b/perform/pio_engine.c
index bf2d30c..3c6adf0 100644
--- a/perform/pio_engine.c
+++ b/perform/pio_engine.c
@@ -146,21 +146,7 @@ do_pio(parameters param)
/* 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");
- }
-
- }
+ h5_dump_info_object(pio_info_g);
}
/* IO type */
@@ -1103,7 +1089,6 @@ do_cleanupfile(iotype iot, char *fname)
}
}
-
#ifndef TIME_MPI
#define TIME_MPI
#endif
diff --git a/perform/pio_perf.c b/perform/pio_perf.c
index 81ba8da..0f6cec6 100644
--- a/perform/pio_perf.c
+++ b/perform/pio_perf.c
@@ -284,7 +284,7 @@ main(int argc, char **argv)
pio_comm_g = MPI_COMM_WORLD;
- parse_environment();
+ h5_set_info_object();
opts = parse_command_line(argc, argv);
if (!opts) {
@@ -1044,56 +1044,6 @@ 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/test/h5test.c b/test/h5test.c
index 8750e32..0935500 100644
--- a/test/h5test.c
+++ b/test/h5test.c
@@ -1,5 +1,5 @@
/*
- * Copyright © 1998-2001 National Center for Supercomputing Applications
+ * Copyright (c) 1998-2002 National Center for Supercomputing Applications
* All rights reserved.
*
* Programmer: Robb Matzke <matzke@llnl.gov>
@@ -61,6 +61,9 @@
#endif
#endif
char *paraprefix = NULL; /* for command line option para-prefix */
+#ifdef H5_HAVE_PARALLEL
+MPI_Info pio_info_g=MPI_INFO_NULL;/* MPI INFO object to run the PIO */
+#endif
/*
* These are the letters that are appended to the file name when generating
@@ -656,3 +659,85 @@ h5_show_hostname(void)
#endif
}
+
+
+#ifdef H5_HAVE_PARALLEL
+/*
+ * Function: h5_set_info_object
+ * Purpose: Process environment variables setting to set up MPI Info object.
+ * Return: 0 if all is fine; otherwise non-zero.
+ * Programmer: Albert Cheng, 2002/05/21.
+ * Modifications:
+ */
+int
+h5_set_info_object(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;
+ }
+
+ }
+ }
+
+ if (envp)
+ HDfree(envp);
+ return(ret_value);
+}
+
+
+/*
+ * Function: h5_dump_info_object
+ * Purpose: Display content of an MPI Info object
+ * Return: void
+ * Programmer: Albert Cheng 2002/05/21
+ * Modifications:
+ */
+void
+h5_dump_info_object(MPI_Info info)
+{
+ char key[MPI_MAX_INFO_KEY+1];
+ char value[MPI_MAX_INFO_VAL+1];
+ int flag;
+ int i, nkeys;
+ int mpi_err;
+
+ printf("Dumping MPI Info Object(%d) (up to %d bytes per item):\n", info,
+ MPI_MAX_INFO_VAL);
+ if (info==MPI_INFO_NULL){
+ printf("object is MPI_INFO_NULL\n");
+ }
+ else {
+ mpi_err=MPI_Info_get_nkeys(info, &nkeys);
+ printf("object has %d items\n", nkeys);
+ for (i=0; i<nkeys; i++){
+ mpi_err=MPI_Info_get_nthkey(info, i, key);
+ mpi_err=MPI_Info_get(info, key, MPI_MAX_INFO_VAL, value, &flag);
+ printf("%s=%s\n", key, value);
+ }
+
+ }
+}
+#endif /* H5_HAVE_PARALLEL */
diff --git a/test/h5test.h b/test/h5test.h
index 2240531..695199c 100644
--- a/test/h5test.h
+++ b/test/h5test.h
@@ -26,6 +26,9 @@
* the parallel test files.
*/
extern char *paraprefix;
+#ifdef H5_HAVE_PARALLEL
+extern MPI_Info pio_info_g; /* MPI INFO object to run the PIO */
+#endif
/*
* The name of the test is printed by saying TESTING("something") which will
@@ -59,7 +62,11 @@ char *h5_fixname(const char *base_name, hid_t fapl, char *fullname,
hid_t h5_fileaccess(void);
void h5_no_hwconv(void);
void h5_reset(void);
+#ifdef H5_HAVE_PARALLEL
void h5_show_hostname(void);
+int h5_set_info_object(void);
+void h5_dump_info_object(MPI_Info info);
+#endif
#ifdef __cplusplus
}