diff options
author | Albert Cheng <acheng@hdfgroup.org> | 2002-05-21 18:49:44 (GMT) |
---|---|---|
committer | Albert Cheng <acheng@hdfgroup.org> | 2002-05-21 18:49:44 (GMT) |
commit | c365ae137377312931605095a53f964410d47f61 (patch) | |
tree | f5804ede4d66c5f25caf22062715a7ba3c0e2994 /test/h5test.c | |
parent | 03ab48c9c306fee878c4f3a97f858f90c078bfdf (diff) | |
download | hdf5-c365ae137377312931605095a53f964410d47f61.zip hdf5-c365ae137377312931605095a53f964410d47f61.tar.gz hdf5-c365ae137377312931605095a53f964410d47f61.tar.bz2 |
[svn-r5446] 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)
Diffstat (limited to 'test/h5test.c')
-rw-r--r-- | test/h5test.c | 83 |
1 files changed, 82 insertions, 1 deletions
diff --git a/test/h5test.c b/test/h5test.c index 23ecb33..e227709 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 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> @@ -60,6 +60,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 @@ -578,3 +581,81 @@ h5_show_hostname(void) WSACleanup(); #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 *namep, *valp; /* name, value pointers */ + int ret_value=0; + + /* handle any MPI INFO hints via $HDF5_MPI_INFO */ + if ((envp = getenv("HDF5_MPI_INFO")) != NULL){ + envp = HDstrdup(envp); + + /* 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; + + 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_Info_get_nkeys(info, &nkeys); + printf("object has %d items\n", nkeys); + for (i=0; i<nkeys; i++){ + MPI_Info_get_nthkey(info, i, key); + MPI_Info_get(info, key, MPI_MAX_INFO_VAL, value, &flag); + printf("%s=%s\n", key, value); + } + + } +} +#endif /* H5_HAVE_PARALLEL */ |