diff options
author | Leon Arber <larber@ncsa.uiuc.edu> | 2005-04-20 21:48:31 (GMT) |
---|---|---|
committer | Leon Arber <larber@ncsa.uiuc.edu> | 2005-04-20 21:48:31 (GMT) |
commit | 705815370505ad3a8d81e918a0a15cfa24a5f0c1 (patch) | |
tree | 89211cff3ff55f56b9df4b4dfdf20e1c157f37c9 | |
parent | af260258da1e7c02a270d43a00f09666c9fd5a51 (diff) | |
download | hdf5-705815370505ad3a8d81e918a0a15cfa24a5f0c1.zip hdf5-705815370505ad3a8d81e918a0a15cfa24a5f0c1.tar.gz hdf5-705815370505ad3a8d81e918a0a15cfa24a5f0c1.tar.bz2 |
[svn-r10634] Purpose:
Use getenv_all for determining HDF5_PARAPREFIX instead of getenv
Description:
the environment variable HDF5_PARAPREFIX is now determined collectively, instead of
having each task call getenv.
Solution:
Environment variables set for task 0 often do not propogate to other tasks which
leads to obscure and hard to track down bugs. getenv_all was written to overcome
this by having all tasks query a single task for the value of its environment.
Eventually, all calls to getenv will be migrated to use getenv_all. For now,
only HDF5_PARAPREFIX will be determined this way.
Platforms tested:
heping pp, sol pp
Misc. update:
-rw-r--r-- | test/h5test.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/test/h5test.c b/test/h5test.c index 8044bed..544ff0b 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -301,9 +301,7 @@ h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size) */ static int explained = 0; - prefix = (paraprefix ? paraprefix : getenv("HDF5_PARAPREFIX")); -/* prefix = (paraprefix ? paraprefix : getenv_all(MPI_COMM_WORLD, 0, "HDF5_PARAPREFIX")); */ - + prefix = (paraprefix ? paraprefix : getenv_all(MPI_COMM_WORLD, 0, "HDF5_PARAPREFIX")); if (!prefix && !explained) { /* print hint by process 0 once. */ @@ -858,10 +856,13 @@ int h5_szip_can_encode(void ) * val is the string to which the value of that environment * variable will be copied. * - * Return: No failure. - * If an env variable doesn't exist, it is set to NULL. - * This function will allocate space for the variable, and it - * is up to the calling function to free that memory. + * NOTE: The pointer returned by this function is only + * valid until the next call to getenv_all and the data + * stored there must be copied somewhere else before any + * further calls to getenv_all take place. + * + * Return: pointer to a string containing the value of the environment variable + * NULL if the varialbe doesn't exist in task 'root's environment. * * Programmer: Leon Arber * 4/4/05 @@ -908,7 +909,6 @@ char* getenv_all(MPI_Comm comm, int root, const char* name) else if(strlen(env) < len) env = (char*) HDrealloc(env, len+1); - HDmemset(env, 0, len); MPI_Bcast(env, len, MPI_CHAR, root, comm); env[len+1] = '\0'; } |