From 4e57d80f2e085a80dfe5f55a39c15e1edc4366f9 Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Mon, 5 Feb 2007 19:13:51 -0500 Subject: [svn-r13242] Bug fix. It was hardcoded to use /tmp/... as the default test file name. Changed it to use $HDF5_PARAPREFIX/... to compose the test file name. Platform Tested: tg-ncsa since it failed there. (Will test other platforms after commit.) --- fortran/examples/ph5example.f90 | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/fortran/examples/ph5example.f90 b/fortran/examples/ph5example.f90 index 4f19268..543e6fa 100644 --- a/fortran/examples/ph5example.f90 +++ b/fortran/examples/ph5example.f90 @@ -22,10 +22,11 @@ IMPLICIT NONE INCLUDE 'mpif.h' - ! Hard coded the file name. Change it according to where your PFS is. - CHARACTER(LEN=20), PARAMETER :: filename = "/tmp/sds.h5" ! File name + CHARACTER(LEN=10), PARAMETER :: default_fname = "sds.h5" ! Default name CHARACTER(LEN=8), PARAMETER :: dsetname = "IntArray" ! Dataset name + CHARACTER(LEN=100) :: filename ! File name + INTEGER :: fnamelen ! File name length INTEGER(HID_T) :: file_id ! File identifier INTEGER(HID_T) :: dset_id ! Dataset identifier INTEGER(HID_T) :: filespace ! Dataspace identifier in file @@ -73,6 +74,19 @@ CALL h5pset_fapl_mpio_f(plist_id, comm, info, error) ! + ! Figure out the filename to use. If your system does not support + ! getenv, comment that statement with this, + ! filename = "" + CALL getenv("HDF5_PARAPREFIX", filename) + fnamelen = LEN_TRIM(filename) + if ( fnamelen == 0 ) then + filename = default_fname + else + filename = filename(1:fnamelen) // "/" // default_fname + endif + print *, "Using filename = ", filename + + ! ! Create the file collectively. ! CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error, access_prp = plist_id) -- cgit v0.12