diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2020-09-30 14:27:10 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2020-09-30 14:27:10 (GMT) |
commit | b2d661b508a7fc7a2592c13bc6bdc175551f075d (patch) | |
tree | 13baeb0d83a7c2a4c6299993c182b1227c2f6114 /tools/test/perform/pio_perf.c | |
parent | 29ab58b58dce556639ea3154e262895773a8a8df (diff) | |
download | hdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.zip hdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.tar.gz hdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.tar.bz2 |
Clang-format of source files
Diffstat (limited to 'tools/test/perform/pio_perf.c')
-rw-r--r-- | tools/test/perform/pio_perf.c | 1079 |
1 files changed, 536 insertions, 543 deletions
diff --git a/tools/test/perform/pio_perf.c b/tools/test/perform/pio_perf.c index cb15f64..f1b8c4f 100644 --- a/tools/test/perform/pio_perf.c +++ b/tools/test/perform/pio_perf.c @@ -70,48 +70,48 @@ #include "pio_perf.h" /* useful macros */ -#define TAB_SPACE 4 +#define TAB_SPACE 4 -#define ONE_KB 1024 -#define ONE_MB (ONE_KB * ONE_KB) -#define ONE_GB (ONE_MB * ONE_KB) +#define ONE_KB 1024 +#define ONE_MB (ONE_KB * ONE_KB) +#define ONE_GB (ONE_MB * ONE_KB) -#define PIO_POSIX 0x1 -#define PIO_MPI 0x2 -#define PIO_HDF5 0x4 +#define PIO_POSIX 0x1 +#define PIO_MPI 0x2 +#define PIO_HDF5 0x4 #ifdef STANDALONE -#define DBL_EPSILON 2.2204460492503131e-16 -#define H5_DBL_ABS_EQUAL(X,Y) (fabs((X)-(Y)) < DBL_EPSILON) +#define DBL_EPSILON 2.2204460492503131e-16 +#define H5_DBL_ABS_EQUAL(X, Y) (fabs((X) - (Y)) < DBL_EPSILON) #endif /* report 0.0 in case t is zero too */ -#define MB_PER_SEC(bytes,t) (H5_DBL_ABS_EQUAL((t), 0.0) ? 0.0 : ((((double)bytes) / ONE_MB) / (t))) +#define MB_PER_SEC(bytes, t) (H5_DBL_ABS_EQUAL((t), 0.0) ? 0.0 : ((((double)bytes) / ONE_MB) / (t))) #ifndef TRUE -#define TRUE 1 -#endif /* TRUE */ +#define TRUE 1 +#endif /* TRUE */ #ifndef FALSE -#define FALSE (!TRUE) -#endif /* FALSE */ +#define FALSE (!TRUE) +#endif /* FALSE */ /* global variables */ -FILE *output; /* output file */ -int comm_world_rank_g; /* my rank in MPI_COMM_RANK */ -int comm_world_nprocs_g;/* num. of processes of MPI_COMM_WORLD */ -MPI_Comm pio_comm_g; /* Communicator to run the PIO */ -int pio_mpi_rank_g; /* MPI rank of pio_comm_g */ -int pio_mpi_nprocs_g; /* Number of processes of pio_comm_g */ -int pio_debug_level = 0;/* The debug level: - * 0 - Off - * 1 - Minimal - * 2 - Some more - * 3 - Maximal - * 4 - Maximal & then some - */ +FILE * output; /* output file */ +int comm_world_rank_g; /* my rank in MPI_COMM_RANK */ +int comm_world_nprocs_g; /* num. of processes of MPI_COMM_WORLD */ +MPI_Comm pio_comm_g; /* Communicator to run the PIO */ +int pio_mpi_rank_g; /* MPI rank of pio_comm_g */ +int pio_mpi_nprocs_g; /* Number of processes of pio_comm_g */ +int pio_debug_level = 0; /* The debug level: + * 0 - Off + * 1 - Minimal + * 2 - Some more + * 3 - Maximal + * 4 - Maximal & then some + */ /* local variables */ -static const char *progname = "h5perf"; +static const char *progname = "h5perf"; /* * Command-line options: The user can specify short or long-named @@ -122,14 +122,13 @@ static const char *progname = "h5perf"; static const char *s_opts = "a:A:B:cCd:D:e:F:ghi:Imno:p:P:stT:wx:X:"; #else static const char *s_opts = "a:A:bB:cCd:D:e:F:ghi:Imno:p:P:stT:wx:X:"; -#endif /* 1 */ -static struct long_options l_opts[] = { - { "align", require_arg, 'a' }, - { "alig", require_arg, 'a' }, - { "ali", require_arg, 'a' }, - { "al", require_arg, 'a' }, - { "api", require_arg, 'A' }, - { "ap", require_arg, 'A' }, +#endif /* 1 */ +static struct long_options l_opts[] = {{"align", require_arg, 'a'}, + {"alig", require_arg, 'a'}, + {"ali", require_arg, 'a'}, + {"al", require_arg, 'a'}, + {"api", require_arg, 'A'}, + {"ap", require_arg, 'A'}, #if 0 /* a sighting of the elusive binary option */ { "binary", no_arg, 'b' }, @@ -137,185 +136,183 @@ static struct long_options l_opts[] = { { "bina", no_arg, 'b' }, { "bin", no_arg, 'b' }, { "bi", no_arg, 'b' }, -#endif /* 0 */ - { "block-size", require_arg, 'B' }, - { "block-siz", require_arg, 'B' }, - { "block-si", require_arg, 'B' }, - { "block-s", require_arg, 'B' }, - { "block-", require_arg, 'B' }, - { "block", require_arg, 'B' }, - { "bloc", require_arg, 'B' }, - { "blo", require_arg, 'B' }, - { "bl", require_arg, 'B' }, - { "chunk", no_arg, 'c' }, - { "chun", no_arg, 'c' }, - { "chu", no_arg, 'c' }, - { "ch", no_arg, 'c' }, - { "collective", no_arg, 'C' }, - { "collectiv", no_arg, 'C' }, - { "collecti", no_arg, 'C' }, - { "collect", no_arg, 'C' }, - { "collec", no_arg, 'C' }, - { "colle", no_arg, 'C' }, - { "coll", no_arg, 'C' }, - { "col", no_arg, 'C' }, - { "co", no_arg, 'C' }, - { "debug", require_arg, 'D' }, - { "debu", require_arg, 'D' }, - { "deb", require_arg, 'D' }, - { "de", require_arg, 'D' }, - { "geometry", no_arg, 'g' }, - { "geometr", no_arg, 'g' }, - { "geomet", no_arg, 'g' }, - { "geome", no_arg, 'g' }, - { "geom", no_arg, 'g' }, - { "geo", no_arg, 'g' }, - { "ge", no_arg, 'g' }, - { "help", no_arg, 'h' }, - { "hel", no_arg, 'h' }, - { "he", no_arg, 'h' }, - { "interleaved", require_arg, 'I' }, - { "interleave", require_arg, 'I' }, - { "interleav", require_arg, 'I' }, - { "interlea", require_arg, 'I' }, - { "interle", require_arg, 'I' }, - { "interl", require_arg, 'I' }, - { "inter", require_arg, 'I' }, - { "inte", require_arg, 'I' }, - { "int", require_arg, 'I' }, - { "in", require_arg, 'I' }, - { "max-num-processes", require_arg, 'P' }, - { "max-num-processe", require_arg, 'P' }, - { "max-num-process", require_arg, 'P' }, - { "max-num-proces", require_arg, 'P' }, - { "max-num-proce", require_arg, 'P' }, - { "max-num-proc", require_arg, 'P' }, - { "max-num-pro", require_arg, 'P' }, - { "max-num-pr", require_arg, 'P' }, - { "max-num-p", require_arg, 'P' }, - { "min-num-processes", require_arg, 'p' }, - { "min-num-processe", require_arg, 'p' }, - { "min-num-process", require_arg, 'p' }, - { "min-num-proces", require_arg, 'p' }, - { "min-num-proce", require_arg, 'p' }, - { "min-num-proc", require_arg, 'p' }, - { "min-num-pro", require_arg, 'p' }, - { "min-num-pr", require_arg, 'p' }, - { "min-num-p", require_arg, 'p' }, - { "max-xfer-size", require_arg, 'X' }, - { "max-xfer-siz", require_arg, 'X' }, - { "max-xfer-si", require_arg, 'X' }, - { "max-xfer-s", require_arg, 'X' }, - { "max-xfer", require_arg, 'X' }, - { "max-xfe", require_arg, 'X' }, - { "max-xf", require_arg, 'X' }, - { "max-x", require_arg, 'X' }, - { "min-xfer-size", require_arg, 'x' }, - { "min-xfer-siz", require_arg, 'x' }, - { "min-xfer-si", require_arg, 'x' }, - { "min-xfer-s", require_arg, 'x' }, - { "min-xfer", require_arg, 'x' }, - { "min-xfe", require_arg, 'x' }, - { "min-xf", require_arg, 'x' }, - { "min-x", require_arg, 'x' }, - { "num-bytes", require_arg, 'e' }, - { "num-byte", require_arg, 'e' }, - { "num-byt", require_arg, 'e' }, - { "num-by", require_arg, 'e' }, - { "num-b", require_arg, 'e' }, - { "num-dsets", require_arg, 'd' }, - { "num-dset", require_arg, 'd' }, - { "num-dse", require_arg, 'd' }, - { "num-ds", require_arg, 'd' }, - { "num-d", require_arg, 'd' }, - { "num-files", require_arg, 'F' }, - { "num-file", require_arg, 'F' }, - { "num-fil", require_arg, 'F' }, - { "num-fi", require_arg, 'F' }, - { "num-f", require_arg, 'F' }, - { "num-iterations", require_arg, 'i' }, - { "num-iteration", require_arg, 'i' }, - { "num-iteratio", require_arg, 'i' }, - { "num-iterati", require_arg, 'i' }, - { "num-iterat", require_arg, 'i' }, - { "num-itera", require_arg, 'i' }, - { "num-iter", require_arg, 'i' }, - { "num-ite", require_arg, 'i' }, - { "num-it", require_arg, 'i' }, - { "num-i", require_arg, 'i' }, - { "output", require_arg, 'o' }, - { "outpu", require_arg, 'o' }, - { "outp", require_arg, 'o' }, - { "out", require_arg, 'o' }, - { "ou", require_arg, 'o' }, - { "threshold", require_arg, 'T' }, - { "threshol", require_arg, 'T' }, - { "thresho", require_arg, 'T' }, - { "thresh", require_arg, 'T' }, - { "thres", require_arg, 'T' }, - { "thre", require_arg, 'T' }, - { "thr", require_arg, 'T' }, - { "th", require_arg, 'T' }, - { "write-only", require_arg, 'w' }, - { "write-onl", require_arg, 'w' }, - { "write-on", require_arg, 'w' }, - { "write-o", require_arg, 'w' }, - { "write", require_arg, 'w' }, - { "writ", require_arg, 'w' }, - { "wri", require_arg, 'w' }, - { "wr", require_arg, 'w' }, - { NULL, 0, '\0' } -}; +#endif /* 0 */ + {"block-size", require_arg, 'B'}, + {"block-siz", require_arg, 'B'}, + {"block-si", require_arg, 'B'}, + {"block-s", require_arg, 'B'}, + {"block-", require_arg, 'B'}, + {"block", require_arg, 'B'}, + {"bloc", require_arg, 'B'}, + {"blo", require_arg, 'B'}, + {"bl", require_arg, 'B'}, + {"chunk", no_arg, 'c'}, + {"chun", no_arg, 'c'}, + {"chu", no_arg, 'c'}, + {"ch", no_arg, 'c'}, + {"collective", no_arg, 'C'}, + {"collectiv", no_arg, 'C'}, + {"collecti", no_arg, 'C'}, + {"collect", no_arg, 'C'}, + {"collec", no_arg, 'C'}, + {"colle", no_arg, 'C'}, + {"coll", no_arg, 'C'}, + {"col", no_arg, 'C'}, + {"co", no_arg, 'C'}, + {"debug", require_arg, 'D'}, + {"debu", require_arg, 'D'}, + {"deb", require_arg, 'D'}, + {"de", require_arg, 'D'}, + {"geometry", no_arg, 'g'}, + {"geometr", no_arg, 'g'}, + {"geomet", no_arg, 'g'}, + {"geome", no_arg, 'g'}, + {"geom", no_arg, 'g'}, + {"geo", no_arg, 'g'}, + {"ge", no_arg, 'g'}, + {"help", no_arg, 'h'}, + {"hel", no_arg, 'h'}, + {"he", no_arg, 'h'}, + {"interleaved", require_arg, 'I'}, + {"interleave", require_arg, 'I'}, + {"interleav", require_arg, 'I'}, + {"interlea", require_arg, 'I'}, + {"interle", require_arg, 'I'}, + {"interl", require_arg, 'I'}, + {"inter", require_arg, 'I'}, + {"inte", require_arg, 'I'}, + {"int", require_arg, 'I'}, + {"in", require_arg, 'I'}, + {"max-num-processes", require_arg, 'P'}, + {"max-num-processe", require_arg, 'P'}, + {"max-num-process", require_arg, 'P'}, + {"max-num-proces", require_arg, 'P'}, + {"max-num-proce", require_arg, 'P'}, + {"max-num-proc", require_arg, 'P'}, + {"max-num-pro", require_arg, 'P'}, + {"max-num-pr", require_arg, 'P'}, + {"max-num-p", require_arg, 'P'}, + {"min-num-processes", require_arg, 'p'}, + {"min-num-processe", require_arg, 'p'}, + {"min-num-process", require_arg, 'p'}, + {"min-num-proces", require_arg, 'p'}, + {"min-num-proce", require_arg, 'p'}, + {"min-num-proc", require_arg, 'p'}, + {"min-num-pro", require_arg, 'p'}, + {"min-num-pr", require_arg, 'p'}, + {"min-num-p", require_arg, 'p'}, + {"max-xfer-size", require_arg, 'X'}, + {"max-xfer-siz", require_arg, 'X'}, + {"max-xfer-si", require_arg, 'X'}, + {"max-xfer-s", require_arg, 'X'}, + {"max-xfer", require_arg, 'X'}, + {"max-xfe", require_arg, 'X'}, + {"max-xf", require_arg, 'X'}, + {"max-x", require_arg, 'X'}, + {"min-xfer-size", require_arg, 'x'}, + {"min-xfer-siz", require_arg, 'x'}, + {"min-xfer-si", require_arg, 'x'}, + {"min-xfer-s", require_arg, 'x'}, + {"min-xfer", require_arg, 'x'}, + {"min-xfe", require_arg, 'x'}, + {"min-xf", require_arg, 'x'}, + {"min-x", require_arg, 'x'}, + {"num-bytes", require_arg, 'e'}, + {"num-byte", require_arg, 'e'}, + {"num-byt", require_arg, 'e'}, + {"num-by", require_arg, 'e'}, + {"num-b", require_arg, 'e'}, + {"num-dsets", require_arg, 'd'}, + {"num-dset", require_arg, 'd'}, + {"num-dse", require_arg, 'd'}, + {"num-ds", require_arg, 'd'}, + {"num-d", require_arg, 'd'}, + {"num-files", require_arg, 'F'}, + {"num-file", require_arg, 'F'}, + {"num-fil", require_arg, 'F'}, + {"num-fi", require_arg, 'F'}, + {"num-f", require_arg, 'F'}, + {"num-iterations", require_arg, 'i'}, + {"num-iteration", require_arg, 'i'}, + {"num-iteratio", require_arg, 'i'}, + {"num-iterati", require_arg, 'i'}, + {"num-iterat", require_arg, 'i'}, + {"num-itera", require_arg, 'i'}, + {"num-iter", require_arg, 'i'}, + {"num-ite", require_arg, 'i'}, + {"num-it", require_arg, 'i'}, + {"num-i", require_arg, 'i'}, + {"output", require_arg, 'o'}, + {"outpu", require_arg, 'o'}, + {"outp", require_arg, 'o'}, + {"out", require_arg, 'o'}, + {"ou", require_arg, 'o'}, + {"threshold", require_arg, 'T'}, + {"threshol", require_arg, 'T'}, + {"thresho", require_arg, 'T'}, + {"thresh", require_arg, 'T'}, + {"thres", require_arg, 'T'}, + {"thre", require_arg, 'T'}, + {"thr", require_arg, 'T'}, + {"th", require_arg, 'T'}, + {"write-only", require_arg, 'w'}, + {"write-onl", require_arg, 'w'}, + {"write-on", require_arg, 'w'}, + {"write-o", require_arg, 'w'}, + {"write", require_arg, 'w'}, + {"writ", require_arg, 'w'}, + {"wri", require_arg, 'w'}, + {"wr", require_arg, 'w'}, + {NULL, 0, '\0'}}; struct options { - long io_types; /* bitmask of which I/O types to test */ - const char *output_file; /* file to print report to */ - long num_dsets; /* number of datasets */ - long num_files; /* number of files */ - off_t num_bpp; /* number of bytes per proc per dset */ - int num_iters; /* number of iterations */ - int max_num_procs; /* maximum number of processes to use */ - int min_num_procs; /* minimum number of processes to use */ - size_t max_xfer_size; /* maximum transfer buffer size */ - size_t min_xfer_size; /* minimum transfer buffer size */ - size_t blk_size; /* Block size */ - unsigned interleaved; /* Interleaved vs. contiguous blocks */ - unsigned collective; /* Collective vs. independent I/O */ - unsigned dim2d; /* 1D vs. 2D geometry */ - int print_times; /* print times as well as throughputs */ - int print_raw; /* print raw data throughput info */ - off_t h5_alignment; /* alignment in HDF5 file */ - off_t h5_threshold; /* threshold for alignment in HDF5 file */ - int h5_use_chunks; /* Make HDF5 dataset chunked */ - int h5_write_only; /* Perform the write tests only */ - int verify; /* Verify data correctness */ + long io_types; /* bitmask of which I/O types to test */ + const char *output_file; /* file to print report to */ + long num_dsets; /* number of datasets */ + long num_files; /* number of files */ + off_t num_bpp; /* number of bytes per proc per dset */ + int num_iters; /* number of iterations */ + int max_num_procs; /* maximum number of processes to use */ + int min_num_procs; /* minimum number of processes to use */ + size_t max_xfer_size; /* maximum transfer buffer size */ + size_t min_xfer_size; /* minimum transfer buffer size */ + size_t blk_size; /* Block size */ + unsigned interleaved; /* Interleaved vs. contiguous blocks */ + unsigned collective; /* Collective vs. independent I/O */ + unsigned dim2d; /* 1D vs. 2D geometry */ + int print_times; /* print times as well as throughputs */ + int print_raw; /* print raw data throughput info */ + off_t h5_alignment; /* alignment in HDF5 file */ + off_t h5_threshold; /* threshold for alignment in HDF5 file */ + int h5_use_chunks; /* Make HDF5 dataset chunked */ + int h5_write_only; /* Perform the write tests only */ + int verify; /* Verify data correctness */ }; typedef struct _minmax { double min; double max; double sum; - int num; + int num; } minmax; /* local functions */ -static off_t parse_size_directive(const char *size); +static off_t parse_size_directive(const char *size); static struct options *parse_command_line(int argc, char *argv[]); -static void run_test_loop(struct options *options); -static int run_test(iotype iot, parameters parms, struct options *opts); -static void output_all_info(minmax *mm, int count, int indent_level); -static void get_minmax(minmax *mm, double val); -static minmax accumulate_minmax_stuff(minmax *mm, int count); -static int create_comm_world(int num_procs, int *doing_pio); -static int destroy_comm_world(void); -static void output_results(const struct options *options, const char *name, - minmax *table, int table_size, off_t data_size); -static void output_times(const struct options *options, const char *name, - minmax *table, int table_size); -static void output_report(const char *fmt, ...); -static void print_indent(register int indent); -static void usage(const char *prog); -static void report_parameters(struct options *opts); +static void run_test_loop(struct options *options); +static int run_test(iotype iot, parameters parms, struct options *opts); +static void output_all_info(minmax *mm, int count, int indent_level); +static void get_minmax(minmax *mm, double val); +static minmax accumulate_minmax_stuff(minmax *mm, int count); +static int create_comm_world(int num_procs, int *doing_pio); +static int destroy_comm_world(void); +static void output_results(const struct options *options, const char *name, minmax *table, int table_size, + off_t data_size); +static void output_times(const struct options *options, const char *name, minmax *table, int table_size); +static void output_report(const char *fmt, ...); +static void print_indent(register int indent); +static void usage(const char *prog); +static void report_parameters(struct options *opts); static off_t squareo(off_t); /* @@ -329,9 +326,9 @@ static off_t squareo(off_t); int main(int argc, char *argv[]) { - int ret; - int exit_value = EXIT_SUCCESS; - struct options *opts = NULL; + int ret; + int exit_value = EXIT_SUCCESS; + struct options *opts = NULL; #ifndef STANDALONE /* Initialize h5tools lib */ @@ -430,26 +427,25 @@ static void run_test_loop(struct options *opts) { parameters parms; - int num_procs; - int doing_pio; /* if this process is doing PIO */ - - parms.num_files = opts->num_files; - parms.num_dsets = opts->num_dsets; - parms.num_iters = opts->num_iters; - parms.blk_size = opts->blk_size; - parms.interleaved = opts->interleaved; - parms.collective = opts->collective; - parms.dim2d = opts->dim2d; - parms.h5_align = (hsize_t)opts->h5_alignment; - parms.h5_thresh = (hsize_t)opts->h5_threshold; + int num_procs; + int doing_pio; /* if this process is doing PIO */ + + parms.num_files = opts->num_files; + parms.num_dsets = opts->num_dsets; + parms.num_iters = opts->num_iters; + parms.blk_size = opts->blk_size; + parms.interleaved = opts->interleaved; + parms.collective = opts->collective; + parms.dim2d = opts->dim2d; + parms.h5_align = (hsize_t)opts->h5_alignment; + parms.h5_thresh = (hsize_t)opts->h5_threshold; parms.h5_use_chunks = opts->h5_use_chunks; parms.h5_write_only = opts->h5_write_only; - parms.verify = opts->verify; + parms.verify = opts->verify; /* start with max_num_procs and decrement it by half for each loop. */ /* if performance needs restart, fewer processes may be needed. */ - for (num_procs = opts->max_num_procs; - num_procs >= opts->min_num_procs; num_procs >>= 1) { + for (num_procs = opts->max_num_procs; num_procs >= opts->min_num_procs; num_procs >>= 1) { register size_t buf_size; parms.num_procs = num_procs; @@ -458,42 +454,41 @@ run_test_loop(struct options *opts) /* do something harsh */ } - /* only processes doing PIO will run the tests */ - if (doing_pio){ + /* only processes doing PIO will run the tests */ + if (doing_pio) { output_report("Number of processors = %ld\n", parms.num_procs); /* multiply the xfer buffer size by 2 for each loop iteration */ - for (buf_size = opts->min_xfer_size; - buf_size <= opts->max_xfer_size; buf_size <<= 1) { + for (buf_size = opts->min_xfer_size; buf_size <= opts->max_xfer_size; buf_size <<= 1) { parms.buf_size = buf_size; - if (parms.dim2d){ - parms.num_bytes = squareo(opts->num_bpp * parms.num_procs); - if (parms.interleaved) - output_report("Transfer Buffer Size: %ldx%ld bytes, File size: %.2f MB\n", - buf_size, opts->blk_size, - ((double)parms.num_dsets * (double)parms.num_bytes) - / ONE_MB); - else - output_report("Transfer Buffer Size: %ldx%ld bytes, File size: %.2f MB\n", - opts->blk_size, buf_size, - ((double)parms.num_dsets * (double)parms.num_bytes) - / ONE_MB); - - print_indent(1); - output_report(" # of files: %ld, # of datasets: %ld, dataset size: %.2fx%.2f KB\n", - parms.num_files, parms.num_dsets, (double)(opts->num_bpp*parms.num_procs)/ONE_KB, - (double)(opts->num_bpp*parms.num_procs)/ONE_KB); - } - else{ - parms.num_bytes = (off_t)opts->num_bpp*parms.num_procs; - output_report("Transfer Buffer Size: %ld bytes, File size: %.2f MB\n", - buf_size,((double)parms.num_dsets * (double)parms.num_bytes) / ONE_MB); - - print_indent(1); - output_report(" # of files: %ld, # of datasets: %ld, dataset size: %.2f MB\n", - parms.num_files, parms.num_dsets, (double)(opts->num_bpp*parms.num_procs)/ONE_MB); - } + if (parms.dim2d) { + parms.num_bytes = squareo(opts->num_bpp * parms.num_procs); + if (parms.interleaved) + output_report("Transfer Buffer Size: %ldx%ld bytes, File size: %.2f MB\n", buf_size, + opts->blk_size, + ((double)parms.num_dsets * (double)parms.num_bytes) / ONE_MB); + else + output_report("Transfer Buffer Size: %ldx%ld bytes, File size: %.2f MB\n", + opts->blk_size, buf_size, + ((double)parms.num_dsets * (double)parms.num_bytes) / ONE_MB); + + print_indent(1); + output_report(" # of files: %ld, # of datasets: %ld, dataset size: %.2fx%.2f KB\n", + parms.num_files, parms.num_dsets, + (double)(opts->num_bpp * parms.num_procs) / ONE_KB, + (double)(opts->num_bpp * parms.num_procs) / ONE_KB); + } + else { + parms.num_bytes = (off_t)opts->num_bpp * parms.num_procs; + output_report("Transfer Buffer Size: %ld bytes, File size: %.2f MB\n", buf_size, + ((double)parms.num_dsets * (double)parms.num_bytes) / ONE_MB); + + print_indent(1); + output_report(" # of files: %ld, # of datasets: %ld, dataset size: %.2f MB\n", + parms.num_files, parms.num_dsets, + (double)(opts->num_bpp * parms.num_procs) / ONE_MB); + } if (opts->io_types & PIO_POSIX) run_test(POSIXIO, parms, opts); @@ -505,14 +500,14 @@ run_test_loop(struct options *opts) run_test(PHDF5, parms, opts); /* Run the tests once if buf_size==0, but then break out */ - if(buf_size==0) + if (buf_size == 0) break; } if (destroy_comm_world() != SUCCESS) { /* do something harsh */ } - } + } } } @@ -526,36 +521,36 @@ run_test_loop(struct options *opts) static int run_test(iotype iot, parameters parms, struct options *opts) { - results res; - register int i, ret_value = SUCCESS; - int comm_size; - off_t raw_size; - minmax *write_mpi_mm_table=NULL; - minmax *write_mm_table=NULL; - minmax *write_gross_mm_table=NULL; - minmax *write_raw_mm_table=NULL; - minmax *read_mpi_mm_table=NULL; - minmax *read_mm_table=NULL; - minmax *read_gross_mm_table=NULL; - minmax *read_raw_mm_table=NULL; - minmax *read_open_mm_table=NULL; - minmax *read_close_mm_table=NULL; - minmax *write_open_mm_table=NULL; - minmax *write_close_mm_table=NULL; - minmax write_mpi_mm = {0.0, 0.0, 0.0, 0}; - minmax write_mm = {0.0, 0.0, 0.0, 0}; - minmax write_gross_mm = {0.0, 0.0, 0.0, 0}; - minmax write_raw_mm = {0.0, 0.0, 0.0, 0}; - minmax read_mpi_mm = {0.0, 0.0, 0.0, 0}; - minmax read_mm = {0.0, 0.0, 0.0, 0}; - minmax read_gross_mm = {0.0, 0.0, 0.0, 0}; - minmax read_raw_mm = {0.0, 0.0, 0.0, 0}; - minmax read_open_mm = {0.0, 0.0, 0.0, 0}; - minmax read_close_mm = {0.0, 0.0, 0.0, 0}; - minmax write_open_mm = {0.0, 0.0, 0.0, 0}; - minmax write_close_mm = {0.0, 0.0, 0.0, 0}; - - raw_size = parms.num_files * (off_t)parms.num_dsets * (off_t)parms.num_bytes; + results res; + register int i, ret_value = SUCCESS; + int comm_size; + off_t raw_size; + minmax * write_mpi_mm_table = NULL; + minmax * write_mm_table = NULL; + minmax * write_gross_mm_table = NULL; + minmax * write_raw_mm_table = NULL; + minmax * read_mpi_mm_table = NULL; + minmax * read_mm_table = NULL; + minmax * read_gross_mm_table = NULL; + minmax * read_raw_mm_table = NULL; + minmax * read_open_mm_table = NULL; + minmax * read_close_mm_table = NULL; + minmax * write_open_mm_table = NULL; + minmax * write_close_mm_table = NULL; + minmax write_mpi_mm = {0.0, 0.0, 0.0, 0}; + minmax write_mm = {0.0, 0.0, 0.0, 0}; + minmax write_gross_mm = {0.0, 0.0, 0.0, 0}; + minmax write_raw_mm = {0.0, 0.0, 0.0, 0}; + minmax read_mpi_mm = {0.0, 0.0, 0.0, 0}; + minmax read_mm = {0.0, 0.0, 0.0, 0}; + minmax read_gross_mm = {0.0, 0.0, 0.0, 0}; + minmax read_raw_mm = {0.0, 0.0, 0.0, 0}; + minmax read_open_mm = {0.0, 0.0, 0.0, 0}; + minmax read_close_mm = {0.0, 0.0, 0.0, 0}; + minmax write_open_mm = {0.0, 0.0, 0.0, 0}; + minmax write_close_mm = {0.0, 0.0, 0.0, 0}; + + raw_size = parms.num_files * (off_t)parms.num_dsets * (off_t)parms.num_bytes; parms.io_type = iot; print_indent(2); output_report("IO API = "); @@ -578,19 +573,19 @@ run_test(iotype iot, parameters parms, struct options *opts) /* allocate space for tables minmax and that it is sufficient */ /* to initialize all elements to zeros by calloc. */ - write_mpi_mm_table = calloc((size_t)parms.num_iters , sizeof(minmax)); - write_mm_table = calloc((size_t)parms.num_iters , sizeof(minmax)); - write_gross_mm_table = calloc((size_t)parms.num_iters , sizeof(minmax)); - write_raw_mm_table = calloc((size_t)parms.num_iters , sizeof(minmax)); - write_open_mm_table = calloc((size_t)parms.num_iters , sizeof(minmax)); - write_close_mm_table = calloc((size_t)parms.num_iters , sizeof(minmax)); + write_mpi_mm_table = calloc((size_t)parms.num_iters, sizeof(minmax)); + write_mm_table = calloc((size_t)parms.num_iters, sizeof(minmax)); + write_gross_mm_table = calloc((size_t)parms.num_iters, sizeof(minmax)); + write_raw_mm_table = calloc((size_t)parms.num_iters, sizeof(minmax)); + write_open_mm_table = calloc((size_t)parms.num_iters, sizeof(minmax)); + write_close_mm_table = calloc((size_t)parms.num_iters, sizeof(minmax)); if (!parms.h5_write_only) { - read_mpi_mm_table = calloc((size_t)parms.num_iters , sizeof(minmax)); - read_mm_table = calloc((size_t)parms.num_iters , sizeof(minmax)); - read_gross_mm_table = calloc((size_t)parms.num_iters , sizeof(minmax)); - read_raw_mm_table = calloc((size_t)parms.num_iters , sizeof(minmax)); - read_open_mm_table = calloc((size_t)parms.num_iters , sizeof(minmax)); - read_close_mm_table = calloc((size_t)parms.num_iters , sizeof(minmax)); + read_mpi_mm_table = calloc((size_t)parms.num_iters, sizeof(minmax)); + read_mm_table = calloc((size_t)parms.num_iters, sizeof(minmax)); + read_gross_mm_table = calloc((size_t)parms.num_iters, sizeof(minmax)); + read_raw_mm_table = calloc((size_t)parms.num_iters, sizeof(minmax)); + read_open_mm_table = calloc((size_t)parms.num_iters, sizeof(minmax)); + read_close_mm_table = calloc((size_t)parms.num_iters, sizeof(minmax)); } /* Do IO iteration times, collecting statistics each time */ @@ -672,10 +667,9 @@ run_test(iotype iot, parameters parms, struct options *opts) get_minmax(&read_close_mm, t); read_close_mm_table[i] = read_close_mm; + } - } - - io_time_destroy(res.timers); + io_time_destroy(res.timers); } /* @@ -692,7 +686,7 @@ run_test(iotype iot, parameters parms, struct options *opts) output_all_info(write_raw_mm_table, parms.num_iters, 4); } - output_results(opts,"Raw Data Write",write_raw_mm_table,parms.num_iters,raw_size); + output_results(opts, "Raw Data Write", write_raw_mm_table, parms.num_iters, raw_size); } /* end if */ /* show mpi write statics */ @@ -713,7 +707,7 @@ run_test(iotype iot, parameters parms, struct options *opts) output_all_info(write_mm_table, parms.num_iters, 4); } - output_results(opts,"Write",write_mm_table,parms.num_iters,raw_size); + output_results(opts, "Write", write_mm_table, parms.num_iters, raw_size); /* accumulate and output the max, min, and average "gross write" times */ if (pio_debug_level >= 3) { @@ -723,27 +717,27 @@ run_test(iotype iot, parameters parms, struct options *opts) output_all_info(write_gross_mm_table, parms.num_iters, 4); } - output_results(opts,"Write Open-Close",write_gross_mm_table,parms.num_iters,raw_size); + output_results(opts, "Write Open-Close", write_gross_mm_table, parms.num_iters, raw_size); if (opts->print_times) { - output_times(opts,"Write File Open",write_open_mm_table,parms.num_iters); - output_times(opts,"Write File Close",write_close_mm_table,parms.num_iters); + output_times(opts, "Write File Open", write_open_mm_table, parms.num_iters); + output_times(opts, "Write File Close", write_close_mm_table, parms.num_iters); } /* Print out time from open to first write */ if (pio_debug_level >= 3) { - /* output all of the times for all iterations */ - print_indent(3); - output_report("Write file open details:\n"); - output_all_info(write_open_mm_table, parms.num_iters, 4); + /* output all of the times for all iterations */ + print_indent(3); + output_report("Write file open details:\n"); + output_all_info(write_open_mm_table, parms.num_iters, 4); } /* Print out time from last write to close */ if (pio_debug_level >= 3) { - /* output all of the times for all iterations */ - print_indent(3); - output_report("Write file close details:\n"); - output_all_info(write_close_mm_table, parms.num_iters, 4); + /* output all of the times for all iterations */ + print_indent(3); + output_report("Write file close details:\n"); + output_all_info(write_close_mm_table, parms.num_iters, 4); } if (!parms.h5_write_only) { @@ -758,8 +752,7 @@ run_test(iotype iot, parameters parms, struct options *opts) output_all_info(read_raw_mm_table, parms.num_iters, 4); } - output_results(opts, "Raw Data Read", read_raw_mm_table, - parms.num_iters, raw_size); + output_results(opts, "Raw Data Read", read_raw_mm_table, parms.num_iters, raw_size); } /* end if */ /* show mpi read statics */ @@ -790,11 +783,11 @@ run_test(iotype iot, parameters parms, struct options *opts) output_all_info(read_gross_mm_table, parms.num_iters, 4); } - output_results(opts, "Read Open-Close", read_gross_mm_table,parms.num_iters, raw_size); + output_results(opts, "Read Open-Close", read_gross_mm_table, parms.num_iters, raw_size); if (opts->print_times) { - output_times(opts,"Read File Open",read_open_mm_table,parms.num_iters); - output_times(opts,"Read File Close",read_close_mm_table,parms.num_iters); + output_times(opts, "Read File Open", read_open_mm_table, parms.num_iters); + output_times(opts, "Read File Close", read_close_mm_table, parms.num_iters); } /* Print out time from open to first read */ @@ -812,7 +805,6 @@ run_test(iotype iot, parameters parms, struct options *opts) output_report("Read file close details:\n"); output_all_info(read_close_mm_table, parms.num_iters, 4); } - } /* clean up our mess */ @@ -890,7 +882,7 @@ get_minmax(minmax *mm, double val) static minmax accumulate_minmax_stuff(minmax *mm, int count) { - int i; + int i; minmax total_mm; total_mm.sum = 0.0f; @@ -926,9 +918,9 @@ static int create_comm_world(int num_procs, int *doing_pio) { /* MPI variables */ - int mrc; /* return values */ - int color; /* for communicator creation */ - int myrank, nprocs; + int mrc; /* return values */ + int color; /* for communicator creation */ + int myrank, nprocs; pio_comm_g = MPI_COMM_NULL; @@ -939,15 +931,14 @@ create_comm_world(int num_procs, int *doing_pio) MPI_Comm_size(MPI_COMM_WORLD, &nprocs); if (num_procs > nprocs) { - HDfprintf(stderr, - "number of process(%d) must be <= number of processes in MPI_COMM_WORLD(%d)\n", - num_procs, nprocs); + HDfprintf(stderr, "number of process(%d) must be <= number of processes in MPI_COMM_WORLD(%d)\n", + num_procs, nprocs); goto error_done; } MPI_Comm_rank(MPI_COMM_WORLD, &myrank); color = (myrank < num_procs); - mrc = MPI_Comm_split(MPI_COMM_WORLD, color, myrank, &pio_comm_g); + mrc = MPI_Comm_split(MPI_COMM_WORLD, color, myrank, &pio_comm_g); if (mrc != MPI_SUCCESS) { HDfprintf(stderr, "MPI_Comm_split failed\n"); @@ -985,7 +976,7 @@ error_done: static int destroy_comm_world(void) { - int mrc = SUCCESS; /* return code */ + int mrc = SUCCESS; /* return code */ /* release MPI resources */ if (pio_comm_g != MPI_COMM_NULL) @@ -1003,63 +994,60 @@ destroy_comm_world(void) * Modifications: */ static void -output_results(const struct options *opts, const char *name, minmax *table, - int table_size,off_t data_size) +output_results(const struct options *opts, const char *name, minmax *table, int table_size, off_t data_size) { - minmax total_mm; + minmax total_mm; total_mm = accumulate_minmax_stuff(table, table_size); print_indent(3); - output_report("%s (%d iteration(s)):\n", name,table_size); + output_report("%s (%d iteration(s)):\n", name, table_size); /* Note: The maximum throughput uses the minimum amount of time & vice versa */ print_indent(4); - output_report("Maximum Throughput: %6.2f MB/s", MB_PER_SEC(data_size,total_mm.min)); - if(opts->print_times) + output_report("Maximum Throughput: %6.2f MB/s", MB_PER_SEC(data_size, total_mm.min)); + if (opts->print_times) output_report(" (%7.3f s)\n", total_mm.min); else output_report("\n"); print_indent(4); - output_report("Average Throughput: %6.2f MB/s", - MB_PER_SEC(data_size,total_mm.sum / total_mm.num)); - if(opts->print_times) + output_report("Average Throughput: %6.2f MB/s", MB_PER_SEC(data_size, total_mm.sum / total_mm.num)); + if (opts->print_times) output_report(" (%7.3f s)\n", (total_mm.sum / total_mm.num)); else output_report("\n"); print_indent(4); - output_report("Minimum Throughput: %6.2f MB/s", MB_PER_SEC(data_size,total_mm.max)); - if(opts->print_times) + output_report("Minimum Throughput: %6.2f MB/s", MB_PER_SEC(data_size, total_mm.max)); + if (opts->print_times) output_report(" (%7.3f s)\n", total_mm.max); else output_report("\n"); - } static void -output_times(const struct options *opts, const char *name, minmax *table, - int table_size) +output_times(const struct options *opts, const char *name, minmax *table, int table_size) { - minmax total_mm; + minmax total_mm; total_mm = accumulate_minmax_stuff(table, table_size); print_indent(3); - output_report("%s (%d iteration(s)):\n", name,table_size); + output_report("%s (%d iteration(s)):\n", name, table_size); /* Note: The maximum throughput uses the minimum amount of time & vice versa */ print_indent(4); - output_report("Minimum Accumulated Time using %d file(s): %7.5f s\n", opts->num_files,(total_mm.min)); + output_report("Minimum Accumulated Time using %d file(s): %7.5f s\n", opts->num_files, (total_mm.min)); print_indent(4); - output_report("Average Accumulated Time using %d file(s): %7.5f s\n", opts->num_files,(total_mm.sum / total_mm.num)); + output_report("Average Accumulated Time using %d file(s): %7.5f s\n", opts->num_files, + (total_mm.sum / total_mm.num)); print_indent(4); - output_report("Maximum Accumulated Time using %d file(s): %7.5f s\n", opts->num_files,(total_mm.max)); + output_report("Maximum Accumulated Time using %d file(s): %7.5f s\n", opts->num_files, (total_mm.max)); } /* @@ -1101,10 +1089,10 @@ print_indent(register int indent) MPI_Comm_rank(pio_comm_g, &myrank); if (myrank == 0) { - indent *= TAB_SPACE; + indent *= TAB_SPACE; - for (; indent > 0; --indent) - HDfputc(' ', output); + for (; indent > 0; --indent) + HDfputc(' ', output); } } @@ -1114,14 +1102,28 @@ recover_size_and_print(long long val, const char *end) if (val >= ONE_KB && (val % ONE_KB) == 0) { if (val >= ONE_MB && (val % ONE_MB) == 0) { if (val >= ONE_GB && (val % ONE_GB) == 0) - HDfprintf(output, "%" H5_PRINTF_LL_WIDTH "d""GB%s", val / ONE_GB, end); + HDfprintf(output, + "%" H5_PRINTF_LL_WIDTH "d" + "GB%s", + val / ONE_GB, end); else - HDfprintf(output, "%" H5_PRINTF_LL_WIDTH "d""MB%s", val / ONE_MB, end); - } else { - HDfprintf(output, "%" H5_PRINTF_LL_WIDTH "d""KB%s", val / ONE_KB, end); + HDfprintf(output, + "%" H5_PRINTF_LL_WIDTH "d" + "MB%s", + val / ONE_MB, end); + } + else { + HDfprintf(output, + "%" H5_PRINTF_LL_WIDTH "d" + "KB%s", + val / ONE_KB, end); } - } else { - HDfprintf(output, "%" H5_PRINTF_LL_WIDTH "d""%s", val, end); + } + else { + HDfprintf(output, + "%" H5_PRINTF_LL_WIDTH "d" + "%s", + val, end); } } @@ -1129,11 +1131,11 @@ static void print_io_api(long io_types) { if (io_types & PIO_POSIX) - HDfprintf(output, "posix "); + HDfprintf(output, "posix "); if (io_types & PIO_MPI) - HDfprintf(output, "mpiio "); + HDfprintf(output, "mpiio "); if (io_types & PIO_HDF5) - HDfprintf(output, "phdf5 "); + HDfprintf(output, "phdf5 "); HDfprintf(output, "\n"); } @@ -1142,90 +1144,84 @@ report_parameters(struct options *opts) { int rank = comm_world_rank_g; - print_version("HDF5 Library"); /* print library version */ + print_version("HDF5 Library"); /* print library version */ HDfprintf(output, "rank %d: ==== Parameters ====\n", rank); HDfprintf(output, "rank %d: IO API=", rank); print_io_api(opts->io_types); - HDfprintf(output, "rank %d: Number of files=%ld\n", rank, - opts->num_files); - HDfprintf(output, "rank %d: Number of datasets=%ld\n", rank, - opts->num_dsets); - HDfprintf(output, "rank %d: Number of iterations=%d\n", rank, - opts->num_iters); - HDfprintf(output, "rank %d: Number of processes=%d:%d\n", rank, - opts->min_num_procs, opts->max_num_procs); - - if (opts->dim2d){ - HDfprintf(output, "rank %d: Number of bytes per process per dataset=", rank); - recover_size_and_print((long long)(opts->num_bpp * opts->num_bpp * opts->min_num_procs), ":"); - recover_size_and_print((long long)(opts->num_bpp * opts->num_bpp * opts->max_num_procs), "\n"); - - HDfprintf(output, "rank %d: Size of dataset(s)=", rank); - recover_size_and_print((long long)(opts->num_bpp * opts->min_num_procs), "x"); - recover_size_and_print((long long)(opts->num_bpp * opts->min_num_procs), ":"); - recover_size_and_print((long long)(opts->num_bpp * opts->max_num_procs), "x"); - recover_size_and_print((long long)(opts->num_bpp * opts->max_num_procs), "\n"); - - HDfprintf(output, "rank %d: File size=", rank); - recover_size_and_print((long long)(squareo(opts->num_bpp * opts->min_num_procs) - * opts->num_dsets), ":"); - recover_size_and_print((long long)(squareo(opts->num_bpp * opts->max_num_procs) - * opts->num_dsets), "\n"); - - HDfprintf(output, "rank %d: Transfer buffer size=", rank); - if(opts->interleaved){ - recover_size_and_print((long long)opts->min_xfer_size, "x"); - recover_size_and_print((long long)opts->blk_size, ":"); - recover_size_and_print((long long)opts->max_xfer_size, "x"); + HDfprintf(output, "rank %d: Number of files=%ld\n", rank, opts->num_files); + HDfprintf(output, "rank %d: Number of datasets=%ld\n", rank, opts->num_dsets); + HDfprintf(output, "rank %d: Number of iterations=%d\n", rank, opts->num_iters); + HDfprintf(output, "rank %d: Number of processes=%d:%d\n", rank, opts->min_num_procs, opts->max_num_procs); + + if (opts->dim2d) { + HDfprintf(output, "rank %d: Number of bytes per process per dataset=", rank); + recover_size_and_print((long long)(opts->num_bpp * opts->num_bpp * opts->min_num_procs), ":"); + recover_size_and_print((long long)(opts->num_bpp * opts->num_bpp * opts->max_num_procs), "\n"); + + HDfprintf(output, "rank %d: Size of dataset(s)=", rank); + recover_size_and_print((long long)(opts->num_bpp * opts->min_num_procs), "x"); + recover_size_and_print((long long)(opts->num_bpp * opts->min_num_procs), ":"); + recover_size_and_print((long long)(opts->num_bpp * opts->max_num_procs), "x"); + recover_size_and_print((long long)(opts->num_bpp * opts->max_num_procs), "\n"); + + HDfprintf(output, "rank %d: File size=", rank); + recover_size_and_print((long long)(squareo(opts->num_bpp * opts->min_num_procs) * opts->num_dsets), + ":"); + recover_size_and_print((long long)(squareo(opts->num_bpp * opts->max_num_procs) * opts->num_dsets), + "\n"); + + HDfprintf(output, "rank %d: Transfer buffer size=", rank); + if (opts->interleaved) { + recover_size_and_print((long long)opts->min_xfer_size, "x"); + recover_size_and_print((long long)opts->blk_size, ":"); + recover_size_and_print((long long)opts->max_xfer_size, "x"); + recover_size_and_print((long long)opts->blk_size, "\n"); + } + else { + recover_size_and_print((long long)opts->blk_size, "x"); + recover_size_and_print((long long)opts->min_xfer_size, ":"); + recover_size_and_print((long long)opts->blk_size, "x"); + recover_size_and_print((long long)opts->max_xfer_size, "\n"); + } + HDfprintf(output, "rank %d: Block size=", rank); + recover_size_and_print((long long)opts->blk_size, "x"); recover_size_and_print((long long)opts->blk_size, "\n"); } - else{ - recover_size_and_print((long long)opts->blk_size, "x"); + else { + HDfprintf(output, "rank %d: Number of bytes per process per dataset=", rank); + recover_size_and_print((long long)opts->num_bpp, "\n"); + + HDfprintf(output, "rank %d: Size of dataset(s)=", rank); + recover_size_and_print((long long)(opts->num_bpp * opts->min_num_procs), ":"); + recover_size_and_print((long long)(opts->num_bpp * opts->max_num_procs), "\n"); + + HDfprintf(output, "rank %d: File size=", rank); + recover_size_and_print((long long)(opts->num_bpp * opts->min_num_procs * opts->num_dsets), ":"); + recover_size_and_print((long long)(opts->num_bpp * opts->max_num_procs * opts->num_dsets), "\n"); + + HDfprintf(output, "rank %d: Transfer buffer size=", rank); recover_size_and_print((long long)opts->min_xfer_size, ":"); - recover_size_and_print((long long)opts->blk_size, "x"); recover_size_and_print((long long)opts->max_xfer_size, "\n"); - } - HDfprintf(output, "rank %d: Block size=", rank); - recover_size_and_print((long long)opts->blk_size, "x"); - recover_size_and_print((long long)opts->blk_size, "\n"); - } - else{ - HDfprintf(output, "rank %d: Number of bytes per process per dataset=", rank); - recover_size_and_print((long long)opts->num_bpp, "\n"); - - HDfprintf(output, "rank %d: Size of dataset(s)=", rank); - recover_size_and_print((long long)(opts->num_bpp * opts->min_num_procs), ":"); - recover_size_and_print((long long)(opts->num_bpp * opts->max_num_procs), "\n"); - - HDfprintf(output, "rank %d: File size=", rank); - recover_size_and_print((long long)(opts->num_bpp * opts->min_num_procs - * opts->num_dsets), ":"); - recover_size_and_print((long long)(opts->num_bpp * opts->max_num_procs - * opts->num_dsets), "\n"); - - HDfprintf(output, "rank %d: Transfer buffer size=", rank); - recover_size_and_print((long long)opts->min_xfer_size, ":"); - recover_size_and_print((long long)opts->max_xfer_size, "\n"); - HDfprintf(output, "rank %d: Block size=", rank); - recover_size_and_print((long long)opts->blk_size, "\n"); + HDfprintf(output, "rank %d: Block size=", rank); + recover_size_and_print((long long)opts->blk_size, "\n"); } HDfprintf(output, "rank %d: Block Pattern in Dataset=", rank); - if(opts->interleaved) + if (opts->interleaved) HDfprintf(output, "Interleaved\n"); else HDfprintf(output, "Contiguous\n"); HDfprintf(output, "rank %d: I/O Method for MPI and HDF5=", rank); - if(opts->collective) + if (opts->collective) HDfprintf(output, "Collective\n"); else HDfprintf(output, "Independent\n"); HDfprintf(output, "rank %d: Geometry=", rank); - if(opts->dim2d) + if (opts->dim2d) HDfprintf(output, "2D\n"); else HDfprintf(output, "1D\n"); @@ -1233,7 +1229,7 @@ report_parameters(struct options *opts) HDfprintf(output, "rank %d: VFL used for HDF5 I/O=%s\n", rank, "MPI-IO driver"); HDfprintf(output, "rank %d: Data storage method in HDF5=", rank); - if(opts->h5_use_chunks) + if (opts->h5_use_chunks) HDfprintf(output, "Chunked\n"); else HDfprintf(output, "Contiguous\n"); @@ -1241,8 +1237,7 @@ report_parameters(struct options *opts) { char *prefix = HDgetenv("HDF5_PARAPREFIX"); - HDfprintf(output, "rank %d: Env HDF5_PARAPREFIX=%s\n", rank, - (prefix ? prefix : "not set")); + HDfprintf(output, "rank %d: Env HDF5_PARAPREFIX=%s\n", rank, (prefix ? prefix : "not set")); } HDfprintf(output, "rank %d: ", rank); @@ -1264,45 +1259,44 @@ report_parameters(struct options *opts) static struct options * parse_command_line(int argc, char *argv[]) { - register int opt; + register int opt; struct options *cl_opts; cl_opts = (struct options *)malloc(sizeof(struct options)); - cl_opts->output_file = NULL; - cl_opts->io_types = 0; /* will set default after parsing options */ - cl_opts->num_dsets = 1; - cl_opts->num_files = 1; - cl_opts->num_bpp = 0; - cl_opts->num_iters = 1; + cl_opts->output_file = NULL; + cl_opts->io_types = 0; /* will set default after parsing options */ + cl_opts->num_dsets = 1; + cl_opts->num_files = 1; + cl_opts->num_bpp = 0; + cl_opts->num_iters = 1; cl_opts->max_num_procs = comm_world_nprocs_g; cl_opts->min_num_procs = 1; cl_opts->max_xfer_size = 0; cl_opts->min_xfer_size = 0; - cl_opts->blk_size = 0; - cl_opts->interleaved = 0; /* Default to contiguous blocks in dataset */ - cl_opts->collective = 0; /* Default to independent I/O access */ - cl_opts->dim2d = 0; /* Default to 1D */ - cl_opts->print_times = FALSE; /* Printing times is off by default */ - cl_opts->print_raw = FALSE; /* Printing raw data throughput is off by default */ - cl_opts->h5_alignment = 1; /* No alignment for HDF5 objects by default */ - cl_opts->h5_threshold = 1; /* No threshold for aligning HDF5 objects by default */ + cl_opts->blk_size = 0; + cl_opts->interleaved = 0; /* Default to contiguous blocks in dataset */ + cl_opts->collective = 0; /* Default to independent I/O access */ + cl_opts->dim2d = 0; /* Default to 1D */ + cl_opts->print_times = FALSE; /* Printing times is off by default */ + cl_opts->print_raw = FALSE; /* Printing raw data throughput is off by default */ + cl_opts->h5_alignment = 1; /* No alignment for HDF5 objects by default */ + cl_opts->h5_threshold = 1; /* No threshold for aligning HDF5 objects by default */ cl_opts->h5_use_chunks = FALSE; /* Don't chunk the HDF5 dataset by default */ cl_opts->h5_write_only = FALSE; /* Do both read and write by default */ - cl_opts->verify = FALSE; /* No Verify data correctness by default */ + cl_opts->verify = FALSE; /* No Verify data correctness by default */ while ((opt = get_option(argc, (const char **)argv, s_opts, l_opts)) != EOF) { switch ((char)opt) { - case 'a': - cl_opts->h5_alignment = parse_size_directive(opt_arg); - break; - case 'A': - { + case 'a': + cl_opts->h5_alignment = parse_size_directive(opt_arg); + break; + case 'A': { const char *end = opt_arg; while (end && *end != '\0') { char buf[10]; - int i; + int i; HDmemset(buf, '\0', sizeof(buf)); @@ -1312,13 +1306,15 @@ parse_command_line(int argc, char *argv[]) if (!HDstrcasecmp(buf, "phdf5")) { cl_opts->io_types |= PIO_HDF5; - } else if (!HDstrcasecmp(buf, "mpiio")) { + } + else if (!HDstrcasecmp(buf, "mpiio")) { cl_opts->io_types |= PIO_MPI; - } else if (!HDstrcasecmp(buf, "posix")) { + } + else if (!HDstrcasecmp(buf, "posix")) { cl_opts->io_types |= PIO_POSIX; - } else { - HDfprintf(stderr, "pio_perf: invalid --api option %s\n", - buf); + } + else { + HDfprintf(stderr, "pio_perf: invalid --api option %s\n", buf); HDexit(EXIT_FAILURE); } @@ -1334,27 +1330,26 @@ parse_command_line(int argc, char *argv[]) case 'b': /* the future "binary" option */ break; -#endif /* 0 */ - case 'B': - cl_opts->blk_size = (size_t)parse_size_directive(opt_arg); - break; - case 'c': - /* Turn on chunked HDF5 dataset creation */ - cl_opts->h5_use_chunks = TRUE; - break; - case 'C': - cl_opts->collective = 1; - break; - case 'd': - cl_opts->num_dsets = atoi(opt_arg); - break; - case 'D': - { +#endif /* 0 */ + case 'B': + cl_opts->blk_size = (size_t)parse_size_directive(opt_arg); + break; + case 'c': + /* Turn on chunked HDF5 dataset creation */ + cl_opts->h5_use_chunks = TRUE; + break; + case 'C': + cl_opts->collective = 1; + break; + case 'd': + cl_opts->num_dsets = atoi(opt_arg); + break; + case 'D': { const char *end = opt_arg; while (end && *end != '\0') { char buf[10]; - int i; + int i; HDmemset(buf, '\0', sizeof(buf)); @@ -1367,8 +1362,7 @@ parse_command_line(int argc, char *argv[]) for (j = 0; j < 10 && buf[j] != '\0'; ++j) if (!isdigit(buf[j])) { - HDfprintf(stderr, "pio_perf: invalid --debug option %s\n", - buf); + HDfprintf(stderr, "pio_perf: invalid --debug option %s\n", buf); HDexit(EXIT_FAILURE); } @@ -1378,23 +1372,24 @@ parse_command_line(int argc, char *argv[]) pio_debug_level = 4; else if (pio_debug_level < 0) pio_debug_level = 0; - } else { + } + else { switch (*buf) { - case 'r': - /* Turn on raw data throughput info */ - cl_opts->print_raw = TRUE; - break; - case 't': - /* Turn on time printing */ - cl_opts->print_times = TRUE; - break; - case 'v': - /* Turn on verify data correctness*/ - cl_opts->verify = TRUE; - break; - default: - HDfprintf(stderr, "pio_perf: invalid --debug option %s\n", buf); - HDexit(EXIT_FAILURE); + case 'r': + /* Turn on raw data throughput info */ + cl_opts->print_raw = TRUE; + break; + case 't': + /* Turn on time printing */ + cl_opts->print_times = TRUE; + break; + case 'v': + /* Turn on verify data correctness*/ + cl_opts->verify = TRUE; + break; + default: + HDfprintf(stderr, "pio_perf: invalid --debug option %s\n", buf); + HDexit(EXIT_FAILURE); } } @@ -1406,53 +1401,52 @@ parse_command_line(int argc, char *argv[]) } break; - case 'e': - cl_opts->num_bpp = parse_size_directive(opt_arg); - break; - case 'F': - cl_opts->num_files = HDatoi(opt_arg); - break; - case 'g': - cl_opts->dim2d = 1; - break; - case 'i': - cl_opts->num_iters = HDatoi(opt_arg); - break; - case 'I': - cl_opts->interleaved = 1; - break; - case 'o': - cl_opts->output_file = opt_arg; - break; - case 'p': - cl_opts->min_num_procs = HDatoi(opt_arg); - break; - case 'P': - cl_opts->max_num_procs = HDatoi(opt_arg); - break; - case 'T': - cl_opts->h5_threshold = parse_size_directive(opt_arg); - break; - case 'w': - cl_opts->h5_write_only = TRUE; - break; - case 'x': - cl_opts->min_xfer_size = (size_t)parse_size_directive(opt_arg); - break; - case 'X': - cl_opts->max_xfer_size = (size_t)parse_size_directive(opt_arg); - break; - case 'h': - case '?': - default: - usage(progname); - HDfree(cl_opts); - return NULL; + case 'e': + cl_opts->num_bpp = parse_size_directive(opt_arg); + break; + case 'F': + cl_opts->num_files = HDatoi(opt_arg); + break; + case 'g': + cl_opts->dim2d = 1; + break; + case 'i': + cl_opts->num_iters = HDatoi(opt_arg); + break; + case 'I': + cl_opts->interleaved = 1; + break; + case 'o': + cl_opts->output_file = opt_arg; + break; + case 'p': + cl_opts->min_num_procs = HDatoi(opt_arg); + break; + case 'P': + cl_opts->max_num_procs = HDatoi(opt_arg); + break; + case 'T': + cl_opts->h5_threshold = parse_size_directive(opt_arg); + break; + case 'w': + cl_opts->h5_write_only = TRUE; + break; + case 'x': + cl_opts->min_xfer_size = (size_t)parse_size_directive(opt_arg); + break; + case 'X': + cl_opts->max_xfer_size = (size_t)parse_size_directive(opt_arg); + break; + case 'h': + case '?': + default: + usage(progname); + HDfree(cl_opts); + return NULL; } } - - if (cl_opts->num_bpp == 0){ + if (cl_opts->num_bpp == 0) { if (cl_opts->dim2d == 0) cl_opts->num_bpp = 256 * ONE_KB; else @@ -1463,38 +1457,37 @@ parse_command_line(int argc, char *argv[]) cl_opts->max_xfer_size = (size_t)cl_opts->num_bpp; if (cl_opts->min_xfer_size == 0) - cl_opts->min_xfer_size = (size_t)(cl_opts->num_bpp)/2; + cl_opts->min_xfer_size = (size_t)(cl_opts->num_bpp) / 2; if (cl_opts->blk_size == 0) - cl_opts->blk_size = (size_t)(cl_opts->num_bpp)/2; - + cl_opts->blk_size = (size_t)(cl_opts->num_bpp) / 2; /* set default if none specified yet */ if (!cl_opts->io_types) - cl_opts->io_types = PIO_HDF5 | PIO_MPI | PIO_POSIX; /* run all API */ + cl_opts->io_types = PIO_HDF5 | PIO_MPI | PIO_POSIX; /* run all API */ /* verify parameters sanity. Adjust if needed. */ /* cap xfer_size with bytes per process */ if (!cl_opts->dim2d) { if (cl_opts->min_xfer_size > (size_t)cl_opts->num_bpp) - cl_opts->min_xfer_size = (size_t)cl_opts->num_bpp; + cl_opts->min_xfer_size = (size_t)cl_opts->num_bpp; if (cl_opts->max_xfer_size > (size_t)cl_opts->num_bpp) - cl_opts->max_xfer_size = (size_t)cl_opts->num_bpp; + cl_opts->max_xfer_size = (size_t)cl_opts->num_bpp; } if (cl_opts->min_xfer_size > cl_opts->max_xfer_size) - cl_opts->min_xfer_size = cl_opts->max_xfer_size; - if (cl_opts->blk_size > (size_t)cl_opts->num_bpp ) + cl_opts->min_xfer_size = cl_opts->max_xfer_size; + if (cl_opts->blk_size > (size_t)cl_opts->num_bpp) cl_opts->blk_size = (size_t)cl_opts->num_bpp; /* check range of number of processes */ if (cl_opts->min_num_procs <= 0) - cl_opts->min_num_procs = 1; + cl_opts->min_num_procs = 1; if (cl_opts->max_num_procs <= 0) - cl_opts->max_num_procs = 1; + cl_opts->max_num_procs = 1; if (cl_opts->min_num_procs > cl_opts->max_num_procs) - cl_opts->min_num_procs = cl_opts->max_num_procs; + cl_opts->min_num_procs = cl_opts->max_num_procs; /* check iteration */ if (cl_opts->num_iters <= 0) - cl_opts->num_iters = 1; + cl_opts->num_iters = 1; return cl_opts; } @@ -1572,7 +1565,7 @@ usage(const char *prog) HDprintf(" -A AL, --api=AL Which APIs to test [default: all of them]\n"); #if 0 HDprintf(" -b, --binary The elusive binary option\n"); -#endif /* 0 */ +#endif /* 0 */ HDprintf(" -B S, --block-size=S Block size within transfer buffer\n"); HDprintf(" (see below for description)\n"); HDprintf(" [default: half the number of bytes per process\n"); @@ -1615,7 +1608,7 @@ usage(const char *prog) HDprintf(" M - Megabyte (%d)\n", ONE_MB); HDprintf(" G - Gigabyte (%d)\n", ONE_GB); HDprintf("\n"); - HDprintf(" Example: '37M' is 37 megabytes or %d bytes\n", 37*ONE_MB); + HDprintf(" Example: '37M' is 37 megabytes or %d bytes\n", 37 * ONE_MB); HDprintf("\n"); HDprintf(" AL - is an API list. Valid values are:\n"); HDprintf(" phdf5 - Parallel HDF5\n"); |