summaryrefslogtreecommitdiffstats
path: root/perform
diff options
context:
space:
mode:
authorMohamad Chaarawi <chaarawi@hdfgroup.org>2014-10-02 15:56:09 (GMT)
committerMohamad Chaarawi <chaarawi@hdfgroup.org>2014-10-02 15:56:09 (GMT)
commit26400c392b45a86e385905fd377e34603a31377a (patch)
tree26b3634a8bd9c718b1259b4f9a6ef9bb83ed7c14 /perform
parentbd9c6d829acd95ba78b07c8d286eae81d74cd1c9 (diff)
downloadhdf5-26400c392b45a86e385905fd377e34603a31377a.zip
hdf5-26400c392b45a86e385905fd377e34603a31377a.tar.gz
hdf5-26400c392b45a86e385905fd377e34603a31377a.tar.bz2
[svn-r25659] fix filename generation with prefix for perf test.
tested h5commitest, jam & platypus parallel.
Diffstat (limited to 'perform')
-rw-r--r--perform/perf.c37
1 files changed, 13 insertions, 24 deletions
diff --git a/perform/perf.c b/perform/perf.c
index b7898ff..7d329f0 100644
--- a/perform/perf.c
+++ b/perform/perf.c
@@ -46,10 +46,6 @@
# include <mpio.h>
#endif
-#ifndef HDF5_PARAPREFIX
-# define HDF5_PARAPREFIX ""
-#endif /* !HDF5_PARAPREFIX */
-
/* Macro definitions */
/* Verify:
* if val is false (0), print mesg and if fatal is true (non-zero), die.
@@ -67,6 +63,8 @@
} \
} while(0)
#define RANK 1
+#define MAX_PATH 1024
+
hsize_t dims[RANK]; /* dataset dim sizes */
hsize_t block[RANK], stride[RANK], count[RANK];
hssize_t start[RANK];
@@ -93,6 +91,11 @@ char opt_file[256] = "perftest.out";
char opt_pvfstab[256] = "notset";
int opt_pvfstab_set = 0;
+const char *FILENAME[] = {
+ opt_file,
+ NULL
+};
+
/* function prototypes */
static int parse_args(int argc, char **argv);
@@ -117,8 +120,7 @@ int main(int argc, char **argv)
MPI_File fh;
MPI_Status status;
int nchars;
- const char *prefix;
- char *fullname=NULL;
+ char filename[MAX_PATH];
herr_t ret; /* Generic return value */
/* startup MPI and determine the rank of this process */
@@ -131,21 +133,6 @@ int main(int argc, char **argv)
if (mynod == 0) printf("# Using hdf5-io calls.\n");
- /* create filename with correct prefix using HDF5_PARAPREFIX */
- prefix = HDgetenv("HDF5_PARAPREFIX");
-
-#ifdef HDF5_PARAPREFIX
- if (!prefix)
- prefix = HDF5_PARAPREFIX;
-#endif /* HDF5_PARAPREFIX */
- fullname = (char*) malloc(strlen(prefix) + strlen(opt_file) + 2);
- if (strlen(prefix) > 0)
- {
- strcpy(fullname, prefix);
- strcat(fullname, "/");
- }
- strcat(fullname, opt_file);
-
/* kindof a weird hack- if the location of the pvfstab file was
* specified on the command line, then spit out this location into
* the appropriate environment variable: */
@@ -217,8 +204,10 @@ int main(int argc, char **argv)
}
}
+ h5_fixname_no_suffix(FILENAME[0], acc_tpl, filename, sizeof filename);
+
/* create the parallel file */
- fid = H5Fcreate(fullname, H5F_ACC_TRUNC, H5P_DEFAULT, acc_tpl);
+ fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, acc_tpl);
VRFY((fid >= 0), "H5Fcreate succeeded", H5FATAL);
/* define a contiquous dataset of opt_iter*nprocs*opt_block chars */
@@ -280,7 +269,7 @@ int main(int argc, char **argv)
MPI_Barrier(MPI_COMM_WORLD);
/* reopen the file for reading */
- fid=H5Fopen(fullname,H5F_ACC_RDONLY,acc_tpl);
+ fid=H5Fopen(filename,H5F_ACC_RDONLY,acc_tpl);
VRFY((fid >= 0), "", H5FATAL);
/* open the dataset */
@@ -401,7 +390,6 @@ die_jar_jar_die:
free(tmp);
if (opt_correct) free(tmp2);
- if(fullname) free(fullname);
MPI_Finalize();
@@ -426,6 +414,7 @@ parse_args(int argc, char **argv)
break;
case 'f': /* filename */
strncpy(opt_file, optarg, 255);
+ FILENAME[0] = opt_file;
break;
case 'p': /* pvfstab file */
strncpy(opt_pvfstab, optarg, 255);