From 1ee2c37ef060efab4772cdd3c793f1049ec18f5f Mon Sep 17 00:00:00 2001 From: Andreas Dilger Date: Fri, 14 Dec 2018 16:26:16 -0700 Subject: [PATCH 01/52] lustre: fix checks for lustre_user.h header Fix the configure check if --with-lustre is specified, but the linux/lustre/lustre_user.h header is not present. Only one of the headers needs to be included if both are found. In some cases, FASYNC is not defined, but forms part of the O_LOV_DELAY_CREATE value, add a #define in that case. Fixes #115. Fixes: cb88c4c19a831d94b864c49a162e2635730540e5 Signed-off-by: Andreas Dilger --- configure.ac | 6 ++++-- src/aiori-POSIX.c | 14 ++++++++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index a3c41b0..a372d84 100755 --- a/configure.ac +++ b/configure.ac @@ -23,7 +23,7 @@ AM_MAINTAINER_MODE # We can't do anything without a working MPI AX_PROG_CC_MPI(,,[ - AC_MSG_FAILURE([MPI compiler requested, but couldn't use MPI.]) + AC_MSG_FAILURE([MPI compiler requested, but could not use MPI.]) ]) AC_PROG_RANLIB @@ -72,7 +72,9 @@ AC_ARG_WITH([lustre], [], [with_lustre=check]) AS_IF([test "x$with_lustre" != xno], [ AC_CHECK_HEADERS([linux/lustre/lustre_user.h lustre/lustre_user.h], break, [ - if test "x$with_lustre" != xcheck; then + if test "x$with_lustre" != xcheck -a \ + "x$ac_cv_header_linux_lustre_lustre_user_h" = "xno" -a \ + "x$ac_cv_header_lustre_lustre_user_h" = "xno" ; then AC_MSG_FAILURE([--with-lustre was given, not found]) fi ]) diff --git a/src/aiori-POSIX.c b/src/aiori-POSIX.c index 0dd712e..4a5a7f3 100755 --- a/src/aiori-POSIX.c +++ b/src/aiori-POSIX.c @@ -32,11 +32,10 @@ #include -#ifdef HAVE_LUSTRE_LUSTRE_USER_H -# include -#endif #ifdef HAVE_LINUX_LUSTRE_LUSTRE_USER_H # include +#elif defined(HAVE_LUSTRE_LUSTRE_USER_H) +# include #endif #ifdef HAVE_GPFS_H # include @@ -278,6 +277,12 @@ void *POSIX_Create(char *testFileName, IOR_param_t * param) set_o_direct_flag(&fd_oflag); #ifdef HAVE_LUSTRE_LUSTRE_USER_H +/* Add a #define for FASYNC if not available, as it forms part of + * the Lustre O_LOV_DELAY_CREATE definition. */ +#ifndef FASYNC +#define FASYNC 00020000 /* fcntl, for BSD compatibility */ +#endif + if (param->lustre_set_striping) { /* In the single-shared-file case, task 0 has to creat the file with the Lustre striping options before any other processes @@ -298,7 +303,8 @@ void *POSIX_Create(char *testFileName, IOR_param_t * param) opts.lmm_stripe_count = param->lustre_stripe_count; /* File needs to be opened O_EXCL because we cannot set - Lustre striping information on a pre-existing file. */ + * Lustre striping information on a pre-existing file.*/ + fd_oflag |= O_CREAT | O_EXCL | O_RDWR | O_LOV_DELAY_CREATE; *fd = open64(testFileName, fd_oflag, 0664); From aafdf897ff422b3afc3ddfe31b8162ae3e01687e Mon Sep 17 00:00:00 2001 From: "Julian M. Kunkel" Date: Wed, 19 Dec 2018 20:29:47 +0000 Subject: [PATCH 02/52] Bugfix for stonewall computation. --- src/mdtest.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/mdtest.c b/src/mdtest.c index e83121c..3998017 100644 --- a/src/mdtest.c +++ b/src/mdtest.c @@ -320,7 +320,7 @@ static void create_file (const char *path, uint64_t itemNum) { //create files sprintf(curr_item, "%s/file.%s"LLU"", path, mk_name, itemNum); - if (rank == 0 && verbose >= 3) { + if ((rank == 0 && verbose >= 3) || verbose >= 5) { fprintf(out_logfile, "V-3: create_remove_items_helper (non-dirs create): curr_item is \"%s\"\n", curr_item); fflush(out_logfile); } @@ -401,6 +401,10 @@ void create_remove_items_helper(const int dirs, const int create, const char *pa create_remove_dirs (path, create, itemNum + i); } if(CHECK_STONE_WALL(progress)){ + if(progress->items_done != 0){ + printf("Error, this is an invalid configuration with stonewall!\n"); + exit(1); + } progress->items_done = i + 1; return; } @@ -1056,13 +1060,13 @@ int updateStoneWallIterations(int iteration, rank_progress_t * progress, double long long sum_accessed = 0; MPI_Reduce(& progress->items_done, & sum_accessed, 1, MPI_LONG_LONG_INT, MPI_SUM, 0, testComm); - if(items != (sum_accessed / size) && rank == 0){ + if(items != (sum_accessed / size)){ summary_table[iteration].stonewall_item_sum[MDTEST_FILE_CREATE_NUM] = sum_accessed; summary_table[iteration].stonewall_item_min[MDTEST_FILE_CREATE_NUM] = min_accessed * size; - fprintf( out_logfile, "Continue stonewall hit min: %lld max: %lld avg: %.1f \n", min_accessed, max_iter, ((double) sum_accessed) / size); - fflush( out_logfile ); - } - if( done != max_iter ){ + if (rank == 0){ + fprintf( out_logfile, "Continue stonewall hit min: %lld max: %lld avg: %.1f \n", min_accessed, max_iter, ((double) sum_accessed) / size); + fflush( out_logfile ); + } hit = 1; } progress->items_start = done; @@ -1119,10 +1123,13 @@ void file_test(const int iteration, const int ntasks, const char *path, rank_pro if (hit){ progress->stone_wall_timer_seconds = 0; - printf("stonewall rank %d: %lld of %lld \n", rank, (long long) progress->items_start, (long long) progress->items_per_dir); + if (verbose > 1){ + printf("stonewall rank %d: %lld of %lld \n", rank, (long long) progress->items_start, (long long) progress->items_per_dir); + } create_remove_items(0, 0, 1, 0, temp_path, 0, progress); // now reset the values progress->stone_wall_timer_seconds = stone_wall_timer_seconds; + items = progress->items_done; } if (stoneWallingStatusFile){ StoreStoneWallingIterations(stoneWallingStatusFile, progress->items_done); From cb40c99e1baca256b2a445c48fd8bbec8da27586 Mon Sep 17 00:00:00 2001 From: "Julian M. Kunkel" Date: Wed, 19 Dec 2018 21:37:37 +0000 Subject: [PATCH 03/52] Reset stonewall timer to make it work again with running all phases in one execution; i.e. not using multiple runs specifying: -C, -r --- src/mdtest.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/mdtest.c b/src/mdtest.c index 3998017..37032f1 100644 --- a/src/mdtest.c +++ b/src/mdtest.c @@ -300,7 +300,6 @@ static void remove_file (const char *path, uint64_t itemNum) { fprintf(out_logfile, "V-3: create_remove_items_helper (non-dirs remove): curr_item is \"%s\"\n", curr_item); fflush(out_logfile); } - if (!(shared_file && rank != 0)) { backend->delete (curr_item, ¶m); } @@ -401,11 +400,9 @@ void create_remove_items_helper(const int dirs, const int create, const char *pa create_remove_dirs (path, create, itemNum + i); } if(CHECK_STONE_WALL(progress)){ - if(progress->items_done != 0){ - printf("Error, this is an invalid configuration with stonewall!\n"); - exit(1); + if(progress->items_done == 0){ + progress->items_done = i + 1; } - progress->items_done = i + 1; return; } } @@ -1124,7 +1121,7 @@ void file_test(const int iteration, const int ntasks, const char *path, rank_pro if (hit){ progress->stone_wall_timer_seconds = 0; if (verbose > 1){ - printf("stonewall rank %d: %lld of %lld \n", rank, (long long) progress->items_start, (long long) progress->items_per_dir); + printf("stonewall rank %d: %lld of %lld \n", rank, (long long) progress->items_start, (long long) progress->items_per_dir); } create_remove_items(0, 0, 1, 0, temp_path, 0, progress); // now reset the values @@ -1134,6 +1131,8 @@ void file_test(const int iteration, const int ntasks, const char *path, rank_pro if (stoneWallingStatusFile){ StoreStoneWallingIterations(stoneWallingStatusFile, progress->items_done); } + // reset stone wall timer to allow proper cleanup + progress->stone_wall_timer_seconds = 0; } } }else{ @@ -1221,6 +1220,8 @@ void file_test(const int iteration, const int ntasks, const char *path, rank_pro t[3] = MPI_Wtime(); if (remove_only) { + progress->items_start = 0; + for (int dir_iter = 0; dir_iter < directory_loops; dir_iter ++){ prep_testdir(iteration, dir_iter); if (unique_dir_per_task) { @@ -2032,6 +2033,7 @@ static void mdtest_iteration(int i, int j, MPI_Group testgroup, mdtest_results_t MPI_Barrier(testComm); if (remove_only) { + progress->items_start = 0; startCreate = MPI_Wtime(); for (int dir_iter = 0; dir_iter < directory_loops; dir_iter ++){ prep_testdir(j, dir_iter); From b561f60702179cded0cc3787f3687f83d40d51a5 Mon Sep 17 00:00:00 2001 From: "Julian M. Kunkel" Date: Sat, 19 Jan 2019 17:00:49 +0000 Subject: [PATCH 04/52] Potential fix for #127 => Segmentation fault due to memory protection. --- src/mdtest.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mdtest.c b/src/mdtest.c index 37032f1..cf58050 100644 --- a/src/mdtest.c +++ b/src/mdtest.c @@ -211,6 +211,8 @@ void parse_dirpath(char *dirpath_arg) { FAIL("out of memory"); } + // prevent changes to the original dirpath_arg + dirpath_arg = strdup(dirpath_arg); token = strtok(dirpath_arg, delimiter_string); while (token != NULL) { filenames[i] = token; From 8996f5494f3d2417c3d1cfb6d3cb5a32e3603d0a Mon Sep 17 00:00:00 2001 From: "Glenn K. Lockwood" Date: Wed, 23 Jan 2019 16:02:58 -0800 Subject: [PATCH 05/52] add malloc check to fix --- src/mdtest.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mdtest.c b/src/mdtest.c index cf58050..20593d9 100644 --- a/src/mdtest.c +++ b/src/mdtest.c @@ -206,13 +206,13 @@ void parse_dirpath(char *dirpath_arg) { } tmp++; } + // prevent changes to the original dirpath_arg + dirpath_arg = strdup(dirpath_arg); filenames = (char **)malloc(path_count * sizeof(char **)); - if (filenames == NULL) { + if (filenames == NULL || dirpath_arg == NULL) { FAIL("out of memory"); } - // prevent changes to the original dirpath_arg - dirpath_arg = strdup(dirpath_arg); token = strtok(dirpath_arg, delimiter_string); while (token != NULL) { filenames[i] = token; From 5271198eb368c850f07470a6a5141085c1303b7b Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Fri, 2 Aug 2019 19:30:29 -0500 Subject: [PATCH 06/52] Travis CI: Fix HDF5 Build Fix the CI. --- .travis.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 29e091c..7d8202d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ install: # Install MPI - sudo apt-get install -y openmpi-bin libopenmpi-dev # Install HDF5 - - sudo apt-get install -y hdf5-tools libhdf5-mpi-dev + - sudo apt-get install -y hdf5-tools libhdf5-openmpi-dev # Install Lustre # TODO: As far as a i can see it needs to be compiled form source with kernel # module as there is no package. @@ -22,10 +22,13 @@ install: # Install HDFS # TODO: Not sure with which c libray hdfs should be used and if it is in # the ubuntu repos - # Probably hadoop needs to be installed an provides nativ api. + # Probably hadoop needs to be installed an provides native API. # Install Amazon S3 # TODO: The needed library needs to be installed. Follow the instructions in # aiori-S3.c to achive this. # GPFS # NOTE: Think GPFS need a license and is therefore not testable with travis. -script: ./travis-build.sh && CONFIGURE_OPTS="--with-hdf5" ./travis-test.sh +script: + - ./travis-build.sh + - export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/hdf5/openmpi:${LD_LIBRARY_PATH} + - CONFIGURE_OPTS="--with-hdf5" CFLAGS="-I/usr/include/hdf5/openmpi -L/usr/lib/x86_64-linux-gnu/hdf5/openmpi" ./travis-test.sh From 61333af82216de14a7f49069260230de6fd3a46a Mon Sep 17 00:00:00 2001 From: Josh Schwartz <52082483+jschwartz-cray@users.noreply.github.com> Date: Wed, 23 Oct 2019 16:17:37 -0600 Subject: [PATCH 07/52] Fix #194. On previous versions of IOR (and most Linux CLI applications in general) multiple flags can be combined such as -vvv to get verbose=3 rather than having to specify each separately as -v -v -v. This patch fixes this behavior. It also fixes issues around handling of the verbose flag where the output would never be printed as we were comparing verbose < VERBOSE_0 where verbose defaults to 0 and can only increase. --- src/ior-output.c | 15 ++-- src/ior.c | 18 ++--- src/option.c | 182 +++++++++++++++++++++++++---------------------- 3 files changed, 116 insertions(+), 99 deletions(-) diff --git a/src/ior-output.c b/src/ior-output.c index 7049a97..2783a90 100644 --- a/src/ior-output.c +++ b/src/ior-output.c @@ -210,7 +210,7 @@ void PrintRepeatStart(){ } void PrintTestEnds(){ - if (rank != 0 || verbose < VERBOSE_0) { + if (rank != 0 || verbose <= VERBOSE_0) { PrintEndSection(); return; } @@ -445,6 +445,9 @@ void ShowSetup(IOR_param_t *params) if(params->dryRun){ PrintKeyValInt("dryRun", params->dryRun); } + if(params->verbose) { + PrintKeyValInt("verbose", params->verbose); + } #ifdef HAVE_LUSTRE_LUSTRE_USER_H if (params->lustre_set_striping) { @@ -528,7 +531,7 @@ static void PrintLongSummaryOneOperation(IOR_test_t *test, const int access) struct results *ops; int reps; - if (rank != 0 || verbose < VERBOSE_0) + if (rank != 0 || verbose <= VERBOSE_0) return; reps = params->repetitions; @@ -643,7 +646,7 @@ void PrintLongSummaryOneTest(IOR_test_t *test) void PrintLongSummaryHeader() { - if (rank != 0 || verbose < VERBOSE_0) + if (rank != 0 || verbose <= VERBOSE_0) return; if(outputFormat != OUTPUT_DEFAULT){ return; @@ -663,7 +666,7 @@ void PrintLongSummaryHeader() void PrintLongSummaryAllTests(IOR_test_t *tests_head) { IOR_test_t *tptr; - if (rank != 0 || verbose < VERBOSE_0) + if (rank != 0 || verbose <= VERBOSE_0) return; PrintArrayEnd(); @@ -696,7 +699,7 @@ void PrintShortSummary(IOR_test_t * test) int reps; int i; - if (rank != 0 || verbose < VERBOSE_0) + if (rank != 0 || verbose <= VERBOSE_0) return; PrintArrayEnd(); @@ -767,7 +770,7 @@ void DisplayFreespace(IOR_param_t * test) void PrintRemoveTiming(double start, double finish, int rep) { - if (rank != 0 || verbose < VERBOSE_0) + if (rank != 0 || verbose <= VERBOSE_0) return; if (outputFormat == OUTPUT_DEFAULT){ diff --git a/src/ior.c b/src/ior.c index 4cd5571..ff5f113 100755 --- a/src/ior.c +++ b/src/ior.c @@ -147,9 +147,9 @@ int ior_main(int argc, char **argv) ShowTestEnd(tptr); } - if (verbose < 0) + if (verbose <= VERBOSE_0) /* always print final summary */ - verbose = 0; + verbose = VERBOSE_1; PrintLongSummaryAllTests(tests_head); /* display finish time */ @@ -1218,7 +1218,7 @@ static void TestIoSys(IOR_test_t *test) return; } if (rank == 0 && verbose >= VERBOSE_1) { - fprintf(out_logfile, "Participating tasks: %d\n", params->numTasks); + fprintf(out_logfile, "Participating tasks : %d\n", params->numTasks); fflush(out_logfile); } if (rank == 0 && params->reorderTasks == TRUE && verbose >= VERBOSE_1) { @@ -1261,12 +1261,12 @@ static void TestIoSys(IOR_test_t *test) } params->timeStampSignatureValue = (unsigned int)currentTime; - if (verbose >= VERBOSE_2) { - fprintf(out_logfile, - "Using Time Stamp %u (0x%x) for Data Signature\n", - params->timeStampSignatureValue, - params->timeStampSignatureValue); - } + } + if (verbose >= VERBOSE_2) { + fprintf(out_logfile, + "Using Time Stamp %u (0x%x) for Data Signature\n", + params->timeStampSignatureValue, + params->timeStampSignatureValue); } if (rep == 0 && verbose >= VERBOSE_0) { PrintTableHeader(); diff --git a/src/option.c b/src/option.c index b1833c1..c6e1403 100644 --- a/src/option.c +++ b/src/option.c @@ -233,106 +233,120 @@ static void option_parse_token(char ** argv, int * flag_parsed_next, int * requi } *flag_parsed_next = 0; - for(int m = 0; m < opt_all->module_count; m++ ){ - option_help * args = opt_all->modules[m].options; - if(args == NULL) continue; - // try to find matching option help - for(option_help * o = args; o->shortVar != 0 || o->longVar != 0 || o->help != NULL ; o++ ){ - if( o->shortVar == 0 && o->longVar == 0 ){ - // section - continue; - } - if ( (txt[0] == '-' && o->shortVar == txt[1]) || (strlen(txt) > 2 && txt[0] == '-' && txt[1] == '-' && o->longVar != NULL && strcmp(txt + 2, o->longVar) == 0)){ - // now process the option. - switch(o->arg){ - case (OPTION_FLAG):{ - assert(o->type == 'd'); - if(arg != NULL){ - int val = atoi(arg); - (*(int*) o->variable) = (val < 0) ? 0 : val; - }else{ - (*(int*) o->variable)++; - } - break; - } - case (OPTION_OPTIONAL_ARGUMENT): - case (OPTION_REQUIRED_ARGUMENT):{ - // check if next is an argument - if(arg == NULL){ - if(o->shortVar == txt[1] && txt[2] != 0){ - arg = & txt[2]; + // just skip over the first dash so we don't have to handle it everywhere below + if(txt[0] != '-'){ + *error = 1; + return; + } + txt++; + + // support groups of multiple flags like -vvv or -vq + for(int flag_index = 0; flag_index < strlen(txt); ++flag_index){ + // don't loop looking for multiple flags if we already processed a long option + if(txt[0] == '-' && flag_index > 0) + break; + + for(int m = 0; m < opt_all->module_count; m++ ){ + option_help * args = opt_all->modules[m].options; + if(args == NULL) continue; + // try to find matching option help + for(option_help * o = args; o->shortVar != 0 || o->longVar != 0 || o->help != NULL ; o++ ){ + if( o->shortVar == 0 && o->longVar == 0 ){ + // section + continue; + } + if ( (o->shortVar == txt[flag_index]) || (strlen(txt) > 2 && txt[0] == '-' && o->longVar != NULL && strcmp(txt + 1, o->longVar) == 0)){ + // now process the option. + switch(o->arg){ + case (OPTION_FLAG):{ + assert(o->type == 'd'); + if(arg != NULL){ + int val = atoi(arg); + (*(int*) o->variable) = (val < 0) ? 0 : val; }else{ - // simply take the next value as argument - i++; - arg = argv[1]; - *flag_parsed_next = 1; + (*(int*) o->variable)++; } + break; } - - if(arg == NULL){ - const char str[] = {o->shortVar, 0}; - printf("Error, argument missing for option %s\n", (o->longVar != NULL) ? o->longVar : str); - exit(1); - } - - switch(o->type){ - case('p'):{ - // call the function in the variable - void(*fp)() = o->variable; - fp(arg); - break; - } - case('F'):{ - *(double*) o->variable = atof(arg); - break; - } - case('f'):{ - *(float*) o->variable = atof(arg); - break; - } - case('d'):{ - int64_t val = string_to_bytes(arg); - if (val > INT_MAX || val < INT_MIN){ - printf("WARNING: parsing the number %s to integer, this produced an overflow!\n", arg); + case (OPTION_OPTIONAL_ARGUMENT): + case (OPTION_REQUIRED_ARGUMENT):{ + // check if next is an argument + if(arg == NULL){ + if(o->shortVar == txt[0] && txt[1] != 0){ + arg = & txt[1]; + }else{ + // simply take the next value as argument + i++; + arg = argv[1]; + *flag_parsed_next = 1; } - *(int*) o->variable = val; - break; } - case('H'): - case('s'):{ - (*(char **) o->variable) = strdup(arg); - break; + + if(arg == NULL){ + const char str[] = {o->shortVar, 0}; + printf("Error, argument missing for option %s\n", (o->longVar != NULL) ? o->longVar : str); + exit(1); } - case('c'):{ - (*(char *)o->variable) = arg[0]; - if(strlen(arg) > 1){ - printf("Error, ignoring remainder of string for option %c (%s).\n", o->shortVar, o->longVar); + + switch(o->type){ + case('p'):{ + // call the function in the variable + void(*fp)() = o->variable; + fp(arg); + break; } - break; + case('F'):{ + *(double*) o->variable = atof(arg); + break; + } + case('f'):{ + *(float*) o->variable = atof(arg); + break; + } + case('d'):{ + int64_t val = string_to_bytes(arg); + if (val > INT_MAX || val < INT_MIN){ + printf("WARNING: parsing the number %s to integer, this produced an overflow!\n", arg); + } + *(int*) o->variable = val; + break; + } + case('H'): + case('s'):{ + (*(char **) o->variable) = strdup(arg); + break; + } + case('c'):{ + (*(char *)o->variable) = arg[0]; + if(strlen(arg) > 1){ + printf("Error, ignoring remainder of string for option %c (%s).\n", o->shortVar, o->longVar); + } + break; + } + case('l'):{ + *(long long*) o->variable = string_to_bytes(arg); + break; + } + default: + printf("ERROR: Unknown option type %c\n", o->type); } - case('l'):{ - *(long long*) o->variable = string_to_bytes(arg); - break; - } - default: - printf("ERROR: Unknown option type %c\n", o->type); } } - } - if(replaced_equal){ - arg[-1] = '='; - } + if(replaced_equal){ + arg[-1] = '='; + } - if(o->arg == OPTION_REQUIRED_ARGUMENT){ - (*requiredArgsSeen)++; - } + if(o->arg == OPTION_REQUIRED_ARGUMENT){ + (*requiredArgsSeen)++; + } - return; + return; + } } } } - if(strcmp(txt, "-h") == 0 || strcmp(txt, "--help") == 0){ + if(strcmp(txt, "h") == 0 || strcmp(txt, "-help") == 0){ *print_help = 1; }else{ *error = 1; From d926bf1c9062d83206e9973d4b2ffa1b080a824d Mon Sep 17 00:00:00 2001 From: Mohamad Chaarawi Date: Wed, 6 Nov 2019 23:10:45 +0000 Subject: [PATCH 08/52] update configure.ac to look under lib64 for DAOS libs Signed-off-by: Mohamad Chaarawi --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index bfd88cf..acacc5d 100755 --- a/configure.ac +++ b/configure.ac @@ -206,7 +206,7 @@ AC_ARG_WITH([daos], AS_IF([test "x$with_daos" != xno], [ DAOS="yes" - LDFLAGS="$LDFLAGS -L$with_daos/lib" + LDFLAGS="$LDFLAGS -L$with_daos/lib64 -L$with_daos/lib" CPPFLAGS="$CPPFLAGS -I$with_daos/include" AC_CHECK_HEADERS(daos_types.h,, [unset DAOS]) AC_CHECK_LIB([uuid], [uuid_generate],, [unset DAOS]) From fbff9b6fb23b2b24cbf233aa3902c45a1f61f297 Mon Sep 17 00:00:00 2001 From: Mohamad Chaarawi Date: Thu, 7 Nov 2019 18:01:07 +0000 Subject: [PATCH 09/52] add DFS prefix option Signed-off-by: Mohamad Chaarawi --- src/aiori-DFS.c | 40 ++++++++++++++-------------------------- 1 file changed, 14 insertions(+), 26 deletions(-) diff --git a/src/aiori-DFS.c b/src/aiori-DFS.c index 6b2f28c..28c9096 100755 --- a/src/aiori-DFS.c +++ b/src/aiori-DFS.c @@ -68,6 +68,7 @@ struct dfs_options{ char *cont; int chunk_size; char *oclass; + char *prefix; int destroy; }; @@ -78,6 +79,7 @@ static struct dfs_options o = { .cont = NULL, .chunk_size = 1048576, .oclass = NULL, + .prefix = NULL, .destroy = 0, }; @@ -88,6 +90,7 @@ static option_help options [] = { {0, "dfs.cont", "DFS container uuid", OPTION_OPTIONAL_ARGUMENT, 's', & o.cont}, {0, "dfs.chunk_size", "chunk size", OPTION_OPTIONAL_ARGUMENT, 'd', &o.chunk_size}, {0, "dfs.oclass", "object class", OPTION_OPTIONAL_ARGUMENT, 's', &o.oclass}, + {0, "dfs.prefix", "mount prefix", OPTION_OPTIONAL_ARGUMENT, 's', & o.prefix}, {0, "dfs.destroy", "Destroy DFS Container", OPTION_FLAG, 'd', &o.destroy}, LAST_OPTION }; @@ -356,7 +359,8 @@ lookup_insert_dir(const char *name) hdl->name[PATH_MAX-1] = '\0'; rc = dfs_lookup(dfs, name, O_RDWR, &hdl->oh, NULL, NULL); - DCHECK(rc, "dfs_lookup() of %s Failed", name); + if (rc) + return NULL; rc = d_hash_rec_insert(dir_hash, hdl->name, strlen(hdl->name), &hdl->entry, true); @@ -432,6 +436,11 @@ DFS_Init() { rc = dfs_mount(poh, coh, O_RDWR, &dfs); DCHECK(rc, "Failed to mount DFS namespace"); + + if (o.prefix) { + rc = dfs_set_prefix(dfs, o.prefix); + DCHECK(rc, "Failed to set DFS Prefix"); + } } static void @@ -800,33 +809,12 @@ DFS_Rmdir(const char *path, IOR_param_t * param) static int DFS_Access(const char *path, int mode, IOR_param_t * param) { - dfs_obj_t *parent = NULL; - char *name = NULL, *dir_name = NULL; - struct stat stbuf; - int rc; + dfs_obj_t *obj = NULL; - rc = parse_filename(path, &name, &dir_name); - DCHECK(rc, "Failed to parse path %s", path); - - assert(dir_name); - - parent = lookup_insert_dir(dir_name); - if (parent == NULL) - GERR("Failed to lookup parent dir"); - - if (name && strcmp(name, ".") == 0) { - free(name); - name = NULL; - } - rc = dfs_stat(dfs, parent, name, &stbuf); - - if (name) - free(name); - if (dir_name) - free(dir_name); - if (rc) + obj = lookup_insert_dir(path); + if (obj == NULL) return -1; - return rc; + return 0; } static int From acfd4673ccd73eda42914135f64da5a8d8ee7fcc Mon Sep 17 00:00:00 2001 From: Mohamad Chaarawi Date: Wed, 13 Nov 2019 00:09:03 +0000 Subject: [PATCH 10/52] We only need to add dirs to the Hash in the DFS driver. Signed-off-by: Mohamad Chaarawi --- src/aiori-DFS.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src/aiori-DFS.c b/src/aiori-DFS.c index 28c9096..9b9859a 100755 --- a/src/aiori-DFS.c +++ b/src/aiori-DFS.c @@ -339,7 +339,7 @@ out: } static dfs_obj_t * -lookup_insert_dir(const char *name) +lookup_insert_dir(const char *name, mode_t *mode) { struct aiori_dir_hdl *hdl; d_list_t *rlink; @@ -358,9 +358,11 @@ lookup_insert_dir(const char *name) strncpy(hdl->name, name, PATH_MAX-1); hdl->name[PATH_MAX-1] = '\0'; - rc = dfs_lookup(dfs, name, O_RDWR, &hdl->oh, NULL, NULL); + rc = dfs_lookup(dfs, name, O_RDWR, &hdl->oh, mode, NULL); if (rc) return NULL; + if (mode && S_ISREG(*mode)) + return hdl->oh; rc = d_hash_rec_insert(dir_hash, hdl->name, strlen(hdl->name), &hdl->entry, true); @@ -515,7 +517,7 @@ DFS_Create(char *testFileName, IOR_param_t *param) assert(dir_name); assert(name); - parent = lookup_insert_dir(dir_name); + parent = lookup_insert_dir(dir_name, NULL); if (parent == NULL) GERR("Failed to lookup parent dir"); @@ -566,7 +568,7 @@ DFS_Open(char *testFileName, IOR_param_t *param) assert(dir_name); assert(name); - parent = lookup_insert_dir(dir_name); + parent = lookup_insert_dir(dir_name, NULL); if (parent == NULL) GERR("Failed to lookup parent dir"); @@ -674,7 +676,7 @@ DFS_Delete(char *testFileName, IOR_param_t * param) assert(dir_name); assert(name); - parent = lookup_insert_dir(dir_name); + parent = lookup_insert_dir(dir_name, NULL); if (parent == NULL) GERR("Failed to lookup parent dir"); @@ -761,7 +763,7 @@ DFS_Mkdir(const char *path, mode_t mode, IOR_param_t * param) if (!name) return 0; - parent = lookup_insert_dir(dir_name); + parent = lookup_insert_dir(dir_name, NULL); if (parent == NULL) GERR("Failed to lookup parent dir"); @@ -790,7 +792,7 @@ DFS_Rmdir(const char *path, IOR_param_t * param) assert(dir_name); assert(name); - parent = lookup_insert_dir(dir_name); + parent = lookup_insert_dir(dir_name, NULL); if (parent == NULL) GERR("Failed to lookup parent dir"); @@ -810,10 +812,16 @@ static int DFS_Access(const char *path, int mode, IOR_param_t * param) { dfs_obj_t *obj = NULL; + mode_t fmode; - obj = lookup_insert_dir(path); + obj = lookup_insert_dir(path, &fmode); if (obj == NULL) return -1; + + /** just close if it's a file */ + if (S_ISREG(fmode)) + dfs_release(obj); + return 0; } @@ -830,7 +838,7 @@ DFS_Stat(const char *path, struct stat *buf, IOR_param_t * param) assert(dir_name); assert(name); - parent = lookup_insert_dir(dir_name); + parent = lookup_insert_dir(dir_name, NULL); if (parent == NULL) GERR("Failed to lookup parent dir"); From be48206e5fba905bfd7d5c4e26b04fab67b3e4d0 Mon Sep 17 00:00:00 2001 From: Jean-Yves VET Date: Wed, 30 Oct 2019 15:43:43 +0100 Subject: [PATCH 11/52] Fix compilation warnings --- src/aiori-POSIX.c | 4 ++-- src/ior.c | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/aiori-POSIX.c b/src/aiori-POSIX.c index 99a68f1..901eed5 100755 --- a/src/aiori-POSIX.c +++ b/src/aiori-POSIX.c @@ -171,7 +171,7 @@ void gpfs_access_start(int fd, IOR_offset_t length, IOR_param_t *param, int acce rc = gpfs_fcntl(fd, &take_locks); if (verbose >= VERBOSE_2 && rc != 0) { - EWARNF("gpfs_fcntl(fd, ...) access range hint failed.", fd); + EWARNF("gpfs_fcntl(%d, ...) access range hint failed.", fd); } } @@ -195,7 +195,7 @@ void gpfs_access_end(int fd, IOR_offset_t length, IOR_param_t *param, int access rc = gpfs_fcntl(fd, &free_locks); if (verbose >= VERBOSE_2 && rc != 0) { - EWARNF("gpfs_fcntl(fd, ...) free range hint failed.", fd); + EWARNF("gpfs_fcntl(%d, ...) free range hint failed.", fd); } } diff --git a/src/ior.c b/src/ior.c index e811f83..57f385d 100755 --- a/src/ior.c +++ b/src/ior.c @@ -503,8 +503,6 @@ void AllocResults(IOR_test_t *test) if (test->results != NULL) return; - IOR_param_t * params = & test->params; - reps = test->params.repetitions; test->results = (IOR_results_t *) safeMalloc(sizeof(IOR_results_t) * reps); } @@ -886,7 +884,7 @@ ReduceIterResults(IOR_test_t *test, double *timer, const int rep, const int acce * number of I/Os issued from that task; then reduce and display the * minimum (best) latency achieved. So what is reported is the average * latency of all ops from a single task, then taking the minimum of - * that between all tasks. */ + * that between all tasks. */ latency = (timer[3] - timer[2]) / (params->blockSize / params->transferSize); MPI_CHECK(MPI_Reduce(&latency, &minlatency, 1, MPI_DOUBLE, MPI_MIN, 0, testComm), "MPI_Reduce()"); From 9da36abacacf8461ccc7601703d050c6de475317 Mon Sep 17 00:00:00 2001 From: Jean-Yves VET Date: Mon, 4 Nov 2019 17:10:36 +0100 Subject: [PATCH 12/52] Fix confusing output of mknod Context: mknod does not return a file descriptor. --- src/aiori-POSIX.c | 16 ++++++---------- src/aiori.h | 4 ++-- src/mdtest.c | 40 +++++++++++++++++++--------------------- 3 files changed, 27 insertions(+), 33 deletions(-) diff --git a/src/aiori-POSIX.c b/src/aiori-POSIX.c index 99a68f1..b57601a 100755 --- a/src/aiori-POSIX.c +++ b/src/aiori-POSIX.c @@ -436,19 +436,15 @@ void *POSIX_Create(char *testFileName, IOR_param_t * param) /* * Creat a file through mknod interface. */ -void *POSIX_Mknod(char *testFileName) +int POSIX_Mknod(char *testFileName) { - int *fd; + int ret; - fd = (int *)malloc(sizeof(int)); - if (fd == NULL) - ERR("Unable to malloc file descriptor"); + ret = mknod(testFileName, S_IFREG | S_IRUSR, 0); + if (ret < 0) + ERR("mknod failed"); - *fd = mknod(testFileName, S_IFREG | S_IRUSR, 0); - if (*fd < 0) - ERR("mknod failed"); - - return ((void *)fd); + return ret; } /* diff --git a/src/aiori.h b/src/aiori.h index da93a1a..3fc9f06 100755 --- a/src/aiori.h +++ b/src/aiori.h @@ -68,7 +68,7 @@ typedef struct ior_aiori { char *name; char *name_legacy; void *(*create)(char *, IOR_param_t *); - void *(*mknod)(char *); + int (*mknod)(char *); void *(*open)(char *, IOR_param_t *); IOR_offset_t (*xfer)(int, void *, IOR_size_t *, IOR_offset_t, IOR_param_t *); @@ -131,7 +131,7 @@ int aiori_posix_access (const char *path, int mode, IOR_param_t * param); int aiori_posix_stat (const char *path, struct stat *buf, IOR_param_t * param); void *POSIX_Create(char *testFileName, IOR_param_t * param); -void *POSIX_Mknod(char *testFileName); +int POSIX_Mknod(char *testFileName); void *POSIX_Open(char *testFileName, IOR_param_t * param); IOR_offset_t POSIX_GetFileSize(IOR_param_t * test, MPI_Comm testComm, char *testFileName); void POSIX_Delete(char *testFileName, IOR_param_t * param); diff --git a/src/mdtest.c b/src/mdtest.c index fe9c153..05e8a44 100644 --- a/src/mdtest.c +++ b/src/mdtest.c @@ -345,7 +345,7 @@ static void remove_file (const char *path, uint64_t itemNum) { static void create_file (const char *path, uint64_t itemNum) { char curr_item[MAX_PATHLEN]; - void *aiori_fh; + void *aiori_fh = NULL; if ( (itemNum % ITEM_COUNT==0 && (itemNum != 0))) { VERBOSE(3,5,"create file: "LLU"", itemNum); @@ -355,36 +355,36 @@ static void create_file (const char *path, uint64_t itemNum) { sprintf(curr_item, "%s/file.%s"LLU"", path, mk_name, itemNum); VERBOSE(3,5,"create_remove_items_helper (non-dirs create): curr_item is '%s'", curr_item); - if (collective_creates) { - param.openFlags = IOR_WRONLY; + param.openFlags = IOR_WRONLY; + if (make_node) { + int ret; + VERBOSE(3,5,"create_remove_items_helper : mknod..." ); + + ret = backend->mknod (curr_item); + if (ret != 0) + FAIL("unable to mknode file %s", curr_item); + + return; + } else if (collective_creates) { VERBOSE(3,5,"create_remove_items_helper (collective): open..." ); - if (make_node) - aiori_fh = backend->mknod (curr_item); - else - aiori_fh = backend->open (curr_item, ¶m); - if (NULL == aiori_fh) { + aiori_fh = backend->open (curr_item, ¶m); + if (NULL == aiori_fh) FAIL("unable to open file %s", curr_item); - } /* * !collective_creates */ } else { - param.openFlags = IOR_CREAT | IOR_WRONLY; + param.openFlags |= IOR_CREAT; param.filePerProc = !shared_file; - param.mode = FILEMODE; - + param.mode = FILEMODE; VERBOSE(3,5,"create_remove_items_helper (non-collective, shared): open..." ); - if (make_node) - aiori_fh = backend->mknod (curr_item); - else - aiori_fh = backend->create (curr_item, ¶m); - if (NULL == aiori_fh) { + aiori_fh = backend->create (curr_item, ¶m); + if (NULL == aiori_fh) FAIL("unable to create file %s", curr_item); - } } if (write_bytes > 0) { @@ -402,9 +402,7 @@ static void create_file (const char *path, uint64_t itemNum) { } VERBOSE(3,5,"create_remove_items_helper: close..." ); - - if (!make_node) - backend->close (aiori_fh, ¶m); + backend->close (aiori_fh, ¶m); } /* helper for creating/removing items */ From 0666875df3c265137c9d4a7492cdb3e6d7574b34 Mon Sep 17 00:00:00 2001 From: Jean-Yves VET Date: Tue, 17 Dec 2019 14:45:24 +0100 Subject: [PATCH 13/52] aiori-IME: Add support of sync and mknod in IME backend This patch adds the support of sync (flush client page cache for all opened files) and mknod in the IME backend. --- src/aiori-IME.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/aiori-IME.c b/src/aiori-IME.c index b6cef34..500f380 100755 --- a/src/aiori-IME.c +++ b/src/aiori-IME.c @@ -51,6 +51,12 @@ static int IME_StatFS(const char *, ior_aiori_statfs_t *, static int IME_RmDir(const char *, IOR_param_t *); static int IME_MkDir(const char *, mode_t, IOR_param_t *); static int IME_Stat(const char *, struct stat *, IOR_param_t *); + +#if (IME_NATIVE_API_VERSION >= 132) +static int IME_Mknod(char *); +static void IME_Sync(IOR_param_t *); +#endif + static void IME_Initialize(); static void IME_Finalize(); @@ -107,6 +113,10 @@ ior_aiori_t ime_aiori = { .initialize = IME_Initialize, .finalize = IME_Finalize, .get_options = IME_options, +#if (IME_NATIVE_API_VERSION >= 132) + .sync = IME_Sync, + .mknod = IME_Mknod, +#endif .enable_mdtest = true, }; @@ -406,3 +416,27 @@ static IOR_offset_t IME_GetFileSize(IOR_param_t *test, MPI_Comm testComm, return(aggFileSizeFromStat); } + +#if (IME_NATIVE_API_VERSION >= 132) +/* + * Create a file through mknod interface. + */ +static int IME_Mknod(char *testFileName) +{ + int ret = ime_native_mknod(testFileName, S_IFREG | S_IRUSR, 0); + if (ret < 0) + ERR("mknod failed"); + + return ret; +} + +/* + * Use IME sync to flush page cache of all opened files. + */ +static void IME_Sync(IOR_param_t * param) +{ + int ret = ime_native_sync(0); + if (ret != 0) + FAIL("Error executing the sync command."); +} +#endif From 73c5c0efc20f91700a4c293a2f089e6d8b5bde67 Mon Sep 17 00:00:00 2001 From: "Julian M. Kunkel" Date: Thu, 19 Dec 2019 13:42:34 +0000 Subject: [PATCH 14/52] Fix for collective operations by Wolfgang Szoecs #210. It does have performance implications but is only active if needed. --- src/ior.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/ior.c b/src/ior.c index 57f385d..5e343d1 100755 --- a/src/ior.c +++ b/src/ior.c @@ -1946,6 +1946,13 @@ static IOR_offset_t WriteOrRead(IOR_param_t *test, IOR_results_t *results, hitStonewall = ((test->deadlineForStonewalling != 0 && (GetTimeStamp() - startForStonewall) > test->deadlineForStonewalling)) || (test->stoneWallingWearOutIterations != 0 && pairCnt == test->stoneWallingWearOutIterations) ; + + if ( test->collective && test->deadlineForStonewalling ) { + // if collective-mode, you'll get a HANG, if some rank 'accidentally' leave this loop + // it absolutely must be an 'all or none': + MPI_CHECK(MPI_Bcast(&hitStonewall, 1, MPI_INT, 0, MPI_COMM_WORLD), "hitStonewall broadcast failed"); + } + } if (test->stoneWallingWearOut){ if (verbose >= VERBOSE_1){ From 240d5fae7903acad748af456a6ce7d110f78484c Mon Sep 17 00:00:00 2001 From: "Julian M. Kunkel" Date: Sat, 21 Dec 2019 11:19:02 +0000 Subject: [PATCH 15/52] Trivial fix to ensure all functions are prototypes. --- src/ior.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ior.h b/src/ior.h index ccf47fa..745a2d3 100755 --- a/src/ior.h +++ b/src/ior.h @@ -241,7 +241,7 @@ typedef struct IOR_test_t { IOR_test_t *CreateTest(IOR_param_t *init_params, int test_num); void AllocResults(IOR_test_t *test); -char * GetPlatformName(); +char * GetPlatformName(void); void init_IOR_Param_t(IOR_param_t *p); /* From 6de5cdc6f9bd9fe5d4b7f92abcb8b9641caf7a50 Mon Sep 17 00:00:00 2001 From: "Julian M. Kunkel" Date: Sat, 21 Dec 2019 14:14:27 +0000 Subject: [PATCH 16/52] Fixed wrong usage of platform, fixed printf output. --- src/ior-output.c | 4 ++-- src/ior.h | 2 +- src/parse_options.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ior-output.c b/src/ior-output.c index 99eeac6..01136fb 100644 --- a/src/ior-output.c +++ b/src/ior-output.c @@ -262,7 +262,7 @@ void PrintHeader(int argc, char **argv) if (outputFormat != OUTPUT_DEFAULT){ PrintKeyVal("Version", META_VERSION); }else{ - printf("IOR-" META_VERSION ": MPI Coordinated Test of Parallel I/O\n"); + fprintf(out_resultfile, "IOR-" META_VERSION ": MPI Coordinated Test of Parallel I/O\n"); } PrintKeyVal("Began", CurrentTimeString()); PrintKeyValStart("Command line"); @@ -323,7 +323,7 @@ void ShowTestStart(IOR_param_t *test) PrintKeyValInt("TestID", test->id); PrintKeyVal("StartTime", CurrentTimeString()); /* if pvfs2:, then skip */ - if (strcasecmp(test->api, "DFS") && + if (strcasecmp(test->api, "DFS") && Regex(test->testFileName, "^[a-z][a-z].*:") == 0) { DisplayFreespace(test); } diff --git a/src/ior.h b/src/ior.h index 745a2d3..6b9d1d7 100755 --- a/src/ior.h +++ b/src/ior.h @@ -100,7 +100,7 @@ typedef struct int numTasks; /* number of tasks for test */ int numNodes; /* number of nodes for test */ int numTasksOnNode0; /* number of tasks on node 0 (usually all the same, but don't have to be, use with caution) */ - int tasksBlockMapping; /* are the tasks in contiguous blocks across nodes or round-robin */ + int tasksBlockMapping; /* are the tasks in contiguous blocks across nodes or round-robin */ int repetitions; /* number of repetitions of test */ int repCounter; /* rep counter */ int multiFile; /* multiple files */ diff --git a/src/parse_options.c b/src/parse_options.c index 74a7b54..607d014 100755 --- a/src/parse_options.c +++ b/src/parse_options.c @@ -544,7 +544,7 @@ IOR_test_t *ParseCommandLine(int argc, char **argv) IOR_test_t *tests = NULL; - GetPlatformName(initialTestParams.platform); + initialTestParams.platform = GetPlatformName(); option_help * options = createGlobalOptions( & initialTestParams); parameters = & initialTestParams; From c702a98376a02841bbc5fe552bfe42028db183f4 Mon Sep 17 00:00:00 2001 From: "Julian M. Kunkel" Date: Sun, 22 Dec 2019 11:21:40 +0000 Subject: [PATCH 17/52] Strict prototypes for AIORI --- src/aiori.h | 8 ++++---- src/ior.c | 4 ++-- src/mdtest.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/aiori.h b/src/aiori.h index 3fc9f06..4be7bd5 100755 --- a/src/aiori.h +++ b/src/aiori.h @@ -74,7 +74,7 @@ typedef struct ior_aiori { IOR_offset_t, IOR_param_t *); void (*close)(void *, IOR_param_t *); void (*delete)(char *, IOR_param_t *); - char* (*get_version)(); + char* (*get_version)(void); void (*fsync)(void *, IOR_param_t *); IOR_offset_t (*get_file_size)(IOR_param_t *, MPI_Comm, char *); int (*statfs) (const char *, ior_aiori_statfs_t *, IOR_param_t * param); @@ -82,8 +82,8 @@ typedef struct ior_aiori { int (*rmdir) (const char *path, IOR_param_t * param); int (*access) (const char *path, int mode, IOR_param_t * param); int (*stat) (const char *path, struct stat *buf, IOR_param_t * param); - void (*initialize)(); /* called once per program before MPI is started */ - void (*finalize)(); /* called once per program after MPI is shutdown */ + void (*initialize)(void); /* called once per program before MPI is started */ + void (*finalize)(void); /* called once per program after MPI is shutdown */ option_help * (*get_options)(void ** init_backend_options, void* init_values); /* initializes the backend options as well and returns the pointer to the option help structure */ bool enable_mdtest; int (*check_params)(IOR_param_t *); /* check if the provided parameters for the given test and the module options are correct, if they aren't print a message and exit(1) or return 1*/ @@ -123,7 +123,7 @@ void * airoi_update_module_options(const ior_aiori_t * backend, options_all_t * const char *aiori_default (void); /* some generic POSIX-based backend calls */ -char * aiori_get_version(); +char * aiori_get_version (void); int aiori_posix_statfs (const char *path, ior_aiori_statfs_t *stat_buf, IOR_param_t * param); int aiori_posix_mkdir (const char *path, mode_t mode, IOR_param_t * param); int aiori_posix_rmdir (const char *path, IOR_param_t * param); diff --git a/src/ior.c b/src/ior.c index 5e343d1..c7c2c27 100755 --- a/src/ior.c +++ b/src/ior.c @@ -1268,7 +1268,7 @@ static void TestIoSys(IOR_test_t *test) /* IO Buffer Setup */ if (params->setTimeStampSignature) { // initialize the buffer properly - params->timeStampSignatureValue = (unsigned int)params->setTimeStampSignature; + params->timeStampSignatureValue = (unsigned int) params->setTimeStampSignature; } XferBuffersSetup(&ioBuffers, params, pretendRank); reseed_incompressible_prng = TRUE; // reset pseudo random generator, necessary to guarantee the next call to FillBuffer produces the same value as it is right now @@ -1289,7 +1289,7 @@ static void TestIoSys(IOR_test_t *test) ERR("cannot get current time"); } params->timeStampSignatureValue = - (unsigned int)currentTime; + (unsigned int) currentTime; if (verbose >= VERBOSE_2) { fprintf(out_logfile, "Using Time Stamp %u (0x%x) for Data Signature\n", diff --git a/src/mdtest.c b/src/mdtest.c index 05e8a44..3b478ca 100644 --- a/src/mdtest.c +++ b/src/mdtest.c @@ -2264,7 +2264,7 @@ mdtest_results_t * mdtest_run(int argc, char **argv, MPI_Comm world_com, FILE * } if (backend->finalize) - backend->finalize(NULL); + backend->finalize(); return summary_table; } From 2a4c21e4575ef303ea945a71b253695c1b9fc68f Mon Sep 17 00:00:00 2001 From: Jeff Olivier Date: Wed, 8 Jan 2020 16:45:50 -0700 Subject: [PATCH 18/52] Add runpath to configure script for daos and cart Enables running without setting LD_LIBRARY_PATH Uses DT_RUNPATH (--enable-new-dtags) so that it can be overwritten by setting LD_LIBRARY_PATH should libraries be moved. Signed-off-by: Jeff Olivier --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 26bee2f..5bdd78b 100755 --- a/configure.ac +++ b/configure.ac @@ -205,7 +205,7 @@ AC_ARG_WITH([cart], AS_IF([test "x$with_cart" != xno], [ CART="yes" - LDFLAGS="$LDFLAGS -L$with_cart/lib" + LDFLAGS="$LDFLAGS -L$with_cart/lib -Wl,--enable-new-dtags -Wl,-rpath=$with_cart/lib" CPPFLAGS="$CPPFLAGS -I$with_cart/include/" AC_CHECK_HEADERS(gurt/common.h,, [unset CART]) AC_CHECK_LIB([gurt], [d_hash_murmur64],, [unset CART]) @@ -218,7 +218,7 @@ AC_ARG_WITH([daos], AS_IF([test "x$with_daos" != xno], [ DAOS="yes" - LDFLAGS="$LDFLAGS -L$with_daos/lib64 -L$with_daos/lib" + LDFLAGS="$LDFLAGS -L$with_daos/lib64 -Wl,--enable-new-dtags -Wl,-rpath=$with_daos/lib64" CPPFLAGS="$CPPFLAGS -I$with_daos/include" AC_CHECK_HEADERS(daos_types.h,, [unset DAOS]) AC_CHECK_LIB([uuid], [uuid_generate],, [unset DAOS]) From c7974d194c6d479c537531c1c68c589574b29683 Mon Sep 17 00:00:00 2001 From: "Julian M. Kunkel" Date: Sun, 19 Jan 2020 11:09:49 +0000 Subject: [PATCH 19/52] Updated user documentation for changed odirect --- doc/USER_GUIDE | 3 ++- doc/sphinx/userDoc/options.rst | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/doc/USER_GUIDE b/doc/USER_GUIDE index 62a6802..3d6b4e4 100755 --- a/doc/USER_GUIDE +++ b/doc/USER_GUIDE @@ -65,7 +65,6 @@ These options are to be used on the command line. E.g., 'IOR -a POSIX -b 4K'. -a S api -- API for I/O, e.g., POSIX -A N refNum -- user reference number to include in long summary -b N blockSize -- contiguous bytes to write per task (e.g.: 8, 4k, 2m, 1g) - -B useO_DIRECT -- uses O_DIRECT for POSIX, bypassing I/O buffers -c collective -- collective I/O -C reorderTasksConstant -- changes task ordering to n+1 ordering for readback -d N interTestDelay -- delay between reps in seconds @@ -118,6 +117,8 @@ NOTES: * S is a string, N is an integer number. * For transfer and block sizes, the case-insensitive K, M, and G suffices are recognized. I.e., '4k' or '4K' is accepted as 4096. +Various options are only valid for specific modules, you can see details when running $ ./ior -h +These options are typically prefixed with the module name, an example is: --posix.odirect ********************* * 4. OPTION DETAILS * diff --git a/doc/sphinx/userDoc/options.rst b/doc/sphinx/userDoc/options.rst index 86fc97e..31240f0 100644 --- a/doc/sphinx/userDoc/options.rst +++ b/doc/sphinx/userDoc/options.rst @@ -22,7 +22,6 @@ These options are to be used on the command line (e.g., ``./ior -a POSIX -b 4K`` -a S api -- API for I/O [POSIX|MPIIO|HDF5|HDFS|S3|S3_EMC|NCMPI|RADOS] -A N refNum -- user reference number to include in long summary -b N blockSize -- contiguous bytes to write per task (e.g.: 8, 4k, 2m, 1g) - -B useO_DIRECT -- uses O_DIRECT for POSIX, bypassing I/O buffers -c collective -- collective I/O -C reorderTasksConstant -- changes task ordering to n+1 ordering for readback -d N interTestDelay -- delay between reps in seconds @@ -76,6 +75,9 @@ These options are to be used on the command line (e.g., ``./ior -a POSIX -b 4K`` * For transfer and block sizes, the case-insensitive K, M, and G suffices are recognized. I.e., '4k' or '4K' is accepted as 4096. +Various options are only valid for specific modules, you can see details when running $ ./ior -h +These options are typically prefixed with the module name, an example is: --posix.odirect + Directive Options ------------------ From e363713c07aab6defe340a360daf39afdbaadf33 Mon Sep 17 00:00:00 2001 From: Mark Nelson Date: Tue, 25 Feb 2020 18:13:29 -0600 Subject: [PATCH 20/52] src/aiori-RADOS: Remove Direct IO option check. Signed-off-by: Mark Nelson --- src/aiori-RADOS.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/aiori-RADOS.c b/src/aiori-RADOS.c index 090414d..b8789d4 100755 --- a/src/aiori-RADOS.c +++ b/src/aiori-RADOS.c @@ -137,9 +137,6 @@ static void *RADOS_Create_Or_Open(char *testFileName, IOR_param_t * param, int c RADOS_Cluster_Init(param); - if (param->useO_DIRECT == TRUE) - WARN("direct I/O mode is not implemented in RADOS\n"); - oid = strdup(testFileName); if (!oid) ERR("unable to allocate RADOS oid"); From 50a4ba07358347fda6ee2bbcf852455c5fc9f1a7 Mon Sep 17 00:00:00 2001 From: Mohamad Chaarawi Date: Mon, 24 Feb 2020 18:59:40 +0000 Subject: [PATCH 21/52] DAOS Driver: Update License & Align with 1.0 API changes - License should inherit from IOR License. - remove checksums from Array API - add DFS dir oclass option Signed-off-by: Mohamad Chaarawi --- src/aiori-DAOS.c | 17 +++++------------ src/aiori-DFS.c | 28 +++++++++++++++------------- 2 files changed, 20 insertions(+), 25 deletions(-) diff --git a/src/aiori-DAOS.c b/src/aiori-DAOS.c index 19a9f64..7f07f7c 100644 --- a/src/aiori-DAOS.c +++ b/src/aiori-DAOS.c @@ -1,16 +1,9 @@ -/* - * -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*- +/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*- * vim:expandtab:shiftwidth=8:tabstop=8: */ /* - * Copyright (C) 2018-2019 Intel Corporation - * - * GOVERNMENT LICENSE RIGHTS-OPEN SOURCE SOFTWARE - * The Government's rights to use, modify, reproduce, release, perform, display, - * or disclose this software are subject to the terms of the Apache License as - * provided in Contract No. 8F-30005. - * Any reproduction of computer software, computer software documentation, or - * portions thereof marked with this legend must also reproduce the markings. + * Copyright (C) 2018-2020 Intel Corporation + * See the file COPYRIGHT for a complete copyright notice and license. */ /* @@ -444,10 +437,10 @@ DAOS_Xfer(int access, void *file, IOR_size_t *buffer, sgl.sg_iovs = &iov; if (access == WRITE) { - rc = daos_array_write(aoh, DAOS_TX_NONE, &iod, &sgl, NULL, NULL); + rc = daos_array_write(aoh, DAOS_TX_NONE, &iod, &sgl, NULL); DCHECK(rc, "daos_array_write() failed (%d).", rc); } else { - rc = daos_array_read(aoh, DAOS_TX_NONE, &iod, &sgl, NULL, NULL); + rc = daos_array_read(aoh, DAOS_TX_NONE, &iod, &sgl, NULL); DCHECK(rc, "daos_array_read() failed (%d).", rc); } diff --git a/src/aiori-DFS.c b/src/aiori-DFS.c index 9b9859a..5099631 100755 --- a/src/aiori-DFS.c +++ b/src/aiori-DFS.c @@ -2,14 +2,8 @@ * vim:expandtab:shiftwidth=8:tabstop=8: */ /* - * Copyright (C) 2018-2019 Intel Corporation - * - * GOVERNMENT LICENSE RIGHTS-OPEN SOURCE SOFTWARE - * The Government's rights to use, modify, reproduce, release, perform, display, - * or disclose this software are subject to the terms of the Apache License as - * provided in Contract No. 8F-30005. - * Any reproduction of computer software, computer software documentation, or - * portions thereof marked with this legend must also reproduce the markings. + * Copyright (C) 2018-2020 Intel Corporation + * See the file COPYRIGHT for a complete copyright notice and license. */ /* @@ -46,6 +40,7 @@ dfs_t *dfs; static daos_handle_t poh, coh; static daos_oclass_id_t objectClass = OC_SX; +static daos_oclass_id_t dir_oclass = OC_SX; static struct d_hash_table *dir_hash; struct aiori_dir_hdl { @@ -68,6 +63,7 @@ struct dfs_options{ char *cont; int chunk_size; char *oclass; + char *dir_oclass; char *prefix; int destroy; }; @@ -79,6 +75,7 @@ static struct dfs_options o = { .cont = NULL, .chunk_size = 1048576, .oclass = NULL, + .dir_oclass = NULL, .prefix = NULL, .destroy = 0, }; @@ -90,6 +87,7 @@ static option_help options [] = { {0, "dfs.cont", "DFS container uuid", OPTION_OPTIONAL_ARGUMENT, 's', & o.cont}, {0, "dfs.chunk_size", "chunk size", OPTION_OPTIONAL_ARGUMENT, 'd', &o.chunk_size}, {0, "dfs.oclass", "object class", OPTION_OPTIONAL_ARGUMENT, 's', &o.oclass}, + {0, "dfs.dir_oclass", "directory object class", OPTION_OPTIONAL_ARGUMENT, 's', &o.dir_oclass}, {0, "dfs.prefix", "mount prefix", OPTION_OPTIONAL_ARGUMENT, 's', & o.prefix}, {0, "dfs.destroy", "Destroy DFS Container", OPTION_FLAG, 'd', &o.destroy}, LAST_OPTION @@ -385,7 +383,13 @@ DFS_Init() { if (o.oclass) { objectClass = daos_oclass_name2id(o.oclass); if (objectClass == OC_UNKNOWN) - GERR("Invalid DAOS Object class %s\n", o.oclass); + GERR("Invalid DAOS object class %s\n", o.oclass); + } + + if (o.dir_oclass) { + dir_oclass = daos_oclass_name2id(o.dir_oclass); + if (dir_oclass == OC_UNKNOWN) + GERR("Invalid DAOS directory object class %s\n", o.dir_oclass); } rc = daos_init(); @@ -506,7 +510,7 @@ DFS_Create(char *testFileName, IOR_param_t *param) { char *name = NULL, *dir_name = NULL; dfs_obj_t *obj = NULL, *parent = NULL; - mode_t mode; + mode_t mode = 0644; int fd_oflag = 0; int rc; @@ -767,15 +771,13 @@ DFS_Mkdir(const char *path, mode_t mode, IOR_param_t * param) if (parent == NULL) GERR("Failed to lookup parent dir"); - rc = dfs_mkdir(dfs, parent, name, mode); + rc = dfs_mkdir(dfs, parent, name, mode, dir_oclass); DCHECK(rc, "dfs_mkdir() of %s Failed", name); if (name) free(name); if (dir_name) free(dir_name); - if (rc) - return -1; return rc; } From 9726aa0ce2abdae4217c31a314c718182feceaf2 Mon Sep 17 00:00:00 2001 From: "Julian M. Kunkel" Date: Sat, 7 Mar 2020 14:40:59 +0000 Subject: [PATCH 22/52] Bugfix API which doesn't set the AIORI backend. --- src/ior.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ior.c b/src/ior.c index c7c2c27..4ec88ea 100755 --- a/src/ior.c +++ b/src/ior.c @@ -78,6 +78,7 @@ IOR_test_t * ior_run(int argc, char **argv, MPI_Comm world_com, FILE * world_out for (tptr = tests_head; tptr != NULL; tptr = tptr->next) { totalErrorCount = 0; verbose = tptr->params.verbose; + backend = tptr->params.backend; if (rank == 0 && verbose >= VERBOSE_0) { ShowTestStart(&tptr->params); } @@ -129,6 +130,7 @@ int ior_main(int argc, char **argv) /* perform each test */ for (tptr = tests_head; tptr != NULL; tptr = tptr->next) { verbose = tptr->params.verbose; + backend = tptr->params.backend; if (rank == 0 && verbose >= VERBOSE_0) { backend = tptr->params.backend; ShowTestStart(&tptr->params); @@ -1256,7 +1258,6 @@ static void TestIoSys(IOR_test_t *test) "Using reorderTasks '-C' (useful to avoid read cache in client)\n"); fflush(out_logfile); } - backend = params->backend; /* show test setup */ if (rank == 0 && verbose >= VERBOSE_0) ShowSetup(params); From 9649a0c520a732cdae17cc774672e181525ed526 Mon Sep 17 00:00:00 2001 From: Mark Nelson Date: Thu, 5 Mar 2020 01:40:05 +0000 Subject: [PATCH 23/52] src/aiori-CEPHFS: New libcephfs backend Signed-off-by: Mark Nelson --- configure.ac | 14 ++ src/Makefile.am | 6 + src/aiori-CEPHFS.c | 361 +++++++++++++++++++++++++++++++++++++++++++++ src/aiori.c | 3 + src/aiori.h | 1 + src/ior.c | 3 +- src/ior.h | 1 - 7 files changed, 387 insertions(+), 2 deletions(-) create mode 100755 src/aiori-CEPHFS.c diff --git a/configure.ac b/configure.ac index 5bdd78b..cc7ddba 100755 --- a/configure.ac +++ b/configure.ac @@ -197,6 +197,20 @@ AM_COND_IF([USE_RADOS_AIORI],[ AC_DEFINE([USE_RADOS_AIORI], [], [Build RADOS backend AIORI]) ]) +# CEPHFS support +AC_ARG_WITH([cephfs], + [AS_HELP_STRING([--with-cephfs], + [support IO with libcephfs backend @<:@default=no@:>@])], + [], + [with_cephfs=no]) +AS_IF([test "x$with_cephfs" != xno], [ + CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=64 -std=gnu11" +]) +AM_CONDITIONAL([USE_CEPHFS_AIORI], [test x$with_cephfs = xyes]) +AM_COND_IF([USE_CEPHFS_AIORI],[ + AC_DEFINE([USE_CEPHFS_AIORI], [], [Build CEPHFS backend AIORI]) +]) + # DAOS Backends (DAOS and DFS) IO support require DAOS and CART/GURT AC_ARG_WITH([cart], [AS_HELP_STRING([--with-cart], diff --git a/src/Makefile.am b/src/Makefile.am index 56b4279..1c37a6e 100755 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -70,6 +70,12 @@ extraSOURCES += aiori-RADOS.c extraLDADD += -lrados endif +if USE_CEPHFS_AIORI +extraSOURCES += aiori-CEPHFS.c +extraLDADD += -lcephfs +endif + + if USE_DAOS_AIORI extraSOURCES += aiori-DAOS.c aiori-DFS.c endif diff --git a/src/aiori-CEPHFS.c b/src/aiori-CEPHFS.c new file mode 100755 index 0000000..d5c6154 --- /dev/null +++ b/src/aiori-CEPHFS.c @@ -0,0 +1,361 @@ +/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*- + * vim:expandtab:shiftwidth=8:tabstop=8: + */ +/******************************************************************************\ +* * +* (C) 2015 The University of Chicago * +* (C) 2020 Red Hat, Inc. * +* * +* See COPYRIGHT in top-level directory. * +* * +******************************************************************************** +* +* Implement abstract I/O interface for CEPHFS. +* +\******************************************************************************/ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include +#include +#include +#include + +#include "ior.h" +#include "iordef.h" +#include "aiori.h" +#include "utilities.h" + +#define CEPH_O_RDONLY 00000000 +#define CEPH_O_WRONLY 00000001 +#define CEPH_O_RDWR 00000002 +#define CEPH_O_CREAT 00000100 +#define CEPH_O_EXCL 00000200 +#define CEPH_O_TRUNC 00001000 +#define CEPH_O_LAZY 00020000 +#define CEPH_O_DIRECTORY 00200000 +#define CEPH_O_NOFOLLOW 00400000 + +/************************** O P T I O N S *****************************/ +struct cephfs_options{ + char * user; + char * conf; + char * prefix; +}; + +static struct cephfs_options o = { + .user = NULL, + .conf = NULL, + .prefix = NULL, +}; + +static option_help options [] = { + {0, "cephfs.user", "Username for the ceph cluster", OPTION_REQUIRED_ARGUMENT, 's', & o.user}, + {0, "cephfs.conf", "Config file for the ceph cluster", OPTION_REQUIRED_ARGUMENT, 's', & o.conf}, + {0, "cephfs.prefix", "mount prefix", OPTION_OPTIONAL_ARGUMENT, 's', & o.prefix}, + LAST_OPTION +}; + +static struct ceph_mount_info *cmount; + +/**************************** P R O T O T Y P E S *****************************/ +static void CEPHFS_Init(); +static void CEPHFS_Final(); +static void *CEPHFS_Create(char *, IOR_param_t *); +static void *CEPHFS_Open(char *, IOR_param_t *); +static IOR_offset_t CEPHFS_Xfer(int, void *, IOR_size_t *, + IOR_offset_t, IOR_param_t *); +static void CEPHFS_Close(void *, IOR_param_t *); +static void CEPHFS_Delete(char *, IOR_param_t *); +static void CEPHFS_Fsync(void *, IOR_param_t *); +static IOR_offset_t CEPHFS_GetFileSize(IOR_param_t *, MPI_Comm, char *); +static int CEPHFS_StatFS(const char *, ior_aiori_statfs_t *, IOR_param_t *); +static int CEPHFS_MkDir(const char *, mode_t, IOR_param_t *); +static int CEPHFS_RmDir(const char *, IOR_param_t *); +static int CEPHFS_Access(const char *, int, IOR_param_t *); +static int CEPHFS_Stat(const char *, struct stat *, IOR_param_t *); +static option_help * CEPHFS_options(); + +/************************** D E C L A R A T I O N S ***************************/ +ior_aiori_t cephfs_aiori = { + .name = "CEPHFS", + .name_legacy = NULL, + .initialize = CEPHFS_Init, + .finalize = CEPHFS_Final, + .create = CEPHFS_Create, + .open = CEPHFS_Open, + .xfer = CEPHFS_Xfer, + .close = CEPHFS_Close, + .delete = CEPHFS_Delete, + .get_version = aiori_get_version, + .fsync = CEPHFS_Fsync, + .get_file_size = CEPHFS_GetFileSize, + .statfs = CEPHFS_StatFS, + .mkdir = CEPHFS_MkDir, + .rmdir = CEPHFS_RmDir, + .access = CEPHFS_Access, + .stat = CEPHFS_Stat, + .get_options = CEPHFS_options, +}; + +#define CEPHFS_ERR(__err_str, __ret) do { \ + errno = -__ret; \ + ERR(__err_str); \ +} while(0) + +/***************************** F U N C T I O N S ******************************/ +static const char* pfix(const char* path) { + const char* npath = path; + const char* prefix = o.prefix; + while (*prefix) { + if(*prefix++ != *npath++) { + return path; + } + } + return npath; +} + +static option_help * CEPHFS_options(){ + return options; +} + +static void CEPHFS_Init() +{ + /* Short circuit if the mount handle already exists */ + if (cmount) { + return; + } + + int ret; + /* create CEPHFS mount handle */ + ret = ceph_create(&cmount, o.user); + if (ret) { + CEPHFS_ERR("unable to create CEPHFS mount handle", ret); + } + + /* set the handle using the Ceph config */ + ret = ceph_conf_read_file(cmount, o.conf); + if (ret) { + CEPHFS_ERR("unable to read ceph config file", ret); + } + + /* mount the handle */ + ret = ceph_mount(cmount, "/"); + if (ret) { + CEPHFS_ERR("unable to mount cephfs", ret); + ceph_shutdown(cmount); + + } + + Inode *root; + + /* try retrieving the root cephfs inode */ + ret = ceph_ll_lookup_root(cmount, &root); + if (ret) { + CEPHFS_ERR("uanble to retrieve root cephfs inode", ret); + ceph_shutdown(cmount); + + } + + return; +} + +static void CEPHFS_Final() +{ + /* shutdown */ + ceph_shutdown(cmount); +} + +static void *CEPHFS_Create(char *testFileName, IOR_param_t * param) +{ + return CEPHFS_Open(testFileName, param); +} + +static void *CEPHFS_Open(char *testFileName, IOR_param_t * param) +{ + const char *file = pfix(testFileName); + int* fd; + fd = (int *)malloc(sizeof(int)); + + mode_t mode = 0664; + int flags = (int) 0; + + /* set IOR file flags to CephFS flags */ + /* -- file open flags -- */ + if (param->openFlags & IOR_RDONLY) { + flags |= CEPH_O_RDONLY; + } + if (param->openFlags & IOR_WRONLY) { + flags |= CEPH_O_WRONLY; + } + if (param->openFlags & IOR_RDWR) { + flags |= CEPH_O_RDWR; + } + if (param->openFlags & IOR_APPEND) { + fprintf(stdout, "File append not implemented in CephFS\n"); + } + if (param->openFlags & IOR_CREAT) { + flags |= CEPH_O_CREAT; + } + if (param->openFlags & IOR_EXCL) { + flags |= CEPH_O_EXCL; + } + if (param->openFlags & IOR_TRUNC) { + flags |= CEPH_O_TRUNC; + } + if (param->openFlags & IOR_DIRECT) { + fprintf(stdout, "O_DIRECT not implemented in CephFS\n"); + } + *fd = ceph_open(cmount, file, flags, mode); + if (*fd < 0) { + CEPHFS_ERR("ceph_open failed", *fd); + } + return (void *) fd; +} + +static IOR_offset_t CEPHFS_Xfer(int access, void *file, IOR_size_t * buffer, + IOR_offset_t length, IOR_param_t * param) +{ + uint64_t size = (uint64_t) length; + char *buf = (char *) buffer; + int fd = *(int *) file; + int ret; + + if (access == WRITE) + { + ret = ceph_write(cmount, fd, buf, size, param->offset); + if (ret < 0) { + CEPHFS_ERR("unable to write file to CephFS", ret); + } else if (ret < size) { + CEPHFS_ERR("short write to CephFS", ret); + } + if (param->fsyncPerWrite == TRUE) { + CEPHFS_Fsync(&fd, param); + } + } + else /* READ */ + { + ret = ceph_read(cmount, fd, buf, size, param->offset); + if (ret < 0) { + CEPHFS_ERR("unable to read file from CephFS", ret); + } else if (ret < size) { + CEPHFS_ERR("short read from CephFS", ret); + } + + } + return length; +} + +static void CEPHFS_Fsync(void *file, IOR_param_t * param) +{ + int fd = *(int *) file; + int ret = ceph_fsync(cmount, fd, 0); + if (ret < 0) { + CEPHFS_ERR("ceph_fsync failed", ret); + } +} + +static void CEPHFS_Close(void *file, IOR_param_t * param) +{ + int fd = *(int *) file; + int ret = ceph_close(cmount, fd); + if (ret < 0) { + CEPHFS_ERR("ceph_close failed", ret); + } + free(file); + + return; +} + +static void CEPHFS_Delete(char *testFileName, IOR_param_t * param) +{ + int ret = ceph_unlink(cmount, pfix(testFileName)); + if (ret < 0) { + CEPHFS_ERR("ceph_unlink failed", ret); + } + return; +} + +static IOR_offset_t CEPHFS_GetFileSize(IOR_param_t * param, MPI_Comm testComm, + char *testFileName) +{ + struct stat stat_buf; + IOR_offset_t aggFileSizeFromStat, tmpMin, tmpMax, tmpSum; + + int ret = ceph_stat(cmount, pfix(testFileName), &stat_buf); + if (ret < 0) { + CEPHFS_ERR("ceph_stat failed", ret); + } + aggFileSizeFromStat = stat_buf.st_size; + + if (param->filePerProc == TRUE) { + MPI_CHECK(MPI_Allreduce(&aggFileSizeFromStat, &tmpSum, 1, + MPI_LONG_LONG_INT, MPI_SUM, testComm), + "cannot total data moved"); + aggFileSizeFromStat = tmpSum; + } else { + MPI_CHECK(MPI_Allreduce(&aggFileSizeFromStat, &tmpMin, 1, + MPI_LONG_LONG_INT, MPI_MIN, testComm), + "cannot total data moved"); + MPI_CHECK(MPI_Allreduce(&aggFileSizeFromStat, &tmpMax, 1, + MPI_LONG_LONG_INT, MPI_MAX, testComm), + "cannot total data moved"); + if (tmpMin != tmpMax) { + if (rank == 0) { + WARN("inconsistent file size by different tasks"); + } + /* incorrect, but now consistent across tasks */ + aggFileSizeFromStat = tmpMin; + } + } + + return (aggFileSizeFromStat); + +} + +static int CEPHFS_StatFS(const char *path, ior_aiori_statfs_t *stat_buf, + IOR_param_t *param) +{ +#if defined(HAVE_STATVFS) + struct statvfs statfs_buf; + int ret = ceph_statfs(cmount, pfix(path), &statfs_buf); + if (ret < 0) { + CEPHFS_ERR("ceph_statfs failed", ret); + return -1; + } + + stat_buf->f_bsize = statfs_buf.f_bsize; + stat_buf->f_blocks = statfs_buf.f_blocks; + stat_buf->f_bfree = statfs_buf.f_bfree; + stat_buf->f_files = statfs_buf.f_files; + stat_buf->f_ffree = statfs_buf.f_ffree; + + return 0; +#else + WARN("ceph_statfs requires statvfs!"); + return -1; +#endif +} + +static int CEPHFS_MkDir(const char *path, mode_t mode, IOR_param_t *param) +{ + return ceph_mkdir(cmount, pfix(path), mode); +} + +static int CEPHFS_RmDir(const char *path, IOR_param_t *param) +{ + return ceph_rmdir(cmount, pfix(path)); +} + +static int CEPHFS_Access(const char *testFileName, int mode, IOR_param_t *param) +{ + struct stat buf; + return ceph_stat(cmount, pfix(testFileName), &buf); +} + +static int CEPHFS_Stat(const char *testFileName, struct stat *buf, IOR_param_t *param) +{ + return ceph_stat(cmount, pfix(testFileName), buf); +} diff --git a/src/aiori.c b/src/aiori.c index a72180d..71f99d1 100644 --- a/src/aiori.c +++ b/src/aiori.c @@ -73,6 +73,9 @@ ior_aiori_t *available_aiori[] = { #ifdef USE_RADOS_AIORI &rados_aiori, #endif +#ifdef USE_CEPHFS_AIORI + &cephfs_aiori, +#endif #ifdef USE_GFARM_AIORI &gfarm_aiori, #endif diff --git a/src/aiori.h b/src/aiori.h index 4be7bd5..4d416c2 100755 --- a/src/aiori.h +++ b/src/aiori.h @@ -109,6 +109,7 @@ extern ior_aiori_t s3_aiori; extern ior_aiori_t s3_plus_aiori; extern ior_aiori_t s3_emc_aiori; extern ior_aiori_t rados_aiori; +extern ior_aiori_t cephfs_aiori; extern ior_aiori_t gfarm_aiori; void aiori_initialize(IOR_test_t * tests); diff --git a/src/ior.c b/src/ior.c index c7c2c27..13868a2 100755 --- a/src/ior.c +++ b/src/ior.c @@ -1618,7 +1618,8 @@ static void ValidateTests(IOR_param_t * test) && (strcasecmp(test->api, "MMAP") != 0) && (strcasecmp(test->api, "HDFS") != 0) && (strcasecmp(test->api, "Gfarm") != 0) - && (strcasecmp(test->api, "RADOS") != 0)) && test->fsync) + && (strcasecmp(test->api, "RADOS") != 0) + && (strcasecmp(test->api, "CEPHFS") != 0)) && test->fsync) WARN_RESET("fsync() not supported in selected backend", test, &defaults, fsync); if ((strcasecmp(test->api, "MPIIO") != 0) && test->preallocate) diff --git a/src/ior.h b/src/ior.h index 6b9d1d7..758b048 100755 --- a/src/ior.h +++ b/src/ior.h @@ -35,7 +35,6 @@ typedef void *rados_t; typedef void *rados_ioctx_t; #endif - #include "option.h" #include "iordef.h" From a21137be3ecdd7e86cde6b7675308a804479d383 Mon Sep 17 00:00:00 2001 From: Jean-Yves VET Date: Tue, 17 Mar 2020 16:31:56 +0100 Subject: [PATCH 24/52] Display outlier host names Display host names when using the -j argument (outlierThreshold) so that IOR could help to better identify slow nodes: WARNING: for client02, task 6, write elapsed transfer time is 65.738326 --- src/ior.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/ior.c b/src/ior.c index 9871193..c831a84 100755 --- a/src/ior.c +++ b/src/ior.c @@ -255,8 +255,13 @@ DisplayOutliers(int numTasks, strcpy(accessString, "read"); } if (fabs(timerVal - mean) > (double)outlierThreshold) { - fprintf(out_logfile, "WARNING: for task %d, %s %s is %f\n", - rank, accessString, timeString, timerVal); + char hostname[MAX_STR]; + int ret = gethostname(hostname, MAX_STR); + if (ret != 0) + strcpy(hostname, "unknown"); + + fprintf(out_logfile, "WARNING: for %s, task %d, %s %s is %f\n", + hostname, rank, accessString, timeString, timerVal); fprintf(out_logfile, " (mean=%f, stddev=%f)\n", mean, sd); fflush(out_logfile); } From eed22a4aaf7c4ba807e72fe1be3df6fe50e8c403 Mon Sep 17 00:00:00 2001 From: Mohamad Chaarawi Date: Mon, 6 Apr 2020 21:42:51 +0000 Subject: [PATCH 25/52] Look into lib64 for cart libraries too. Signed-off-by: Mohamad Chaarawi --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 5bdd78b..5a2f8f9 100755 --- a/configure.ac +++ b/configure.ac @@ -205,7 +205,7 @@ AC_ARG_WITH([cart], AS_IF([test "x$with_cart" != xno], [ CART="yes" - LDFLAGS="$LDFLAGS -L$with_cart/lib -Wl,--enable-new-dtags -Wl,-rpath=$with_cart/lib" + LDFLAGS="$LDFLAGS -L$with_cart/lib -L$with_cart/lib64 -Wl,--enable-new-dtags -Wl,-rpath=$with_cart/lib64" CPPFLAGS="$CPPFLAGS -I$with_cart/include/" AC_CHECK_HEADERS(gurt/common.h,, [unset CART]) AC_CHECK_LIB([gurt], [d_hash_murmur64],, [unset CART]) From 1b8848ccbcda0ce04b6029698944e2b55a2da618 Mon Sep 17 00:00:00 2001 From: Mohamad Chaarawi Date: Mon, 13 Apr 2020 19:34:46 +0000 Subject: [PATCH 26/52] Use l2g-g2l to share the dfs mount instead of opening by each rank. Signed-off-by: Mohamad Chaarawi --- configure.ac | 3 ++- src/aiori-DFS.c | 35 +++++++++++++++++++++-------------- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/configure.ac b/configure.ac index 5a2f8f9..5ee1530 100755 --- a/configure.ac +++ b/configure.ac @@ -205,7 +205,8 @@ AC_ARG_WITH([cart], AS_IF([test "x$with_cart" != xno], [ CART="yes" - LDFLAGS="$LDFLAGS -L$with_cart/lib -L$with_cart/lib64 -Wl,--enable-new-dtags -Wl,-rpath=$with_cart/lib64" + LDFLAGS="$LDFLAGS -L$with_cart/lib64 -Wl,--enable-new-dtags -Wl,-rpath=$with_cart/lib64" + LDFLAGS="$LDFLAGS -L$with_cart/lib -Wl,--enable-new-dtags -Wl,-rpath=$with_cart/lib" CPPFLAGS="$CPPFLAGS -I$with_cart/include/" AC_CHECK_HEADERS(gurt/common.h,, [unset CART]) AC_CHECK_LIB([gurt], [d_hash_murmur64],, [unset CART]) diff --git a/src/aiori-DFS.c b/src/aiori-DFS.c index 5099631..f8c6ce9 100755 --- a/src/aiori-DFS.c +++ b/src/aiori-DFS.c @@ -52,7 +52,7 @@ struct aiori_dir_hdl { enum handleType { POOL_HANDLE, CONT_HANDLE, - ARRAY_HANDLE + DFS_HANDLE }; /************************** O P T I O N S *****************************/ @@ -194,7 +194,7 @@ static d_hash_table_ops_t hdl_hash_ops = { /* Distribute process 0's pool or container handle to others. */ static void -HandleDistribute(daos_handle_t *handle, enum handleType type) +HandleDistribute(enum handleType type) { d_iov_t global; int rc; @@ -203,13 +203,15 @@ HandleDistribute(daos_handle_t *handle, enum handleType type) global.iov_buf_len = 0; global.iov_len = 0; - assert(type == POOL_HANDLE || type == CONT_HANDLE); + assert(type == POOL_HANDLE || type == CONT_HANDLE || type == DFS_HANDLE); if (rank == 0) { /* Get the global handle size. */ if (type == POOL_HANDLE) - rc = daos_pool_local2global(*handle, &global); + rc = daos_pool_local2global(poh, &global); + else if (type == CONT_HANDLE) + rc = daos_cont_local2global(coh, &global); else - rc = daos_cont_local2global(*handle, &global); + rc = dfs_local2global(dfs, &global); DCHECK(rc, "Failed to get global handle size"); } @@ -224,9 +226,11 @@ HandleDistribute(daos_handle_t *handle, enum handleType type) if (rank == 0) { if (type == POOL_HANDLE) - rc = daos_pool_local2global(*handle, &global); + rc = daos_pool_local2global(poh, &global); + else if (type == CONT_HANDLE) + rc = daos_cont_local2global(coh, &global); else - rc = daos_cont_local2global(*handle, &global); + rc = dfs_local2global(dfs, &global); DCHECK(rc, "Failed to create global handle"); } @@ -236,9 +240,11 @@ HandleDistribute(daos_handle_t *handle, enum handleType type) if (rank != 0) { if (type == POOL_HANDLE) - rc = daos_pool_global2local(global, handle); + rc = daos_pool_global2local(global, &poh); + else if (type == CONT_HANDLE) + rc = daos_cont_global2local(poh, global, &coh); else - rc = daos_cont_global2local(poh, global, handle); + rc = dfs_global2local(poh, coh, 0, global, &dfs); DCHECK(rc, "Failed to get local handle"); } @@ -435,13 +441,14 @@ DFS_Init() { } else if (rc) { DCHECK(rc, "Failed to create container"); } + + rc = dfs_mount(poh, coh, O_RDWR, &dfs); + DCHECK(rc, "Failed to mount DFS namespace"); } - HandleDistribute(&poh, POOL_HANDLE); - HandleDistribute(&coh, CONT_HANDLE); - - rc = dfs_mount(poh, coh, O_RDWR, &dfs); - DCHECK(rc, "Failed to mount DFS namespace"); + HandleDistribute(POOL_HANDLE); + HandleDistribute(CONT_HANDLE); + HandleDistribute(DFS_HANDLE); if (o.prefix) { rc = dfs_set_prefix(dfs, o.prefix); From 48eb1880e92d8580ad5cab24ecc690526698271e Mon Sep 17 00:00:00 2001 From: "Julian M. Kunkel" Date: Tue, 21 Apr 2020 10:35:53 +0100 Subject: [PATCH 27/52] For better testing: Fixed fake tasks per node to work with MPI3, added environment variable to fake num nodes. --- src/utilities.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/src/utilities.c b/src/utilities.c index a657d9f..34222e0 100755 --- a/src/utilities.c +++ b/src/utilities.c @@ -272,6 +272,15 @@ int QueryNodeMapping(MPI_Comm comm, int print_nodemap) { * tasks on node rank 0. */ int GetNumNodes(MPI_Comm comm) { + if (getenv("IOR_FAKE_NODES")){ + int numNodes = atoi(getenv("IOR_FAKE_NODES")); + int rank; + MPI_Comm_rank(comm, & rank); + if(rank == 0){ + printf("Fake number of node: using %d\n", numNodes); + } + return numNodes; + } #if MPI_VERSION >= 3 MPI_Comm shared_comm; int shared_rank = 0; @@ -338,6 +347,15 @@ int GetNumTasks(MPI_Comm comm) { * method will return the same value it always has. */ int GetNumTasksOnNode0(MPI_Comm comm) { + if (getenv("IOR_FAKE_TASK_PER_NODES")){ + int tasksPerNode = atoi(getenv("IOR_FAKE_TASK_PER_NODES")); + int rank; + MPI_Comm_rank(comm, & rank); + if(rank == 0){ + printf("Fake tasks per node: using %d\n", tasksPerNode); + } + return tasksPerNode; + } #if MPI_VERSION >= 3 MPI_Comm shared_comm; int shared_rank = 0; @@ -368,15 +386,6 @@ int GetNumTasksOnNode0(MPI_Comm comm) { int size; MPI_Comm_size(comm, & size); /* for debugging and testing */ - if (getenv("IOR_FAKE_TASK_PER_NODES")){ - int tasksPerNode = atoi(getenv("IOR_FAKE_TASK_PER_NODES")); - int rank; - MPI_Comm_rank(comm, & rank); - if(rank == 0){ - printf("Fake tasks per node: using %d\n", tasksPerNode); - } - return tasksPerNode; - } char localhost[MAX_PATHLEN], hostname[MAX_PATHLEN]; int count = 1, From a536649abb4335719dd503337778c64cfbdd0d5b Mon Sep 17 00:00:00 2001 From: "Julian M. Kunkel" Date: Wed, 20 May 2020 17:46:35 +0100 Subject: [PATCH 28/52] Clarified some issues in the test framework and added example test. #219 --- configure.ac | 1 + src/Makefile.am | 10 +--------- src/ior-internal.h | 3 +++ src/ior.c | 6 ++---- src/test/Makefile.am | 8 ++++++++ src/test/example.c | 31 +++++++++++++++++++++++++++++++ 6 files changed, 46 insertions(+), 13 deletions(-) create mode 100755 src/test/Makefile.am create mode 100644 src/test/example.c diff --git a/configure.ac b/configure.ac index 0cb99c4..cd71b39 100755 --- a/configure.ac +++ b/configure.ac @@ -348,6 +348,7 @@ AM_CONDITIONAL([USE_CAPS], [test x$enable_caps = xyes]) AC_CONFIG_FILES([Makefile src/Makefile + src/test/Makefile contrib/Makefile doc/Makefile]) AC_OUTPUT diff --git a/src/Makefile.am b/src/Makefile.am index 1c37a6e..3786560 100755 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS = . +SUBDIRS = . test bin_PROGRAMS = ior mdtest if USE_CAPS @@ -123,11 +123,3 @@ MDTEST_CPPFLAGS = $(mdtest_CPPFLAGS) libaiori_a_SOURCES += $(extraSOURCES) libaiori_a_CPPFLAGS = $(extraCPPFLAGS) - - -TESTS = testlib -bin_PROGRAMS += testlib - -testlib_SOURCES = ./test/lib.c -testlib_LDFLAGS = $(extraLDFLAGS) -testlib_LDADD = libaiori.a $(extraLDADD) diff --git a/src/ior-internal.h b/src/ior-internal.h index 7daf8de..9cc8406 100644 --- a/src/ior-internal.h +++ b/src/ior-internal.h @@ -26,6 +26,9 @@ void PrintTestEnds(); void PrintTableHeader(); /* End of ior-output */ +IOR_offset_t *GetOffsetArraySequential(IOR_param_t * test, int pretendRank); +IOR_offset_t *GetOffsetArrayRandom(IOR_param_t * test, int pretendRank, int access); + struct results { double min; double max; diff --git a/src/ior.c b/src/ior.c index c831a84..2237cc3 100755 --- a/src/ior.c +++ b/src/ior.c @@ -1731,8 +1731,7 @@ static void ValidateTests(IOR_param_t * test) * @param pretendRank int pretended Rank for shifting the offsest corectly * @return IOR_offset_t */ -static IOR_offset_t *GetOffsetArraySequential(IOR_param_t * test, - int pretendRank) +IOR_offset_t *GetOffsetArraySequential(IOR_param_t * test, int pretendRank) { IOR_offset_t i, j, k = 0; IOR_offset_t offsets; @@ -1781,8 +1780,7 @@ static IOR_offset_t *GetOffsetArraySequential(IOR_param_t * test, * @return IOR_offset_t * @return */ -static IOR_offset_t *GetOffsetArrayRandom(IOR_param_t * test, int pretendRank, - int access) +IOR_offset_t *GetOffsetArrayRandom(IOR_param_t * test, int pretendRank, int access) { int seed; IOR_offset_t i, value, tmp; diff --git a/src/test/Makefile.am b/src/test/Makefile.am new file mode 100755 index 0000000..1f2b141 --- /dev/null +++ b/src/test/Makefile.am @@ -0,0 +1,8 @@ +LDFLAGS = $(extraLDFLAGS) +LDADD = ../libaiori.a $(extraLDADD) + +# Add test here +TESTS = testlib testexample +check_PROGRAMS = $(TESTS) +testexample_SOURCES = example.c +testlib_SOURCES = lib.c diff --git a/src/test/example.c b/src/test/example.c new file mode 100644 index 0000000..5bb4b2b --- /dev/null +++ b/src/test/example.c @@ -0,0 +1,31 @@ +#include + +#include +#include + +// build a single test via, e.g., mpicc example.c -I ../src/ ../src/libaiori.a -lm + +int main(){ + IOR_param_t test; + init_IOR_Param_t(& test); + test.blockSize = 10; + test.transferSize = 10; + test.segmentCount = 5; + test.numTasks = 2; + + // having an individual file + test.filePerProc = 1; + + IOR_offset_t * offsets; + offsets = GetOffsetArraySequential(& test, 0); + assert(offsets[0] == 0); + assert(offsets[1] == 10); + assert(offsets[2] == 20); + assert(offsets[3] == 30); + assert(offsets[4] == 40); + // for(int i = 0; i < test.segmentCount; i++){ + // printf("%lld\n", (long long int) offsets[i]); + // } + printf("OK\n"); + return 0; +} From 4b417ef1f3e3386164884ab3cab512f938fd4789 Mon Sep 17 00:00:00 2001 From: "Julian M. Kunkel" Date: Thu, 28 May 2020 19:05:41 +0100 Subject: [PATCH 29/52] IOR shouldn't fail if it cannot determine file system sizes but warn. Functionality should presumably be moved into AIORI backends. --- src/mdtest.c | 2 +- src/utilities.c | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/mdtest.c b/src/mdtest.c index 3b478ca..e0e7bbb 100644 --- a/src/mdtest.c +++ b/src/mdtest.c @@ -1514,7 +1514,7 @@ void show_file_system_size(char *file_system) { * 100; if (realpath(file_system, real_path) == NULL) { - FAIL("unable to use realpath() on file system %s", file_system); + WARN("unable to use realpath() on file system"); } diff --git a/src/utilities.c b/src/utilities.c index 34222e0..bcb1e03 100755 --- a/src/utilities.c +++ b/src/utilities.c @@ -565,7 +565,7 @@ IOR_offset_t StringToBytes(char *size_str) /* * Displays size of file system and percent of data blocks and inodes used. */ -void ShowFileSystemSize(char *fileSystem) +void ShowFileSystemSize(char *fileSystem) // this might be converted to an AIORI call { #ifndef _WIN32 /* FIXME */ char realPath[PATH_MAX]; @@ -585,11 +585,13 @@ void ShowFileSystemSize(char *fileSystem) #ifdef __sun if (statvfs(fileSystem, &statusBuffer) != 0) { - ERR("unable to statvfs() file system"); + WARN("unable to statvfs() file system"); + return; } #else /* !__sun */ if (statfs(fileSystem, &statusBuffer) != 0) { - ERR("unable to statfs() file system"); + WARN("unable to statfs() file system"); + return; } #endif /* __sun */ @@ -620,7 +622,8 @@ void ShowFileSystemSize(char *fileSystem) /* show results */ if (realpath(fileSystem, realPath) == NULL) { - ERR("unable to use realpath()"); + WARN("unable to use realpath()"); + return; } if(outputFormat == OUTPUT_DEFAULT){ From 28fae361f40e95899a1d027c0ec6ac58312c381a Mon Sep 17 00:00:00 2001 From: Mohamad Chaarawi Date: Thu, 28 May 2020 18:34:31 +0000 Subject: [PATCH 30/52] dfs: add DFS sync call Signed-off-by: Mohamad Chaarawi --- src/aiori-DFS.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/aiori-DFS.c b/src/aiori-DFS.c index f8c6ce9..6487488 100755 --- a/src/aiori-DFS.c +++ b/src/aiori-DFS.c @@ -102,6 +102,7 @@ static void DFS_Close(void *, IOR_param_t *); static void DFS_Delete(char *, IOR_param_t *); static char* DFS_GetVersion(); static void DFS_Fsync(void *, IOR_param_t *); +static void DFS_Sync(IOR_param_t *); static IOR_offset_t DFS_GetFileSize(IOR_param_t *, MPI_Comm, char *); static int DFS_Statfs (const char *, ior_aiori_statfs_t *, IOR_param_t *); static int DFS_Stat (const char *, struct stat *, IOR_param_t *); @@ -123,6 +124,7 @@ ior_aiori_t dfs_aiori = { .delete = DFS_Delete, .get_version = DFS_GetVersion, .fsync = DFS_Fsync, + .sync = DFS_Sync, .get_file_size = DFS_GetFileSize, .statfs = DFS_Statfs, .mkdir = DFS_Mkdir, @@ -132,6 +134,7 @@ ior_aiori_t dfs_aiori = { .initialize = DFS_Init, .finalize = DFS_Finalize, .get_options = DFS_options, + .enable_mdtest = true, }; /***************************** F U N C T I O N S ******************************/ @@ -658,6 +661,18 @@ DFS_Xfer(int access, void *file, IOR_size_t *buffer, IOR_offset_t length, static void DFS_Fsync(void *fd, IOR_param_t * param) { + /* no cache in DFS, so this is a no-op currently */ + dfs_sync(dfs); + return; +} + +/* + * Perform sync() on the dfs mount. + */ +static void +DFS_Sync(IOR_param_t * param) +{ + /* no cache in DFS, so this is a no-op currently */ dfs_sync(dfs); return; } From f97090a86bd3398c671364f5eb37fc9e3500bbae Mon Sep 17 00:00:00 2001 From: "Julian M. Kunkel" Date: Thu, 28 May 2020 20:11:52 +0100 Subject: [PATCH 31/52] Typo fix. --- src/mdtest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mdtest.c b/src/mdtest.c index e0e7bbb..5e792a1 100644 --- a/src/mdtest.c +++ b/src/mdtest.c @@ -274,7 +274,7 @@ static void prep_testdir(int j, int dir_iter){ static void phase_end(){ if (call_sync){ if(! backend->sync){ - FAIL("Error, backend does not provide the sync method, but your requested to use sync."); + FAIL("Error, backend does not provide the sync method, but you requested to use sync."); } backend->sync(& param); } From 4eb0ebec55d56194b0ef13cd3bc1f12ab1bbe4ee Mon Sep 17 00:00:00 2001 From: "Julian M. Kunkel" Date: Thu, 28 May 2020 21:13:45 +0100 Subject: [PATCH 32/52] Add dummy sync to dummy backend. --- src/aiori-DUMMY.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/aiori-DUMMY.c b/src/aiori-DUMMY.c index 90fec9a..f368c79 100755 --- a/src/aiori-DUMMY.c +++ b/src/aiori-DUMMY.c @@ -76,6 +76,11 @@ static void DUMMY_Fsync(void *fd, IOR_param_t * param) } } + +static void DUMMY_Sync(IOR_param_t * param) +{ +} + static void DUMMY_Close(void *fd, IOR_param_t * param) { if(verbose > 4){ @@ -143,7 +148,7 @@ static int DUMMY_stat (const char *path, struct stat *buf, IOR_param_t * param){ return 0; } -static int DUMMY_check_params(IOR_param_t * test){ +static int DUMMY_check_params(IOR_param_t * test){ return 1; } @@ -167,5 +172,7 @@ ior_aiori_t dummy_aiori = { .finalize = NULL, .get_options = DUMMY_options, .enable_mdtest = true, - .check_params = DUMMY_check_params + .check_params = DUMMY_check_params, + .sync = DUMMY_Sync, + .enable_mdtest = true }; From 153b7aa60fc5e0bc82d86b2487dc3760ce4407c0 Mon Sep 17 00:00:00 2001 From: "Julian M. Kunkel" Date: Thu, 28 May 2020 21:18:44 +0100 Subject: [PATCH 33/52] Critical bugfix for ior API (used e.g. in IO500) TODO: Check potential issue when using IOR scripts with different backends. --- src/ior.c | 4 +++- src/mdtest.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ior.c b/src/ior.c index 2237cc3..05070b0 100755 --- a/src/ior.c +++ b/src/ior.c @@ -76,6 +76,7 @@ IOR_test_t * ior_run(int argc, char **argv, MPI_Comm world_com, FILE * world_out /* perform each test */ for (tptr = tests_head; tptr != NULL; tptr = tptr->next) { + aiori_initialize(tptr); totalErrorCount = 0; verbose = tptr->params.verbose; backend = tptr->params.backend; @@ -85,6 +86,7 @@ IOR_test_t * ior_run(int argc, char **argv, MPI_Comm world_com, FILE * world_out TestIoSys(tptr); tptr->results->errors = totalErrorCount; ShowTestEnd(tptr); + aiori_finalize(tptr); } PrintLongSummaryAllTests(tests_head); @@ -123,7 +125,7 @@ int ior_main(int argc, char **argv) InitTests(tests_head, mpi_comm_world); verbose = tests_head->params.verbose; - aiori_initialize(tests_head); + aiori_initialize(tests_head); // this is quite suspicious, likely an error when multiple tests need to be executed with different backends and options PrintHeader(argc, argv); diff --git a/src/mdtest.c b/src/mdtest.c index 5e792a1..f82db1b 100644 --- a/src/mdtest.c +++ b/src/mdtest.c @@ -274,7 +274,7 @@ static void prep_testdir(int j, int dir_iter){ static void phase_end(){ if (call_sync){ if(! backend->sync){ - FAIL("Error, backend does not provide the sync method, but you requested to use sync."); + FAIL("Error, backend does not provide the sync method, but you requested to use sync.\n"); } backend->sync(& param); } From 8abb7a62dcb1c30b05f071da3150d4cb07f5a04d Mon Sep 17 00:00:00 2001 From: Mark Nelson Date: Thu, 28 May 2020 22:28:16 +0000 Subject: [PATCH 34/52] src/aiori-CEPHFS: Add sync Signed-off-by: Mark Nelson --- src/aiori-CEPHFS.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/aiori-CEPHFS.c b/src/aiori-CEPHFS.c index d5c6154..2c8d34b 100755 --- a/src/aiori-CEPHFS.c +++ b/src/aiori-CEPHFS.c @@ -76,6 +76,7 @@ static int CEPHFS_MkDir(const char *, mode_t, IOR_param_t *); static int CEPHFS_RmDir(const char *, IOR_param_t *); static int CEPHFS_Access(const char *, int, IOR_param_t *); static int CEPHFS_Stat(const char *, struct stat *, IOR_param_t *); +static void CEPHFS_Sync(IOR_param_t *); static option_help * CEPHFS_options(); /************************** D E C L A R A T I O N S ***************************/ @@ -97,6 +98,7 @@ ior_aiori_t cephfs_aiori = { .rmdir = CEPHFS_RmDir, .access = CEPHFS_Access, .stat = CEPHFS_Stat, + .sync = CEPHFS_Sync, .get_options = CEPHFS_options, }; @@ -359,3 +361,12 @@ static int CEPHFS_Stat(const char *testFileName, struct stat *buf, IOR_param_t * { return ceph_stat(cmount, pfix(testFileName), buf); } + +static void CEPHFS_Sync(IOR_param_t *param) +{ + int ret = ceph_sync_fs(cmount); + if (ret < 0) { + CEPHFS_ERR("ceph_sync_fs failed", ret); + } + +} From efc6d4983245f2cea472a928428d9e236f68124f Mon Sep 17 00:00:00 2001 From: Mark Nelson Date: Thu, 28 May 2020 19:32:13 -0500 Subject: [PATCH 35/52] src/aiori-CEPHFS: Add option checks before init Signed-off-by: Mark Nelson --- src/aiori-CEPHFS.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/aiori-CEPHFS.c b/src/aiori-CEPHFS.c index 2c8d34b..0d38901 100755 --- a/src/aiori-CEPHFS.c +++ b/src/aiori-CEPHFS.c @@ -125,6 +125,12 @@ static option_help * CEPHFS_options(){ static void CEPHFS_Init() { + /* Short circuit if the options haven't been filled yet. */ + if (!o.user || !o.conf || !o.prefix) { + WARN("CEPHFS_Init() called before options have been populated!"); + return; + } + /* Short circuit if the mount handle already exists */ if (cmount) { return; From edba70e99c7609a84943c0b2ae7317fbbd71b60e Mon Sep 17 00:00:00 2001 From: Mark Nelson Date: Thu, 28 May 2020 20:18:05 -0500 Subject: [PATCH 36/52] aiori-CEPHFS: don't just unmount on close, release cmount too. Signed-off-by: Mark Nelson --- src/aiori-CEPHFS.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/aiori-CEPHFS.c b/src/aiori-CEPHFS.c index 0d38901..27f12db 100755 --- a/src/aiori-CEPHFS.c +++ b/src/aiori-CEPHFS.c @@ -173,7 +173,15 @@ static void CEPHFS_Init() static void CEPHFS_Final() { /* shutdown */ - ceph_shutdown(cmount); + int ret = ceph_unmount(cmount); + if (ret < 0) { + CEPHFS_ERR("ceph_umount failed", ret); + } + ret = ceph_release(cmount); + if (ret < 0) { + CEPHFS_ERR("ceph_release failed", ret); + } + cmount = NULL; } static void *CEPHFS_Create(char *testFileName, IOR_param_t * param) @@ -273,7 +281,6 @@ static void CEPHFS_Close(void *file, IOR_param_t * param) CEPHFS_ERR("ceph_close failed", ret); } free(file); - return; } From 2de42103112ecdf44de28daf3e22185d239d5f34 Mon Sep 17 00:00:00 2001 From: "Julian M. Kunkel" Date: Fri, 29 May 2020 16:05:42 +0100 Subject: [PATCH 37/52] Provide a string option parser function. --- src/option.c | 10 ++++++++++ src/option.h | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/option.c b/src/option.c index 26c7b2d..2c3e8ef 100644 --- a/src/option.c +++ b/src/option.c @@ -351,6 +351,16 @@ static void option_parse_token(char ** argv, int * flag_parsed_next, int * requi } } +int option_parse_str(char*val, options_all_t * opt_all){ + int flag_parsed_next; + int error = 0; + int requiredArgsSeen = 0; + int print_help = 0; + char * argv[2] = {val, NULL}; + option_parse_token(argv, & flag_parsed_next, & requiredArgsSeen, opt_all, & error, & print_help); + return error; +} + int option_parse_key_value(char * key, char *val, options_all_t * opt_all){ int flag_parsed_next; int error = 0; diff --git a/src/option.h b/src/option.h index 7225921..624da51 100644 --- a/src/option.h +++ b/src/option.h @@ -38,9 +38,9 @@ typedef struct{ int64_t string_to_bytes(char *size_str); void option_print_current(option_help * args); - //@return the number of parsed arguments int option_parse(int argc, char ** argv, options_all_t * args); +int option_parse_str(char*val, options_all_t * opt_all); /* Parse a single line */ int option_parse_key_value(char * key, char * value, options_all_t * opt_all); From 1890aaaeb096b178a29cb79fa65e6c61b43acc66 Mon Sep 17 00:00:00 2001 From: "Julian M. Kunkel" Date: Sat, 30 May 2020 18:19:48 +0100 Subject: [PATCH 38/52] Started to move IOR specific knowledge out of AIORI. For now, and compatibility, IOR options can still be set/internally accessed using the backends init_xfer_options. This should be removed in the long run to strip away this dependency. --- src/aiori-DUMMY.c | 63 ++++++++---- src/aiori-MMAP.c | 80 +++++++++------ src/aiori-MPIIO.c | 243 ++++++++++++++++++++++++++++---------------- src/aiori-POSIX.c | 66 ++++++------ src/aiori-S3.c | 12 +-- src/aiori.c | 96 +---------------- src/aiori.h | 64 ++++++------ src/ior-output.c | 6 -- src/ior.c | 108 +++++++------------- src/ior.h | 12 +-- src/mdtest.c | 19 ++-- src/parse_options.c | 40 +------- 12 files changed, 371 insertions(+), 438 deletions(-) diff --git a/src/aiori-DUMMY.c b/src/aiori-DUMMY.c index f368c79..c58a128 100755 --- a/src/aiori-DUMMY.c +++ b/src/aiori-DUMMY.c @@ -46,12 +46,17 @@ static option_help * DUMMY_options(void ** init_backend_options, void * init_val return help; } -static void *DUMMY_Create(char *testFileName, IOR_param_t * param) +static int count_init = 0; + +static void *DUMMY_Create(char *testFileName, int iorflags, void * param) { + if(count_init <= 0){ + ERR("DUMMY missing initialization in create\n"); + } if(verbose > 4){ fprintf(out_logfile, "DUMMY create: %s = %p\n", testFileName, current); } - dummy_options_t * o = (dummy_options_t*) param->backend_options; + dummy_options_t * o = (dummy_options_t*) param; if (o->delay_creates){ if (! o->delay_rank_0_only || (o->delay_rank_0_only && rank == 0)){ struct timespec wait = { o->delay_creates / 1000 / 1000, 1000l * (o->delay_creates % 1000000)}; @@ -61,15 +66,18 @@ static void *DUMMY_Create(char *testFileName, IOR_param_t * param) return current++; } -static void *DUMMY_Open(char *testFileName, IOR_param_t * param) +static void *DUMMY_Open(char *testFileName, int flags, void * param) { + if(count_init <= 0){ + ERR("DUMMY missing initialization in open\n"); + } if(verbose > 4){ fprintf(out_logfile, "DUMMY open: %s = %p\n", testFileName, current); } return current++; } -static void DUMMY_Fsync(void *fd, IOR_param_t * param) +static void DUMMY_Fsync(void *fd, void * param) { if(verbose > 4){ fprintf(out_logfile, "DUMMY fsync %p\n", fd); @@ -77,18 +85,18 @@ static void DUMMY_Fsync(void *fd, IOR_param_t * param) } -static void DUMMY_Sync(IOR_param_t * param) +static void DUMMY_Sync(void * param) { } -static void DUMMY_Close(void *fd, IOR_param_t * param) +static void DUMMY_Close(void *fd, void * param) { if(verbose > 4){ fprintf(out_logfile, "DUMMY close %p\n", fd); } } -static void DUMMY_Delete(char *testFileName, IOR_param_t * param) +static void DUMMY_Delete(char *testFileName, void * param) { if(verbose > 4){ fprintf(out_logfile, "DUMMY delete: %s\n", testFileName); @@ -100,7 +108,7 @@ static char * DUMMY_getVersion() return "0.5"; } -static IOR_offset_t DUMMY_GetFileSize(IOR_param_t * test, MPI_Comm testComm, char *testFileName) +static IOR_offset_t DUMMY_GetFileSize(void * test, MPI_Comm testComm, char *testFileName) { if(verbose > 4){ fprintf(out_logfile, "DUMMY getFileSize: %s\n", testFileName); @@ -108,11 +116,11 @@ static IOR_offset_t DUMMY_GetFileSize(IOR_param_t * test, MPI_Comm testComm, cha return 0; } -static IOR_offset_t DUMMY_Xfer(int access, void *file, IOR_size_t * buffer, IOR_offset_t length, IOR_param_t * param){ +static IOR_offset_t DUMMY_Xfer(int access, void *file, IOR_size_t * buffer, IOR_offset_t length, void * param){ if(verbose > 4){ fprintf(out_logfile, "DUMMY xfer: %p\n", file); } - dummy_options_t * o = (dummy_options_t*) param->backend_options; + dummy_options_t * o = (dummy_options_t*) param; if (o->delay_xfer){ if (! o->delay_rank_0_only || (o->delay_rank_0_only && rank == 0)){ struct timespec wait = {o->delay_xfer / 1000 / 1000, 1000l * (o->delay_xfer % 1000000)}; @@ -122,7 +130,7 @@ static IOR_offset_t DUMMY_Xfer(int access, void *file, IOR_size_t * buffer, IOR_ return length; } -static int DUMMY_statfs (const char * path, ior_aiori_statfs_t * stat, IOR_param_t * param){ +static int DUMMY_statfs (const char * path, ior_aiori_statfs_t * stat, void * param){ stat->f_bsize = 1; stat->f_blocks = 1; stat->f_bfree = 1; @@ -132,26 +140,40 @@ static int DUMMY_statfs (const char * path, ior_aiori_statfs_t * stat, IOR_param return 0; } -static int DUMMY_mkdir (const char *path, mode_t mode, IOR_param_t * param){ +static int DUMMY_mkdir (const char *path, mode_t mode, void * param){ return 0; } -static int DUMMY_rmdir (const char *path, IOR_param_t * param){ +static int DUMMY_rmdir (const char *path, void * param){ return 0; } -static int DUMMY_access (const char *path, int mode, IOR_param_t * param){ +static int DUMMY_access (const char *path, int mode, void * param){ return 0; } -static int DUMMY_stat (const char *path, struct stat *buf, IOR_param_t * param){ +static int DUMMY_stat (const char *path, struct stat *buf, void * param){ return 0; } -static int DUMMY_check_params(IOR_param_t * test){ - return 1; +static int DUMMY_check_params(void * test){ + return 0; } +static void DUMMY_init(void * options){ + WARN("DUMMY initialized"); + count_init++; +} + +static void DUMMY_final(void * options){ + WARN("DUMMY finalized"); + if(count_init <= 0){ + ERR("DUMMY invalid finalization\n"); + } + count_init--; +} + + ior_aiori_t dummy_aiori = { .name = "DUMMY", .name_legacy = NULL, @@ -168,11 +190,10 @@ ior_aiori_t dummy_aiori = { .rmdir = DUMMY_rmdir, .access = DUMMY_access, .stat = DUMMY_stat, - .initialize = NULL, - .finalize = NULL, + .initialize = DUMMY_init, + .finalize = DUMMY_final, .get_options = DUMMY_options, - .enable_mdtest = true, .check_params = DUMMY_check_params, .sync = DUMMY_Sync, - .enable_mdtest = true + .enable_mdtest = true }; diff --git a/src/aiori-MMAP.c b/src/aiori-MMAP.c index 7be860a..0b55557 100644 --- a/src/aiori-MMAP.c +++ b/src/aiori-MMAP.c @@ -26,14 +26,15 @@ #include "utilities.h" /**************************** P R O T O T Y P E S *****************************/ -static void *MMAP_Create(char *, IOR_param_t *); -static void *MMAP_Open(char *, IOR_param_t *); +static void *MMAP_Create(char *, int flags, void *); +static void *MMAP_Open(char *, int flags, void *); static IOR_offset_t MMAP_Xfer(int, void *, IOR_size_t *, - IOR_offset_t, IOR_param_t *); -static void MMAP_Close(void *, IOR_param_t *); -static void MMAP_Fsync(void *, IOR_param_t *); + IOR_offset_t, void *); +static void MMAP_Close(void *, void *); +static void MMAP_Fsync(void *, void *); static option_help * MMAP_options(void ** init_backend_options, void * init_values); - +static void MMAP_init_xfer_options(IOR_param_t * params); +static int MMAP_check_params(void * options); /************************** D E C L A R A T I O N S ***************************/ ior_aiori_t mmap_aiori = { @@ -43,10 +44,12 @@ ior_aiori_t mmap_aiori = { .xfer = MMAP_Xfer, .close = MMAP_Close, .delete = POSIX_Delete, + .init_xfer_options = MMAP_init_xfer_options, .get_version = aiori_get_version, .fsync = MMAP_Fsync, .get_file_size = POSIX_GetFileSize, .get_options = MMAP_options, + .check_params = MMAP_check_params }; /***************************** F U N C T I O N S ******************************/ @@ -79,25 +82,37 @@ static option_help * MMAP_options(void ** init_backend_options, void * init_valu return help; } -static void ior_mmap_file(int *file, IOR_param_t *param) +static IOR_param_t * ior_param = NULL; + +static void MMAP_init_xfer_options(IOR_param_t * params){ + ior_param = params; +} + +static int MMAP_check_params(void * options){ + if (ior_param->fsyncPerWrite && (ior_param->transferSize & (sysconf(_SC_PAGESIZE) - 1))) + ERR("transfer size must be aligned with PAGESIZE for MMAP with fsyncPerWrite"); + return 0; +} + +static void ior_mmap_file(int *file, int mflags, void *param) { int flags = PROT_READ; - IOR_offset_t size = param->expectedAggFileSize; + IOR_offset_t size = ior_param->expectedAggFileSize; - if (param->open == WRITE) + if (mflags & IOR_WRONLY || mflags & IOR_RDWR) flags |= PROT_WRITE; - mmap_options_t *o = (mmap_options_t*) param->backend_options; + mmap_options_t *o = (mmap_options_t*) param; o->mmap_ptr = mmap(NULL, size, flags, MAP_SHARED, *file, 0); if (o->mmap_ptr == MAP_FAILED) ERR("mmap() failed"); - if (param->randomOffset) + if (ior_param->randomOffset) flags = POSIX_MADV_RANDOM; else flags = POSIX_MADV_SEQUENTIAL; - + if(o->madv_pattern){ if (posix_madvise(o->mmap_ptr, size, flags) != 0) ERR("madvise() failed"); @@ -114,26 +129,25 @@ static void ior_mmap_file(int *file, IOR_param_t *param) /* * Creat and open a file through the POSIX interface, then setup mmap. */ -static void *MMAP_Create(char *testFileName, IOR_param_t * param) +static void *MMAP_Create(char *testFileName, int flags, void * param) { int *fd; - fd = POSIX_Create(testFileName, param); - if (ftruncate(*fd, param->expectedAggFileSize) != 0) + fd = POSIX_Create(testFileName, flags, param); + if (ftruncate(*fd, ior_param->expectedAggFileSize) != 0) ERR("ftruncate() failed"); - ior_mmap_file(fd, param); + ior_mmap_file(fd, flags, param); return ((void *)fd); } /* * Open a file through the POSIX interface and setup mmap. */ -static void *MMAP_Open(char *testFileName, IOR_param_t * param) +static void *MMAP_Open(char *testFileName, int flags, void * param) { int *fd; - - fd = POSIX_Open(testFileName, param); - ior_mmap_file(fd, param); + fd = POSIX_Open(testFileName, flags, param); + ior_mmap_file(fd, flags, param); return ((void *)fd); } @@ -141,19 +155,19 @@ static void *MMAP_Open(char *testFileName, IOR_param_t * param) * Write or read access to file using mmap */ static IOR_offset_t MMAP_Xfer(int access, void *file, IOR_size_t * buffer, - IOR_offset_t length, IOR_param_t * param) + IOR_offset_t length, void * param) { - mmap_options_t *o = (mmap_options_t*) param->backend_options; + mmap_options_t *o = (mmap_options_t*) param; if (access == WRITE) { - memcpy(o->mmap_ptr + param->offset, buffer, length); + memcpy(o->mmap_ptr + ior_param->offset, buffer, length); } else { - memcpy(buffer, o->mmap_ptr + param->offset, length); + memcpy(buffer, o->mmap_ptr + ior_param->offset, length); } - if (param->fsyncPerWrite == TRUE) { - if (msync(o->mmap_ptr + param->offset, length, MS_SYNC) != 0) + if (ior_param->fsyncPerWrite == TRUE) { + if (msync(o->mmap_ptr + ior_param->offset, length, MS_SYNC) != 0) ERR("msync() failed"); - if (posix_madvise(o->mmap_ptr + param->offset, length, + if (posix_madvise(o->mmap_ptr + ior_param->offset, length, POSIX_MADV_DONTNEED) != 0) ERR("madvise() failed"); } @@ -163,20 +177,20 @@ static IOR_offset_t MMAP_Xfer(int access, void *file, IOR_size_t * buffer, /* * Perform msync(). */ -static void MMAP_Fsync(void *fd, IOR_param_t * param) +static void MMAP_Fsync(void *fd, void * param) { - mmap_options_t *o = (mmap_options_t*) param->backend_options; - if (msync(o->mmap_ptr, param->expectedAggFileSize, MS_SYNC) != 0) + mmap_options_t *o = (mmap_options_t*) param; + if (msync(o->mmap_ptr, ior_param->expectedAggFileSize, MS_SYNC) != 0) EWARN("msync() failed"); } /* * Close a file through the POSIX interface, after tear down the mmap. */ -static void MMAP_Close(void *fd, IOR_param_t * param) +static void MMAP_Close(void *fd, void * param) { - mmap_options_t *o = (mmap_options_t*) param->backend_options; - if (munmap(o->mmap_ptr, param->expectedAggFileSize) != 0) + mmap_options_t *o = (mmap_options_t*) param; + if (munmap(o->mmap_ptr, ior_param->expectedAggFileSize) != 0) ERR("munmap failed"); o->mmap_ptr = NULL; POSIX_Close(fd, param); diff --git a/src/aiori-MPIIO.c b/src/aiori-MPIIO.c index 04c10be..443230b 100755 --- a/src/aiori-MPIIO.c +++ b/src/aiori-MPIIO.c @@ -31,23 +31,61 @@ /**************************** P R O T O T Y P E S *****************************/ -static IOR_offset_t SeekOffset(MPI_File, IOR_offset_t, IOR_param_t *); +static IOR_offset_t SeekOffset(MPI_File, IOR_offset_t, void *); -static void *MPIIO_Create(char *, IOR_param_t *); -static void *MPIIO_Open(char *, IOR_param_t *); +static void *MPIIO_Create(char *, int iorflags, void *); +static void *MPIIO_Open(char *, int flags, void *); static IOR_offset_t MPIIO_Xfer(int, void *, IOR_size_t *, - IOR_offset_t, IOR_param_t *); -static void MPIIO_Close(void *, IOR_param_t *); + IOR_offset_t, void *); +static void MPIIO_Close(void *, void *); static char* MPIIO_GetVersion(); -static void MPIIO_Fsync(void *, IOR_param_t *); - +static void MPIIO_Fsync(void *, void *); +static void MPIIO_init_xfer_options(IOR_param_t * params); +static int MPIIO_check_params(void * options); /************************** D E C L A R A T I O N S ***************************/ +typedef struct { + int dry_run; + int showHints; /* show hints */ + int useFileView; /* use MPI_File_set_view */ + int preallocate; /* preallocate file size */ + int useSharedFilePointer; /* use shared file pointer */ + int useStridedDatatype; /* put strided access into datatype */ + char * hintsFileName; /* full name for hints file */ +} mpiio_options_t; + +static option_help * MPIIO_options(void ** init_backend_options, void * init_values){ + mpiio_options_t * o = malloc(sizeof(mpiio_options_t)); + if (init_values != NULL){ + memcpy(o, init_values, sizeof(mpiio_options_t)); + }else{ + memset(o, 0, sizeof(mpiio_options_t)); + } + *init_backend_options = o; + + option_help h [] = { + {0, "mpiio.dryRun", "Dry run, disable actual IO", OPTION_FLAG, 'd', & o->dry_run}, + {0, "mpiio.hintsFileName","Full name for hints file", OPTION_OPTIONAL_ARGUMENT, 's', & o->hintsFileName}, + {0, "mpiio.showHints", "Show MPI hints", OPTION_FLAG, 'd', & o->showHints}, + {0, "mpiio.preallocate", "Preallocate file size", OPTION_FLAG, 'd', & o->preallocate}, + {0, "mpiio.useStridedDatatype", "put strided access into datatype [not working]", OPTION_FLAG, 'd', & o->useStridedDatatype}, + //{'P', NULL, "useSharedFilePointer -- use shared file pointer [not working]", OPTION_FLAG, 'd', & params->useSharedFilePointer}, + {0, "mpiio.useFileView", "Use MPI_File_set_view", OPTION_FLAG, 'd', & o->useFileView}, + LAST_OPTION + }; + option_help * help = malloc(sizeof(h)); + memcpy(help, h, sizeof(h)); + return help; +} + + ior_aiori_t mpiio_aiori = { .name = "MPIIO", .name_legacy = NULL, .create = MPIIO_Create, + .get_options = MPIIO_options, + .init_xfer_options = MPIIO_init_xfer_options, .open = MPIIO_Open, .xfer = MPIIO_Xfer, .close = MPIIO_Close, @@ -60,16 +98,46 @@ ior_aiori_t mpiio_aiori = { .rmdir = aiori_posix_rmdir, .access = MPIIO_Access, .stat = aiori_posix_stat, + .check_params = MPIIO_check_params }; /***************************** F U N C T I O N S ******************************/ +static IOR_param_t * ior_param = NULL; + +static void MPIIO_init_xfer_options(IOR_param_t * params){ + ior_param = params; +} + +static int MPIIO_check_params(void * module_options){ + mpiio_options_t * param = (mpiio_options_t*) module_options; + if ((param->useFileView == TRUE) + && (sizeof(MPI_Aint) < 8) /* used for 64-bit datatypes */ + &&((ior_param->numTasks * ior_param->blockSize) > + (2 * (IOR_offset_t) GIBIBYTE))) + ERR("segment size must be < 2GiB"); + if (param->useSharedFilePointer) + ERR("shared file pointer not implemented"); + if (param->useStridedDatatype) + ERR("strided datatype not implemented"); + if (param->useStridedDatatype && (ior_param->blockSize < sizeof(IOR_size_t) + || ior_param->transferSize < + sizeof(IOR_size_t))) + ERR("need larger file size for strided datatype in MPIIO"); + if (ior_param->randomOffset && ior_param->collective) + ERR("random offset not available with collective MPIIO"); + if (ior_param->randomOffset && param->useFileView) + ERR("random offset not available with MPIIO fileviews"); + + return 0; +} /* * Try to access a file through the MPIIO interface. */ -int MPIIO_Access(const char *path, int mode, IOR_param_t *param) +int MPIIO_Access(const char *path, int mode, void *module_options) { - if(param->dryRun){ + mpiio_options_t * param = (mpiio_options_t*) module_options; + if(param->dry_run){ return MPI_SUCCESS; } MPI_File fd; @@ -98,23 +166,21 @@ int MPIIO_Access(const char *path, int mode, IOR_param_t *param) /* * Create and open a file through the MPIIO interface. */ -static void *MPIIO_Create(char *testFileName, IOR_param_t * param) +static void *MPIIO_Create(char *testFileName, int iorflags, void * module_options) { - if(param->dryRun){ - return 0; - } - return MPIIO_Open(testFileName, param); + return MPIIO_Open(testFileName, iorflags, module_options); } /* * Open a file through the MPIIO interface. Setup file view. */ -static void *MPIIO_Open(char *testFileName, IOR_param_t * param) +static void *MPIIO_Open(char *testFileName, int flags, void * module_options) { + mpiio_options_t * param = (mpiio_options_t*) module_options; int fd_mode = (int)0, offsetFactor, tasksPerFile, - transfersPerBlock = param->blockSize / param->transferSize; + transfersPerBlock = ior_param->blockSize / ior_param->transferSize; struct fileTypeStruct { int globalSizes[2], localSizes[2], startIndices[2]; } fileTypeStruct; @@ -130,28 +196,28 @@ static void *MPIIO_Open(char *testFileName, IOR_param_t * param) /* set IOR file flags to MPIIO flags */ /* -- file open flags -- */ - if (param->openFlags & IOR_RDONLY) { + if (flags & IOR_RDONLY) { fd_mode |= MPI_MODE_RDONLY; } - if (param->openFlags & IOR_WRONLY) { + if (flags & IOR_WRONLY) { fd_mode |= MPI_MODE_WRONLY; } - if (param->openFlags & IOR_RDWR) { + if (flags & IOR_RDWR) { fd_mode |= MPI_MODE_RDWR; } - if (param->openFlags & IOR_APPEND) { + if (flags & IOR_APPEND) { fd_mode |= MPI_MODE_APPEND; } - if (param->openFlags & IOR_CREAT) { + if (flags & IOR_CREAT) { fd_mode |= MPI_MODE_CREATE; } - if (param->openFlags & IOR_EXCL) { + if (flags & IOR_EXCL) { fd_mode |= MPI_MODE_EXCL; } - if (param->openFlags & IOR_TRUNC) { + if (flags & IOR_TRUNC) { fprintf(stdout, "File truncation not implemented in MPIIO\n"); } - if (param->openFlags & IOR_DIRECT) { + if (flags & IOR_DIRECT) { fprintf(stdout, "O_DIRECT not implemented in MPIIO\n"); } @@ -162,7 +228,7 @@ static void *MPIIO_Open(char *testFileName, IOR_param_t * param) */ fd_mode |= MPI_MODE_UNIQUE_OPEN; - if (param->filePerProc) { + if (ior_param->filePerProc) { comm = MPI_COMM_SELF; } else { comm = testComm; @@ -181,13 +247,13 @@ static void *MPIIO_Open(char *testFileName, IOR_param_t * param) ShowHints(&mpiHints); fprintf(stdout, "}\n"); } - if(! param->dryRun){ + if(! param->dry_run){ MPI_CHECKF(MPI_File_open(comm, testFileName, fd_mode, mpiHints, fd), "cannot open file: %s", testFileName); } /* show hints actually attached to file handle */ - if (rank == 0 && param->showHints && ! param->dryRun) { + if (rank == 0 && param->showHints && ! param->dry_run) { if (mpiHints != MPI_INFO_NULL) MPI_CHECK(MPI_Info_free(&mpiHints), "MPI_Info_free failed"); MPI_CHECK(MPI_File_get_info(*fd, &mpiHints), @@ -198,29 +264,29 @@ static void *MPIIO_Open(char *testFileName, IOR_param_t * param) } /* preallocate space for file */ - if (param->preallocate && param->open == WRITE && ! param->dryRun) { + if (param->preallocate && ior_param->open == WRITE && ! param->dry_run) { MPI_CHECK(MPI_File_preallocate(*fd, - (MPI_Offset) (param->segmentCount + (MPI_Offset) (ior_param->segmentCount * - param->blockSize * - param->numTasks)), + ior_param->blockSize * + ior_param->numTasks)), "cannot preallocate file"); } /* create file view */ if (param->useFileView) { /* create contiguous transfer datatype */ MPI_CHECK(MPI_Type_contiguous - (param->transferSize / sizeof(IOR_size_t), - MPI_LONG_LONG_INT, ¶m->transferType), + (ior_param->transferSize / sizeof(IOR_size_t), + MPI_LONG_LONG_INT, &ior_param->transferType), "cannot create contiguous datatype"); - MPI_CHECK(MPI_Type_commit(¶m->transferType), + MPI_CHECK(MPI_Type_commit(&ior_param->transferType), "cannot commit datatype"); - if (param->filePerProc) { + if (ior_param->filePerProc) { offsetFactor = 0; tasksPerFile = 1; } else { - offsetFactor = (rank + rankOffset) % param->numTasks; - tasksPerFile = param->numTasks; + offsetFactor = (rank + rankOffset) % ior_param->numTasks; + tasksPerFile = ior_param->numTasks; } /* @@ -239,15 +305,15 @@ static void *MPIIO_Open(char *testFileName, IOR_param_t * param) (2, fileTypeStruct.globalSizes, fileTypeStruct.localSizes, fileTypeStruct.startIndices, MPI_ORDER_C, - param->transferType, ¶m->fileType), + ior_param->transferType, &ior_param->fileType), "cannot create subarray"); - MPI_CHECK(MPI_Type_commit(¶m->fileType), + MPI_CHECK(MPI_Type_commit(&ior_param->fileType), "cannot commit datatype"); - if(! param->dryRun){ + if(! param->dry_run){ MPI_CHECK(MPI_File_set_view(*fd, (MPI_Offset) 0, - param->transferType, - param->fileType, "native", + ior_param->transferType, + ior_param->fileType, "native", (MPI_Info) MPI_INFO_NULL), "cannot set file view"); } @@ -261,14 +327,14 @@ static void *MPIIO_Open(char *testFileName, IOR_param_t * param) * Write or read access to file using the MPIIO interface. */ static IOR_offset_t MPIIO_Xfer(int access, void *fd, IOR_size_t * buffer, - IOR_offset_t length, IOR_param_t * param) + IOR_offset_t length, void * module_options) { /* NOTE: The second arg is (void *) for reads, and (const void *) for writes. Therefore, one of the two sets of assignments below will get "assignment from incompatible pointer-type" warnings, if we only use this one set of signatures. */ - - if(param->dryRun) + mpiio_options_t * param = (mpiio_options_t*) module_options; + if(param->dry_run) return length; int (MPIAPI * Access) (MPI_File, void *, int, @@ -319,7 +385,7 @@ static IOR_offset_t MPIIO_Xfer(int access, void *fd, IOR_size_t * buffer, */ if (param->useFileView) { /* find offset in file */ - if (SeekOffset(*(MPI_File *) fd, param->offset, param) < + if (SeekOffset(*(MPI_File *) fd, ior_param->offset, param) < 0) { /* if unsuccessful */ length = -1; @@ -331,24 +397,24 @@ static IOR_offset_t MPIIO_Xfer(int access, void *fd, IOR_size_t * buffer, * e.g., 'IOR -s 2 -b 32K -t 32K -a MPIIO -S' */ if (param->useStridedDatatype) { - length = param->segmentCount; + length = ior_param->segmentCount; } else { length = 1; } - if (param->collective) { + if (ior_param->collective) { /* individual, collective call */ MPI_CHECK(Access_all (*(MPI_File *) fd, buffer, length, - param->transferType, &status), + ior_param->transferType, &status), "cannot access collective"); } else { /* individual, noncollective call */ MPI_CHECK(Access (*(MPI_File *) fd, buffer, length, - param->transferType, &status), + ior_param->transferType, &status), "cannot access noncollective"); } - length *= param->transferSize; /* for return value in bytes */ + length *= ior_param->transferSize; /* for return value in bytes */ } } else { /* @@ -358,7 +424,7 @@ static IOR_offset_t MPIIO_Xfer(int access, void *fd, IOR_size_t * buffer, if (param->useSharedFilePointer) { /* find offset in file */ if (SeekOffset - (*(MPI_File *) fd, param->offset, param) < 0) { + (*(MPI_File *) fd, ior_param->offset, param) < 0) { /* if unsuccessful */ length = -1; } else { @@ -374,32 +440,31 @@ static IOR_offset_t MPIIO_Xfer(int access, void *fd, IOR_size_t * buffer, "useSharedFilePointer not implemented\n"); } } else { - if (param->collective) { + if (ior_param->collective) { /* explicit, collective call */ MPI_CHECK(Access_at_all - (*(MPI_File *) fd, param->offset, + (*(MPI_File *) fd, ior_param->offset, buffer, length, MPI_BYTE, &status), "cannot access explicit, collective"); } else { /* explicit, noncollective call */ MPI_CHECK(Access_at - (*(MPI_File *) fd, param->offset, + (*(MPI_File *) fd, ior_param->offset, buffer, length, MPI_BYTE, &status), "cannot access explicit, noncollective"); } } } - if((access == WRITE) && (param->fsyncPerWrite == TRUE)) - MPIIO_Fsync(fd, param); return (length); } /* * Perform fsync(). */ -static void MPIIO_Fsync(void *fdp, IOR_param_t * param) +static void MPIIO_Fsync(void *fdp, void * module_options) { - if(param->dryRun) + mpiio_options_t * param = (mpiio_options_t*) module_options; + if(param->dry_run) return; if (MPI_File_sync(*(MPI_File *)fdp) != MPI_SUCCESS) EWARN("fsync() failed"); @@ -408,29 +473,31 @@ static void MPIIO_Fsync(void *fdp, IOR_param_t * param) /* * Close a file through the MPIIO interface. */ -static void MPIIO_Close(void *fd, IOR_param_t * param) +static void MPIIO_Close(void *fd, void * module_options) { - if(! param->dryRun){ + mpiio_options_t * param = (mpiio_options_t*) module_options; + if(! param->dry_run){ MPI_CHECK(MPI_File_close((MPI_File *) fd), "cannot close file"); } - if ((param->useFileView == TRUE) && (param->fd_fppReadCheck == NULL)) { - /* - * need to free the datatype, so done in the close process - */ - MPI_CHECK(MPI_Type_free(¶m->fileType), - "cannot free MPI file datatype"); - MPI_CHECK(MPI_Type_free(¶m->transferType), - "cannot free MPI transfer datatype"); - } + //if ((param->useFileView == TRUE) && (param->fd_fppReadCheck == NULL)) { + // /* + // * need to free the datatype, so done in the close process + // */ + // MPI_CHECK(MPI_Type_free(¶m->fileType), + // "cannot free MPI file datatype"); + // MPI_CHECK(MPI_Type_free(¶m->transferType), + // "cannot free MPI transfer datatype"); + //} free(fd); } /* * Delete a file through the MPIIO interface. */ -void MPIIO_Delete(char *testFileName, IOR_param_t * param) +void MPIIO_Delete(char *testFileName, void * module_options) { - if(param->dryRun) + mpiio_options_t * param = (mpiio_options_t*) module_options; + if(param->dry_run) return; MPI_CHECKF(MPI_File_delete(testFileName, (MPI_Info) MPI_INFO_NULL), "cannot delete file: %s", testFileName); @@ -452,36 +519,37 @@ static char* MPIIO_GetVersion() * Seek to offset in file using the MPIIO interface. */ static IOR_offset_t SeekOffset(MPI_File fd, IOR_offset_t offset, - IOR_param_t * param) + void * module_options) { + mpiio_options_t * param = (mpiio_options_t*) module_options; int offsetFactor, tasksPerFile; IOR_offset_t tempOffset; tempOffset = offset; - if (param->filePerProc) { + if (ior_param->filePerProc) { offsetFactor = 0; tasksPerFile = 1; } else { - offsetFactor = (rank + rankOffset) % param->numTasks; - tasksPerFile = param->numTasks; + offsetFactor = (rank + rankOffset) % ior_param->numTasks; + tasksPerFile = ior_param->numTasks; } if (param->useFileView) { /* recall that offsets in a file view are counted in units of transfer size */ - if (param->filePerProc) { - tempOffset = tempOffset / param->transferSize; + if (ior_param->filePerProc) { + tempOffset = tempOffset / ior_param->transferSize; } else { /* * this formula finds a file view offset for a task * from an absolute offset */ - tempOffset = ((param->blockSize / param->transferSize) + tempOffset = ((ior_param->blockSize / ior_param->transferSize) * (tempOffset / - (param->blockSize * tasksPerFile))) - + (((tempOffset % (param->blockSize * tasksPerFile)) - - (offsetFactor * param->blockSize)) - / param->transferSize); + (ior_param->blockSize * tasksPerFile))) + + (((tempOffset % (ior_param->blockSize * tasksPerFile)) + - (offsetFactor * ior_param->blockSize)) + / ior_param->transferSize); } } MPI_CHECK(MPI_File_seek(fd, tempOffset, MPI_SEEK_SET), @@ -493,17 +561,18 @@ static IOR_offset_t SeekOffset(MPI_File fd, IOR_offset_t offset, * Use MPI_File_get_size() to return aggregate file size. * NOTE: This function is used by the HDF5 and NCMPI backends. */ -IOR_offset_t MPIIO_GetFileSize(IOR_param_t * test, MPI_Comm testComm, +IOR_offset_t MPIIO_GetFileSize(void * module_options, MPI_Comm testComm, char *testFileName) { - if(test->dryRun) + mpiio_options_t * test = (mpiio_options_t*) module_options; + if(test->dry_run) return 0; IOR_offset_t aggFileSizeFromStat, tmpMin, tmpMax, tmpSum; MPI_File fd; MPI_Comm comm; MPI_Info mpiHints = MPI_INFO_NULL; - if (test->filePerProc == TRUE) { + if (ior_param->filePerProc == TRUE) { comm = MPI_COMM_SELF; } else { comm = testComm; @@ -519,7 +588,7 @@ IOR_offset_t MPIIO_GetFileSize(IOR_param_t * test, MPI_Comm testComm, if (mpiHints != MPI_INFO_NULL) MPI_CHECK(MPI_Info_free(&mpiHints), "MPI_Info_free failed"); - if (test->filePerProc == TRUE) { + if (ior_param->filePerProc == TRUE) { MPI_CHECK(MPI_Allreduce(&aggFileSizeFromStat, &tmpSum, 1, MPI_LONG_LONG_INT, MPI_SUM, testComm), "cannot total data moved"); diff --git a/src/aiori-POSIX.c b/src/aiori-POSIX.c index 463a9c8..f7c9cd3 100755 --- a/src/aiori-POSIX.c +++ b/src/aiori-POSIX.c @@ -69,9 +69,11 @@ /**************************** P R O T O T Y P E S *****************************/ static IOR_offset_t POSIX_Xfer(int, void *, IOR_size_t *, - IOR_offset_t, IOR_param_t *); -static void POSIX_Fsync(void *, IOR_param_t *); -static void POSIX_Sync(IOR_param_t * ); + IOR_offset_t, void *); +static void POSIX_Fsync(void *, void *); +static void POSIX_Sync(void * ); +static void POSIX_init_xfer_options(IOR_param_t * params); + /************************** O P T I O N S *****************************/ typedef struct{ @@ -113,6 +115,7 @@ ior_aiori_t posix_aiori = { .xfer = POSIX_Xfer, .close = POSIX_Close, .delete = POSIX_Delete, + .init_xfer_options = POSIX_init_xfer_options, .get_version = aiori_get_version, .fsync = POSIX_Fsync, .get_file_size = POSIX_GetFileSize, @@ -128,6 +131,11 @@ ior_aiori_t posix_aiori = { /***************************** F U N C T I O N S ******************************/ +static IOR_param_t * ior_param = NULL; + +static void POSIX_init_xfer_options(IOR_param_t * params){ + ior_param = params; +} #ifdef HAVE_GPFS_FCNTL_H void gpfs_free_all_locks(int fd) @@ -151,7 +159,7 @@ void gpfs_free_all_locks(int fd) EWARNF("gpfs_fcntl(%d, ...) release all locks hint failed.", fd); } } -void gpfs_access_start(int fd, IOR_offset_t length, IOR_param_t *param, int access) +void gpfs_access_start(int fd, IOR_offset_t length, void *param, int access) { int rc; struct { @@ -175,7 +183,7 @@ void gpfs_access_start(int fd, IOR_offset_t length, IOR_param_t *param, int acce } } -void gpfs_access_end(int fd, IOR_offset_t length, IOR_param_t *param, int access) +void gpfs_access_end(int fd, IOR_offset_t length, void *param, int access) { int rc; struct { @@ -318,7 +326,7 @@ bool beegfs_createFilePath(char* filepath, mode_t mode, int numTargets, int chun /* * Creat and open a file through the POSIX interface. */ -void *POSIX_Create(char *testFileName, IOR_param_t * param) +void *POSIX_Create(char *testFileName, int flags, void * param) { int fd_oflag = O_BINARY; int mode = 0664; @@ -327,12 +335,12 @@ void *POSIX_Create(char *testFileName, IOR_param_t * param) fd = (int *)malloc(sizeof(int)); if (fd == NULL) ERR("Unable to malloc file descriptor"); - posix_options_t * o = (posix_options_t*) param->backend_options; + posix_options_t * o = (posix_options_t*) param; if (o->direct_io == TRUE){ set_o_direct_flag(&fd_oflag); } - if(param->dryRun) + if(ior_param->dryRun) return 0; #ifdef HAVE_LUSTRE_LUSTRE_USER_H @@ -450,7 +458,7 @@ int POSIX_Mknod(char *testFileName) /* * Open a file through the POSIX interface. */ -void *POSIX_Open(char *testFileName, IOR_param_t * param) +void *POSIX_Open(char *testFileName, int flags, void * param) { int fd_oflag = O_BINARY; int *fd; @@ -459,13 +467,13 @@ void *POSIX_Open(char *testFileName, IOR_param_t * param) if (fd == NULL) ERR("Unable to malloc file descriptor"); - posix_options_t * o = (posix_options_t*) param->backend_options; + posix_options_t * o = (posix_options_t*) param; if (o->direct_io == TRUE) set_o_direct_flag(&fd_oflag); fd_oflag |= O_RDWR; - if(param->dryRun) + if(ior_param->dryRun) return 0; *fd = open64(testFileName, fd_oflag); @@ -496,7 +504,7 @@ void *POSIX_Open(char *testFileName, IOR_param_t * param) * Write or read access to file using the POSIX interface. */ static IOR_offset_t POSIX_Xfer(int access, void *file, IOR_size_t * buffer, - IOR_offset_t length, IOR_param_t * param) + IOR_offset_t length, void * param) { int xferRetries = 0; long long remaining = (long long)length; @@ -504,7 +512,7 @@ static IOR_offset_t POSIX_Xfer(int access, void *file, IOR_size_t * buffer, long long rc; int fd; - if(param->dryRun) + if(ior_param->dryRun) return length; fd = *(int *)file; @@ -517,8 +525,8 @@ static IOR_offset_t POSIX_Xfer(int access, void *file, IOR_size_t * buffer, /* seek to offset */ - if (lseek64(fd, param->offset, SEEK_SET) == -1) - ERRF("lseek64(%d, %lld, SEEK_SET) failed", fd, param->offset); + if (lseek64(fd, ior_param->offset, SEEK_SET) == -1) + ERRF("lseek64(%d, %lld, SEEK_SET) failed", fd, ior_param->offset); while (remaining > 0) { /* write/read file */ @@ -527,20 +535,20 @@ static IOR_offset_t POSIX_Xfer(int access, void *file, IOR_size_t * buffer, fprintf(stdout, "task %d writing to offset %lld\n", rank, - param->offset + length - remaining); + ior_param->offset + length - remaining); } rc = write(fd, ptr, remaining); if (rc == -1) ERRF("write(%d, %p, %lld) failed", fd, (void*)ptr, remaining); - if (param->fsyncPerWrite == TRUE) + if (ior_param->fsyncPerWrite == TRUE) POSIX_Fsync(&fd, param); } else { /* READ or CHECK */ if (verbose >= VERBOSE_4) { fprintf(stdout, "task %d reading from offset %lld\n", rank, - param->offset + length - remaining); + ior_param->offset + length - remaining); } rc = read(fd, ptr, remaining); if (rc == 0) @@ -556,8 +564,8 @@ static IOR_offset_t POSIX_Xfer(int access, void *file, IOR_size_t * buffer, rank, access == WRITE ? "write()" : "read()", rc, remaining, - param->offset + length - remaining); - if (param->singleXferAttempt == TRUE) + ior_param->offset + length - remaining); + if (ior_param->singleXferAttempt == TRUE) MPI_CHECK(MPI_Abort(MPI_COMM_WORLD, -1), "barrier error"); if (xferRetries > MAX_RETRY) @@ -580,14 +588,14 @@ static IOR_offset_t POSIX_Xfer(int access, void *file, IOR_size_t * buffer, /* * Perform fsync(). */ -static void POSIX_Fsync(void *fd, IOR_param_t * param) +static void POSIX_Fsync(void *fd, void * param) { if (fsync(*(int *)fd) != 0) EWARNF("fsync(%d) failed", *(int *)fd); } -static void POSIX_Sync(IOR_param_t * param) +static void POSIX_Sync(void * param) { int ret = system("sync"); if (ret != 0){ @@ -599,9 +607,9 @@ static void POSIX_Sync(IOR_param_t * param) /* * Close a file through the POSIX interface. */ -void POSIX_Close(void *fd, IOR_param_t * param) +void POSIX_Close(void *fd, void * param) { - if(param->dryRun) + if(ior_param->dryRun) return; if (close(*(int *)fd) != 0) ERRF("close(%d) failed", *(int *)fd); @@ -611,9 +619,9 @@ void POSIX_Close(void *fd, IOR_param_t * param) /* * Delete a file through the POSIX interface. */ -void POSIX_Delete(char *testFileName, IOR_param_t * param) +void POSIX_Delete(char *testFileName, void * param) { - if(param->dryRun) + if(ior_param->dryRun) return; if (unlink(testFileName) != 0){ EWARNF("[RANK %03d]: unlink() of file \"%s\" failed\n", @@ -624,10 +632,10 @@ void POSIX_Delete(char *testFileName, IOR_param_t * param) /* * Use POSIX stat() to return aggregate file size. */ -IOR_offset_t POSIX_GetFileSize(IOR_param_t * test, MPI_Comm testComm, +IOR_offset_t POSIX_GetFileSize(void * test, MPI_Comm testComm, char *testFileName) { - if(test->dryRun) + if(ior_param->dryRun) return 0; struct stat stat_buf; IOR_offset_t aggFileSizeFromStat, tmpMin, tmpMax, tmpSum; @@ -637,7 +645,7 @@ IOR_offset_t POSIX_GetFileSize(IOR_param_t * test, MPI_Comm testComm, } aggFileSizeFromStat = stat_buf.st_size; - if (test->filePerProc == TRUE) { + if (ior_param->filePerProc == TRUE) { MPI_CHECK(MPI_Allreduce(&aggFileSizeFromStat, &tmpSum, 1, MPI_LONG_LONG_INT, MPI_SUM, testComm), "cannot total data moved"); diff --git a/src/aiori-S3.c b/src/aiori-S3.c index 2c9a9af..a060646 100755 --- a/src/aiori-S3.c +++ b/src/aiori-S3.c @@ -157,8 +157,8 @@ static void EMC_Close(void*, IOR_param_t*); static void S3_Delete(char*, IOR_param_t*); static void S3_Fsync(void*, IOR_param_t*); static IOR_offset_t S3_GetFileSize(IOR_param_t*, MPI_Comm, char*); -static void S3_init(); -static void S3_finalize(); +static void S3_init(void * options); +static void S3_finalize(void * options); static int S3_check_params(IOR_param_t *); @@ -218,14 +218,14 @@ ior_aiori_t s3_emc_aiori = { }; -static void S3_init(){ +static void S3_init(void * options){ /* This is supposed to be done before *any* threads are created. * Could MPI_Init() create threads (or call multi-threaded * libraries)? We'll assume so. */ AWS4C_CHECK( aws_init() ); } -static void S3_finalize(){ +static void S3_finalize(void * options){ /* done once per program, after exiting all threads. * NOTE: This fn doesn't return a value that can be checked for success. */ aws_cleanup(); @@ -241,10 +241,10 @@ static int S3_check_params(IOR_param_t * test){ if (Nto1 && (s != 1) && (b != t)) { ERR("N:1 (strided) requires xfer-size == block-size"); - return 0; + return 1; } - return 1; + return 0; } /* modelled on similar macros in iordef.h */ diff --git a/src/aiori.c b/src/aiori.c index 71f99d1..592c503 100644 --- a/src/aiori.c +++ b/src/aiori.c @@ -152,7 +152,7 @@ void aiori_supported_apis(char * APIs, char * APIs_legacy, enum bench_type type) * This function provides a AIORI statfs for POSIX-compliant filesystems. It * uses statvfs is available and falls back on statfs. */ -int aiori_posix_statfs (const char *path, ior_aiori_statfs_t *stat_buf, IOR_param_t * param) +int aiori_posix_statfs (const char *path, ior_aiori_statfs_t *stat_buf, void * module_options) { int ret; #if defined(HAVE_STATVFS) @@ -177,22 +177,22 @@ int aiori_posix_statfs (const char *path, ior_aiori_statfs_t *stat_buf, IOR_para return 0; } -int aiori_posix_mkdir (const char *path, mode_t mode, IOR_param_t * param) +int aiori_posix_mkdir (const char *path, mode_t mode, void * module_options) { return mkdir (path, mode); } -int aiori_posix_rmdir (const char *path, IOR_param_t * param) +int aiori_posix_rmdir (const char *path, void * module_options) { return rmdir (path); } -int aiori_posix_access (const char *path, int mode, IOR_param_t * param) +int aiori_posix_access (const char *path, int mode, void * module_options) { return access (path, mode); } -int aiori_posix_stat (const char *path, struct stat *buf, IOR_param_t * param) +int aiori_posix_stat (const char *path, struct stat *buf, void * module_options) { return stat (path, buf); } @@ -202,92 +202,6 @@ char* aiori_get_version() return ""; } -static bool is_initialized = false; - -static void init_or_fini_internal(const ior_aiori_t *test_backend, - const bool init) -{ - if (init) - { - if (test_backend->initialize) - test_backend->initialize(); - } - else - { - if (test_backend->finalize) - test_backend->finalize(); - } -} - -static void init_or_fini(IOR_test_t *tests, const bool init) -{ - /* Sanity check, we were compiled with SOME backend, right? */ - if (0 == aiori_count ()) { - ERR("No IO backends compiled into aiori. " - "Run 'configure --with-', and recompile."); - } - - /* Pointer to the initialize of finalize function */ - - - /* if tests is NULL, initialize or finalize all available backends */ - if (tests == NULL) - { - for (ior_aiori_t **tmp = available_aiori ; *tmp != NULL; ++tmp) - init_or_fini_internal(*tmp, init); - - return; - } - - for (IOR_test_t *t = tests; t != NULL; t = t->next) - { - IOR_param_t *params = &t->params; - assert(params != NULL); - - const ior_aiori_t *test_backend = params->backend; - assert(test_backend != NULL); - - init_or_fini_internal(test_backend, init); - } -} - - -/** - * Initialize IO backends. - * - * @param[in] tests Pointers to the first test - * - * This function initializes all backends which will be used. If tests is NULL - * all available backends are initialized. - */ -void aiori_initialize(IOR_test_t *tests) -{ - if (is_initialized) - return; - - init_or_fini(tests, true); - - is_initialized = true; -} - -/** - * Finalize IO backends. - * - * @param[in] tests Pointers to the first test - * - * This function finalizes all backends which were used. If tests is NULL - * all available backends are finialized. - */ -void aiori_finalize(IOR_test_t *tests) -{ - if (!is_initialized) - return; - - is_initialized = false; - - init_or_fini(tests, false); -} - const ior_aiori_t *aiori_select (const char *api) { char warn_str[256] = {0}; diff --git a/src/aiori.h b/src/aiori.h index 4d416c2..4dd2eed 100755 --- a/src/aiori.h +++ b/src/aiori.h @@ -67,27 +67,31 @@ typedef struct ior_aiori_statfs { typedef struct ior_aiori { char *name; char *name_legacy; - void *(*create)(char *, IOR_param_t *); + void *(*create)(char *, int iorflags, void *); int (*mknod)(char *); - void *(*open)(char *, IOR_param_t *); + void *(*open)(char *, int iorflags, void *); + /* + Allow to set generic transfer options that shall be applied to any subsequent IO call. + */ + void (*init_xfer_options)(IOR_param_t * params); IOR_offset_t (*xfer)(int, void *, IOR_size_t *, - IOR_offset_t, IOR_param_t *); - void (*close)(void *, IOR_param_t *); - void (*delete)(char *, IOR_param_t *); + IOR_offset_t, void *); + void (*close)(void *, void *); + void (*delete)(char *, void *); char* (*get_version)(void); - void (*fsync)(void *, IOR_param_t *); - IOR_offset_t (*get_file_size)(IOR_param_t *, MPI_Comm, char *); - int (*statfs) (const char *, ior_aiori_statfs_t *, IOR_param_t * param); - int (*mkdir) (const char *path, mode_t mode, IOR_param_t * param); - int (*rmdir) (const char *path, IOR_param_t * param); - int (*access) (const char *path, int mode, IOR_param_t * param); - int (*stat) (const char *path, struct stat *buf, IOR_param_t * param); - void (*initialize)(void); /* called once per program before MPI is started */ - void (*finalize)(void); /* called once per program after MPI is shutdown */ + void (*fsync)(void *, void *); + IOR_offset_t (*get_file_size)(void * module_options, MPI_Comm, char *); + int (*statfs) (const char *, ior_aiori_statfs_t *, void * module_options); + int (*mkdir) (const char *path, mode_t mode, void * module_options); + int (*rmdir) (const char *path, void * module_options); + int (*access) (const char *path, int mode, void * module_options); + int (*stat) (const char *path, struct stat *buf, void * module_options); + void (*initialize)(void * options); /* called once per program before MPI is started */ + void (*finalize)(void * options); /* called once per program after MPI is shutdown */ option_help * (*get_options)(void ** init_backend_options, void* init_values); /* initializes the backend options as well and returns the pointer to the option help structure */ bool enable_mdtest; - int (*check_params)(IOR_param_t *); /* check if the provided parameters for the given test and the module options are correct, if they aren't print a message and exit(1) or return 1*/ - void (*sync)(IOR_param_t * ); /* synchronize every pending operation for this storage */ + int (*check_params)(void *); /* check if the provided module_optionseters for the given test and the module options are correct, if they aren't print a message and exit(1) or return 1*/ + void (*sync)(void * ); /* synchronize every pending operation for this storage */ } ior_aiori_t; enum bench_type { @@ -112,8 +116,6 @@ extern ior_aiori_t rados_aiori; extern ior_aiori_t cephfs_aiori; extern ior_aiori_t gfarm_aiori; -void aiori_initialize(IOR_test_t * tests); -void aiori_finalize(IOR_test_t * tests); const ior_aiori_t *aiori_select (const char *api); int aiori_count (void); void aiori_supported_apis(char * APIs, char * APIs_legacy, enum bench_type type); @@ -125,25 +127,25 @@ const char *aiori_default (void); /* some generic POSIX-based backend calls */ char * aiori_get_version (void); -int aiori_posix_statfs (const char *path, ior_aiori_statfs_t *stat_buf, IOR_param_t * param); -int aiori_posix_mkdir (const char *path, mode_t mode, IOR_param_t * param); -int aiori_posix_rmdir (const char *path, IOR_param_t * param); -int aiori_posix_access (const char *path, int mode, IOR_param_t * param); -int aiori_posix_stat (const char *path, struct stat *buf, IOR_param_t * param); +int aiori_posix_statfs (const char *path, ior_aiori_statfs_t *stat_buf, void * module_options); +int aiori_posix_mkdir (const char *path, mode_t mode, void * module_options); +int aiori_posix_rmdir (const char *path, void * module_options); +int aiori_posix_access (const char *path, int mode, void * module_options); +int aiori_posix_stat (const char *path, struct stat *buf, void * module_options); -void *POSIX_Create(char *testFileName, IOR_param_t * param); +void *POSIX_Create(char *testFileName, int flags, void * module_options); int POSIX_Mknod(char *testFileName); -void *POSIX_Open(char *testFileName, IOR_param_t * param); -IOR_offset_t POSIX_GetFileSize(IOR_param_t * test, MPI_Comm testComm, char *testFileName); -void POSIX_Delete(char *testFileName, IOR_param_t * param); -void POSIX_Close(void *fd, IOR_param_t * param); +void *POSIX_Open(char *testFileName, int flags, void * module_options); +IOR_offset_t POSIX_GetFileSize(void * test, MPI_Comm testComm, char *testFileName); +void POSIX_Delete(char *testFileName, void * module_options); +void POSIX_Close(void *fd, void * module_options); option_help * POSIX_options(void ** init_backend_options, void * init_values); /* NOTE: these 3 MPI-IO functions are exported for reuse by HDF5/PNetCDF */ -void MPIIO_Delete(char *testFileName, IOR_param_t * param); -IOR_offset_t MPIIO_GetFileSize(IOR_param_t * test, MPI_Comm testComm, +void MPIIO_Delete(char *testFileName, void * module_options); +IOR_offset_t MPIIO_GetFileSize(void * test, MPI_Comm testComm, char *testFileName); -int MPIIO_Access(const char *, int, IOR_param_t *); +int MPIIO_Access(const char *, int, void *); #endif /* not _AIORI_H */ diff --git a/src/ior-output.c b/src/ior-output.c index 01136fb..3bb8fd7 100644 --- a/src/ior-output.c +++ b/src/ior-output.c @@ -337,7 +337,6 @@ void ShowTestStart(IOR_param_t *test) PrintKeyVal("api", test->api); PrintKeyVal("platform", test->platform); PrintKeyVal("testFileName", test->testFileName); - PrintKeyVal("hintsFileName", test->hintsFileName); PrintKeyValInt("deadlineForStonewall", test->deadlineForStonewalling); PrintKeyValInt("stoneWallingWearOut", test->stoneWallingWearOut); PrintKeyValInt("maxTimeDuration", test->maxTimeDuration); @@ -355,7 +354,6 @@ void ShowTestStart(IOR_param_t *test) PrintKeyValInt("fsync", test->fsync); PrintKeyValInt("fsyncperwrite", test->fsyncPerWrite); PrintKeyValInt("useExistingTestFile", test->useExistingTestFile); - PrintKeyValInt("showHints", test->showHints); PrintKeyValInt("uniqueDir", test->uniqueDir); PrintKeyValInt("individualDataSets", test->individualDataSets); PrintKeyValInt("singleXferAttempt", test->singleXferAttempt); @@ -368,12 +366,8 @@ void ShowTestStart(IOR_param_t *test) PrintKeyValInt("randomOffset", test->randomOffset); PrintKeyValInt("checkWrite", test->checkWrite); PrintKeyValInt("checkRead", test->checkRead); - PrintKeyValInt("preallocate", test->preallocate); - PrintKeyValInt("useFileView", test->useFileView); PrintKeyValInt("setAlignment", test->setAlignment); PrintKeyValInt("storeFileOffset", test->storeFileOffset); - PrintKeyValInt("useSharedFilePointer", test->useSharedFilePointer); - PrintKeyValInt("useStridedDatatype", test->useStridedDatatype); PrintKeyValInt("keepFile", test->keepFile); PrintKeyValInt("keepFileWithError", test->keepFileWithError); PrintKeyValInt("quitOnError", test->quitOnError); diff --git a/src/ior.c b/src/ior.c index 05070b0..206a9f4 100755 --- a/src/ior.c +++ b/src/ior.c @@ -58,6 +58,28 @@ static IOR_offset_t WriteOrRead(IOR_param_t *test, IOR_results_t *results, void *fd, const int access, IOR_io_buffers *ioBuffers); +static void test_initialize(IOR_test_t * test){ + verbose = test->params.verbose; + backend = test->params.backend; + if (rank == 0 && verbose >= VERBOSE_0) { + ShowTestStart(& test->params); + } + if(backend->initialize){ + backend->initialize(test->params.backend_options); + } + if(backend->init_xfer_options){ + backend->init_xfer_options(test); + } +} + +static void test_finalize(IOR_test_t * test){ + backend = test->params.backend; + if(backend->finalize){ + backend->finalize(test->params.backend_options); + } +} + + IOR_test_t * ior_run(int argc, char **argv, MPI_Comm world_com, FILE * world_out){ IOR_test_t *tests_head; IOR_test_t *tptr; @@ -76,17 +98,12 @@ IOR_test_t * ior_run(int argc, char **argv, MPI_Comm world_com, FILE * world_out /* perform each test */ for (tptr = tests_head; tptr != NULL; tptr = tptr->next) { - aiori_initialize(tptr); + test_initialize(tptr); totalErrorCount = 0; - verbose = tptr->params.verbose; - backend = tptr->params.backend; - if (rank == 0 && verbose >= VERBOSE_0) { - ShowTestStart(&tptr->params); - } TestIoSys(tptr); tptr->results->errors = totalErrorCount; ShowTestEnd(tptr); - aiori_finalize(tptr); + test_finalize(tptr); } PrintLongSummaryAllTests(tests_head); @@ -125,18 +142,11 @@ int ior_main(int argc, char **argv) InitTests(tests_head, mpi_comm_world); verbose = tests_head->params.verbose; - aiori_initialize(tests_head); // this is quite suspicious, likely an error when multiple tests need to be executed with different backends and options - PrintHeader(argc, argv); /* perform each test */ for (tptr = tests_head; tptr != NULL; tptr = tptr->next) { - verbose = tptr->params.verbose; - backend = tptr->params.backend; - if (rank == 0 && verbose >= VERBOSE_0) { - backend = tptr->params.backend; - ShowTestStart(&tptr->params); - } + test_initialize(tptr); // This is useful for trapping a running MPI process. While // this is sleeping, run the script 'testing/hdfs/gdb.attach' @@ -148,6 +158,7 @@ int ior_main(int argc, char **argv) TestIoSys(tptr); ShowTestEnd(tptr); + test_finalize(tptr); } if (verbose < 0) @@ -158,8 +169,6 @@ int ior_main(int argc, char **argv) /* display finish time */ PrintTestEnds(); - aiori_finalize(tests_head); - MPI_CHECK(MPI_Finalize(), "cannot finalize MPI"); DestroyTests(tests_head); @@ -180,10 +189,6 @@ void init_IOR_Param_t(IOR_param_t * p) assert (NULL != default_aiori); memset(p, 0, sizeof(IOR_param_t)); - - p->mode = IOR_IRUSR | IOR_IWUSR | IOR_IRGRP | IOR_IWGRP; - p->openFlags = IOR_RDWR | IOR_CREAT; - p->api = strdup(default_aiori); p->platform = strdup("HOST(OSTYPE)"); p->testFileName = strdup("testFile"); @@ -1338,7 +1343,7 @@ static void TestIoSys(IOR_test_t *test) MPI_CHECK(MPI_Barrier(testComm), "barrier error"); params->open = WRITE; timer[0] = GetTimeStamp(); - fd = backend->create(testFileName, params); + fd = backend->create(testFileName, IOR_WRONLY | IOR_CREAT, params->backend_options); timer[1] = GetTimeStamp(); if (params->intraTestBarriers) MPI_CHECK(MPI_Barrier(testComm), @@ -1412,7 +1417,7 @@ static void TestIoSys(IOR_test_t *test) GetTestFileName(testFileName, params); params->open = WRITECHECK; - fd = backend->open(testFileName, params); + fd = backend->open(testFileName, IOR_RDONLY, params); dataMoved = WriteOrRead(params, &results[rep], fd, WRITECHECK, &ioBuffers); backend->close(fd, params); rankOffset = 0; @@ -1484,7 +1489,7 @@ static void TestIoSys(IOR_test_t *test) MPI_CHECK(MPI_Barrier(testComm), "barrier error"); params->open = READ; timer[0] = GetTimeStamp(); - fd = backend->open(testFileName, params); + fd = backend->open(testFileName, IOR_RDONLY, params); timer[1] = GetTimeStamp(); if (params->intraTestBarriers) MPI_CHECK(MPI_Barrier(testComm), @@ -1613,11 +1618,6 @@ static void ValidateTests(IOR_param_t * test) && (test->blockSize < sizeof(IOR_size_t) || test->transferSize < sizeof(IOR_size_t))) ERR("block/transfer size may not be smaller than IOR_size_t for NCMPI"); - if ((test->useFileView == TRUE) - && (sizeof(MPI_Aint) < 8) /* used for 64-bit datatypes */ - &&((test->numTasks * test->blockSize) > - (2 * (IOR_offset_t) GIBIBYTE))) - ERR("segment size must be < 2GiB"); if ((strcasecmp(test->api, "POSIX") != 0) && test->singleXferAttempt) WARN_RESET("retry only available in POSIX", test, &defaults, singleXferAttempt); @@ -1630,39 +1630,6 @@ static void ValidateTests(IOR_param_t * test) && (strcasecmp(test->api, "CEPHFS") != 0)) && test->fsync) WARN_RESET("fsync() not supported in selected backend", test, &defaults, fsync); - if ((strcasecmp(test->api, "MPIIO") != 0) && test->preallocate) - WARN_RESET("preallocation only available in MPIIO", - test, &defaults, preallocate); - if ((strcasecmp(test->api, "MPIIO") != 0) && test->useFileView) - WARN_RESET("file view only available in MPIIO", - test, &defaults, useFileView); - if ((strcasecmp(test->api, "MPIIO") != 0) && test->useSharedFilePointer) - WARN_RESET("shared file pointer only available in MPIIO", - test, &defaults, useSharedFilePointer); - if ((strcasecmp(test->api, "MPIIO") == 0) && test->useSharedFilePointer) - WARN_RESET("shared file pointer not implemented", - test, &defaults, useSharedFilePointer); - if ((strcasecmp(test->api, "MPIIO") != 0) && test->useStridedDatatype) - WARN_RESET("strided datatype only available in MPIIO", - test, &defaults, useStridedDatatype); - if ((strcasecmp(test->api, "MPIIO") == 0) && test->useStridedDatatype) - WARN_RESET("strided datatype not implemented", - test, &defaults, useStridedDatatype); - if ((strcasecmp(test->api, "MPIIO") == 0) - && test->useStridedDatatype && (test->blockSize < sizeof(IOR_size_t) - || test->transferSize < - sizeof(IOR_size_t))) - ERR("need larger file size for strided datatype in MPIIO"); - if ((strcasecmp(test->api, "POSIX") == 0) && test->showHints) - WARN_RESET("hints not available in POSIX", - test, &defaults, showHints); - if ((strcasecmp(test->api, "POSIX") == 0) && test->collective) - WARN_RESET("collective not available in POSIX", - test, &defaults, collective); - if ((strcasecmp(test->api, "MMAP") == 0) && test->fsyncPerWrite - && (test->transferSize & (sysconf(_SC_PAGESIZE) - 1))) - ERR("transfer size must be aligned with PAGESIZE for MMAP with fsyncPerWrite"); - /* parameter consitency */ if (test->reorderTasks == TRUE && test->reorderTasksRandom == TRUE) ERR("Both Constant and Random task re-ordering specified. Choose one and resubmit"); @@ -1676,14 +1643,6 @@ static void ValidateTests(IOR_param_t * test) ERR("random offset not available with read check option (use write check)"); if (test->randomOffset && test->storeFileOffset) ERR("random offset not available with store file offset option)"); - - - if ((strcasecmp(test->api, "MPIIO") == 0) && test->randomOffset - && test->collective) - ERR("random offset not available with collective MPIIO"); - if ((strcasecmp(test->api, "MPIIO") == 0) && test->randomOffset - && test->useFileView) - ERR("random offset not available with MPIIO fileviews"); if ((strcasecmp(test->api, "HDF5") == 0) && test->randomOffset) ERR("random offset not available with HDF5"); if ((strcasecmp(test->api, "NCMPI") == 0) && test->randomOffset) @@ -1719,8 +1678,11 @@ static void ValidateTests(IOR_param_t * test) /* allow the backend to validate the options */ if(test->backend->check_params){ + if(test->backend->init_xfer_options){ + test->backend->init_xfer_options(test); + } int check = test->backend->check_params(test); - if (check == 0){ + if (check){ ERR("The backend returned that the test parameters are invalid."); } } @@ -1870,9 +1832,11 @@ static IOR_offset_t WriteOrReadSingle(IOR_offset_t pairCnt, IOR_offset_t *offset FillBuffer(buffer, test, test->offset, pretendRank); } amtXferred = - backend->xfer(access, fd, buffer, transfer, test); + backend->xfer(access, fd, buffer, transfer, test->backend_options); if (amtXferred != transfer) ERR("cannot write to file"); + if (test->fsyncPerWrite) + backend->fsync(fd, test->backend_options); if (test->interIODelay > 0){ struct timespec wait = {test->interIODelay / 1000 / 1000, 1000l * (test->interIODelay % 1000000)}; nanosleep( & wait, NULL); diff --git a/src/ior.h b/src/ior.h index 758b048..14d6ddf 100755 --- a/src/ior.h +++ b/src/ior.h @@ -84,17 +84,15 @@ typedef struct { const struct ior_aiori * backend; char * debug; /* debug info string */ - unsigned int mode; /* file permissions */ - unsigned int openFlags; /* open flags (see also ) */ int referenceNumber; /* user supplied reference number */ char * api; /* API for I/O */ char * apiVersion; /* API version */ char * platform; /* platform type */ char * testFileName; /* full name for test */ char * testFileName_fppReadCheck;/* filename for fpp read check */ - char * hintsFileName; /* full name for hints file */ char * options; /* options string */ // intermediate options + int collective; /* collective I/O */ int dryRun; /* do not perform any I/Os just run evtl. inputs print dummy output */ int numTasks; /* number of tasks for test */ int numNodes; /* number of nodes for test */ @@ -119,17 +117,12 @@ typedef struct int keepFileWithError; /* don't delete the testfile with errors */ int errorFound; /* error found in data check */ int quitOnError; /* quit code when error in check */ - int collective; /* collective I/O */ IOR_offset_t segmentCount; /* number of segments (or HDF5 datasets) */ IOR_offset_t blockSize; /* contiguous bytes to write per task */ IOR_offset_t transferSize; /* size of transfer in bytes */ IOR_offset_t offset; /* offset for read/write */ IOR_offset_t expectedAggFileSize; /* calculated aggregate file size */ - int preallocate; /* preallocate file size */ - int useFileView; /* use MPI_File_set_view */ - int useSharedFilePointer; /* use shared file pointer */ - int useStridedDatatype; /* put strided access into datatype */ - int showHints; /* show hints */ + int summary_every_test; /* flag to print summary every test, not just at end */ int uniqueDir; /* use unique directory for each fpp */ int useExistingTestFile; /* do not delete test file before access */ @@ -144,7 +137,6 @@ typedef struct int verbose; /* verbosity */ int setTimeStampSignature; /* set time stamp signature */ unsigned int timeStampSignatureValue; /* value for time stamp signature */ - void * fd_fppReadCheck; /* additional fd for fpp read check */ int randomSeed; /* random seed for write/read check */ unsigned int incompressibleSeed; /* random seed for incompressible file creation */ int randomOffset; /* access is to random offsets */ diff --git a/src/mdtest.c b/src/mdtest.c index f82db1b..6d789f0 100644 --- a/src/mdtest.c +++ b/src/mdtest.c @@ -355,8 +355,6 @@ static void create_file (const char *path, uint64_t itemNum) { sprintf(curr_item, "%s/file.%s"LLU"", path, mk_name, itemNum); VERBOSE(3,5,"create_remove_items_helper (non-dirs create): curr_item is '%s'", curr_item); - param.openFlags = IOR_WRONLY; - if (make_node) { int ret; VERBOSE(3,5,"create_remove_items_helper : mknod..." ); @@ -369,7 +367,7 @@ static void create_file (const char *path, uint64_t itemNum) { } else if (collective_creates) { VERBOSE(3,5,"create_remove_items_helper (collective): open..." ); - aiori_fh = backend->open (curr_item, ¶m); + aiori_fh = backend->open (curr_item, IOR_WRONLY | IOR_CREAT, ¶m); if (NULL == aiori_fh) FAIL("unable to open file %s", curr_item); @@ -377,12 +375,10 @@ static void create_file (const char *path, uint64_t itemNum) { * !collective_creates */ } else { - param.openFlags |= IOR_CREAT; param.filePerProc = !shared_file; - param.mode = FILEMODE; VERBOSE(3,5,"create_remove_items_helper (non-collective, shared): open..." ); - aiori_fh = backend->create (curr_item, ¶m); + aiori_fh = backend->create (curr_item, IOR_WRONLY | IOR_CREAT, ¶m.backend_options); if (NULL == aiori_fh) FAIL("unable to create file %s", curr_item); } @@ -449,9 +445,7 @@ void collective_helper(const int dirs, const int create, const char* path, uint6 void *aiori_fh; //create files - param.openFlags = IOR_WRONLY | IOR_CREAT; - param.mode = FILEMODE; - aiori_fh = backend->create (curr_item, ¶m); + aiori_fh = backend->create (curr_item, IOR_WRONLY | IOR_CREAT, ¶m); if (NULL == aiori_fh) { FAIL("unable to create file %s", curr_item); } @@ -713,8 +707,7 @@ void mdtest_read(int random, int dirs, const long dir_iter, char *path) { VERBOSE(3,5,"mdtest_read file: %s", item); /* open file for reading */ - param.openFlags = O_RDONLY; - aiori_fh = backend->open (item, ¶m); + aiori_fh = backend->open (item, O_RDONLY, ¶m); if (NULL == aiori_fh) { FAIL("unable to open file %s", item); } @@ -1972,7 +1965,7 @@ mdtest_results_t * mdtest_run(int argc, char **argv, MPI_Comm world_com, FILE * MPI_Comm_size(testComm, &size); if (backend->initialize) - backend->initialize(); + backend->initialize(param.backend_options); pid = getpid(); uid = getuid(); @@ -2264,7 +2257,7 @@ mdtest_results_t * mdtest_run(int argc, char **argv, MPI_Comm world_com, FILE * } if (backend->finalize) - backend->finalize(); + backend->finalize(param.backend_options); return summary_table; } diff --git a/src/parse_options.c b/src/parse_options.c index 607d014..51a5d24 100755 --- a/src/parse_options.c +++ b/src/parse_options.c @@ -62,24 +62,6 @@ static void CheckRunSettings(IOR_test_t *tests) params->readFile = TRUE; params->writeFile = TRUE; } - - /* If only read or write is requested, then fix the default - * openFlags to not be open RDWR. It matters in the case - * of HDFS, which doesn't support opening RDWR. - * (We assume int-valued params are exclusively 0 or 1.) - */ - if ((params->openFlags & IOR_RDWR) - && ((params->readFile | params->checkRead | params->checkWrite) - ^ params->writeFile)) { - - params->openFlags &= ~(IOR_RDWR); - if (params->readFile | params->checkRead) { - params->openFlags |= IOR_RDONLY; - params->openFlags &= ~(IOR_CREAT|IOR_EXCL); - } - else - params->openFlags |= IOR_WRONLY; - } } } @@ -137,8 +119,6 @@ void DecodeDirective(char *line, IOR_param_t *params, options_all_t * module_opt params->platform = strdup(value); } else if (strcasecmp(option, "testfile") == 0) { params->testFileName = strdup(value); - } else if (strcasecmp(option, "hintsfilename") == 0) { - params->hintsFileName = strdup(value); } else if (strcasecmp(option, "deadlineforstonewalling") == 0) { params->deadlineForStonewalling = atoi(value); } else if (strcasecmp(option, "stoneWallingWearOut") == 0) { @@ -213,20 +193,8 @@ void DecodeDirective(char *line, IOR_param_t *params, options_all_t * module_opt params->verbose = atoi(value); } else if (strcasecmp(option, "settimestampsignature") == 0) { params->setTimeStampSignature = atoi(value); - } else if (strcasecmp(option, "collective") == 0) { - params->collective = atoi(value); - } else if (strcasecmp(option, "preallocate") == 0) { - params->preallocate = atoi(value); } else if (strcasecmp(option, "storefileoffset") == 0) { params->storeFileOffset = atoi(value); - } else if (strcasecmp(option, "usefileview") == 0) { - params->useFileView = atoi(value); - } else if (strcasecmp(option, "usesharedfilepointer") == 0) { - params->useSharedFilePointer = atoi(value); - } else if (strcasecmp(option, "usestrideddatatype") == 0) { - params->useStridedDatatype = atoi(value); - } else if (strcasecmp(option, "showhints") == 0) { - params->showHints = atoi(value); } else if (strcasecmp(option, "uniqueDir") == 0) { params->uniqueDir = atoi(value); } else if (strcasecmp(option, "useexistingtestfile") == 0) { @@ -472,7 +440,7 @@ option_help * createGlobalOptions(IOR_param_t * params){ {'a', NULL, apiStr, OPTION_OPTIONAL_ARGUMENT, 's', & params->api}, {'A', NULL, "refNum -- user supplied reference number to include in the summary", OPTION_OPTIONAL_ARGUMENT, 'd', & params->referenceNumber}, {'b', NULL, "blockSize -- contiguous bytes to write per task (e.g.: 8, 4k, 2m, 1g)", OPTION_OPTIONAL_ARGUMENT, 'l', & params->blockSize}, - {'c', NULL, "collective -- collective I/O", OPTION_FLAG, 'd', & params->collective}, + {'c', "collective", "Use collective I/O", OPTION_FLAG, 'd', & params->collective}, {'C', NULL, "reorderTasks -- changes task ordering for readback (useful to avoid client cache)", OPTION_FLAG, 'd', & params->reorderTasks}, {'d', NULL, "interTestDelay -- delay between reps in seconds", OPTION_OPTIONAL_ARGUMENT, 'd', & params->interTestDelay}, {'D', NULL, "deadlineForStonewalling -- seconds before stopping write or read phase", OPTION_OPTIONAL_ARGUMENT, 'd', & params->deadlineForStonewalling}, @@ -489,7 +457,6 @@ option_help * createGlobalOptions(IOR_param_t * params){ * after all the arguments are in and we know which it keep. */ {'G', NULL, "setTimeStampSignature -- set value for time stamp signature/random seed", OPTION_OPTIONAL_ARGUMENT, 'd', & params->setTimeStampSignature}, - {'H', NULL, "showHints -- show hints", OPTION_FLAG, 'd', & params->showHints}, {'i', NULL, "repetitions -- number of repetitions of test", OPTION_OPTIONAL_ARGUMENT, 'd', & params->repetitions}, {'I', NULL, "individualDataSets -- datasets not shared by all procs [not working]", OPTION_FLAG, 'd', & params->individualDataSets}, {'j', NULL, "outlierThreshold -- warn on outlier N seconds from mean", OPTION_OPTIONAL_ARGUMENT, 'd', & params->outlierThreshold}, @@ -503,20 +470,15 @@ option_help * createGlobalOptions(IOR_param_t * params){ {'N', NULL, "numTasks -- number of tasks that are participating in the test (overrides MPI)", OPTION_OPTIONAL_ARGUMENT, 'd', & params->numTasks}, {'o', NULL, "testFile -- full name for test", OPTION_OPTIONAL_ARGUMENT, 's', & params->testFileName}, {'O', NULL, "string of IOR directives (e.g. -O checkRead=1,lustreStripeCount=32)", OPTION_OPTIONAL_ARGUMENT, 'p', & decodeDirectiveWrapper}, - {'p', NULL, "preallocate -- preallocate file size", OPTION_FLAG, 'd', & params->preallocate}, - {'P', NULL, "useSharedFilePointer -- use shared file pointer [not working]", OPTION_FLAG, 'd', & params->useSharedFilePointer}, {'q', NULL, "quitOnError -- during file error-checking, abort on error", OPTION_FLAG, 'd', & params->quitOnError}, {'Q', NULL, "taskPerNodeOffset for read tests use with -C & -Z options (-C constant N, -Z at least N)", OPTION_OPTIONAL_ARGUMENT, 'd', & params->taskPerNodeOffset}, {'r', NULL, "readFile -- read existing file", OPTION_FLAG, 'd', & params->readFile}, {'R', NULL, "checkRead -- verify that the output of read matches the expected signature (used with -G)", OPTION_FLAG, 'd', & params->checkRead}, {'s', NULL, "segmentCount -- number of segments", OPTION_OPTIONAL_ARGUMENT, 'd', & params->segmentCount}, - {'S', NULL, "useStridedDatatype -- put strided access into datatype [not working]", OPTION_FLAG, 'd', & params->useStridedDatatype}, {'t', NULL, "transferSize -- size of transfer in bytes (e.g.: 8, 4k, 2m, 1g)", OPTION_OPTIONAL_ARGUMENT, 'l', & params->transferSize}, {'T', NULL, "maxTimeDuration -- max time in minutes executing repeated test; it aborts only between iterations and not within a test!", OPTION_OPTIONAL_ARGUMENT, 'd', & params->maxTimeDuration}, {'u', NULL, "uniqueDir -- use unique directory name for each file-per-process", OPTION_FLAG, 'd', & params->uniqueDir}, - {'U', NULL, "hintsFileName -- full name for hints file", OPTION_OPTIONAL_ARGUMENT, 's', & params->hintsFileName}, {'v', NULL, "verbose -- output information (repeating flag increases level)", OPTION_FLAG, 'd', & params->verbose}, - {'V', NULL, "useFileView -- use MPI_File_set_view", OPTION_FLAG, 'd', & params->useFileView}, {'w', NULL, "writeFile -- write file", OPTION_FLAG, 'd', & params->writeFile}, {'W', NULL, "checkWrite -- check read after write", OPTION_FLAG, 'd', & params->checkWrite}, {'x', NULL, "singleXferAttempt -- do not retry transfer if incomplete", OPTION_FLAG, 'd', & params->singleXferAttempt}, From aa9e2ad8150eb3a72a69d6486568ea67b923fa96 Mon Sep 17 00:00:00 2001 From: "Julian M. Kunkel" Date: Sat, 30 May 2020 18:30:26 +0100 Subject: [PATCH 39/52] MDTest updated for AIORI changes. --- src/mdtest.c | 63 ++++++++++++++++++++++++++-------------------------- 1 file changed, 32 insertions(+), 31 deletions(-) diff --git a/src/mdtest.c b/src/mdtest.c index 6d789f0..4b4dd15 100644 --- a/src/mdtest.c +++ b/src/mdtest.c @@ -166,6 +166,7 @@ static uid_t uid; /* Use the POSIX backend by default */ static const ior_aiori_t *backend; +static void * backend_options; static IOR_param_t param; @@ -276,7 +277,7 @@ static void phase_end(){ if(! backend->sync){ FAIL("Error, backend does not provide the sync method, but you requested to use sync.\n"); } - backend->sync(& param); + backend->sync(backend_options); } if (barriers) { @@ -318,11 +319,11 @@ static void create_remove_dirs (const char *path, bool create, uint64_t itemNum) VERBOSE(3,5,"create_remove_items_helper (dirs %s): curr_item is '%s'", operation, curr_item); if (create) { - if (backend->mkdir(curr_item, DIRMODE, ¶m) == -1) { + if (backend->mkdir(curr_item, DIRMODE, backend_options) == -1) { FAIL("unable to create directory %s", curr_item); } } else { - if (backend->rmdir(curr_item, ¶m) == -1) { + if (backend->rmdir(curr_item, backend_options) == -1) { FAIL("unable to remove directory %s", curr_item); } } @@ -339,7 +340,7 @@ static void remove_file (const char *path, uint64_t itemNum) { sprintf(curr_item, "%s/file.%s"LLU"", path, rm_name, itemNum); VERBOSE(3,5,"create_remove_items_helper (non-dirs remove): curr_item is '%s'", curr_item); if (!(shared_file && rank != 0)) { - backend->delete (curr_item, ¶m); + backend->delete (curr_item, backend_options); } } @@ -367,7 +368,7 @@ static void create_file (const char *path, uint64_t itemNum) { } else if (collective_creates) { VERBOSE(3,5,"create_remove_items_helper (collective): open..." ); - aiori_fh = backend->open (curr_item, IOR_WRONLY | IOR_CREAT, ¶m); + aiori_fh = backend->open (curr_item, IOR_WRONLY | IOR_CREAT, backend_options); if (NULL == aiori_fh) FAIL("unable to open file %s", curr_item); @@ -378,7 +379,7 @@ static void create_file (const char *path, uint64_t itemNum) { param.filePerProc = !shared_file; VERBOSE(3,5,"create_remove_items_helper (non-collective, shared): open..." ); - aiori_fh = backend->create (curr_item, IOR_WRONLY | IOR_CREAT, ¶m.backend_options); + aiori_fh = backend->create (curr_item, IOR_WRONLY | IOR_CREAT, backend_options); if (NULL == aiori_fh) FAIL("unable to create file %s", curr_item); } @@ -392,13 +393,13 @@ static void create_file (const char *path, uint64_t itemNum) { */ param.offset = 0; param.fsyncPerWrite = sync_file; - if ( write_bytes != (size_t) backend->xfer (WRITE, aiori_fh, (IOR_size_t *) write_buffer, write_bytes, ¶m)) { + if ( write_bytes != (size_t) backend->xfer (WRITE, aiori_fh, (IOR_size_t *) write_buffer, write_bytes, backend_options)) { FAIL("unable to write file %s", curr_item); } } VERBOSE(3,5,"create_remove_items_helper: close..." ); - backend->close (aiori_fh, ¶m); + backend->close (aiori_fh, backend_options); } /* helper for creating/removing items */ @@ -445,15 +446,15 @@ void collective_helper(const int dirs, const int create, const char* path, uint6 void *aiori_fh; //create files - aiori_fh = backend->create (curr_item, IOR_WRONLY | IOR_CREAT, ¶m); + aiori_fh = backend->create (curr_item, IOR_WRONLY | IOR_CREAT, backend_options); if (NULL == aiori_fh) { FAIL("unable to create file %s", curr_item); } - backend->close (aiori_fh, ¶m); + backend->close (aiori_fh, backend_options); } else if (!(shared_file && rank != 0)) { //remove files - backend->delete (curr_item, ¶m); + backend->delete (curr_item, backend_options); } if(CHECK_STONE_WALL(progress)){ progress->items_done = i + 1; @@ -610,7 +611,7 @@ void mdtest_stat(const int random, const int dirs, const long dir_iter, const ch /* below temp used to be hiername */ VERBOSE(3,5,"mdtest_stat %4s: %s", (dirs ? "dir" : "file"), item); - if (-1 == backend->stat (item, &buf, ¶m)) { + if (-1 == backend->stat (item, &buf, backend_options)) { FAIL("unable to stat %s %s", dirs ? "directory" : "file", item); } } @@ -707,7 +708,7 @@ void mdtest_read(int random, int dirs, const long dir_iter, char *path) { VERBOSE(3,5,"mdtest_read file: %s", item); /* open file for reading */ - aiori_fh = backend->open (item, O_RDONLY, ¶m); + aiori_fh = backend->open (item, O_RDONLY, backend_options); if (NULL == aiori_fh) { FAIL("unable to open file %s", item); } @@ -715,7 +716,7 @@ void mdtest_read(int random, int dirs, const long dir_iter, char *path) { /* read file */ if (read_bytes > 0) { read_buffer[0] = 42; /* use a random value to ensure that the read_buffer is now different from the expected buffer and read isn't sometimes NOOP */ - if (read_bytes != (size_t) backend->xfer (READ, aiori_fh, (IOR_size_t *) read_buffer, read_bytes, ¶m)) { + if (read_bytes != (size_t) backend->xfer (READ, aiori_fh, (IOR_size_t *) read_buffer, read_bytes, backend_options)) { FAIL("unable to read file %s", item); } if(verify_read){ @@ -727,7 +728,7 @@ void mdtest_read(int random, int dirs, const long dir_iter, char *path) { } /* close file */ - backend->close (aiori_fh, ¶m); + backend->close (aiori_fh, backend_options); } } @@ -1482,7 +1483,7 @@ void show_file_system_size(char *file_system) { VERBOSE(1,-1,"Entering show_file_system_size on %s", file_system ); - ret = backend->statfs (file_system, &stat_buf, ¶m); + ret = backend->statfs (file_system, &stat_buf, backend_options); if (0 != ret) { FAIL("unable to stat file system %s", file_system); } @@ -1546,9 +1547,6 @@ void display_freespace(char *testdirpath) strcpy(dirpath, "."); } - if (param.api && strcasecmp(param.api, "DFS") == 0) - return; - VERBOSE(3,5,"Before show_file_system_size, dirpath is '%s'", dirpath ); show_file_system_size(dirpath); VERBOSE(3,5, "After show_file_system_size, dirpath is '%s'\n", dirpath ); @@ -1570,7 +1568,7 @@ void create_remove_directory_tree(int create, if (create) { VERBOSE(2,5,"Making directory '%s'", dir); - if (-1 == backend->mkdir (dir, DIRMODE, ¶m)) { + if (-1 == backend->mkdir (dir, DIRMODE, backend_options)) { fprintf(out_logfile, "error could not create directory '%s'\n", dir); } #ifdef HAVE_LUSTRE_LUSTREAPI @@ -1588,7 +1586,7 @@ void create_remove_directory_tree(int create, if (!create) { VERBOSE(2,5,"Remove directory '%s'", dir); - if (-1 == backend->rmdir(dir, ¶m)) { + if (-1 == backend->rmdir(dir, backend_options)) { FAIL("Unable to remove directory %s", dir); } } @@ -1604,7 +1602,7 @@ void create_remove_directory_tree(int create, if (create) { VERBOSE(2,5,"Making directory '%s'", temp_path); - if (-1 == backend->mkdir(temp_path, DIRMODE, ¶m)) { + if (-1 == backend->mkdir(temp_path, DIRMODE, backend_options)) { FAIL("Unable to create directory %s", temp_path); } } @@ -1615,7 +1613,7 @@ void create_remove_directory_tree(int create, if (!create) { VERBOSE(2,5,"Remove directory '%s'", temp_path); - if (-1 == backend->rmdir(temp_path, ¶m)) { + if (-1 == backend->rmdir(temp_path, backend_options)) { FAIL("Unable to remove directory %s", temp_path); } } @@ -1644,8 +1642,8 @@ static void mdtest_iteration(int i, int j, MPI_Group testgroup, mdtest_results_t prep_testdir(j, dir_iter); VERBOSE(2,5,"main (for j loop): making testdir, '%s'", testdir ); - if ((rank < path_count) && backend->access(testdir, F_OK, ¶m) != 0) { - if (backend->mkdir(testdir, DIRMODE, ¶m) != 0) { + if ((rank < path_count) && backend->access(testdir, F_OK, backend_options) != 0) { + if (backend->mkdir(testdir, DIRMODE, backend_options) != 0) { FAIL("Unable to create test directory %s", testdir); } #ifdef HAVE_LUSTRE_LUSTREAPI @@ -1825,9 +1823,9 @@ static void mdtest_iteration(int i, int j, MPI_Group testgroup, mdtest_results_t for (int dir_iter = 0; dir_iter < directory_loops; dir_iter ++){ prep_testdir(j, dir_iter); - if ((rank < path_count) && backend->access(testdir, F_OK, ¶m) == 0) { + if ((rank < path_count) && backend->access(testdir, F_OK, backend_options) == 0) { //if (( rank == 0 ) && access(testdir, F_OK) == 0) { - if (backend->rmdir(testdir, ¶m) == -1) { + if (backend->rmdir(testdir, backend_options) == -1) { FAIL("unable to remove directory %s", testdir); } } @@ -1956,6 +1954,7 @@ mdtest_results_t * mdtest_run(int argc, char **argv, MPI_Comm world_com, FILE * options_all_t * global_options = airoi_create_all_module_options(options); option_parse(argc, argv, global_options); updateParsedOptions(& param, global_options); + backend_options = param.backend_options; free(global_options->modules); free(global_options); @@ -1964,8 +1963,9 @@ mdtest_results_t * mdtest_run(int argc, char **argv, MPI_Comm world_com, FILE * MPI_Comm_rank(testComm, &rank); MPI_Comm_size(testComm, &size); - if (backend->initialize) - backend->initialize(param.backend_options); + if (backend->initialize){ + backend->initialize(backend_options); + } pid = getpid(); uid = getuid(); @@ -2256,8 +2256,9 @@ mdtest_results_t * mdtest_run(int argc, char **argv, MPI_Comm world_com, FILE * free(rand_array); } - if (backend->finalize) - backend->finalize(param.backend_options); + if (backend->finalize){ + backend->finalize(backend_options); + } return summary_table; } From 930ccdc68d453bf7027c26f3395f3d6f68c1d6d3 Mon Sep 17 00:00:00 2001 From: "Julian M. Kunkel" Date: Sat, 30 May 2020 19:01:20 +0100 Subject: [PATCH 40/52] Updated HDF5 to new module specification. --- src/aiori-HDF5.c | 202 +++++++++++++++++++++++++------------------- src/aiori-MPIIO.c | 2 +- src/ior-output.c | 2 - src/ior.c | 31 +------ src/ior.h | 5 -- src/parse_options.c | 9 -- 6 files changed, 120 insertions(+), 131 deletions(-) diff --git a/src/aiori-HDF5.c b/src/aiori-HDF5.c index ab329db..85a6e19 100755 --- a/src/aiori-HDF5.c +++ b/src/aiori-HDF5.c @@ -81,22 +81,29 @@ #endif /* H5_VERS_MAJOR > 1 && H5_VERS_MINOR > 6 */ /**************************** P R O T O T Y P E S *****************************/ -static IOR_offset_t SeekOffset(void *, IOR_offset_t, IOR_param_t *); -static void SetupDataSet(void *, IOR_param_t *); -static void *HDF5_Create(char *, IOR_param_t *); -static void *HDF5_Open(char *, IOR_param_t *); +static IOR_offset_t SeekOffset(void *, IOR_offset_t, void *); +static void SetupDataSet(void *, void *); +static void *HDF5_Create(char *, int flags, void *); +static void *HDF5_Open(char *, int flags, void *); static IOR_offset_t HDF5_Xfer(int, void *, IOR_size_t *, - IOR_offset_t, IOR_param_t *); -static void HDF5_Close(void *, IOR_param_t *); -static void HDF5_Delete(char *, IOR_param_t *); + IOR_offset_t, void *); +static void HDF5_Close(void *, void *); +static void HDF5_Delete(char *, void *); static char* HDF5_GetVersion(); -static void HDF5_Fsync(void *, IOR_param_t *); -static IOR_offset_t HDF5_GetFileSize(IOR_param_t *, MPI_Comm, char *); -static int HDF5_Access(const char *, int, IOR_param_t *); +static void HDF5_Fsync(void *, void *); +static IOR_offset_t HDF5_GetFileSize(void *, MPI_Comm, char *); +static int HDF5_Access(const char *, int, void *); +static void HDF5_init_xfer_options(IOR_param_t * params); +static int HDF5_check_params(void * options); /************************** O P T I O N S *****************************/ typedef struct{ int collective_md; + char * hintsFileName; /* full name for hints file */ + int showHints; /* show hints */ + int individualDataSets; /* datasets not shared by all procs */ + int noFill; /* no fill in file creation */ + IOR_offset_t setAlignment; /* alignment in bytes */ } HDF5_options_t; /***************************** F U N C T I O N S ******************************/ @@ -106,14 +113,21 @@ static option_help * HDF5_options(void ** init_backend_options, void * init_valu if (init_values != NULL){ memcpy(o, init_values, sizeof(HDF5_options_t)); }else{ + memset(o, 0, sizeof(HDF5_options_t)); /* initialize the options properly */ o->collective_md = 0; + o->setAlignment = 1; } *init_backend_options = o; option_help h [] = { {0, "hdf5.collectiveMetadata", "Use collectiveMetadata (available since HDF5-1.10.0)", OPTION_FLAG, 'd', & o->collective_md}, + {0, "hdf5.hintsFileName","Full name for hints file", OPTION_OPTIONAL_ARGUMENT, 's', & o->hintsFileName}, + {0, "hdf5.showHints", "Show MPI hints", OPTION_FLAG, 'd', & o->showHints}, + {0, "hdf5.individualDataSets", "Datasets not shared by all procs [not working]", OPTION_FLAG, 'd', & o->individualDataSets}, + {0, "hdf5.setAlignment", "HDF5 alignment in bytes (e.g.: 8, 4k, 2m, 1g)", OPTION_OPTIONAL_ARGUMENT, 'd', & o->setAlignment}, + {0, "hdf5.noFill", "No fill in HDF5 file creation", OPTION_FLAG, 'd', & o->noFill}, LAST_OPTION }; option_help * help = malloc(sizeof(h)); @@ -133,6 +147,7 @@ ior_aiori_t hdf5_aiori = { .close = HDF5_Close, .delete = HDF5_Delete, .get_version = HDF5_GetVersion, + .init_xfer_options = HDF5_init_xfer_options, .fsync = HDF5_Fsync, .get_file_size = HDF5_GetFileSize, .statfs = aiori_posix_statfs, @@ -140,7 +155,8 @@ ior_aiori_t hdf5_aiori = { .rmdir = aiori_posix_rmdir, .access = HDF5_Access, .stat = aiori_posix_stat, - .get_options = HDF5_options + .get_options = HDF5_options, + .check_params = HDF5_check_params }; static hid_t xferPropList; /* xfer property list */ @@ -151,20 +167,47 @@ hid_t memDataSpace; /* memory data space id */ int newlyOpenedFile; /* newly opened file */ /***************************** F U N C T I O N S ******************************/ +static IOR_param_t * ior_param = NULL; + +static void HDF5_init_xfer_options(IOR_param_t * params){ + ior_param = params; +} + +static int HDF5_check_params(void * options){ + HDF5_options_t *o = (HDF5_options_t*) options; + if (o->setAlignment < 0) + ERR("alignment must be non-negative integer"); + if (o->individualDataSets) + ERR("individual data sets not implemented"); + if (o->noFill) { + /* check if hdf5 available */ +#if defined (H5_VERS_MAJOR) && defined (H5_VERS_MINOR) + /* no-fill option not available until hdf5-1.6.x */ +#if (H5_VERS_MAJOR > 0 && H5_VERS_MINOR > 5) +#else + ERRF("'no fill' option not available in HDF5"); +#endif +#else + WARN("unable to determine HDF5 version for 'no fill' usage"); +#endif + } + return 0; +} /* * Create and open a file through the HDF5 interface. */ -static void *HDF5_Create(char *testFileName, IOR_param_t * param) +static void *HDF5_Create(char *testFileName, int flags, void * param) { - return HDF5_Open(testFileName, param); + return HDF5_Open(testFileName, flags, param); } /* * Open a file through the HDF5 interface. */ -static void *HDF5_Open(char *testFileName, IOR_param_t * param) +static void *HDF5_Open(char *testFileName, int flags, void * param) { + HDF5_options_t *o = (HDF5_options_t*) param; hid_t accessPropList, createPropList; hsize_t memStart[NUM_DIMS], dataSetDims[NUM_DIMS], @@ -182,36 +225,27 @@ static void *HDF5_Open(char *testFileName, IOR_param_t * param) /* * HDF5 uses different flags than those for POSIX/MPIIO */ - if (param->open == WRITE) { /* WRITE flags */ - param->openFlags = IOR_TRUNC; - } else { /* READ or check WRITE/READ flags */ - param->openFlags = IOR_RDONLY; - } - /* set IOR file flags to HDF5 flags */ /* -- file open flags -- */ - if (param->openFlags & IOR_RDONLY) { + if (flags & IOR_RDONLY) { fd_mode |= H5F_ACC_RDONLY; } - if (param->openFlags & IOR_WRONLY) { - fprintf(stdout, "File write only not implemented in HDF5\n"); - } - if (param->openFlags & IOR_RDWR) { + if (flags & IOR_WRONLY || flags & IOR_RDWR) { fd_mode |= H5F_ACC_RDWR; } - if (param->openFlags & IOR_APPEND) { + if (flags & IOR_APPEND) { fprintf(stdout, "File append not implemented in HDF5\n"); } - if (param->openFlags & IOR_CREAT) { + if (flags & IOR_CREAT) { fd_mode |= H5F_ACC_CREAT; } - if (param->openFlags & IOR_EXCL) { + if (flags & IOR_EXCL) { fd_mode |= H5F_ACC_EXCL; } - if (param->openFlags & IOR_TRUNC) { + if (flags & IOR_TRUNC) { fd_mode |= H5F_ACC_TRUNC; } - if (param->openFlags & IOR_DIRECT) { + if (flags & IOR_DIRECT) { fprintf(stdout, "O_DIRECT not implemented in HDF5\n"); } @@ -231,13 +265,13 @@ static void *HDF5_Open(char *testFileName, IOR_param_t * param) * someday HDF5 implementation will allow subsets of MPI_COMM_WORLD */ /* store MPI communicator info for the file access property list */ - if (param->filePerProc) { + if (ior_param->filePerProc) { comm = MPI_COMM_SELF; } else { comm = testComm; } - SetHints(&mpiHints, param->hintsFileName); + SetHints(&mpiHints, o->hintsFileName); /* * note that with MP_HINTS_FILTERED=no, all key/value pairs will * be in the info object. The info object that is attached to @@ -245,7 +279,7 @@ static void *HDF5_Open(char *testFileName, IOR_param_t * param) * deemed valid by the implementation. */ /* show hints passed to file */ - if (rank == 0 && param->showHints) { + if (rank == 0 && o->showHints) { fprintf(stdout, "\nhints passed to access property list {\n"); ShowHints(&mpiHints); fprintf(stdout, "}\n"); @@ -254,12 +288,11 @@ static void *HDF5_Open(char *testFileName, IOR_param_t * param) "cannot set file access property list"); /* set alignment */ - HDF5_CHECK(H5Pset_alignment(accessPropList, param->setAlignment, - param->setAlignment), + HDF5_CHECK(H5Pset_alignment(accessPropList, o->setAlignment, o->setAlignment), "cannot set alignment"); #ifdef HAVE_H5PSET_ALL_COLL_METADATA_OPS - HDF5_options_t *o = (HDF5_options_t*) param->backend_options; + if (o->collective_md) { /* more scalable metadata */ @@ -271,10 +304,9 @@ static void *HDF5_Open(char *testFileName, IOR_param_t * param) #endif /* open file */ - if(! param->dryRun){ - if (param->open == WRITE) { /* WRITE */ - *fd = H5Fcreate(testFileName, fd_mode, - createPropList, accessPropList); + if(! ior_param->dryRun){ + if (ior_param->open == WRITE) { /* WRITE */ + *fd = H5Fcreate(testFileName, H5F_ACC_TRUNC, createPropList, accessPropList); HDF5_CHECK(*fd, "cannot create file"); } else { /* READ or CHECK */ *fd = H5Fopen(testFileName, fd_mode, accessPropList); @@ -283,9 +315,8 @@ static void *HDF5_Open(char *testFileName, IOR_param_t * param) } /* show hints actually attached to file handle */ - if (param->showHints || (1) /* WEL - this needs fixing */ ) { - if (rank == 0 - && (param->showHints) /* WEL - this needs fixing */ ) { + if (o->showHints || (1) /* WEL - this needs fixing */ ) { + if (rank == 0 && (o->showHints) /* WEL - this needs fixing */ ) { WARN("showHints not working for HDF5"); } } else { @@ -334,7 +365,7 @@ static void *HDF5_Open(char *testFileName, IOR_param_t * param) HDF5_CHECK(xferPropList, "cannot create transfer property list"); /* set data transfer mode */ - if (param->collective) { + if (ior_param->collective) { HDF5_CHECK(H5Pset_dxpl_mpio(xferPropList, H5FD_MPIO_COLLECTIVE), "cannot set collective data transfer mode"); } else { @@ -346,9 +377,9 @@ static void *HDF5_Open(char *testFileName, IOR_param_t * param) /* set up memory data space for transfer */ memStart[0] = (hsize_t) 0; memCount[0] = (hsize_t) 1; - memStride[0] = (hsize_t) (param->transferSize / sizeof(IOR_size_t)); - memBlock[0] = (hsize_t) (param->transferSize / sizeof(IOR_size_t)); - memDataSpaceDims[0] = (hsize_t) param->transferSize; + memStride[0] = (hsize_t) (ior_param->transferSize / sizeof(IOR_size_t)); + memBlock[0] = (hsize_t) (ior_param->transferSize / sizeof(IOR_size_t)); + memDataSpaceDims[0] = (hsize_t) ior_param->transferSize; memDataSpace = H5Screate_simple(NUM_DIMS, memDataSpaceDims, NULL); HDF5_CHECK(memDataSpace, "cannot create simple memory data space"); @@ -358,18 +389,18 @@ static void *HDF5_Open(char *testFileName, IOR_param_t * param) memBlock), "cannot create hyperslab"); /* set up parameters for fpp or different dataset count */ - if (param->filePerProc) { + if (ior_param->filePerProc) { tasksPerDataSet = 1; } else { - if (param->individualDataSets) { + if (o->individualDataSets) { /* each task in segment has single data set */ tasksPerDataSet = 1; } else { /* share single data set across all tasks in segment */ - tasksPerDataSet = param->numTasks; + tasksPerDataSet = ior_param->numTasks; } } - dataSetDims[0] = (hsize_t) ((param->blockSize / sizeof(IOR_size_t)) + dataSetDims[0] = (hsize_t) ((ior_param->blockSize / sizeof(IOR_size_t)) * tasksPerDataSet); /* create a simple data space containing information on size @@ -386,7 +417,7 @@ static void *HDF5_Open(char *testFileName, IOR_param_t * param) * Write or read access to file using the HDF5 interface. */ static IOR_offset_t HDF5_Xfer(int access, void *fd, IOR_size_t * buffer, - IOR_offset_t length, IOR_param_t * param) + IOR_offset_t length, void * param) { static int firstReadCheck = FALSE, startNewDataSet; IOR_offset_t segmentPosition, segmentSize; @@ -405,17 +436,16 @@ static IOR_offset_t HDF5_Xfer(int access, void *fd, IOR_size_t * buffer, } /* determine by offset if need to start new data set */ - if (param->filePerProc == TRUE) { + if (ior_param->filePerProc == TRUE) { segmentPosition = (IOR_offset_t) 0; - segmentSize = param->blockSize; + segmentSize = ior_param->blockSize; } else { segmentPosition = - (IOR_offset_t) ((rank + rankOffset) % param->numTasks) - * param->blockSize; - segmentSize = - (IOR_offset_t) (param->numTasks) * param->blockSize; + (IOR_offset_t) ((rank + rankOffset) % ior_param->numTasks) + * ior_param->blockSize; + segmentSize = (IOR_offset_t) (ior_param->numTasks) * ior_param->blockSize; } - if ((IOR_offset_t) ((param->offset - segmentPosition) % segmentSize) == + if ((IOR_offset_t) ((ior_param->offset - segmentPosition) % segmentSize) == 0) { /* * ordinarily start a new data set, unless this is the @@ -427,7 +457,7 @@ static IOR_offset_t HDF5_Xfer(int access, void *fd, IOR_size_t * buffer, } } - if(param->dryRun) + if(ior_param->dryRun) return length; /* create new data set */ @@ -441,7 +471,7 @@ static IOR_offset_t HDF5_Xfer(int access, void *fd, IOR_size_t * buffer, SetupDataSet(fd, param); } - SeekOffset(fd, param->offset, param); + SeekOffset(fd, ior_param->offset, param); /* this is necessary to reset variables for reaccessing file */ startNewDataSet = FALSE; @@ -465,7 +495,7 @@ static IOR_offset_t HDF5_Xfer(int access, void *fd, IOR_size_t * buffer, /* * Perform fsync(). */ -static void HDF5_Fsync(void *fd, IOR_param_t * param) +static void HDF5_Fsync(void *fd, void * param) { ; } @@ -473,11 +503,11 @@ static void HDF5_Fsync(void *fd, IOR_param_t * param) /* * Close a file through the HDF5 interface. */ -static void HDF5_Close(void *fd, IOR_param_t * param) +static void HDF5_Close(void *fd, void * param) { - if(param->dryRun) + if(ior_param->dryRun) return; - if (param->fd_fppReadCheck == NULL) { + //if (ior_param->fd_fppReadCheck == NULL) { HDF5_CHECK(H5Dclose(dataSet), "cannot close data set"); HDF5_CHECK(H5Sclose(dataSpace), "cannot close data space"); HDF5_CHECK(H5Sclose(fileDataSpace), @@ -486,7 +516,7 @@ static void HDF5_Close(void *fd, IOR_param_t * param) "cannot close memory data space"); HDF5_CHECK(H5Pclose(xferPropList), " cannot close transfer property list"); - } + //} HDF5_CHECK(H5Fclose(*(hid_t *) fd), "cannot close file"); free(fd); } @@ -494,9 +524,9 @@ static void HDF5_Close(void *fd, IOR_param_t * param) /* * Delete a file through the HDF5 interface. */ -static void HDF5_Delete(char *testFileName, IOR_param_t * param) +static void HDF5_Delete(char *testFileName, void * param) { - if(param->dryRun) + if(ior_param->dryRun) return MPIIO_Delete(testFileName, param); return; @@ -528,23 +558,24 @@ static char * HDF5_GetVersion() * Seek to offset in file using the HDF5 interface and set up hyperslab. */ static IOR_offset_t SeekOffset(void *fd, IOR_offset_t offset, - IOR_param_t * param) + void * param) { + HDF5_options_t *o = (HDF5_options_t*) param; IOR_offset_t segmentSize; hsize_t hsStride[NUM_DIMS], hsCount[NUM_DIMS], hsBlock[NUM_DIMS]; hsize_t hsStart[NUM_DIMS]; - if (param->filePerProc == TRUE) { - segmentSize = (IOR_offset_t) param->blockSize; + if (ior_param->filePerProc == TRUE) { + segmentSize = (IOR_offset_t) ior_param->blockSize; } else { segmentSize = - (IOR_offset_t) (param->numTasks) * param->blockSize; + (IOR_offset_t) (ior_param->numTasks) * ior_param->blockSize; } /* create a hyperslab representing the file data space */ - if (param->individualDataSets) { + if (o->individualDataSets) { /* start at zero offset if not */ - hsStart[0] = (hsize_t) ((offset % param->blockSize) + hsStart[0] = (hsize_t) ((offset % ior_param->blockSize) / sizeof(IOR_size_t)); } else { /* start at a unique offset if shared */ @@ -552,8 +583,8 @@ static IOR_offset_t SeekOffset(void *fd, IOR_offset_t offset, (hsize_t) ((offset % segmentSize) / sizeof(IOR_size_t)); } hsCount[0] = (hsize_t) 1; - hsStride[0] = (hsize_t) (param->transferSize / sizeof(IOR_size_t)); - hsBlock[0] = (hsize_t) (param->transferSize / sizeof(IOR_size_t)); + hsStride[0] = (hsize_t) (ior_param->transferSize / sizeof(IOR_size_t)); + hsBlock[0] = (hsize_t) (ior_param->transferSize / sizeof(IOR_size_t)); /* retrieve data space from data set for hyperslab */ fileDataSpace = H5Dget_space(dataSet); @@ -567,8 +598,9 @@ static IOR_offset_t SeekOffset(void *fd, IOR_offset_t offset, /* * Create HDF5 data set. */ -static void SetupDataSet(void *fd, IOR_param_t * param) +static void SetupDataSet(void *fd, void * param) { + HDF5_options_t *o = (HDF5_options_t*) param; char dataSetName[MAX_STR]; hid_t dataSetPropList; int dataSetID; @@ -582,8 +614,8 @@ static void SetupDataSet(void *fd, IOR_param_t * param) dataSetSuffix = 0; /* may want to use individual access to each data set someday */ - if (param->individualDataSets) { - dataSetID = (rank + rankOffset) % param->numTasks; + if (o->individualDataSets) { + dataSetID = (rank + rankOffset) % ior_param->numTasks; } else { dataSetID = 0; } @@ -591,14 +623,14 @@ static void SetupDataSet(void *fd, IOR_param_t * param) sprintf(dataSetName, "%s-%04d.%04d", "Dataset", dataSetID, dataSetSuffix++); - if (param->open == WRITE) { /* WRITE */ + if (ior_param->open == WRITE) { /* WRITE */ /* create data set */ dataSetPropList = H5Pcreate(H5P_DATASET_CREATE); /* check if hdf5 available */ #if defined (H5_VERS_MAJOR) && defined (H5_VERS_MINOR) /* no-fill option not available until hdf5-1.6.x */ #if (H5_VERS_MAJOR > 0 && H5_VERS_MINOR > 5) - if (param->noFill == TRUE) { + if (o->noFill == TRUE) { if (rank == 0 && verbose >= VERBOSE_1) { fprintf(stdout, "\nusing 'no fill' option\n"); } @@ -629,9 +661,9 @@ static void SetupDataSet(void *fd, IOR_param_t * param) * Use MPIIO call to get file size. */ static IOR_offset_t -HDF5_GetFileSize(IOR_param_t * test, MPI_Comm testComm, char *testFileName) +HDF5_GetFileSize(void * test, MPI_Comm testComm, char *testFileName) { - if(test->dryRun) + if(ior_param->dryRun) return 0; return(MPIIO_GetFileSize(test, testComm, testFileName)); } @@ -639,9 +671,9 @@ HDF5_GetFileSize(IOR_param_t * test, MPI_Comm testComm, char *testFileName) /* * Use MPIIO call to check for access. */ -static int HDF5_Access(const char *path, int mode, IOR_param_t *param) +static int HDF5_Access(const char *path, int mode, void *param) { - if(param->dryRun) + if(ior_param->dryRun) return 0; return(MPIIO_Access(path, mode, param)); } diff --git a/src/aiori-MPIIO.c b/src/aiori-MPIIO.c index 443230b..5c8a012 100755 --- a/src/aiori-MPIIO.c +++ b/src/aiori-MPIIO.c @@ -52,7 +52,7 @@ typedef struct { int preallocate; /* preallocate file size */ int useSharedFilePointer; /* use shared file pointer */ int useStridedDatatype; /* put strided access into datatype */ - char * hintsFileName; /* full name for hints file */ + char * hintsFileName; /* full name for hints file */ } mpiio_options_t; static option_help * MPIIO_options(void ** init_backend_options, void * init_values){ diff --git a/src/ior-output.c b/src/ior-output.c index 3bb8fd7..fe5039d 100644 --- a/src/ior-output.c +++ b/src/ior-output.c @@ -355,7 +355,6 @@ void ShowTestStart(IOR_param_t *test) PrintKeyValInt("fsyncperwrite", test->fsyncPerWrite); PrintKeyValInt("useExistingTestFile", test->useExistingTestFile); PrintKeyValInt("uniqueDir", test->uniqueDir); - PrintKeyValInt("individualDataSets", test->individualDataSets); PrintKeyValInt("singleXferAttempt", test->singleXferAttempt); PrintKeyValInt("readFile", test->readFile); PrintKeyValInt("writeFile", test->writeFile); @@ -366,7 +365,6 @@ void ShowTestStart(IOR_param_t *test) PrintKeyValInt("randomOffset", test->randomOffset); PrintKeyValInt("checkWrite", test->checkWrite); PrintKeyValInt("checkRead", test->checkRead); - PrintKeyValInt("setAlignment", test->setAlignment); PrintKeyValInt("storeFileOffset", test->storeFileOffset); PrintKeyValInt("keepFile", test->keepFile); PrintKeyValInt("keepFileWithError", test->keepFileWithError); diff --git a/src/ior.c b/src/ior.c index 206a9f4..33c21ba 100755 --- a/src/ior.c +++ b/src/ior.c @@ -68,7 +68,7 @@ static void test_initialize(IOR_test_t * test){ backend->initialize(test->params.backend_options); } if(backend->init_xfer_options){ - backend->init_xfer_options(test); + backend->init_xfer_options(& test->params); } } @@ -214,7 +214,6 @@ void init_IOR_Param_t(IOR_param_t * p) p->randomSeed = -1; p->incompressibleSeed = 573; p->testComm = mpi_comm_world; - p->setAlignment = 1; p->lustre_start_ost = -1; hdfs_user = getenv("USER"); @@ -1343,7 +1342,7 @@ static void TestIoSys(IOR_test_t *test) MPI_CHECK(MPI_Barrier(testComm), "barrier error"); params->open = WRITE; timer[0] = GetTimeStamp(); - fd = backend->create(testFileName, IOR_WRONLY | IOR_CREAT, params->backend_options); + fd = backend->create(testFileName, IOR_WRONLY | IOR_CREAT | IOR_TRUNC, params->backend_options); timer[1] = GetTimeStamp(); if (params->intraTestBarriers) MPI_CHECK(MPI_Barrier(testComm), @@ -1592,8 +1591,6 @@ static void ValidateTests(IOR_param_t * test) ERR("block size must be non-negative integer"); if ((test->transferSize % sizeof(IOR_size_t)) != 0) ERR("transfer size must be a multiple of access size"); - if (test->setAlignment < 0) - ERR("alignment must be non-negative integer"); if (test->transferSize < 0) ERR("transfer size must be non-negative integer"); if (test->transferSize == 0) { @@ -1647,32 +1644,8 @@ static void ValidateTests(IOR_param_t * test) ERR("random offset not available with HDF5"); if ((strcasecmp(test->api, "NCMPI") == 0) && test->randomOffset) ERR("random offset not available with NCMPI"); - if ((strcasecmp(test->api, "HDF5") != 0) && test->individualDataSets) - WARN_RESET("individual datasets only available in HDF5", - test, &defaults, individualDataSets); - if ((strcasecmp(test->api, "HDF5") == 0) && test->individualDataSets) - WARN_RESET("individual data sets not implemented", - test, &defaults, individualDataSets); if ((strcasecmp(test->api, "NCMPI") == 0) && test->filePerProc) ERR("file-per-proc not available in current NCMPI"); - if (test->noFill) { - if (strcasecmp(test->api, "HDF5") != 0) { - ERR("'no fill' option only available in HDF5"); - } else { - /* check if hdf5 available */ -#if defined (H5_VERS_MAJOR) && defined (H5_VERS_MINOR) - /* no-fill option not available until hdf5-1.6.x */ -#if (H5_VERS_MAJOR > 0 && H5_VERS_MINOR > 5) - ; -#else - ERRF("'no fill' option not available in %s", - test->apiVersion); -#endif -#else - WARN("unable to determine HDF5 version for 'no fill' usage"); -#endif - } - } if (test->useExistingTestFile && test->lustre_set_striping) ERR("Lustre stripe options are incompatible with useExistingTestFile"); diff --git a/src/ior.h b/src/ior.h index 14d6ddf..52c68a1 100755 --- a/src/ior.h +++ b/src/ior.h @@ -159,11 +159,6 @@ typedef struct MPI_Datatype transferType; /* datatype for transfer */ MPI_Datatype fileType; /* filetype for file view */ - /* HDF5 variables */ - int individualDataSets; /* datasets not shared by all procs */ - int noFill; /* no fill in file creation */ - IOR_offset_t setAlignment; /* alignment in bytes */ - /* HDFS variables */ char * hdfs_user; /* copied from ENV, for now */ const char* hdfs_name_node; diff --git a/src/parse_options.c b/src/parse_options.c index 51a5d24..f976fe8 100755 --- a/src/parse_options.c +++ b/src/parse_options.c @@ -179,16 +179,10 @@ void DecodeDirective(char *line, IOR_param_t *params, options_all_t * module_opt params->blockSize = string_to_bytes(value); } else if (strcasecmp(option, "transfersize") == 0) { params->transferSize = string_to_bytes(value); - } else if (strcasecmp(option, "setalignment") == 0) { - params->setAlignment = string_to_bytes(value); } else if (strcasecmp(option, "singlexferattempt") == 0) { params->singleXferAttempt = atoi(value); - } else if (strcasecmp(option, "individualdatasets") == 0) { - params->individualDataSets = atoi(value); } else if (strcasecmp(option, "intraTestBarriers") == 0) { params->intraTestBarriers = atoi(value); - } else if (strcasecmp(option, "nofill") == 0) { - params->noFill = atoi(value); } else if (strcasecmp(option, "verbose") == 0) { params->verbose = atoi(value); } else if (strcasecmp(option, "settimestampsignature") == 0) { @@ -458,15 +452,12 @@ option_help * createGlobalOptions(IOR_param_t * params){ */ {'G', NULL, "setTimeStampSignature -- set value for time stamp signature/random seed", OPTION_OPTIONAL_ARGUMENT, 'd', & params->setTimeStampSignature}, {'i', NULL, "repetitions -- number of repetitions of test", OPTION_OPTIONAL_ARGUMENT, 'd', & params->repetitions}, - {'I', NULL, "individualDataSets -- datasets not shared by all procs [not working]", OPTION_FLAG, 'd', & params->individualDataSets}, {'j', NULL, "outlierThreshold -- warn on outlier N seconds from mean", OPTION_OPTIONAL_ARGUMENT, 'd', & params->outlierThreshold}, - {'J', NULL, "setAlignment -- HDF5 alignment in bytes (e.g.: 8, 4k, 2m, 1g)", OPTION_OPTIONAL_ARGUMENT, 'd', & params->setAlignment}, {'k', NULL, "keepFile -- don't remove the test file(s) on program exit", OPTION_FLAG, 'd', & params->keepFile}, {'K', NULL, "keepFileWithError -- keep error-filled file(s) after data-checking", OPTION_FLAG, 'd', & params->keepFileWithError}, {'l', NULL, "datapacket type-- type of packet that will be created [offset|incompressible|timestamp|o|i|t]", OPTION_OPTIONAL_ARGUMENT, 's', & params->buffer_type}, {'m', NULL, "multiFile -- use number of reps (-i) for multiple file count", OPTION_FLAG, 'd', & params->multiFile}, {'M', NULL, "memoryPerNode -- hog memory on the node (e.g.: 2g, 75%)", OPTION_OPTIONAL_ARGUMENT, 's', & params->memoryPerNodeStr}, - {'n', NULL, "noFill -- no fill in HDF5 file creation", OPTION_FLAG, 'd', & params->noFill}, {'N', NULL, "numTasks -- number of tasks that are participating in the test (overrides MPI)", OPTION_OPTIONAL_ARGUMENT, 'd', & params->numTasks}, {'o', NULL, "testFile -- full name for test", OPTION_OPTIONAL_ARGUMENT, 's', & params->testFileName}, {'O', NULL, "string of IOR directives (e.g. -O checkRead=1,lustreStripeCount=32)", OPTION_OPTIONAL_ARGUMENT, 'p', & decodeDirectiveWrapper}, From e91b79cea029282f46b0c9c228d4b60e654375a6 Mon Sep 17 00:00:00 2001 From: "Julian M. Kunkel" Date: Sat, 30 May 2020 20:09:37 +0100 Subject: [PATCH 41/52] Moved Lustre/GPFS/BeeGFS options into POSIX backend. Needs testing. Additional minor fixes. --- src/aiori-MMAP.c | 1 + src/aiori-POSIX.c | 100 ++++++++++++++++++++++++++++++++------------ src/aiori.h | 1 + src/ior-output.c | 8 ---- src/ior.c | 14 ++----- src/ior.h | 18 +------- src/iordef.h | 4 +- src/mdtest.c | 6 +++ src/parse_options.c | 49 ---------------------- src/utilities.c | 2 +- 10 files changed, 90 insertions(+), 113 deletions(-) diff --git a/src/aiori-MMAP.c b/src/aiori-MMAP.c index 0b55557..10c196e 100644 --- a/src/aiori-MMAP.c +++ b/src/aiori-MMAP.c @@ -86,6 +86,7 @@ static IOR_param_t * ior_param = NULL; static void MMAP_init_xfer_options(IOR_param_t * params){ ior_param = params; + aiori_posix_init_xfer_options(params); } static int MMAP_check_params(void * options){ diff --git a/src/aiori-POSIX.c b/src/aiori-POSIX.c index f7c9cd3..b7b01e4 100755 --- a/src/aiori-POSIX.c +++ b/src/aiori-POSIX.c @@ -72,13 +72,28 @@ static IOR_offset_t POSIX_Xfer(int, void *, IOR_size_t *, IOR_offset_t, void *); static void POSIX_Fsync(void *, void *); static void POSIX_Sync(void * ); -static void POSIX_init_xfer_options(IOR_param_t * params); - +static int POSIX_check_params(void * options); /************************** O P T I O N S *****************************/ typedef struct{ /* in case of a change, please update depending MMAP module too */ int direct_io; + + /* Lustre variables */ + int lustre_set_striping; /* flag that we need to set lustre striping */ + int lustre_stripe_count; + int lustre_stripe_size; + int lustre_start_ost; + int lustre_ignore_locks; + + /* gpfs variables */ + int gpfs_hint_access; /* use gpfs "access range" hint */ + int gpfs_release_token; /* immediately release GPFS tokens after + creating or opening a file */ + /* beegfs variables */ + int beegfs_numTargets; /* number storage targets to use */ + int beegfs_chunkSize; /* srtipe pattern for new files */ + } posix_options_t; @@ -88,13 +103,32 @@ option_help * POSIX_options(void ** init_backend_options, void * init_values){ if (init_values != NULL){ memcpy(o, init_values, sizeof(posix_options_t)); }else{ + memset(o, 0, sizeof(posix_options_t)); o->direct_io = 0; + o->lustre_start_ost = -1; + o->beegfs_numTargets = -1; + o->beegfs_chunkSize = -1; } *init_backend_options = o; option_help h [] = { {0, "posix.odirect", "Direct I/O Mode", OPTION_FLAG, 'd', & o->direct_io}, +#ifdef HAVE_BEEGFS_BEEGFS_H + {0, "posix.beegfs.NumTargets", "", OPTION_OPTIONAL_ARGUMENT, 'd', & o->beegfs_numTargets}, + {0, "posix.beegfs.ChunkSize", "", OPTION_OPTIONAL_ARGUMENT, 'd', & o->beegfs_chunkSize}, +#endif +#ifdef HAVE_GPFS_FCNTL_H + {0, "posix.gpfs.hintaccess", "", OPTION_FLAG, 'd', & o->gpfs_hint_access}, + {0, "posix.gpfs.releasetoken", "", OPTION_OPTIONAL_ARGUMENT, 'd', & o->gpfs_release_token}, + +#endif +#ifdef HAVE_LUSTRE_LUSTRE_USER_H + {0, "posix.lustre.stripecount", "", OPTION_OPTIONAL_ARGUMENT, 'd', & o->lustre_stripe_count}, + {0, "posix.lustre.stripesize", "", OPTION_OPTIONAL_ARGUMENT, 'd', & o->lustre_stripe_size}, + {0, "posix.lustre.startost", "", OPTION_OPTIONAL_ARGUMENT, 'd', & o->lustre_start_ost}, + {0, "posix.lustre.ignorelocks", "", OPTION_FLAG, 'd', & o->lustre_ignore_locks}, +#endif LAST_OPTION }; option_help * help = malloc(sizeof(h)); @@ -115,7 +149,7 @@ ior_aiori_t posix_aiori = { .xfer = POSIX_Xfer, .close = POSIX_Close, .delete = POSIX_Delete, - .init_xfer_options = POSIX_init_xfer_options, + .init_xfer_options = aiori_posix_init_xfer_options, .get_version = aiori_get_version, .fsync = POSIX_Fsync, .get_file_size = POSIX_GetFileSize, @@ -126,17 +160,29 @@ ior_aiori_t posix_aiori = { .stat = aiori_posix_stat, .get_options = POSIX_options, .enable_mdtest = true, - .sync = POSIX_Sync + .sync = POSIX_Sync, + .check_params = POSIX_check_params }; /***************************** F U N C T I O N S ******************************/ static IOR_param_t * ior_param = NULL; -static void POSIX_init_xfer_options(IOR_param_t * params){ +void aiori_posix_init_xfer_options(IOR_param_t * params){ ior_param = params; } +static int POSIX_check_params(void * param){ + posix_options_t * o = (posix_options_t*) param; + if (ior_param->useExistingTestFile && o->lustre_set_striping) + ERR("Lustre stripe options are incompatible with useExistingTestFile"); + if (o->beegfs_chunkSize != -1 && (!ISPOWEROFTWO(o->beegfs_chunkSize) || o->beegfs_chunkSize < (1<<16))) + ERR("beegfsChunkSize must be a power of two and >64k"); + if(o->lustre_stripe_count != -1 || o->lustre_stripe_size != 0) + o->lustre_set_striping = 1; + return 0; +} + #ifdef HAVE_GPFS_FCNTL_H void gpfs_free_all_locks(int fd) { @@ -159,7 +205,7 @@ void gpfs_free_all_locks(int fd) EWARNF("gpfs_fcntl(%d, ...) release all locks hint failed.", fd); } } -void gpfs_access_start(int fd, IOR_offset_t length, void *param, int access) +void gpfs_access_start(int fd, IOR_offset_t length, int access) { int rc; struct { @@ -173,7 +219,7 @@ void gpfs_access_start(int fd, IOR_offset_t length, void *param, int access) take_locks.access.structLen = sizeof(take_locks.access); take_locks.access.structType = GPFS_ACCESS_RANGE; - take_locks.access.start = param->offset; + take_locks.access.start = ior_param->offset; take_locks.access.length = length; take_locks.access.isWrite = (access == WRITE); @@ -183,7 +229,7 @@ void gpfs_access_start(int fd, IOR_offset_t length, void *param, int access) } } -void gpfs_access_end(int fd, IOR_offset_t length, void *param, int access) +void gpfs_access_end(int fd, IOR_offset_t length, int access) { int rc; struct { @@ -198,7 +244,7 @@ void gpfs_access_end(int fd, IOR_offset_t length, void *param, int access) free_locks.free.structLen = sizeof(free_locks.free); free_locks.free.structType = GPFS_FREE_RANGE; - free_locks.free.start = param->offset; + free_locks.free.start = ior_param->offset; free_locks.free.length = length; rc = gpfs_fcntl(fd, &free_locks); @@ -349,12 +395,11 @@ void *POSIX_Create(char *testFileName, int flags, void * param) #ifndef FASYNC #define FASYNC 00020000 /* fcntl, for BSD compatibility */ #endif - - if (param->lustre_set_striping) { + if (o->lustre_set_striping) { /* In the single-shared-file case, task 0 has to creat the file with the Lustre striping options before any other processes open the file */ - if (!param->filePerProc && rank != 0) { + if (!ior_param->filePerProc && rank != 0) { MPI_CHECK(MPI_Barrier(testComm), "barrier error"); fd_oflag |= O_RDWR; *fd = open64(testFileName, fd_oflag, mode); @@ -366,9 +411,9 @@ void *POSIX_Create(char *testFileName, int flags, void * param) /* Setup Lustre IOCTL striping pattern structure */ opts.lmm_magic = LOV_USER_MAGIC; - opts.lmm_stripe_size = param->lustre_stripe_size; - opts.lmm_stripe_offset = param->lustre_start_ost; - opts.lmm_stripe_count = param->lustre_stripe_count; + opts.lmm_stripe_size = o->lustre_stripe_size; + opts.lmm_stripe_offset = o->lustre_start_ost; + opts.lmm_stripe_count = o->lustre_stripe_count; /* File needs to be opened O_EXCL because we cannot set * Lustre striping information on a pre-existing file.*/ @@ -391,7 +436,7 @@ void *POSIX_Create(char *testFileName, int flags, void * param) MPI_CHECK(MPI_Abort(MPI_COMM_WORLD, -1), "MPI_Abort() error"); } - if (!param->filePerProc) + if (!ior_param->filePerProc) MPI_CHECK(MPI_Barrier(testComm), "barrier error"); } @@ -401,12 +446,12 @@ void *POSIX_Create(char *testFileName, int flags, void * param) fd_oflag |= O_CREAT | O_RDWR; #ifdef HAVE_BEEGFS_BEEGFS_H - if (beegfs_isOptionSet(param->beegfs_chunkSize) - || beegfs_isOptionSet(param->beegfs_numTargets)) { + if (beegfs_isOptionSet(o->beegfs_chunkSize) + || beegfs_isOptionSet(o->beegfs_numTargets)) { bool result = beegfs_createFilePath(testFileName, mode, - param->beegfs_numTargets, - param->beegfs_chunkSize); + o->beegfs_numTargets, + o->beegfs_chunkSize); if (result) { fd_oflag &= ~O_CREAT; } else { @@ -423,7 +468,7 @@ void *POSIX_Create(char *testFileName, int flags, void * param) #ifdef HAVE_LUSTRE_LUSTRE_USER_H } - if (param->lustre_ignore_locks) { + if (o->lustre_ignore_locks) { int lustre_ioctl_flags = LL_FILE_IGNORE_LOCK; if (ioctl(*fd, LL_IOC_SETFLAGS, &lustre_ioctl_flags) == -1) ERRF("ioctl(%d, LL_IOC_SETFLAGS, ...) failed", *fd); @@ -434,7 +479,7 @@ void *POSIX_Create(char *testFileName, int flags, void * param) /* in the single shared file case, immediately release all locks, with * the intent that we can avoid some byte range lock revocation: * everyone will be writing/reading from individual regions */ - if (param->gpfs_release_token ) { + if (o->gpfs_release_token ) { gpfs_free_all_locks(*fd); } #endif @@ -481,7 +526,7 @@ void *POSIX_Open(char *testFileName, int flags, void * param) ERRF("open64(\"%s\", %d) failed", testFileName, fd_oflag); #ifdef HAVE_LUSTRE_LUSTRE_USER_H - if (param->lustre_ignore_locks) { + if (o->lustre_ignore_locks) { int lustre_ioctl_flags = LL_FILE_IGNORE_LOCK; if (verbose >= VERBOSE_1) { fprintf(stdout, @@ -493,7 +538,7 @@ void *POSIX_Open(char *testFileName, int flags, void * param) #endif /* HAVE_LUSTRE_LUSTRE_USER_H */ #ifdef HAVE_GPFS_FCNTL_H - if(param->gpfs_release_token) { + if(o->gpfs_release_token) { gpfs_free_all_locks(*fd); } #endif @@ -511,6 +556,7 @@ static IOR_offset_t POSIX_Xfer(int access, void *file, IOR_size_t * buffer, char *ptr = (char *)buffer; long long rc; int fd; + posix_options_t * o = (posix_options_t*) param; if(ior_param->dryRun) return length; @@ -518,8 +564,8 @@ static IOR_offset_t POSIX_Xfer(int access, void *file, IOR_size_t * buffer, fd = *(int *)file; #ifdef HAVE_GPFS_FCNTL_H - if (param->gpfs_hint_access) { - gpfs_access_start(fd, length, param, access); + if (o->gpfs_hint_access) { + gpfs_access_start(fd, length, access); } #endif @@ -578,7 +624,7 @@ static IOR_offset_t POSIX_Xfer(int access, void *file, IOR_size_t * buffer, xferRetries++; } #ifdef HAVE_GPFS_FCNTL_H - if (param->gpfs_hint_access) { + if (o->gpfs_hint_access) { gpfs_access_end(fd, length, param, access); } #endif diff --git a/src/aiori.h b/src/aiori.h index 4dd2eed..f99c424 100755 --- a/src/aiori.h +++ b/src/aiori.h @@ -132,6 +132,7 @@ int aiori_posix_mkdir (const char *path, mode_t mode, void * module_options); int aiori_posix_rmdir (const char *path, void * module_options); int aiori_posix_access (const char *path, int mode, void * module_options); int aiori_posix_stat (const char *path, struct stat *buf, void * module_options); +void aiori_posix_init_xfer_options(IOR_param_t * params); void *POSIX_Create(char *testFileName, int flags, void * module_options); int POSIX_Mknod(char *testFileName); diff --git a/src/ior-output.c b/src/ior-output.c index fe5039d..2bffd40 100644 --- a/src/ior-output.c +++ b/src/ior-output.c @@ -444,14 +444,6 @@ void ShowSetup(IOR_param_t *params) if(params->dryRun){ PrintKeyValInt("dryRun", params->dryRun); } - -#ifdef HAVE_LUSTRE_LUSTRE_USER_H - if (params->lustre_set_striping) { - PrintKeyVal("Lustre stripe size", ((params->lustre_stripe_size == 0) ? "Use default" : - HumanReadable(params->lustre_stripe_size, BASE_TWO))); - PrintKeyValInt("Lustre stripe count", params->lustre_stripe_count); - } -#endif /* HAVE_LUSTRE_LUSTRE_USER_H */ if (params->deadlineForStonewalling > 0) { PrintKeyValInt("stonewallingTime", params->deadlineForStonewalling); PrintKeyValInt("stoneWallingWearOut", params->stoneWallingWearOut ); diff --git a/src/ior.c b/src/ior.c index 33c21ba..59fc26b 100755 --- a/src/ior.c +++ b/src/ior.c @@ -214,7 +214,6 @@ void init_IOR_Param_t(IOR_param_t * p) p->randomSeed = -1; p->incompressibleSeed = 573; p->testComm = mpi_comm_world; - p->lustre_start_ost = -1; hdfs_user = getenv("USER"); if (!hdfs_user) @@ -228,9 +227,6 @@ void init_IOR_Param_t(IOR_param_t * p) p->URI = NULL; p->part_number = 0; - - p->beegfs_numTargets = -1; - p->beegfs_chunkSize = -1; } static void @@ -1646,15 +1642,13 @@ static void ValidateTests(IOR_param_t * test) ERR("random offset not available with NCMPI"); if ((strcasecmp(test->api, "NCMPI") == 0) && test->filePerProc) ERR("file-per-proc not available in current NCMPI"); - if (test->useExistingTestFile && test->lustre_set_striping) - ERR("Lustre stripe options are incompatible with useExistingTestFile"); + if(test->backend->init_xfer_options){ + test->backend->init_xfer_options(test); + } /* allow the backend to validate the options */ if(test->backend->check_params){ - if(test->backend->init_xfer_options){ - test->backend->init_xfer_options(test); - } - int check = test->backend->check_params(test); + int check = test->backend->check_params(test->backend_options); if (check){ ERR("The backend returned that the test parameters are invalid."); } diff --git a/src/ior.h b/src/ior.h index 52c68a1..f09d617 100755 --- a/src/ior.h +++ b/src/ior.h @@ -36,8 +36,9 @@ typedef void *rados_ioctx_t; #endif #include "option.h" - #include "iordef.h" + +#define ISPOWEROFTWO(x) ((x != 0) && !(x & (x - 1))) /******************** DATA Packet Type ***************************************/ /* Holds the types of data packets: generic, offset, timestamp, incompressible */ @@ -178,21 +179,6 @@ typedef struct /* NCMPI variables */ int var_id; /* variable id handle for data set */ - /* Lustre variables */ - int lustre_stripe_count; - int lustre_stripe_size; - int lustre_start_ost; - int lustre_set_striping; /* flag that we need to set lustre striping */ - int lustre_ignore_locks; - - /* gpfs variables */ - int gpfs_hint_access; /* use gpfs "access range" hint */ - int gpfs_release_token; /* immediately release GPFS tokens after - creating or opening a file */ - /* beegfs variables */ - int beegfs_numTargets; /* number storage targets to use */ - int beegfs_chunkSize; /* srtipe pattern for new files */ - int id; /* test's unique ID */ int intraTestBarriers; /* barriers between open/op and op/close */ } IOR_param_t; diff --git a/src/iordef.h b/src/iordef.h index 78cf1d3..4c46b29 100755 --- a/src/iordef.h +++ b/src/iordef.h @@ -181,13 +181,13 @@ typedef long long int IOR_size_t; /* display error message and terminate execution */ -#define ERR(MSG) do { \ +#define ERR_ERRNO(MSG) do { \ ERRF("%s", MSG); \ } while (0) /* display a simple error message (i.e. errno is not set) and terminate execution */ -#define ERR_SIMPLE(MSG) do { \ +#define ERR(MSG) do { \ fprintf(stdout, "ior ERROR: %s, (%s:%d)\n", \ MSG, __FILE__, __LINE__); \ fflush(stdout); \ diff --git a/src/mdtest.c b/src/mdtest.c index 4b4dd15..bdd70c9 100644 --- a/src/mdtest.c +++ b/src/mdtest.c @@ -1966,6 +1966,12 @@ mdtest_results_t * mdtest_run(int argc, char **argv, MPI_Comm world_com, FILE * if (backend->initialize){ backend->initialize(backend_options); } + if(backend->init_xfer_options){ + backend->init_xfer_options(& param); + } + if(backend->check_params){ + backend->check_params(backend_options); + } pid = getpid(); uid = getuid(); diff --git a/src/parse_options.c b/src/parse_options.c index f976fe8..97e10dc 100755 --- a/src/parse_options.c +++ b/src/parse_options.c @@ -32,8 +32,6 @@ #include "option.h" #include "aiori.h" -#define ISPOWEROFTWO(x) ((x != 0) && !(x & (x - 1))) - IOR_param_t initialTestParams; option_help * createGlobalOptions(IOR_param_t * params); @@ -205,53 +203,6 @@ void DecodeDirective(char *line, IOR_param_t *params, options_all_t * module_opt } else if (strcasecmp(option, "memoryPerNode") == 0) { params->memoryPerNode = NodeMemoryStringToBytes(value); params->memoryPerTask = 0; - } else if (strcasecmp(option, "lustrestripecount") == 0) { -#ifndef HAVE_LUSTRE_LUSTRE_USER_H - ERR("ior was not compiled with Lustre support"); -#endif - params->lustre_stripe_count = atoi(value); - params->lustre_set_striping = 1; - } else if (strcasecmp(option, "lustrestripesize") == 0) { -#ifndef HAVE_LUSTRE_LUSTRE_USER_H - ERR("ior was not compiled with Lustre support"); -#endif - params->lustre_stripe_size = string_to_bytes(value); - params->lustre_set_striping = 1; - } else if (strcasecmp(option, "lustrestartost") == 0) { -#ifndef HAVE_LUSTRE_LUSTRE_USER_H - ERR("ior was not compiled with Lustre support"); -#endif - params->lustre_start_ost = atoi(value); - params->lustre_set_striping = 1; - } else if (strcasecmp(option, "lustreignorelocks") == 0) { -#ifndef HAVE_LUSTRE_LUSTRE_USER_H - ERR("ior was not compiled with Lustre support"); -#endif - params->lustre_ignore_locks = atoi(value); - } else if (strcasecmp(option, "gpfshintaccess") == 0) { -#ifndef HAVE_GPFS_FCNTL_H - ERR("ior was not compiled with GPFS hint support"); -#endif - params->gpfs_hint_access = atoi(value); - } else if (strcasecmp(option, "gpfsreleasetoken") == 0) { -#ifndef HAVE_GPFS_FCNTL_H - ERR("ior was not compiled with GPFS hint support"); -#endif - params->gpfs_release_token = atoi(value); - } else if (strcasecmp(option, "beegfsNumTargets") == 0) { -#ifndef HAVE_BEEGFS_BEEGFS_H - ERR("ior was not compiled with BeeGFS support"); -#endif - params->beegfs_numTargets = atoi(value); - if (params->beegfs_numTargets < 1) - ERR("beegfsNumTargets must be >= 1"); - } else if (strcasecmp(option, "beegfsChunkSize") == 0) { - #ifndef HAVE_BEEGFS_BEEGFS_H - ERR("ior was not compiled with BeeGFS support"); - #endif - params->beegfs_chunkSize = string_to_bytes(value); - if (!ISPOWEROFTWO(params->beegfs_chunkSize) || params->beegfs_chunkSize < (1<<16)) - ERR("beegfsChunkSize must be a power of two and >64k"); } else if (strcasecmp(option, "summaryalways") == 0) { params->summary_every_test = atoi(value); } else { diff --git a/src/utilities.c b/src/utilities.c index bcb1e03..1f83c83 100755 --- a/src/utilities.c +++ b/src/utilities.c @@ -146,7 +146,7 @@ void updateParsedOptions(IOR_param_t * options, options_all_t * global_options){ } const ior_aiori_t * backend = aiori_select(options->api); if (backend == NULL) - ERR_SIMPLE("unrecognized I/O API"); + ERR("Unrecognized I/O API"); options->backend = backend; /* copy the actual module options into the test */ From 294b8891e69b88c62e431d9d5600bfb0571dc58e Mon Sep 17 00:00:00 2001 From: "Julian M. Kunkel" Date: Sun, 31 May 2020 11:50:15 +0100 Subject: [PATCH 42/52] Created dummy option type to provide type safety. Fixed various call issues for options. --- src/aiori-DUMMY.c | 40 +++++++-------- src/aiori-HDF5.c | 48 +++++++++--------- src/aiori-MMAP.c | 30 +++++------ src/aiori-MPIIO.c | 125 ++++++++++++++++++++++++---------------------- src/aiori-POSIX.c | 30 +++++------ src/aiori.c | 10 ++-- src/aiori.h | 68 +++++++++++++------------ src/ior.c | 41 ++++++++------- src/ior.h | 6 +-- src/mdtest.c | 4 +- src/option.h | 4 +- 11 files changed, 205 insertions(+), 201 deletions(-) diff --git a/src/aiori-DUMMY.c b/src/aiori-DUMMY.c index c58a128..766a2c0 100755 --- a/src/aiori-DUMMY.c +++ b/src/aiori-DUMMY.c @@ -25,7 +25,7 @@ typedef struct { static char * current = (char*) 1; -static option_help * DUMMY_options(void ** init_backend_options, void * init_values){ +static option_help * DUMMY_options(airori_mod_opt_t ** init_backend_options, airori_mod_opt_t * init_values){ dummy_options_t * o = malloc(sizeof(dummy_options_t)); if (init_values != NULL){ memcpy(o, init_values, sizeof(dummy_options_t)); @@ -33,7 +33,7 @@ static option_help * DUMMY_options(void ** init_backend_options, void * init_val memset(o, 0, sizeof(dummy_options_t)); } - *init_backend_options = o; + *init_backend_options = (airori_mod_opt_t*) o; option_help h [] = { {0, "dummy.delay-create", "Delay per create in usec", OPTION_OPTIONAL_ARGUMENT, 'l', & o->delay_creates}, @@ -48,7 +48,7 @@ static option_help * DUMMY_options(void ** init_backend_options, void * init_val static int count_init = 0; -static void *DUMMY_Create(char *testFileName, int iorflags, void * param) +static void *DUMMY_Create(char *testFileName, int iorflags, airori_mod_opt_t * options) { if(count_init <= 0){ ERR("DUMMY missing initialization in create\n"); @@ -56,7 +56,7 @@ static void *DUMMY_Create(char *testFileName, int iorflags, void * param) if(verbose > 4){ fprintf(out_logfile, "DUMMY create: %s = %p\n", testFileName, current); } - dummy_options_t * o = (dummy_options_t*) param; + dummy_options_t * o = (dummy_options_t*) options; if (o->delay_creates){ if (! o->delay_rank_0_only || (o->delay_rank_0_only && rank == 0)){ struct timespec wait = { o->delay_creates / 1000 / 1000, 1000l * (o->delay_creates % 1000000)}; @@ -66,7 +66,7 @@ static void *DUMMY_Create(char *testFileName, int iorflags, void * param) return current++; } -static void *DUMMY_Open(char *testFileName, int flags, void * param) +static void *DUMMY_Open(char *testFileName, int flags, airori_mod_opt_t * options) { if(count_init <= 0){ ERR("DUMMY missing initialization in open\n"); @@ -77,7 +77,7 @@ static void *DUMMY_Open(char *testFileName, int flags, void * param) return current++; } -static void DUMMY_Fsync(void *fd, void * param) +static void DUMMY_Fsync(void *fd, airori_mod_opt_t * options) { if(verbose > 4){ fprintf(out_logfile, "DUMMY fsync %p\n", fd); @@ -85,18 +85,18 @@ static void DUMMY_Fsync(void *fd, void * param) } -static void DUMMY_Sync(void * param) +static void DUMMY_Sync(airori_mod_opt_t * options) { } -static void DUMMY_Close(void *fd, void * param) +static void DUMMY_Close(void *fd, airori_mod_opt_t * options) { if(verbose > 4){ fprintf(out_logfile, "DUMMY close %p\n", fd); } } -static void DUMMY_Delete(char *testFileName, void * param) +static void DUMMY_Delete(char *testFileName, airori_mod_opt_t * options) { if(verbose > 4){ fprintf(out_logfile, "DUMMY delete: %s\n", testFileName); @@ -108,7 +108,7 @@ static char * DUMMY_getVersion() return "0.5"; } -static IOR_offset_t DUMMY_GetFileSize(void * test, MPI_Comm testComm, char *testFileName) +static IOR_offset_t DUMMY_GetFileSize(airori_mod_opt_t * options, MPI_Comm testComm, char *testFileName) { if(verbose > 4){ fprintf(out_logfile, "DUMMY getFileSize: %s\n", testFileName); @@ -116,11 +116,11 @@ static IOR_offset_t DUMMY_GetFileSize(void * test, MPI_Comm testComm, char *test return 0; } -static IOR_offset_t DUMMY_Xfer(int access, void *file, IOR_size_t * buffer, IOR_offset_t length, void * param){ +static IOR_offset_t DUMMY_Xfer(int access, void *file, IOR_size_t * buffer, IOR_offset_t length, airori_mod_opt_t * options){ if(verbose > 4){ fprintf(out_logfile, "DUMMY xfer: %p\n", file); } - dummy_options_t * o = (dummy_options_t*) param; + dummy_options_t * o = (dummy_options_t*) options; if (o->delay_xfer){ if (! o->delay_rank_0_only || (o->delay_rank_0_only && rank == 0)){ struct timespec wait = {o->delay_xfer / 1000 / 1000, 1000l * (o->delay_xfer % 1000000)}; @@ -130,7 +130,7 @@ static IOR_offset_t DUMMY_Xfer(int access, void *file, IOR_size_t * buffer, IOR_ return length; } -static int DUMMY_statfs (const char * path, ior_aiori_statfs_t * stat, void * param){ +static int DUMMY_statfs (const char * path, ior_aiori_statfs_t * stat, airori_mod_opt_t * options){ stat->f_bsize = 1; stat->f_blocks = 1; stat->f_bfree = 1; @@ -140,32 +140,32 @@ static int DUMMY_statfs (const char * path, ior_aiori_statfs_t * stat, void * pa return 0; } -static int DUMMY_mkdir (const char *path, mode_t mode, void * param){ +static int DUMMY_mkdir (const char *path, mode_t mode, airori_mod_opt_t * options){ return 0; } -static int DUMMY_rmdir (const char *path, void * param){ +static int DUMMY_rmdir (const char *path, airori_mod_opt_t * options){ return 0; } -static int DUMMY_access (const char *path, int mode, void * param){ +static int DUMMY_access (const char *path, int mode, airori_mod_opt_t * options){ return 0; } -static int DUMMY_stat (const char *path, struct stat *buf, void * param){ +static int DUMMY_stat (const char *path, struct stat *buf, airori_mod_opt_t * options){ return 0; } -static int DUMMY_check_params(void * test){ +static int DUMMY_check_params(airori_mod_opt_t * options){ return 0; } -static void DUMMY_init(void * options){ +static void DUMMY_init(airori_mod_opt_t * options){ WARN("DUMMY initialized"); count_init++; } -static void DUMMY_final(void * options){ +static void DUMMY_final(airori_mod_opt_t * options){ WARN("DUMMY finalized"); if(count_init <= 0){ ERR("DUMMY invalid finalization\n"); diff --git a/src/aiori-HDF5.c b/src/aiori-HDF5.c index 85a6e19..e66e5d4 100755 --- a/src/aiori-HDF5.c +++ b/src/aiori-HDF5.c @@ -81,20 +81,20 @@ #endif /* H5_VERS_MAJOR > 1 && H5_VERS_MINOR > 6 */ /**************************** P R O T O T Y P E S *****************************/ -static IOR_offset_t SeekOffset(void *, IOR_offset_t, void *); -static void SetupDataSet(void *, void *); -static void *HDF5_Create(char *, int flags, void *); -static void *HDF5_Open(char *, int flags, void *); +static IOR_offset_t SeekOffset(void *, IOR_offset_t, airori_mod_opt_t *); +static void SetupDataSet(void *, airori_mod_opt_t *); +static void *HDF5_Create(char *, int flags, airori_mod_opt_t *); +static void *HDF5_Open(char *, int flags, airori_mod_opt_t *); static IOR_offset_t HDF5_Xfer(int, void *, IOR_size_t *, - IOR_offset_t, void *); -static void HDF5_Close(void *, void *); -static void HDF5_Delete(char *, void *); + IOR_offset_t, airori_mod_opt_t *); +static void HDF5_Close(void *, airori_mod_opt_t *); +static void HDF5_Delete(char *, airori_mod_opt_t *); static char* HDF5_GetVersion(); -static void HDF5_Fsync(void *, void *); -static IOR_offset_t HDF5_GetFileSize(void *, MPI_Comm, char *); -static int HDF5_Access(const char *, int, void *); +static void HDF5_Fsync(void *, airori_mod_opt_t *); +static IOR_offset_t HDF5_GetFileSize(airori_mod_opt_t *, MPI_Comm, char *); +static int HDF5_Access(const char *, int, airori_mod_opt_t *); static void HDF5_init_xfer_options(IOR_param_t * params); -static int HDF5_check_params(void * options); +static int HDF5_check_params(airori_mod_opt_t * options); /************************** O P T I O N S *****************************/ typedef struct{ @@ -107,7 +107,7 @@ typedef struct{ } HDF5_options_t; /***************************** F U N C T I O N S ******************************/ -static option_help * HDF5_options(void ** init_backend_options, void * init_values){ +static option_help * HDF5_options(airori_mod_opt_t ** init_backend_options, airori_mod_opt_t * init_values){ HDF5_options_t * o = malloc(sizeof(HDF5_options_t)); if (init_values != NULL){ @@ -119,7 +119,7 @@ static option_help * HDF5_options(void ** init_backend_options, void * init_valu o->setAlignment = 1; } - *init_backend_options = o; + *init_backend_options = (airori_mod_opt_t*) o; option_help h [] = { {0, "hdf5.collectiveMetadata", "Use collectiveMetadata (available since HDF5-1.10.0)", OPTION_FLAG, 'd', & o->collective_md}, @@ -173,7 +173,7 @@ static void HDF5_init_xfer_options(IOR_param_t * params){ ior_param = params; } -static int HDF5_check_params(void * options){ +static int HDF5_check_params(airori_mod_opt_t * options){ HDF5_options_t *o = (HDF5_options_t*) options; if (o->setAlignment < 0) ERR("alignment must be non-negative integer"); @@ -197,7 +197,7 @@ static int HDF5_check_params(void * options){ /* * Create and open a file through the HDF5 interface. */ -static void *HDF5_Create(char *testFileName, int flags, void * param) +static void *HDF5_Create(char *testFileName, int flags, airori_mod_opt_t * param) { return HDF5_Open(testFileName, flags, param); } @@ -205,7 +205,7 @@ static void *HDF5_Create(char *testFileName, int flags, void * param) /* * Open a file through the HDF5 interface. */ -static void *HDF5_Open(char *testFileName, int flags, void * param) +static void *HDF5_Open(char *testFileName, int flags, airori_mod_opt_t * param) { HDF5_options_t *o = (HDF5_options_t*) param; hid_t accessPropList, createPropList; @@ -417,7 +417,7 @@ static void *HDF5_Open(char *testFileName, int flags, void * param) * Write or read access to file using the HDF5 interface. */ static IOR_offset_t HDF5_Xfer(int access, void *fd, IOR_size_t * buffer, - IOR_offset_t length, void * param) + IOR_offset_t length, airori_mod_opt_t * param) { static int firstReadCheck = FALSE, startNewDataSet; IOR_offset_t segmentPosition, segmentSize; @@ -495,7 +495,7 @@ static IOR_offset_t HDF5_Xfer(int access, void *fd, IOR_size_t * buffer, /* * Perform fsync(). */ -static void HDF5_Fsync(void *fd, void * param) +static void HDF5_Fsync(void *fd, airori_mod_opt_t * param) { ; } @@ -503,7 +503,7 @@ static void HDF5_Fsync(void *fd, void * param) /* * Close a file through the HDF5 interface. */ -static void HDF5_Close(void *fd, void * param) +static void HDF5_Close(void *fd, airori_mod_opt_t * param) { if(ior_param->dryRun) return; @@ -524,7 +524,7 @@ static void HDF5_Close(void *fd, void * param) /* * Delete a file through the HDF5 interface. */ -static void HDF5_Delete(char *testFileName, void * param) +static void HDF5_Delete(char *testFileName, airori_mod_opt_t * param) { if(ior_param->dryRun) return @@ -558,7 +558,7 @@ static char * HDF5_GetVersion() * Seek to offset in file using the HDF5 interface and set up hyperslab. */ static IOR_offset_t SeekOffset(void *fd, IOR_offset_t offset, - void * param) + airori_mod_opt_t * param) { HDF5_options_t *o = (HDF5_options_t*) param; IOR_offset_t segmentSize; @@ -598,7 +598,7 @@ static IOR_offset_t SeekOffset(void *fd, IOR_offset_t offset, /* * Create HDF5 data set. */ -static void SetupDataSet(void *fd, void * param) +static void SetupDataSet(void *fd, airori_mod_opt_t * param) { HDF5_options_t *o = (HDF5_options_t*) param; char dataSetName[MAX_STR]; @@ -661,7 +661,7 @@ static void SetupDataSet(void *fd, void * param) * Use MPIIO call to get file size. */ static IOR_offset_t -HDF5_GetFileSize(void * test, MPI_Comm testComm, char *testFileName) +HDF5_GetFileSize(airori_mod_opt_t * test, MPI_Comm testComm, char *testFileName) { if(ior_param->dryRun) return 0; @@ -671,7 +671,7 @@ HDF5_GetFileSize(void * test, MPI_Comm testComm, char *testFileName) /* * Use MPIIO call to check for access. */ -static int HDF5_Access(const char *path, int mode, void *param) +static int HDF5_Access(const char *path, int mode, airori_mod_opt_t *param) { if(ior_param->dryRun) return 0; diff --git a/src/aiori-MMAP.c b/src/aiori-MMAP.c index 10c196e..81e7a81 100644 --- a/src/aiori-MMAP.c +++ b/src/aiori-MMAP.c @@ -26,15 +26,15 @@ #include "utilities.h" /**************************** P R O T O T Y P E S *****************************/ -static void *MMAP_Create(char *, int flags, void *); -static void *MMAP_Open(char *, int flags, void *); +static void *MMAP_Create(char *, int flags, airori_mod_opt_t *); +static void *MMAP_Open(char *, int flags, airori_mod_opt_t *); static IOR_offset_t MMAP_Xfer(int, void *, IOR_size_t *, - IOR_offset_t, void *); -static void MMAP_Close(void *, void *); -static void MMAP_Fsync(void *, void *); -static option_help * MMAP_options(void ** init_backend_options, void * init_values); + IOR_offset_t, airori_mod_opt_t *); +static void MMAP_Close(void *, airori_mod_opt_t *); +static void MMAP_Fsync(void *, airori_mod_opt_t *); +static option_help * MMAP_options(airori_mod_opt_t ** init_backend_options, airori_mod_opt_t * init_values); static void MMAP_init_xfer_options(IOR_param_t * params); -static int MMAP_check_params(void * options); +static int MMAP_check_params(airori_mod_opt_t * options); /************************** D E C L A R A T I O N S ***************************/ ior_aiori_t mmap_aiori = { @@ -61,7 +61,7 @@ typedef struct{ int madv_pattern; } mmap_options_t; -static option_help * MMAP_options(void ** init_backend_options, void * init_values){ +static option_help * MMAP_options(airori_mod_opt_t ** init_backend_options, airori_mod_opt_t * init_values){ mmap_options_t * o = malloc(sizeof(mmap_options_t)); if (init_values != NULL){ @@ -70,7 +70,7 @@ static option_help * MMAP_options(void ** init_backend_options, void * init_valu memset(o, 0, sizeof(mmap_options_t)); } - *init_backend_options = o; + *init_backend_options = (airori_mod_opt_t*) o; option_help h [] = { {0, "mmap.madv_dont_need", "Use advise don't need", OPTION_FLAG, 'd', & o->madv_dont_need}, @@ -89,7 +89,7 @@ static void MMAP_init_xfer_options(IOR_param_t * params){ aiori_posix_init_xfer_options(params); } -static int MMAP_check_params(void * options){ +static int MMAP_check_params(airori_mod_opt_t * options){ if (ior_param->fsyncPerWrite && (ior_param->transferSize & (sysconf(_SC_PAGESIZE) - 1))) ERR("transfer size must be aligned with PAGESIZE for MMAP with fsyncPerWrite"); return 0; @@ -130,7 +130,7 @@ static void ior_mmap_file(int *file, int mflags, void *param) /* * Creat and open a file through the POSIX interface, then setup mmap. */ -static void *MMAP_Create(char *testFileName, int flags, void * param) +static void *MMAP_Create(char *testFileName, int flags, airori_mod_opt_t * param) { int *fd; @@ -144,7 +144,7 @@ static void *MMAP_Create(char *testFileName, int flags, void * param) /* * Open a file through the POSIX interface and setup mmap. */ -static void *MMAP_Open(char *testFileName, int flags, void * param) +static void *MMAP_Open(char *testFileName, int flags, airori_mod_opt_t * param) { int *fd; fd = POSIX_Open(testFileName, flags, param); @@ -156,7 +156,7 @@ static void *MMAP_Open(char *testFileName, int flags, void * param) * Write or read access to file using mmap */ static IOR_offset_t MMAP_Xfer(int access, void *file, IOR_size_t * buffer, - IOR_offset_t length, void * param) + IOR_offset_t length, airori_mod_opt_t * param) { mmap_options_t *o = (mmap_options_t*) param; if (access == WRITE) { @@ -178,7 +178,7 @@ static IOR_offset_t MMAP_Xfer(int access, void *file, IOR_size_t * buffer, /* * Perform msync(). */ -static void MMAP_Fsync(void *fd, void * param) +static void MMAP_Fsync(void *fd, airori_mod_opt_t * param) { mmap_options_t *o = (mmap_options_t*) param; if (msync(o->mmap_ptr, ior_param->expectedAggFileSize, MS_SYNC) != 0) @@ -188,7 +188,7 @@ static void MMAP_Fsync(void *fd, void * param) /* * Close a file through the POSIX interface, after tear down the mmap. */ -static void MMAP_Close(void *fd, void * param) +static void MMAP_Close(void *fd, airori_mod_opt_t * param) { mmap_options_t *o = (mmap_options_t*) param; if (munmap(o->mmap_ptr, ior_param->expectedAggFileSize) != 0) diff --git a/src/aiori-MPIIO.c b/src/aiori-MPIIO.c index 5c8a012..6a22170 100755 --- a/src/aiori-MPIIO.c +++ b/src/aiori-MPIIO.c @@ -31,20 +31,26 @@ /**************************** P R O T O T Y P E S *****************************/ -static IOR_offset_t SeekOffset(MPI_File, IOR_offset_t, void *); +static IOR_offset_t SeekOffset(MPI_File, IOR_offset_t, airori_mod_opt_t *); -static void *MPIIO_Create(char *, int iorflags, void *); -static void *MPIIO_Open(char *, int flags, void *); +static void *MPIIO_Create(char *, int iorflags, airori_mod_opt_t *); +static void *MPIIO_Open(char *, int flags, airori_mod_opt_t *); static IOR_offset_t MPIIO_Xfer(int, void *, IOR_size_t *, - IOR_offset_t, void *); -static void MPIIO_Close(void *, void *); + IOR_offset_t, airori_mod_opt_t *); +static void MPIIO_Close(void *, airori_mod_opt_t *); static char* MPIIO_GetVersion(); -static void MPIIO_Fsync(void *, void *); +static void MPIIO_Fsync(void *, airori_mod_opt_t *); static void MPIIO_init_xfer_options(IOR_param_t * params); -static int MPIIO_check_params(void * options); +static int MPIIO_check_params(airori_mod_opt_t * options); /************************** D E C L A R A T I O N S ***************************/ +typedef struct{ + MPI_File fd; + MPI_Datatype transferType; /* datatype for transfer */ + MPI_Datatype fileType; /* filetype for file view */ +} mpiio_fd_t; + typedef struct { int dry_run; int showHints; /* show hints */ @@ -55,14 +61,14 @@ typedef struct { char * hintsFileName; /* full name for hints file */ } mpiio_options_t; -static option_help * MPIIO_options(void ** init_backend_options, void * init_values){ +static option_help * MPIIO_options(airori_mod_opt_t ** init_backend_options, airori_mod_opt_t * init_values){ mpiio_options_t * o = malloc(sizeof(mpiio_options_t)); if (init_values != NULL){ memcpy(o, init_values, sizeof(mpiio_options_t)); }else{ memset(o, 0, sizeof(mpiio_options_t)); } - *init_backend_options = o; + *init_backend_options = (airori_mod_opt_t*) o; option_help h [] = { {0, "mpiio.dryRun", "Dry run, disable actual IO", OPTION_FLAG, 'd', & o->dry_run}, @@ -108,7 +114,7 @@ static void MPIIO_init_xfer_options(IOR_param_t * params){ ior_param = params; } -static int MPIIO_check_params(void * module_options){ +static int MPIIO_check_params(airori_mod_opt_t * module_options){ mpiio_options_t * param = (mpiio_options_t*) module_options; if ((param->useFileView == TRUE) && (sizeof(MPI_Aint) < 8) /* used for 64-bit datatypes */ @@ -134,7 +140,7 @@ static int MPIIO_check_params(void * module_options){ /* * Try to access a file through the MPIIO interface. */ -int MPIIO_Access(const char *path, int mode, void *module_options) +int MPIIO_Access(const char *path, int mode, airori_mod_opt_t *module_options) { mpiio_options_t * param = (mpiio_options_t*) module_options; if(param->dry_run){ @@ -166,7 +172,7 @@ int MPIIO_Access(const char *path, int mode, void *module_options) /* * Create and open a file through the MPIIO interface. */ -static void *MPIIO_Create(char *testFileName, int iorflags, void * module_options) +static void *MPIIO_Create(char *testFileName, int iorflags, airori_mod_opt_t * module_options) { return MPIIO_Open(testFileName, iorflags, module_options); } @@ -174,7 +180,7 @@ static void *MPIIO_Create(char *testFileName, int iorflags, void * module_option /* * Open a file through the MPIIO interface. Setup file view. */ -static void *MPIIO_Open(char *testFileName, int flags, void * module_options) +static void *MPIIO_Open(char *testFileName, int flags, airori_mod_opt_t * module_options) { mpiio_options_t * param = (mpiio_options_t*) module_options; int fd_mode = (int)0, @@ -184,16 +190,12 @@ static void *MPIIO_Open(char *testFileName, int flags, void * module_options) struct fileTypeStruct { int globalSizes[2], localSizes[2], startIndices[2]; } fileTypeStruct; - MPI_File *fd; + + mpiio_fd_t * mfd = malloc(sizeof(mpiio_fd_t)); + memset(mfd, 0, sizeof(mpiio_fd_t)); MPI_Comm comm; MPI_Info mpiHints = MPI_INFO_NULL; - fd = (MPI_File *) malloc(sizeof(MPI_File)); - if (fd == NULL) - ERR("malloc failed()"); - - *fd = 0; - /* set IOR file flags to MPIIO flags */ /* -- file open flags -- */ if (flags & IOR_RDONLY) { @@ -214,9 +216,6 @@ static void *MPIIO_Open(char *testFileName, int flags, void * module_options) if (flags & IOR_EXCL) { fd_mode |= MPI_MODE_EXCL; } - if (flags & IOR_TRUNC) { - fprintf(stdout, "File truncation not implemented in MPIIO\n"); - } if (flags & IOR_DIRECT) { fprintf(stdout, "O_DIRECT not implemented in MPIIO\n"); } @@ -248,15 +247,18 @@ static void *MPIIO_Open(char *testFileName, int flags, void * module_options) fprintf(stdout, "}\n"); } if(! param->dry_run){ - MPI_CHECKF(MPI_File_open(comm, testFileName, fd_mode, mpiHints, fd), + MPI_CHECKF(MPI_File_open(comm, testFileName, fd_mode, mpiHints, & mfd->fd), "cannot open file: %s", testFileName); + if (flags & IOR_TRUNC) { + MPI_CHECKF(MPI_File_set_size(mfd->fd, 0), "cannot truncate file: %s", testFileName); + } } /* show hints actually attached to file handle */ if (rank == 0 && param->showHints && ! param->dry_run) { if (mpiHints != MPI_INFO_NULL) MPI_CHECK(MPI_Info_free(&mpiHints), "MPI_Info_free failed"); - MPI_CHECK(MPI_File_get_info(*fd, &mpiHints), + MPI_CHECK(MPI_File_get_info(mfd->fd, &mpiHints), "cannot get file info"); fprintf(stdout, "\nhints returned from opened file {\n"); ShowHints(&mpiHints); @@ -265,7 +267,7 @@ static void *MPIIO_Open(char *testFileName, int flags, void * module_options) /* preallocate space for file */ if (param->preallocate && ior_param->open == WRITE && ! param->dry_run) { - MPI_CHECK(MPI_File_preallocate(*fd, + MPI_CHECK(MPI_File_preallocate(mfd->fd, (MPI_Offset) (ior_param->segmentCount * ior_param->blockSize * @@ -277,9 +279,9 @@ static void *MPIIO_Open(char *testFileName, int flags, void * module_options) /* create contiguous transfer datatype */ MPI_CHECK(MPI_Type_contiguous (ior_param->transferSize / sizeof(IOR_size_t), - MPI_LONG_LONG_INT, &ior_param->transferType), + MPI_LONG_LONG_INT, & mfd->transferType), "cannot create contiguous datatype"); - MPI_CHECK(MPI_Type_commit(&ior_param->transferType), + MPI_CHECK(MPI_Type_commit(& mfd->transferType), "cannot commit datatype"); if (ior_param->filePerProc) { offsetFactor = 0; @@ -305,29 +307,29 @@ static void *MPIIO_Open(char *testFileName, int flags, void * module_options) (2, fileTypeStruct.globalSizes, fileTypeStruct.localSizes, fileTypeStruct.startIndices, MPI_ORDER_C, - ior_param->transferType, &ior_param->fileType), + mfd->transferType, & mfd->fileType), "cannot create subarray"); - MPI_CHECK(MPI_Type_commit(&ior_param->fileType), + MPI_CHECK(MPI_Type_commit(& mfd->fileType), "cannot commit datatype"); if(! param->dry_run){ - MPI_CHECK(MPI_File_set_view(*fd, (MPI_Offset) 0, - ior_param->transferType, - ior_param->fileType, "native", + MPI_CHECK(MPI_File_set_view(mfd->fd, (MPI_Offset) 0, + mfd->transferType, + mfd->fileType, "native", (MPI_Info) MPI_INFO_NULL), "cannot set file view"); } } if (mpiHints != MPI_INFO_NULL) MPI_CHECK(MPI_Info_free(&mpiHints), "MPI_Info_free failed"); - return ((void *)fd); + return ((void *) mfd); } /* * Write or read access to file using the MPIIO interface. */ -static IOR_offset_t MPIIO_Xfer(int access, void *fd, IOR_size_t * buffer, - IOR_offset_t length, void * module_options) +static IOR_offset_t MPIIO_Xfer(int access, void * fdp, IOR_size_t * buffer, + IOR_offset_t length, airori_mod_opt_t * module_options) { /* NOTE: The second arg is (void *) for reads, and (const void *) for writes. Therefore, one of the two sets of assignments below @@ -336,6 +338,7 @@ static IOR_offset_t MPIIO_Xfer(int access, void *fd, IOR_size_t * buffer, mpiio_options_t * param = (mpiio_options_t*) module_options; if(param->dry_run) return length; + mpiio_fd_t * mfd = (mpiio_fd_t*) fdp; int (MPIAPI * Access) (MPI_File, void *, int, MPI_Datatype, MPI_Status *); @@ -385,7 +388,7 @@ static IOR_offset_t MPIIO_Xfer(int access, void *fd, IOR_size_t * buffer, */ if (param->useFileView) { /* find offset in file */ - if (SeekOffset(*(MPI_File *) fd, ior_param->offset, param) < + if (SeekOffset(mfd->fd, ior_param->offset, module_options) < 0) { /* if unsuccessful */ length = -1; @@ -404,14 +407,14 @@ static IOR_offset_t MPIIO_Xfer(int access, void *fd, IOR_size_t * buffer, if (ior_param->collective) { /* individual, collective call */ MPI_CHECK(Access_all - (*(MPI_File *) fd, buffer, length, - ior_param->transferType, &status), + (mfd->fd, buffer, length, + mfd->transferType, &status), "cannot access collective"); } else { /* individual, noncollective call */ MPI_CHECK(Access - (*(MPI_File *) fd, buffer, length, - ior_param->transferType, &status), + (mfd->fd, buffer, length, + mfd->transferType, &status), "cannot access noncollective"); } length *= ior_param->transferSize; /* for return value in bytes */ @@ -424,7 +427,7 @@ static IOR_offset_t MPIIO_Xfer(int access, void *fd, IOR_size_t * buffer, if (param->useSharedFilePointer) { /* find offset in file */ if (SeekOffset - (*(MPI_File *) fd, ior_param->offset, param) < 0) { + (mfd->fd, ior_param->offset, module_options) < 0) { /* if unsuccessful */ length = -1; } else { @@ -443,13 +446,13 @@ static IOR_offset_t MPIIO_Xfer(int access, void *fd, IOR_size_t * buffer, if (ior_param->collective) { /* explicit, collective call */ MPI_CHECK(Access_at_all - (*(MPI_File *) fd, ior_param->offset, + (mfd->fd, ior_param->offset, buffer, length, MPI_BYTE, &status), "cannot access explicit, collective"); } else { /* explicit, noncollective call */ MPI_CHECK(Access_at - (*(MPI_File *) fd, ior_param->offset, + (mfd->fd, ior_param->offset, buffer, length, MPI_BYTE, &status), "cannot access explicit, noncollective"); } @@ -461,40 +464,40 @@ static IOR_offset_t MPIIO_Xfer(int access, void *fd, IOR_size_t * buffer, /* * Perform fsync(). */ -static void MPIIO_Fsync(void *fdp, void * module_options) +static void MPIIO_Fsync(void *fdp, airori_mod_opt_t * module_options) { mpiio_options_t * param = (mpiio_options_t*) module_options; if(param->dry_run) return; - if (MPI_File_sync(*(MPI_File *)fdp) != MPI_SUCCESS) + mpiio_fd_t * mfd = (mpiio_fd_t*) fdp; + if (MPI_File_sync(mfd->fd) != MPI_SUCCESS) EWARN("fsync() failed"); } /* * Close a file through the MPIIO interface. */ -static void MPIIO_Close(void *fd, void * module_options) +static void MPIIO_Close(void *fdp, airori_mod_opt_t * module_options) { mpiio_options_t * param = (mpiio_options_t*) module_options; + mpiio_fd_t * mfd = (mpiio_fd_t*) fdp; if(! param->dry_run){ - MPI_CHECK(MPI_File_close((MPI_File *) fd), "cannot close file"); + MPI_CHECK(MPI_File_close(& mfd->fd), "cannot close file"); } - //if ((param->useFileView == TRUE) && (param->fd_fppReadCheck == NULL)) { - // /* - // * need to free the datatype, so done in the close process - // */ - // MPI_CHECK(MPI_Type_free(¶m->fileType), - // "cannot free MPI file datatype"); - // MPI_CHECK(MPI_Type_free(¶m->transferType), - // "cannot free MPI transfer datatype"); - //} - free(fd); + if (param->useFileView == TRUE) { + /* + * need to free the datatype, so done in the close process + */ + MPI_CHECK(MPI_Type_free(& mfd->fileType), "cannot free MPI file datatype"); + MPI_CHECK(MPI_Type_free(& mfd->transferType), "cannot free MPI transfer datatype"); + } + free(fdp); } /* * Delete a file through the MPIIO interface. */ -void MPIIO_Delete(char *testFileName, void * module_options) +void MPIIO_Delete(char *testFileName, airori_mod_opt_t * module_options) { mpiio_options_t * param = (mpiio_options_t*) module_options; if(param->dry_run) @@ -519,7 +522,7 @@ static char* MPIIO_GetVersion() * Seek to offset in file using the MPIIO interface. */ static IOR_offset_t SeekOffset(MPI_File fd, IOR_offset_t offset, - void * module_options) + airori_mod_opt_t * module_options) { mpiio_options_t * param = (mpiio_options_t*) module_options; int offsetFactor, tasksPerFile; @@ -561,7 +564,7 @@ static IOR_offset_t SeekOffset(MPI_File fd, IOR_offset_t offset, * Use MPI_File_get_size() to return aggregate file size. * NOTE: This function is used by the HDF5 and NCMPI backends. */ -IOR_offset_t MPIIO_GetFileSize(void * module_options, MPI_Comm testComm, +IOR_offset_t MPIIO_GetFileSize(airori_mod_opt_t * module_options, MPI_Comm testComm, char *testFileName) { mpiio_options_t * test = (mpiio_options_t*) module_options; diff --git a/src/aiori-POSIX.c b/src/aiori-POSIX.c index b7b01e4..20f37f4 100755 --- a/src/aiori-POSIX.c +++ b/src/aiori-POSIX.c @@ -69,10 +69,10 @@ /**************************** P R O T O T Y P E S *****************************/ static IOR_offset_t POSIX_Xfer(int, void *, IOR_size_t *, - IOR_offset_t, void *); -static void POSIX_Fsync(void *, void *); -static void POSIX_Sync(void * ); -static int POSIX_check_params(void * options); + IOR_offset_t, airori_mod_opt_t *); +static void POSIX_Fsync(void *, airori_mod_opt_t *); +static void POSIX_Sync(airori_mod_opt_t * ); +static int POSIX_check_params(airori_mod_opt_t * options); /************************** O P T I O N S *****************************/ typedef struct{ @@ -97,7 +97,7 @@ typedef struct{ } posix_options_t; -option_help * POSIX_options(void ** init_backend_options, void * init_values){ +option_help * POSIX_options(airori_mod_opt_t ** init_backend_options, airori_mod_opt_t * init_values){ posix_options_t * o = malloc(sizeof(posix_options_t)); if (init_values != NULL){ @@ -110,7 +110,7 @@ option_help * POSIX_options(void ** init_backend_options, void * init_values){ o->beegfs_chunkSize = -1; } - *init_backend_options = o; + *init_backend_options = (airori_mod_opt_t*) o; option_help h [] = { {0, "posix.odirect", "Direct I/O Mode", OPTION_FLAG, 'd', & o->direct_io}, @@ -172,7 +172,7 @@ void aiori_posix_init_xfer_options(IOR_param_t * params){ ior_param = params; } -static int POSIX_check_params(void * param){ +static int POSIX_check_params(airori_mod_opt_t * param){ posix_options_t * o = (posix_options_t*) param; if (ior_param->useExistingTestFile && o->lustre_set_striping) ERR("Lustre stripe options are incompatible with useExistingTestFile"); @@ -372,7 +372,7 @@ bool beegfs_createFilePath(char* filepath, mode_t mode, int numTargets, int chun /* * Creat and open a file through the POSIX interface. */ -void *POSIX_Create(char *testFileName, int flags, void * param) +void *POSIX_Create(char *testFileName, int flags, airori_mod_opt_t * param) { int fd_oflag = O_BINARY; int mode = 0664; @@ -503,7 +503,7 @@ int POSIX_Mknod(char *testFileName) /* * Open a file through the POSIX interface. */ -void *POSIX_Open(char *testFileName, int flags, void * param) +void *POSIX_Open(char *testFileName, int flags, airori_mod_opt_t * param) { int fd_oflag = O_BINARY; int *fd; @@ -549,7 +549,7 @@ void *POSIX_Open(char *testFileName, int flags, void * param) * Write or read access to file using the POSIX interface. */ static IOR_offset_t POSIX_Xfer(int access, void *file, IOR_size_t * buffer, - IOR_offset_t length, void * param) + IOR_offset_t length, airori_mod_opt_t * param) { int xferRetries = 0; long long remaining = (long long)length; @@ -634,14 +634,14 @@ static IOR_offset_t POSIX_Xfer(int access, void *file, IOR_size_t * buffer, /* * Perform fsync(). */ -static void POSIX_Fsync(void *fd, void * param) +static void POSIX_Fsync(void *fd, airori_mod_opt_t * param) { if (fsync(*(int *)fd) != 0) EWARNF("fsync(%d) failed", *(int *)fd); } -static void POSIX_Sync(void * param) +static void POSIX_Sync(airori_mod_opt_t * param) { int ret = system("sync"); if (ret != 0){ @@ -653,7 +653,7 @@ static void POSIX_Sync(void * param) /* * Close a file through the POSIX interface. */ -void POSIX_Close(void *fd, void * param) +void POSIX_Close(void *fd, airori_mod_opt_t * param) { if(ior_param->dryRun) return; @@ -665,7 +665,7 @@ void POSIX_Close(void *fd, void * param) /* * Delete a file through the POSIX interface. */ -void POSIX_Delete(char *testFileName, void * param) +void POSIX_Delete(char *testFileName, airori_mod_opt_t * param) { if(ior_param->dryRun) return; @@ -678,7 +678,7 @@ void POSIX_Delete(char *testFileName, void * param) /* * Use POSIX stat() to return aggregate file size. */ -IOR_offset_t POSIX_GetFileSize(void * test, MPI_Comm testComm, +IOR_offset_t POSIX_GetFileSize(airori_mod_opt_t * test, MPI_Comm testComm, char *testFileName) { if(ior_param->dryRun) diff --git a/src/aiori.c b/src/aiori.c index 592c503..42eb871 100644 --- a/src/aiori.c +++ b/src/aiori.c @@ -152,7 +152,7 @@ void aiori_supported_apis(char * APIs, char * APIs_legacy, enum bench_type type) * This function provides a AIORI statfs for POSIX-compliant filesystems. It * uses statvfs is available and falls back on statfs. */ -int aiori_posix_statfs (const char *path, ior_aiori_statfs_t *stat_buf, void * module_options) +int aiori_posix_statfs (const char *path, ior_aiori_statfs_t *stat_buf, airori_mod_opt_t * module_options) { int ret; #if defined(HAVE_STATVFS) @@ -177,22 +177,22 @@ int aiori_posix_statfs (const char *path, ior_aiori_statfs_t *stat_buf, void * m return 0; } -int aiori_posix_mkdir (const char *path, mode_t mode, void * module_options) +int aiori_posix_mkdir (const char *path, mode_t mode, airori_mod_opt_t * module_options) { return mkdir (path, mode); } -int aiori_posix_rmdir (const char *path, void * module_options) +int aiori_posix_rmdir (const char *path, airori_mod_opt_t * module_options) { return rmdir (path); } -int aiori_posix_access (const char *path, int mode, void * module_options) +int aiori_posix_access (const char *path, int mode, airori_mod_opt_t * module_options) { return access (path, mode); } -int aiori_posix_stat (const char *path, struct stat *buf, void * module_options) +int aiori_posix_stat (const char *path, struct stat *buf, airori_mod_opt_t * module_options) { return stat (path, buf); } diff --git a/src/aiori.h b/src/aiori.h index f99c424..dab41c6 100755 --- a/src/aiori.h +++ b/src/aiori.h @@ -63,35 +63,40 @@ typedef struct ior_aiori_statfs { uint64_t f_ffree; } ior_aiori_statfs_t; +/* this is a dummy structure to create some type safety */ +typedef struct airori_mod_opt_t{ + void * dummy; +} airori_mod_opt_t; + typedef struct ior_aiori { char *name; char *name_legacy; - void *(*create)(char *, int iorflags, void *); + void *(*create)(char *, int iorflags, airori_mod_opt_t *); int (*mknod)(char *); - void *(*open)(char *, int iorflags, void *); + void *(*open)(char *, int iorflags, airori_mod_opt_t *); /* Allow to set generic transfer options that shall be applied to any subsequent IO call. */ void (*init_xfer_options)(IOR_param_t * params); IOR_offset_t (*xfer)(int, void *, IOR_size_t *, - IOR_offset_t, void *); - void (*close)(void *, void *); - void (*delete)(char *, void *); + IOR_offset_t, airori_mod_opt_t *); + void (*close)(void *, airori_mod_opt_t *); + void (*delete)(char *, airori_mod_opt_t *); char* (*get_version)(void); - void (*fsync)(void *, void *); - IOR_offset_t (*get_file_size)(void * module_options, MPI_Comm, char *); - int (*statfs) (const char *, ior_aiori_statfs_t *, void * module_options); - int (*mkdir) (const char *path, mode_t mode, void * module_options); - int (*rmdir) (const char *path, void * module_options); - int (*access) (const char *path, int mode, void * module_options); - int (*stat) (const char *path, struct stat *buf, void * module_options); - void (*initialize)(void * options); /* called once per program before MPI is started */ - void (*finalize)(void * options); /* called once per program after MPI is shutdown */ - option_help * (*get_options)(void ** init_backend_options, void* init_values); /* initializes the backend options as well and returns the pointer to the option help structure */ + void (*fsync)(void *, airori_mod_opt_t *); + IOR_offset_t (*get_file_size)(airori_mod_opt_t * module_options, MPI_Comm, char *); + int (*statfs) (const char *, ior_aiori_statfs_t *, airori_mod_opt_t * module_options); + int (*mkdir) (const char *path, mode_t mode, airori_mod_opt_t * module_options); + int (*rmdir) (const char *path, airori_mod_opt_t * module_options); + int (*access) (const char *path, int mode, airori_mod_opt_t * module_options); + int (*stat) (const char *path, struct stat *buf, airori_mod_opt_t * module_options); + void (*initialize)(airori_mod_opt_t * options); /* called once per program before MPI is started */ + void (*finalize)(airori_mod_opt_t * options); /* called once per program after MPI is shutdown */ + option_help * (*get_options)(airori_mod_opt_t ** init_backend_options, airori_mod_opt_t* init_values); /* initializes the backend options as well and returns the pointer to the option help structure */ + int (*check_params)(airori_mod_opt_t *); /* check if the provided module_optionseters for the given test and the module options are correct, if they aren't print a message and exit(1) or return 1*/ + void (*sync)(airori_mod_opt_t * ); /* synchronize every pending operation for this storage */ bool enable_mdtest; - int (*check_params)(void *); /* check if the provided module_optionseters for the given test and the module options are correct, if they aren't print a message and exit(1) or return 1*/ - void (*sync)(void * ); /* synchronize every pending operation for this storage */ } ior_aiori_t; enum bench_type { @@ -127,26 +132,25 @@ const char *aiori_default (void); /* some generic POSIX-based backend calls */ char * aiori_get_version (void); -int aiori_posix_statfs (const char *path, ior_aiori_statfs_t *stat_buf, void * module_options); -int aiori_posix_mkdir (const char *path, mode_t mode, void * module_options); -int aiori_posix_rmdir (const char *path, void * module_options); -int aiori_posix_access (const char *path, int mode, void * module_options); -int aiori_posix_stat (const char *path, struct stat *buf, void * module_options); +int aiori_posix_statfs (const char *path, ior_aiori_statfs_t *stat_buf, airori_mod_opt_t * module_options); +int aiori_posix_mkdir (const char *path, mode_t mode, airori_mod_opt_t * module_options); +int aiori_posix_rmdir (const char *path, airori_mod_opt_t * module_options); +int aiori_posix_access (const char *path, int mode, airori_mod_opt_t * module_options); +int aiori_posix_stat (const char *path, struct stat *buf, airori_mod_opt_t * module_options); void aiori_posix_init_xfer_options(IOR_param_t * params); -void *POSIX_Create(char *testFileName, int flags, void * module_options); +void *POSIX_Create(char *testFileName, int flags, airori_mod_opt_t * module_options); int POSIX_Mknod(char *testFileName); -void *POSIX_Open(char *testFileName, int flags, void * module_options); -IOR_offset_t POSIX_GetFileSize(void * test, MPI_Comm testComm, char *testFileName); -void POSIX_Delete(char *testFileName, void * module_options); -void POSIX_Close(void *fd, void * module_options); -option_help * POSIX_options(void ** init_backend_options, void * init_values); +void *POSIX_Open(char *testFileName, int flags, airori_mod_opt_t * module_options); +IOR_offset_t POSIX_GetFileSize(airori_mod_opt_t * test, MPI_Comm testComm, char *testFileName); +void POSIX_Delete(char *testFileName, airori_mod_opt_t * module_options); +void POSIX_Close(void *fd, airori_mod_opt_t * module_options); +option_help * POSIX_options(airori_mod_opt_t ** init_backend_options, airori_mod_opt_t * init_values); /* NOTE: these 3 MPI-IO functions are exported for reuse by HDF5/PNetCDF */ -void MPIIO_Delete(char *testFileName, void * module_options); -IOR_offset_t MPIIO_GetFileSize(void * test, MPI_Comm testComm, - char *testFileName); -int MPIIO_Access(const char *, int, void *); +void MPIIO_Delete(char *testFileName, airori_mod_opt_t * module_options); +IOR_offset_t MPIIO_GetFileSize(airori_mod_opt_t * options, MPI_Comm testComm, char *testFileName); +int MPIIO_Access(const char *, int, airori_mod_opt_t *); #endif /* not _AIORI_H */ diff --git a/src/ior.c b/src/ior.c index 59fc26b..3323b7f 100755 --- a/src/ior.c +++ b/src/ior.c @@ -824,15 +824,15 @@ static char *PrependDir(IOR_param_t * test, char *rootDir) sprintf(dir + i + 1, "%d", (rank + rankOffset) % test->numTasks); /* dir doesn't exist, so create */ - if (backend->access(dir, F_OK, test) != 0) { - if (backend->mkdir(dir, S_IRWXU, test) < 0) { + if (backend->access(dir, F_OK, test->backend_options) != 0) { + if (backend->mkdir(dir, S_IRWXU, test->backend_options) < 0) { ERRF("cannot create directory: %s", dir); } /* check if correct permissions */ - } else if (backend->access(dir, R_OK, test) != 0 || - backend->access(dir, W_OK, test) != 0 || - backend->access(dir, X_OK, test) != 0) { + } else if (backend->access(dir, R_OK, test->backend_options) != 0 || + backend->access(dir, W_OK, test->backend_options) != 0 || + backend->access(dir, X_OK, test->backend_options) != 0) { ERRF("invalid directory permissions: %s", dir); } @@ -919,24 +919,24 @@ static void RemoveFile(char *testFileName, int filePerProc, IOR_param_t * test) rankOffset = 0; GetTestFileName(testFileName, test); } - if (backend->access(testFileName, F_OK, test) == 0) { + if (backend->access(testFileName, F_OK, test->backend_options) == 0) { if (verbose >= VERBOSE_3) { fprintf(out_logfile, "task %d removing %s\n", rank, testFileName); } - backend->delete(testFileName, test); + backend->delete(testFileName, test->backend_options); } if (test->reorderTasksRandom == TRUE) { rankOffset = tmpRankOffset; GetTestFileName(testFileName, test); } } else { - if ((rank == 0) && (backend->access(testFileName, F_OK, test) == 0)) { + if ((rank == 0) && (backend->access(testFileName, F_OK, test->backend_options) == 0)) { if (verbose >= VERBOSE_3) { fprintf(out_logfile, "task %d removing %s\n", rank, testFileName); } - backend->delete(testFileName, test); + backend->delete(testFileName, test->backend_options); } } } @@ -1359,14 +1359,14 @@ static void TestIoSys(IOR_test_t *test) MPI_CHECK(MPI_Barrier(testComm), "barrier error"); timer[4] = GetTimeStamp(); - backend->close(fd, params); + backend->close(fd, params->backend_options); timer[5] = GetTimeStamp(); MPI_CHECK(MPI_Barrier(testComm), "barrier error"); /* get the size of the file just written */ results[rep].write.aggFileSizeFromStat = - backend->get_file_size(params, testComm, testFileName); + backend->get_file_size(params->backend_options, testComm, testFileName); /* check if stat() of file doesn't equal expected file size, use actual amount of byte moved */ @@ -1412,9 +1412,9 @@ static void TestIoSys(IOR_test_t *test) GetTestFileName(testFileName, params); params->open = WRITECHECK; - fd = backend->open(testFileName, IOR_RDONLY, params); + fd = backend->open(testFileName, IOR_RDONLY, params->backend_options); dataMoved = WriteOrRead(params, &results[rep], fd, WRITECHECK, &ioBuffers); - backend->close(fd, params); + backend->close(fd, params->backend_options); rankOffset = 0; } /* @@ -1484,7 +1484,7 @@ static void TestIoSys(IOR_test_t *test) MPI_CHECK(MPI_Barrier(testComm), "barrier error"); params->open = READ; timer[0] = GetTimeStamp(); - fd = backend->open(testFileName, IOR_RDONLY, params); + fd = backend->open(testFileName, IOR_RDONLY, params->backend_options); timer[1] = GetTimeStamp(); if (params->intraTestBarriers) MPI_CHECK(MPI_Barrier(testComm), @@ -1501,12 +1501,12 @@ static void TestIoSys(IOR_test_t *test) MPI_CHECK(MPI_Barrier(testComm), "barrier error"); timer[4] = GetTimeStamp(); - backend->close(fd, params); + backend->close(fd, params->backend_options); timer[5] = GetTimeStamp(); /* get the size of the file just read */ results[rep].read.aggFileSizeFromStat = - backend->get_file_size(params, testComm, + backend->get_file_size(params->backend_options, testComm, testFileName); /* check if stat() of file doesn't equal expected file size, @@ -1809,8 +1809,7 @@ static IOR_offset_t WriteOrReadSingle(IOR_offset_t pairCnt, IOR_offset_t *offset nanosleep( & wait, NULL); } } else if (access == READ) { - amtXferred = - backend->xfer(access, fd, buffer, transfer, test); + amtXferred = backend->xfer(access, fd, buffer, transfer, test->backend_options); if (amtXferred != transfer) ERR("cannot read from file"); if (test->interIODelay > 0){ @@ -1824,7 +1823,7 @@ static IOR_offset_t WriteOrReadSingle(IOR_offset_t pairCnt, IOR_offset_t *offset FillBuffer(readCheckBuffer, test, test->offset, pretendRank); } - amtXferred = backend->xfer(access, fd, checkBuffer, transfer, test); + amtXferred = backend->xfer(access, fd, checkBuffer, transfer, test->backend_options); if (amtXferred != transfer) ERR("cannot read from file write check"); (*transferCount)++; @@ -1834,7 +1833,7 @@ static IOR_offset_t WriteOrReadSingle(IOR_offset_t pairCnt, IOR_offset_t *offset } else if (access == READCHECK) { memset(checkBuffer, 'a', transfer); - amtXferred = backend->xfer(access, fd, checkBuffer, transfer, test); + amtXferred = backend->xfer(access, fd, checkBuffer, transfer, test->backend_options); if (amtXferred != transfer){ ERR("cannot read from file"); } @@ -1931,7 +1930,7 @@ static IOR_offset_t WriteOrRead(IOR_param_t *test, IOR_results_t *results, free(offsetArray); if (access == WRITE && test->fsync == TRUE) { - backend->fsync(fd, test); /*fsync after all accesses */ + backend->fsync(fd, test->backend_options); /*fsync after all accesses */ } return (dataMoved); } diff --git a/src/ior.h b/src/ior.h index f09d617..d208507 100755 --- a/src/ior.h +++ b/src/ior.h @@ -94,6 +94,7 @@ typedef struct char * options; /* options string */ // intermediate options int collective; /* collective I/O */ + MPI_Comm testComm; /* MPI communicator */ int dryRun; /* do not perform any I/Os just run evtl. inputs print dummy output */ int numTasks; /* number of tasks for test */ int numNodes; /* number of nodes for test */ @@ -155,11 +156,6 @@ typedef struct int fsyncPerWrite; /* fsync() after each write */ int fsync; /* fsync() after write */ - /* MPI variables */ - MPI_Comm testComm; /* MPI communicator */ - MPI_Datatype transferType; /* datatype for transfer */ - MPI_Datatype fileType; /* filetype for file view */ - /* HDFS variables */ char * hdfs_user; /* copied from ENV, for now */ const char* hdfs_name_node; diff --git a/src/mdtest.c b/src/mdtest.c index bdd70c9..b81b143 100644 --- a/src/mdtest.c +++ b/src/mdtest.c @@ -2143,8 +2143,8 @@ mdtest_results_t * mdtest_run(int argc, char **argv, MPI_Comm world_com, FILE * } /* if directory does not exist, create it */ - if ((rank < path_count) && backend->access(testdirpath, F_OK, ¶m) != 0) { - if (backend->mkdir(testdirpath, DIRMODE, ¶m) != 0) { + if ((rank < path_count) && backend->access(testdirpath, F_OK, backend_options) != 0) { + if (backend->mkdir(testdirpath, DIRMODE, backend_options) != 0) { FAIL("Unable to create test directory path %s", testdirpath); } } diff --git a/src/option.h b/src/option.h index 624da51..9c2dffd 100644 --- a/src/option.h +++ b/src/option.h @@ -23,10 +23,12 @@ typedef struct{ void * variable; } option_help; +typedef struct airori_mod_opt_t airori_mod_opt_t; + typedef struct{ char * prefix; // may be NULL to include it in the standard name option_help * options; - void * defaults; // these default values are taken from the command line + airori_mod_opt_t * defaults; // these default values are taken from the command line } option_module; typedef struct{ From c4c19d3245cf4a4e29be4fbe9963b883fcd1fcce Mon Sep 17 00:00:00 2001 From: "Julian M. Kunkel" Date: Sun, 31 May 2020 11:58:34 +0100 Subject: [PATCH 43/52] Fixed type typo in name. --- src/aiori-DUMMY.c | 36 +++++++++++------------ src/aiori-HDF5.c | 48 +++++++++++++++---------------- src/aiori-MMAP.c | 30 +++++++++---------- src/aiori-MPIIO.c | 38 ++++++++++++------------ src/aiori-POSIX.c | 30 +++++++++---------- src/aiori.c | 10 +++---- src/aiori.h | 73 ++++++++++++++++++++++++----------------------- src/option.h | 4 +-- 8 files changed, 136 insertions(+), 133 deletions(-) diff --git a/src/aiori-DUMMY.c b/src/aiori-DUMMY.c index 766a2c0..ce8933c 100755 --- a/src/aiori-DUMMY.c +++ b/src/aiori-DUMMY.c @@ -25,7 +25,7 @@ typedef struct { static char * current = (char*) 1; -static option_help * DUMMY_options(airori_mod_opt_t ** init_backend_options, airori_mod_opt_t * init_values){ +static option_help * DUMMY_options(aiori_mod_opt_t ** init_backend_options, aiori_mod_opt_t * init_values){ dummy_options_t * o = malloc(sizeof(dummy_options_t)); if (init_values != NULL){ memcpy(o, init_values, sizeof(dummy_options_t)); @@ -33,7 +33,7 @@ static option_help * DUMMY_options(airori_mod_opt_t ** init_backend_options, air memset(o, 0, sizeof(dummy_options_t)); } - *init_backend_options = (airori_mod_opt_t*) o; + *init_backend_options = (aiori_mod_opt_t*) o; option_help h [] = { {0, "dummy.delay-create", "Delay per create in usec", OPTION_OPTIONAL_ARGUMENT, 'l', & o->delay_creates}, @@ -48,7 +48,7 @@ static option_help * DUMMY_options(airori_mod_opt_t ** init_backend_options, air static int count_init = 0; -static void *DUMMY_Create(char *testFileName, int iorflags, airori_mod_opt_t * options) +static void *DUMMY_Create(char *testFileName, int iorflags, aiori_mod_opt_t * options) { if(count_init <= 0){ ERR("DUMMY missing initialization in create\n"); @@ -66,7 +66,7 @@ static void *DUMMY_Create(char *testFileName, int iorflags, airori_mod_opt_t * o return current++; } -static void *DUMMY_Open(char *testFileName, int flags, airori_mod_opt_t * options) +static void *DUMMY_Open(char *testFileName, int flags, aiori_mod_opt_t * options) { if(count_init <= 0){ ERR("DUMMY missing initialization in open\n"); @@ -77,7 +77,7 @@ static void *DUMMY_Open(char *testFileName, int flags, airori_mod_opt_t * option return current++; } -static void DUMMY_Fsync(void *fd, airori_mod_opt_t * options) +static void DUMMY_Fsync(void *fd, aiori_mod_opt_t * options) { if(verbose > 4){ fprintf(out_logfile, "DUMMY fsync %p\n", fd); @@ -85,18 +85,18 @@ static void DUMMY_Fsync(void *fd, airori_mod_opt_t * options) } -static void DUMMY_Sync(airori_mod_opt_t * options) +static void DUMMY_Sync(aiori_mod_opt_t * options) { } -static void DUMMY_Close(void *fd, airori_mod_opt_t * options) +static void DUMMY_Close(void *fd, aiori_mod_opt_t * options) { if(verbose > 4){ fprintf(out_logfile, "DUMMY close %p\n", fd); } } -static void DUMMY_Delete(char *testFileName, airori_mod_opt_t * options) +static void DUMMY_Delete(char *testFileName, aiori_mod_opt_t * options) { if(verbose > 4){ fprintf(out_logfile, "DUMMY delete: %s\n", testFileName); @@ -108,7 +108,7 @@ static char * DUMMY_getVersion() return "0.5"; } -static IOR_offset_t DUMMY_GetFileSize(airori_mod_opt_t * options, MPI_Comm testComm, char *testFileName) +static IOR_offset_t DUMMY_GetFileSize(aiori_mod_opt_t * options, MPI_Comm testComm, char *testFileName) { if(verbose > 4){ fprintf(out_logfile, "DUMMY getFileSize: %s\n", testFileName); @@ -116,7 +116,7 @@ static IOR_offset_t DUMMY_GetFileSize(airori_mod_opt_t * options, MPI_Comm testC return 0; } -static IOR_offset_t DUMMY_Xfer(int access, void *file, IOR_size_t * buffer, IOR_offset_t length, airori_mod_opt_t * options){ +static IOR_offset_t DUMMY_Xfer(int access, void *file, IOR_size_t * buffer, IOR_offset_t length, aiori_mod_opt_t * options){ if(verbose > 4){ fprintf(out_logfile, "DUMMY xfer: %p\n", file); } @@ -130,7 +130,7 @@ static IOR_offset_t DUMMY_Xfer(int access, void *file, IOR_size_t * buffer, IOR_ return length; } -static int DUMMY_statfs (const char * path, ior_aiori_statfs_t * stat, airori_mod_opt_t * options){ +static int DUMMY_statfs (const char * path, ior_aiori_statfs_t * stat, aiori_mod_opt_t * options){ stat->f_bsize = 1; stat->f_blocks = 1; stat->f_bfree = 1; @@ -140,32 +140,32 @@ static int DUMMY_statfs (const char * path, ior_aiori_statfs_t * stat, airori_mo return 0; } -static int DUMMY_mkdir (const char *path, mode_t mode, airori_mod_opt_t * options){ +static int DUMMY_mkdir (const char *path, mode_t mode, aiori_mod_opt_t * options){ return 0; } -static int DUMMY_rmdir (const char *path, airori_mod_opt_t * options){ +static int DUMMY_rmdir (const char *path, aiori_mod_opt_t * options){ return 0; } -static int DUMMY_access (const char *path, int mode, airori_mod_opt_t * options){ +static int DUMMY_access (const char *path, int mode, aiori_mod_opt_t * options){ return 0; } -static int DUMMY_stat (const char *path, struct stat *buf, airori_mod_opt_t * options){ +static int DUMMY_stat (const char *path, struct stat *buf, aiori_mod_opt_t * options){ return 0; } -static int DUMMY_check_params(airori_mod_opt_t * options){ +static int DUMMY_check_params(aiori_mod_opt_t * options){ return 0; } -static void DUMMY_init(airori_mod_opt_t * options){ +static void DUMMY_init(aiori_mod_opt_t * options){ WARN("DUMMY initialized"); count_init++; } -static void DUMMY_final(airori_mod_opt_t * options){ +static void DUMMY_final(aiori_mod_opt_t * options){ WARN("DUMMY finalized"); if(count_init <= 0){ ERR("DUMMY invalid finalization\n"); diff --git a/src/aiori-HDF5.c b/src/aiori-HDF5.c index e66e5d4..203aa3f 100755 --- a/src/aiori-HDF5.c +++ b/src/aiori-HDF5.c @@ -81,20 +81,20 @@ #endif /* H5_VERS_MAJOR > 1 && H5_VERS_MINOR > 6 */ /**************************** P R O T O T Y P E S *****************************/ -static IOR_offset_t SeekOffset(void *, IOR_offset_t, airori_mod_opt_t *); -static void SetupDataSet(void *, airori_mod_opt_t *); -static void *HDF5_Create(char *, int flags, airori_mod_opt_t *); -static void *HDF5_Open(char *, int flags, airori_mod_opt_t *); +static IOR_offset_t SeekOffset(void *, IOR_offset_t, aiori_mod_opt_t *); +static void SetupDataSet(void *, aiori_mod_opt_t *); +static void *HDF5_Create(char *, int flags, aiori_mod_opt_t *); +static void *HDF5_Open(char *, int flags, aiori_mod_opt_t *); static IOR_offset_t HDF5_Xfer(int, void *, IOR_size_t *, - IOR_offset_t, airori_mod_opt_t *); -static void HDF5_Close(void *, airori_mod_opt_t *); -static void HDF5_Delete(char *, airori_mod_opt_t *); + IOR_offset_t, aiori_mod_opt_t *); +static void HDF5_Close(void *, aiori_mod_opt_t *); +static void HDF5_Delete(char *, aiori_mod_opt_t *); static char* HDF5_GetVersion(); -static void HDF5_Fsync(void *, airori_mod_opt_t *); -static IOR_offset_t HDF5_GetFileSize(airori_mod_opt_t *, MPI_Comm, char *); -static int HDF5_Access(const char *, int, airori_mod_opt_t *); +static void HDF5_Fsync(void *, aiori_mod_opt_t *); +static IOR_offset_t HDF5_GetFileSize(aiori_mod_opt_t *, MPI_Comm, char *); +static int HDF5_Access(const char *, int, aiori_mod_opt_t *); static void HDF5_init_xfer_options(IOR_param_t * params); -static int HDF5_check_params(airori_mod_opt_t * options); +static int HDF5_check_params(aiori_mod_opt_t * options); /************************** O P T I O N S *****************************/ typedef struct{ @@ -107,7 +107,7 @@ typedef struct{ } HDF5_options_t; /***************************** F U N C T I O N S ******************************/ -static option_help * HDF5_options(airori_mod_opt_t ** init_backend_options, airori_mod_opt_t * init_values){ +static option_help * HDF5_options(aiori_mod_opt_t ** init_backend_options, aiori_mod_opt_t * init_values){ HDF5_options_t * o = malloc(sizeof(HDF5_options_t)); if (init_values != NULL){ @@ -119,7 +119,7 @@ static option_help * HDF5_options(airori_mod_opt_t ** init_backend_options, airo o->setAlignment = 1; } - *init_backend_options = (airori_mod_opt_t*) o; + *init_backend_options = (aiori_mod_opt_t*) o; option_help h [] = { {0, "hdf5.collectiveMetadata", "Use collectiveMetadata (available since HDF5-1.10.0)", OPTION_FLAG, 'd', & o->collective_md}, @@ -173,7 +173,7 @@ static void HDF5_init_xfer_options(IOR_param_t * params){ ior_param = params; } -static int HDF5_check_params(airori_mod_opt_t * options){ +static int HDF5_check_params(aiori_mod_opt_t * options){ HDF5_options_t *o = (HDF5_options_t*) options; if (o->setAlignment < 0) ERR("alignment must be non-negative integer"); @@ -197,7 +197,7 @@ static int HDF5_check_params(airori_mod_opt_t * options){ /* * Create and open a file through the HDF5 interface. */ -static void *HDF5_Create(char *testFileName, int flags, airori_mod_opt_t * param) +static void *HDF5_Create(char *testFileName, int flags, aiori_mod_opt_t * param) { return HDF5_Open(testFileName, flags, param); } @@ -205,7 +205,7 @@ static void *HDF5_Create(char *testFileName, int flags, airori_mod_opt_t * param /* * Open a file through the HDF5 interface. */ -static void *HDF5_Open(char *testFileName, int flags, airori_mod_opt_t * param) +static void *HDF5_Open(char *testFileName, int flags, aiori_mod_opt_t * param) { HDF5_options_t *o = (HDF5_options_t*) param; hid_t accessPropList, createPropList; @@ -417,7 +417,7 @@ static void *HDF5_Open(char *testFileName, int flags, airori_mod_opt_t * param) * Write or read access to file using the HDF5 interface. */ static IOR_offset_t HDF5_Xfer(int access, void *fd, IOR_size_t * buffer, - IOR_offset_t length, airori_mod_opt_t * param) + IOR_offset_t length, aiori_mod_opt_t * param) { static int firstReadCheck = FALSE, startNewDataSet; IOR_offset_t segmentPosition, segmentSize; @@ -495,7 +495,7 @@ static IOR_offset_t HDF5_Xfer(int access, void *fd, IOR_size_t * buffer, /* * Perform fsync(). */ -static void HDF5_Fsync(void *fd, airori_mod_opt_t * param) +static void HDF5_Fsync(void *fd, aiori_mod_opt_t * param) { ; } @@ -503,7 +503,7 @@ static void HDF5_Fsync(void *fd, airori_mod_opt_t * param) /* * Close a file through the HDF5 interface. */ -static void HDF5_Close(void *fd, airori_mod_opt_t * param) +static void HDF5_Close(void *fd, aiori_mod_opt_t * param) { if(ior_param->dryRun) return; @@ -524,7 +524,7 @@ static void HDF5_Close(void *fd, airori_mod_opt_t * param) /* * Delete a file through the HDF5 interface. */ -static void HDF5_Delete(char *testFileName, airori_mod_opt_t * param) +static void HDF5_Delete(char *testFileName, aiori_mod_opt_t * param) { if(ior_param->dryRun) return @@ -558,7 +558,7 @@ static char * HDF5_GetVersion() * Seek to offset in file using the HDF5 interface and set up hyperslab. */ static IOR_offset_t SeekOffset(void *fd, IOR_offset_t offset, - airori_mod_opt_t * param) + aiori_mod_opt_t * param) { HDF5_options_t *o = (HDF5_options_t*) param; IOR_offset_t segmentSize; @@ -598,7 +598,7 @@ static IOR_offset_t SeekOffset(void *fd, IOR_offset_t offset, /* * Create HDF5 data set. */ -static void SetupDataSet(void *fd, airori_mod_opt_t * param) +static void SetupDataSet(void *fd, aiori_mod_opt_t * param) { HDF5_options_t *o = (HDF5_options_t*) param; char dataSetName[MAX_STR]; @@ -661,7 +661,7 @@ static void SetupDataSet(void *fd, airori_mod_opt_t * param) * Use MPIIO call to get file size. */ static IOR_offset_t -HDF5_GetFileSize(airori_mod_opt_t * test, MPI_Comm testComm, char *testFileName) +HDF5_GetFileSize(aiori_mod_opt_t * test, MPI_Comm testComm, char *testFileName) { if(ior_param->dryRun) return 0; @@ -671,7 +671,7 @@ HDF5_GetFileSize(airori_mod_opt_t * test, MPI_Comm testComm, char *testFileName) /* * Use MPIIO call to check for access. */ -static int HDF5_Access(const char *path, int mode, airori_mod_opt_t *param) +static int HDF5_Access(const char *path, int mode, aiori_mod_opt_t *param) { if(ior_param->dryRun) return 0; diff --git a/src/aiori-MMAP.c b/src/aiori-MMAP.c index 81e7a81..5a920a7 100644 --- a/src/aiori-MMAP.c +++ b/src/aiori-MMAP.c @@ -26,15 +26,15 @@ #include "utilities.h" /**************************** P R O T O T Y P E S *****************************/ -static void *MMAP_Create(char *, int flags, airori_mod_opt_t *); -static void *MMAP_Open(char *, int flags, airori_mod_opt_t *); +static void *MMAP_Create(char *, int flags, aiori_mod_opt_t *); +static void *MMAP_Open(char *, int flags, aiori_mod_opt_t *); static IOR_offset_t MMAP_Xfer(int, void *, IOR_size_t *, - IOR_offset_t, airori_mod_opt_t *); -static void MMAP_Close(void *, airori_mod_opt_t *); -static void MMAP_Fsync(void *, airori_mod_opt_t *); -static option_help * MMAP_options(airori_mod_opt_t ** init_backend_options, airori_mod_opt_t * init_values); + IOR_offset_t, aiori_mod_opt_t *); +static void MMAP_Close(void *, aiori_mod_opt_t *); +static void MMAP_Fsync(void *, aiori_mod_opt_t *); +static option_help * MMAP_options(aiori_mod_opt_t ** init_backend_options, aiori_mod_opt_t * init_values); static void MMAP_init_xfer_options(IOR_param_t * params); -static int MMAP_check_params(airori_mod_opt_t * options); +static int MMAP_check_params(aiori_mod_opt_t * options); /************************** D E C L A R A T I O N S ***************************/ ior_aiori_t mmap_aiori = { @@ -61,7 +61,7 @@ typedef struct{ int madv_pattern; } mmap_options_t; -static option_help * MMAP_options(airori_mod_opt_t ** init_backend_options, airori_mod_opt_t * init_values){ +static option_help * MMAP_options(aiori_mod_opt_t ** init_backend_options, aiori_mod_opt_t * init_values){ mmap_options_t * o = malloc(sizeof(mmap_options_t)); if (init_values != NULL){ @@ -70,7 +70,7 @@ static option_help * MMAP_options(airori_mod_opt_t ** init_backend_options, airo memset(o, 0, sizeof(mmap_options_t)); } - *init_backend_options = (airori_mod_opt_t*) o; + *init_backend_options = (aiori_mod_opt_t*) o; option_help h [] = { {0, "mmap.madv_dont_need", "Use advise don't need", OPTION_FLAG, 'd', & o->madv_dont_need}, @@ -89,7 +89,7 @@ static void MMAP_init_xfer_options(IOR_param_t * params){ aiori_posix_init_xfer_options(params); } -static int MMAP_check_params(airori_mod_opt_t * options){ +static int MMAP_check_params(aiori_mod_opt_t * options){ if (ior_param->fsyncPerWrite && (ior_param->transferSize & (sysconf(_SC_PAGESIZE) - 1))) ERR("transfer size must be aligned with PAGESIZE for MMAP with fsyncPerWrite"); return 0; @@ -130,7 +130,7 @@ static void ior_mmap_file(int *file, int mflags, void *param) /* * Creat and open a file through the POSIX interface, then setup mmap. */ -static void *MMAP_Create(char *testFileName, int flags, airori_mod_opt_t * param) +static void *MMAP_Create(char *testFileName, int flags, aiori_mod_opt_t * param) { int *fd; @@ -144,7 +144,7 @@ static void *MMAP_Create(char *testFileName, int flags, airori_mod_opt_t * param /* * Open a file through the POSIX interface and setup mmap. */ -static void *MMAP_Open(char *testFileName, int flags, airori_mod_opt_t * param) +static void *MMAP_Open(char *testFileName, int flags, aiori_mod_opt_t * param) { int *fd; fd = POSIX_Open(testFileName, flags, param); @@ -156,7 +156,7 @@ static void *MMAP_Open(char *testFileName, int flags, airori_mod_opt_t * param) * Write or read access to file using mmap */ static IOR_offset_t MMAP_Xfer(int access, void *file, IOR_size_t * buffer, - IOR_offset_t length, airori_mod_opt_t * param) + IOR_offset_t length, aiori_mod_opt_t * param) { mmap_options_t *o = (mmap_options_t*) param; if (access == WRITE) { @@ -178,7 +178,7 @@ static IOR_offset_t MMAP_Xfer(int access, void *file, IOR_size_t * buffer, /* * Perform msync(). */ -static void MMAP_Fsync(void *fd, airori_mod_opt_t * param) +static void MMAP_Fsync(void *fd, aiori_mod_opt_t * param) { mmap_options_t *o = (mmap_options_t*) param; if (msync(o->mmap_ptr, ior_param->expectedAggFileSize, MS_SYNC) != 0) @@ -188,7 +188,7 @@ static void MMAP_Fsync(void *fd, airori_mod_opt_t * param) /* * Close a file through the POSIX interface, after tear down the mmap. */ -static void MMAP_Close(void *fd, airori_mod_opt_t * param) +static void MMAP_Close(void *fd, aiori_mod_opt_t * param) { mmap_options_t *o = (mmap_options_t*) param; if (munmap(o->mmap_ptr, ior_param->expectedAggFileSize) != 0) diff --git a/src/aiori-MPIIO.c b/src/aiori-MPIIO.c index 6a22170..f366872 100755 --- a/src/aiori-MPIIO.c +++ b/src/aiori-MPIIO.c @@ -31,17 +31,17 @@ /**************************** P R O T O T Y P E S *****************************/ -static IOR_offset_t SeekOffset(MPI_File, IOR_offset_t, airori_mod_opt_t *); +static IOR_offset_t SeekOffset(MPI_File, IOR_offset_t, aiori_mod_opt_t *); -static void *MPIIO_Create(char *, int iorflags, airori_mod_opt_t *); -static void *MPIIO_Open(char *, int flags, airori_mod_opt_t *); +static void *MPIIO_Create(char *, int iorflags, aiori_mod_opt_t *); +static void *MPIIO_Open(char *, int flags, aiori_mod_opt_t *); static IOR_offset_t MPIIO_Xfer(int, void *, IOR_size_t *, - IOR_offset_t, airori_mod_opt_t *); -static void MPIIO_Close(void *, airori_mod_opt_t *); + IOR_offset_t, aiori_mod_opt_t *); +static void MPIIO_Close(void *, aiori_mod_opt_t *); static char* MPIIO_GetVersion(); -static void MPIIO_Fsync(void *, airori_mod_opt_t *); +static void MPIIO_Fsync(void *, aiori_mod_opt_t *); static void MPIIO_init_xfer_options(IOR_param_t * params); -static int MPIIO_check_params(airori_mod_opt_t * options); +static int MPIIO_check_params(aiori_mod_opt_t * options); /************************** D E C L A R A T I O N S ***************************/ @@ -61,14 +61,14 @@ typedef struct { char * hintsFileName; /* full name for hints file */ } mpiio_options_t; -static option_help * MPIIO_options(airori_mod_opt_t ** init_backend_options, airori_mod_opt_t * init_values){ +static option_help * MPIIO_options(aiori_mod_opt_t ** init_backend_options, aiori_mod_opt_t * init_values){ mpiio_options_t * o = malloc(sizeof(mpiio_options_t)); if (init_values != NULL){ memcpy(o, init_values, sizeof(mpiio_options_t)); }else{ memset(o, 0, sizeof(mpiio_options_t)); } - *init_backend_options = (airori_mod_opt_t*) o; + *init_backend_options = (aiori_mod_opt_t*) o; option_help h [] = { {0, "mpiio.dryRun", "Dry run, disable actual IO", OPTION_FLAG, 'd', & o->dry_run}, @@ -114,7 +114,7 @@ static void MPIIO_init_xfer_options(IOR_param_t * params){ ior_param = params; } -static int MPIIO_check_params(airori_mod_opt_t * module_options){ +static int MPIIO_check_params(aiori_mod_opt_t * module_options){ mpiio_options_t * param = (mpiio_options_t*) module_options; if ((param->useFileView == TRUE) && (sizeof(MPI_Aint) < 8) /* used for 64-bit datatypes */ @@ -140,7 +140,7 @@ static int MPIIO_check_params(airori_mod_opt_t * module_options){ /* * Try to access a file through the MPIIO interface. */ -int MPIIO_Access(const char *path, int mode, airori_mod_opt_t *module_options) +int MPIIO_Access(const char *path, int mode, aiori_mod_opt_t *module_options) { mpiio_options_t * param = (mpiio_options_t*) module_options; if(param->dry_run){ @@ -172,7 +172,7 @@ int MPIIO_Access(const char *path, int mode, airori_mod_opt_t *module_options) /* * Create and open a file through the MPIIO interface. */ -static void *MPIIO_Create(char *testFileName, int iorflags, airori_mod_opt_t * module_options) +static void *MPIIO_Create(char *testFileName, int iorflags, aiori_mod_opt_t * module_options) { return MPIIO_Open(testFileName, iorflags, module_options); } @@ -180,7 +180,7 @@ static void *MPIIO_Create(char *testFileName, int iorflags, airori_mod_opt_t * m /* * Open a file through the MPIIO interface. Setup file view. */ -static void *MPIIO_Open(char *testFileName, int flags, airori_mod_opt_t * module_options) +static void *MPIIO_Open(char *testFileName, int flags, aiori_mod_opt_t * module_options) { mpiio_options_t * param = (mpiio_options_t*) module_options; int fd_mode = (int)0, @@ -329,7 +329,7 @@ static void *MPIIO_Open(char *testFileName, int flags, airori_mod_opt_t * module * Write or read access to file using the MPIIO interface. */ static IOR_offset_t MPIIO_Xfer(int access, void * fdp, IOR_size_t * buffer, - IOR_offset_t length, airori_mod_opt_t * module_options) + IOR_offset_t length, aiori_mod_opt_t * module_options) { /* NOTE: The second arg is (void *) for reads, and (const void *) for writes. Therefore, one of the two sets of assignments below @@ -464,7 +464,7 @@ static IOR_offset_t MPIIO_Xfer(int access, void * fdp, IOR_size_t * buffer, /* * Perform fsync(). */ -static void MPIIO_Fsync(void *fdp, airori_mod_opt_t * module_options) +static void MPIIO_Fsync(void *fdp, aiori_mod_opt_t * module_options) { mpiio_options_t * param = (mpiio_options_t*) module_options; if(param->dry_run) @@ -477,7 +477,7 @@ static void MPIIO_Fsync(void *fdp, airori_mod_opt_t * module_options) /* * Close a file through the MPIIO interface. */ -static void MPIIO_Close(void *fdp, airori_mod_opt_t * module_options) +static void MPIIO_Close(void *fdp, aiori_mod_opt_t * module_options) { mpiio_options_t * param = (mpiio_options_t*) module_options; mpiio_fd_t * mfd = (mpiio_fd_t*) fdp; @@ -497,7 +497,7 @@ static void MPIIO_Close(void *fdp, airori_mod_opt_t * module_options) /* * Delete a file through the MPIIO interface. */ -void MPIIO_Delete(char *testFileName, airori_mod_opt_t * module_options) +void MPIIO_Delete(char *testFileName, aiori_mod_opt_t * module_options) { mpiio_options_t * param = (mpiio_options_t*) module_options; if(param->dry_run) @@ -522,7 +522,7 @@ static char* MPIIO_GetVersion() * Seek to offset in file using the MPIIO interface. */ static IOR_offset_t SeekOffset(MPI_File fd, IOR_offset_t offset, - airori_mod_opt_t * module_options) + aiori_mod_opt_t * module_options) { mpiio_options_t * param = (mpiio_options_t*) module_options; int offsetFactor, tasksPerFile; @@ -564,7 +564,7 @@ static IOR_offset_t SeekOffset(MPI_File fd, IOR_offset_t offset, * Use MPI_File_get_size() to return aggregate file size. * NOTE: This function is used by the HDF5 and NCMPI backends. */ -IOR_offset_t MPIIO_GetFileSize(airori_mod_opt_t * module_options, MPI_Comm testComm, +IOR_offset_t MPIIO_GetFileSize(aiori_mod_opt_t * module_options, MPI_Comm testComm, char *testFileName) { mpiio_options_t * test = (mpiio_options_t*) module_options; diff --git a/src/aiori-POSIX.c b/src/aiori-POSIX.c index 20f37f4..4ecc557 100755 --- a/src/aiori-POSIX.c +++ b/src/aiori-POSIX.c @@ -69,10 +69,10 @@ /**************************** P R O T O T Y P E S *****************************/ static IOR_offset_t POSIX_Xfer(int, void *, IOR_size_t *, - IOR_offset_t, airori_mod_opt_t *); -static void POSIX_Fsync(void *, airori_mod_opt_t *); -static void POSIX_Sync(airori_mod_opt_t * ); -static int POSIX_check_params(airori_mod_opt_t * options); + IOR_offset_t, aiori_mod_opt_t *); +static void POSIX_Fsync(void *, aiori_mod_opt_t *); +static void POSIX_Sync(aiori_mod_opt_t * ); +static int POSIX_check_params(aiori_mod_opt_t * options); /************************** O P T I O N S *****************************/ typedef struct{ @@ -97,7 +97,7 @@ typedef struct{ } posix_options_t; -option_help * POSIX_options(airori_mod_opt_t ** init_backend_options, airori_mod_opt_t * init_values){ +option_help * POSIX_options(aiori_mod_opt_t ** init_backend_options, aiori_mod_opt_t * init_values){ posix_options_t * o = malloc(sizeof(posix_options_t)); if (init_values != NULL){ @@ -110,7 +110,7 @@ option_help * POSIX_options(airori_mod_opt_t ** init_backend_options, airori_mod o->beegfs_chunkSize = -1; } - *init_backend_options = (airori_mod_opt_t*) o; + *init_backend_options = (aiori_mod_opt_t*) o; option_help h [] = { {0, "posix.odirect", "Direct I/O Mode", OPTION_FLAG, 'd', & o->direct_io}, @@ -172,7 +172,7 @@ void aiori_posix_init_xfer_options(IOR_param_t * params){ ior_param = params; } -static int POSIX_check_params(airori_mod_opt_t * param){ +static int POSIX_check_params(aiori_mod_opt_t * param){ posix_options_t * o = (posix_options_t*) param; if (ior_param->useExistingTestFile && o->lustre_set_striping) ERR("Lustre stripe options are incompatible with useExistingTestFile"); @@ -372,7 +372,7 @@ bool beegfs_createFilePath(char* filepath, mode_t mode, int numTargets, int chun /* * Creat and open a file through the POSIX interface. */ -void *POSIX_Create(char *testFileName, int flags, airori_mod_opt_t * param) +void *POSIX_Create(char *testFileName, int flags, aiori_mod_opt_t * param) { int fd_oflag = O_BINARY; int mode = 0664; @@ -503,7 +503,7 @@ int POSIX_Mknod(char *testFileName) /* * Open a file through the POSIX interface. */ -void *POSIX_Open(char *testFileName, int flags, airori_mod_opt_t * param) +void *POSIX_Open(char *testFileName, int flags, aiori_mod_opt_t * param) { int fd_oflag = O_BINARY; int *fd; @@ -549,7 +549,7 @@ void *POSIX_Open(char *testFileName, int flags, airori_mod_opt_t * param) * Write or read access to file using the POSIX interface. */ static IOR_offset_t POSIX_Xfer(int access, void *file, IOR_size_t * buffer, - IOR_offset_t length, airori_mod_opt_t * param) + IOR_offset_t length, aiori_mod_opt_t * param) { int xferRetries = 0; long long remaining = (long long)length; @@ -634,14 +634,14 @@ static IOR_offset_t POSIX_Xfer(int access, void *file, IOR_size_t * buffer, /* * Perform fsync(). */ -static void POSIX_Fsync(void *fd, airori_mod_opt_t * param) +static void POSIX_Fsync(void *fd, aiori_mod_opt_t * param) { if (fsync(*(int *)fd) != 0) EWARNF("fsync(%d) failed", *(int *)fd); } -static void POSIX_Sync(airori_mod_opt_t * param) +static void POSIX_Sync(aiori_mod_opt_t * param) { int ret = system("sync"); if (ret != 0){ @@ -653,7 +653,7 @@ static void POSIX_Sync(airori_mod_opt_t * param) /* * Close a file through the POSIX interface. */ -void POSIX_Close(void *fd, airori_mod_opt_t * param) +void POSIX_Close(void *fd, aiori_mod_opt_t * param) { if(ior_param->dryRun) return; @@ -665,7 +665,7 @@ void POSIX_Close(void *fd, airori_mod_opt_t * param) /* * Delete a file through the POSIX interface. */ -void POSIX_Delete(char *testFileName, airori_mod_opt_t * param) +void POSIX_Delete(char *testFileName, aiori_mod_opt_t * param) { if(ior_param->dryRun) return; @@ -678,7 +678,7 @@ void POSIX_Delete(char *testFileName, airori_mod_opt_t * param) /* * Use POSIX stat() to return aggregate file size. */ -IOR_offset_t POSIX_GetFileSize(airori_mod_opt_t * test, MPI_Comm testComm, +IOR_offset_t POSIX_GetFileSize(aiori_mod_opt_t * test, MPI_Comm testComm, char *testFileName) { if(ior_param->dryRun) diff --git a/src/aiori.c b/src/aiori.c index 42eb871..be9c2b4 100644 --- a/src/aiori.c +++ b/src/aiori.c @@ -152,7 +152,7 @@ void aiori_supported_apis(char * APIs, char * APIs_legacy, enum bench_type type) * This function provides a AIORI statfs for POSIX-compliant filesystems. It * uses statvfs is available and falls back on statfs. */ -int aiori_posix_statfs (const char *path, ior_aiori_statfs_t *stat_buf, airori_mod_opt_t * module_options) +int aiori_posix_statfs (const char *path, ior_aiori_statfs_t *stat_buf, aiori_mod_opt_t * module_options) { int ret; #if defined(HAVE_STATVFS) @@ -177,22 +177,22 @@ int aiori_posix_statfs (const char *path, ior_aiori_statfs_t *stat_buf, airori_m return 0; } -int aiori_posix_mkdir (const char *path, mode_t mode, airori_mod_opt_t * module_options) +int aiori_posix_mkdir (const char *path, mode_t mode, aiori_mod_opt_t * module_options) { return mkdir (path, mode); } -int aiori_posix_rmdir (const char *path, airori_mod_opt_t * module_options) +int aiori_posix_rmdir (const char *path, aiori_mod_opt_t * module_options) { return rmdir (path); } -int aiori_posix_access (const char *path, int mode, airori_mod_opt_t * module_options) +int aiori_posix_access (const char *path, int mode, aiori_mod_opt_t * module_options) { return access (path, mode); } -int aiori_posix_stat (const char *path, struct stat *buf, airori_mod_opt_t * module_options) +int aiori_posix_stat (const char *path, struct stat *buf, aiori_mod_opt_t * module_options) { return stat (path, buf); } diff --git a/src/aiori.h b/src/aiori.h index dab41c6..7662e8f 100755 --- a/src/aiori.h +++ b/src/aiori.h @@ -63,39 +63,42 @@ typedef struct ior_aiori_statfs { uint64_t f_ffree; } ior_aiori_statfs_t; -/* this is a dummy structure to create some type safety */ -typedef struct airori_mod_opt_t{ - void * dummy; -} airori_mod_opt_t; +typedef struct aiori_xfer_hint_t{ +} aiori_xfer_hint_t; + +/* this is a dummy structure to create some type safety */ +typedef struct aiori_mod_opt_t{ + void * dummy; +} aiori_mod_opt_t; typedef struct ior_aiori { char *name; char *name_legacy; - void *(*create)(char *, int iorflags, airori_mod_opt_t *); + void *(*create)(char *, int iorflags, aiori_mod_opt_t *); int (*mknod)(char *); - void *(*open)(char *, int iorflags, airori_mod_opt_t *); + void *(*open)(char *, int iorflags, aiori_mod_opt_t *); /* Allow to set generic transfer options that shall be applied to any subsequent IO call. */ void (*init_xfer_options)(IOR_param_t * params); IOR_offset_t (*xfer)(int, void *, IOR_size_t *, - IOR_offset_t, airori_mod_opt_t *); - void (*close)(void *, airori_mod_opt_t *); - void (*delete)(char *, airori_mod_opt_t *); + IOR_offset_t, aiori_mod_opt_t *); + void (*close)(void *, aiori_mod_opt_t *); + void (*delete)(char *, aiori_mod_opt_t *); char* (*get_version)(void); - void (*fsync)(void *, airori_mod_opt_t *); - IOR_offset_t (*get_file_size)(airori_mod_opt_t * module_options, MPI_Comm, char *); - int (*statfs) (const char *, ior_aiori_statfs_t *, airori_mod_opt_t * module_options); - int (*mkdir) (const char *path, mode_t mode, airori_mod_opt_t * module_options); - int (*rmdir) (const char *path, airori_mod_opt_t * module_options); - int (*access) (const char *path, int mode, airori_mod_opt_t * module_options); - int (*stat) (const char *path, struct stat *buf, airori_mod_opt_t * module_options); - void (*initialize)(airori_mod_opt_t * options); /* called once per program before MPI is started */ - void (*finalize)(airori_mod_opt_t * options); /* called once per program after MPI is shutdown */ - option_help * (*get_options)(airori_mod_opt_t ** init_backend_options, airori_mod_opt_t* init_values); /* initializes the backend options as well and returns the pointer to the option help structure */ - int (*check_params)(airori_mod_opt_t *); /* check if the provided module_optionseters for the given test and the module options are correct, if they aren't print a message and exit(1) or return 1*/ - void (*sync)(airori_mod_opt_t * ); /* synchronize every pending operation for this storage */ + void (*fsync)(void *, aiori_mod_opt_t *); + IOR_offset_t (*get_file_size)(aiori_mod_opt_t * module_options, MPI_Comm, char *); + int (*statfs) (const char *, ior_aiori_statfs_t *, aiori_mod_opt_t * module_options); + int (*mkdir) (const char *path, mode_t mode, aiori_mod_opt_t * module_options); + int (*rmdir) (const char *path, aiori_mod_opt_t * module_options); + int (*access) (const char *path, int mode, aiori_mod_opt_t * module_options); + int (*stat) (const char *path, struct stat *buf, aiori_mod_opt_t * module_options); + void (*initialize)(aiori_mod_opt_t * options); /* called once per program before MPI is started */ + void (*finalize)(aiori_mod_opt_t * options); /* called once per program after MPI is shutdown */ + option_help * (*get_options)(aiori_mod_opt_t ** init_backend_options, aiori_mod_opt_t* init_values); /* initializes the backend options as well and returns the pointer to the option help structure */ + int (*check_params)(aiori_mod_opt_t *); /* check if the provided module_optionseters for the given test and the module options are correct, if they aren't print a message and exit(1) or return 1*/ + void (*sync)(aiori_mod_opt_t * ); /* synchronize every pending operation for this storage */ bool enable_mdtest; } ior_aiori_t; @@ -132,25 +135,25 @@ const char *aiori_default (void); /* some generic POSIX-based backend calls */ char * aiori_get_version (void); -int aiori_posix_statfs (const char *path, ior_aiori_statfs_t *stat_buf, airori_mod_opt_t * module_options); -int aiori_posix_mkdir (const char *path, mode_t mode, airori_mod_opt_t * module_options); -int aiori_posix_rmdir (const char *path, airori_mod_opt_t * module_options); -int aiori_posix_access (const char *path, int mode, airori_mod_opt_t * module_options); -int aiori_posix_stat (const char *path, struct stat *buf, airori_mod_opt_t * module_options); +int aiori_posix_statfs (const char *path, ior_aiori_statfs_t *stat_buf, aiori_mod_opt_t * module_options); +int aiori_posix_mkdir (const char *path, mode_t mode, aiori_mod_opt_t * module_options); +int aiori_posix_rmdir (const char *path, aiori_mod_opt_t * module_options); +int aiori_posix_access (const char *path, int mode, aiori_mod_opt_t * module_options); +int aiori_posix_stat (const char *path, struct stat *buf, aiori_mod_opt_t * module_options); void aiori_posix_init_xfer_options(IOR_param_t * params); -void *POSIX_Create(char *testFileName, int flags, airori_mod_opt_t * module_options); +void *POSIX_Create(char *testFileName, int flags, aiori_mod_opt_t * module_options); int POSIX_Mknod(char *testFileName); -void *POSIX_Open(char *testFileName, int flags, airori_mod_opt_t * module_options); -IOR_offset_t POSIX_GetFileSize(airori_mod_opt_t * test, MPI_Comm testComm, char *testFileName); -void POSIX_Delete(char *testFileName, airori_mod_opt_t * module_options); -void POSIX_Close(void *fd, airori_mod_opt_t * module_options); -option_help * POSIX_options(airori_mod_opt_t ** init_backend_options, airori_mod_opt_t * init_values); +void *POSIX_Open(char *testFileName, int flags, aiori_mod_opt_t * module_options); +IOR_offset_t POSIX_GetFileSize(aiori_mod_opt_t * test, MPI_Comm testComm, char *testFileName); +void POSIX_Delete(char *testFileName, aiori_mod_opt_t * module_options); +void POSIX_Close(void *fd, aiori_mod_opt_t * module_options); +option_help * POSIX_options(aiori_mod_opt_t ** init_backend_options, aiori_mod_opt_t * init_values); /* NOTE: these 3 MPI-IO functions are exported for reuse by HDF5/PNetCDF */ -void MPIIO_Delete(char *testFileName, airori_mod_opt_t * module_options); -IOR_offset_t MPIIO_GetFileSize(airori_mod_opt_t * options, MPI_Comm testComm, char *testFileName); -int MPIIO_Access(const char *, int, airori_mod_opt_t *); +void MPIIO_Delete(char *testFileName, aiori_mod_opt_t * module_options); +IOR_offset_t MPIIO_GetFileSize(aiori_mod_opt_t * options, MPI_Comm testComm, char *testFileName); +int MPIIO_Access(const char *, int, aiori_mod_opt_t *); #endif /* not _AIORI_H */ diff --git a/src/option.h b/src/option.h index 9c2dffd..5ca305f 100644 --- a/src/option.h +++ b/src/option.h @@ -23,12 +23,12 @@ typedef struct{ void * variable; } option_help; -typedef struct airori_mod_opt_t airori_mod_opt_t; +typedef struct aiori_mod_opt_t aiori_mod_opt_t; typedef struct{ char * prefix; // may be NULL to include it in the standard name option_help * options; - airori_mod_opt_t * defaults; // these default values are taken from the command line + aiori_mod_opt_t * defaults; // these default values are taken from the command line } option_module; typedef struct{ From 8098c3740ad505f615e907a29b460108b4aad024 Mon Sep 17 00:00:00 2001 From: "Julian M. Kunkel" Date: Sun, 31 May 2020 12:11:00 +0100 Subject: [PATCH 44/52] Refactored fd into aiori_fd_t for type safety. --- src/aiori-DUMMY.c | 14 +++++++------- src/aiori-HDF5.c | 23 +++++++++++------------ src/aiori-MMAP.c | 28 ++++++++++++++-------------- src/aiori-MPIIO.c | 20 ++++++++++---------- src/aiori-POSIX.c | 27 ++++++++++++++------------- src/aiori.h | 20 ++++++++++++-------- src/ior.c | 8 ++++---- src/mdtest.c | 6 +++--- 8 files changed, 75 insertions(+), 71 deletions(-) diff --git a/src/aiori-DUMMY.c b/src/aiori-DUMMY.c index ce8933c..2e4feb5 100755 --- a/src/aiori-DUMMY.c +++ b/src/aiori-DUMMY.c @@ -48,7 +48,7 @@ static option_help * DUMMY_options(aiori_mod_opt_t ** init_backend_options, aior static int count_init = 0; -static void *DUMMY_Create(char *testFileName, int iorflags, aiori_mod_opt_t * options) +static aiori_fd_t *DUMMY_Create(char *testFileName, int iorflags, aiori_mod_opt_t * options) { if(count_init <= 0){ ERR("DUMMY missing initialization in create\n"); @@ -63,10 +63,10 @@ static void *DUMMY_Create(char *testFileName, int iorflags, aiori_mod_opt_t * op nanosleep( & wait, NULL); } } - return current++; + return (aiori_fd_t*) current++; } -static void *DUMMY_Open(char *testFileName, int flags, aiori_mod_opt_t * options) +static aiori_fd_t *DUMMY_Open(char *testFileName, int flags, aiori_mod_opt_t * options) { if(count_init <= 0){ ERR("DUMMY missing initialization in open\n"); @@ -74,10 +74,10 @@ static void *DUMMY_Open(char *testFileName, int flags, aiori_mod_opt_t * options if(verbose > 4){ fprintf(out_logfile, "DUMMY open: %s = %p\n", testFileName, current); } - return current++; + return (aiori_fd_t*) current++; } -static void DUMMY_Fsync(void *fd, aiori_mod_opt_t * options) +static void DUMMY_Fsync(aiori_fd_t *fd, aiori_mod_opt_t * options) { if(verbose > 4){ fprintf(out_logfile, "DUMMY fsync %p\n", fd); @@ -89,7 +89,7 @@ static void DUMMY_Sync(aiori_mod_opt_t * options) { } -static void DUMMY_Close(void *fd, aiori_mod_opt_t * options) +static void DUMMY_Close(aiori_fd_t *fd, aiori_mod_opt_t * options) { if(verbose > 4){ fprintf(out_logfile, "DUMMY close %p\n", fd); @@ -116,7 +116,7 @@ static IOR_offset_t DUMMY_GetFileSize(aiori_mod_opt_t * options, MPI_Comm testCo return 0; } -static IOR_offset_t DUMMY_Xfer(int access, void *file, IOR_size_t * buffer, IOR_offset_t length, aiori_mod_opt_t * options){ +static IOR_offset_t DUMMY_Xfer(int access, aiori_fd_t *file, IOR_size_t * buffer, IOR_offset_t length, aiori_mod_opt_t * options){ if(verbose > 4){ fprintf(out_logfile, "DUMMY xfer: %p\n", file); } diff --git a/src/aiori-HDF5.c b/src/aiori-HDF5.c index 203aa3f..6669902 100755 --- a/src/aiori-HDF5.c +++ b/src/aiori-HDF5.c @@ -83,14 +83,14 @@ static IOR_offset_t SeekOffset(void *, IOR_offset_t, aiori_mod_opt_t *); static void SetupDataSet(void *, aiori_mod_opt_t *); -static void *HDF5_Create(char *, int flags, aiori_mod_opt_t *); -static void *HDF5_Open(char *, int flags, aiori_mod_opt_t *); -static IOR_offset_t HDF5_Xfer(int, void *, IOR_size_t *, +static aiori_fd_t *HDF5_Create(char *, int flags, aiori_mod_opt_t *); +static aiori_fd_t *HDF5_Open(char *, int flags, aiori_mod_opt_t *); +static IOR_offset_t HDF5_Xfer(int, aiori_fd_t *, IOR_size_t *, IOR_offset_t, aiori_mod_opt_t *); -static void HDF5_Close(void *, aiori_mod_opt_t *); +static void HDF5_Close(aiori_fd_t *, aiori_mod_opt_t *); static void HDF5_Delete(char *, aiori_mod_opt_t *); static char* HDF5_GetVersion(); -static void HDF5_Fsync(void *, aiori_mod_opt_t *); +static void HDF5_Fsync(aiori_fd_t *, aiori_mod_opt_t *); static IOR_offset_t HDF5_GetFileSize(aiori_mod_opt_t *, MPI_Comm, char *); static int HDF5_Access(const char *, int, aiori_mod_opt_t *); static void HDF5_init_xfer_options(IOR_param_t * params); @@ -197,7 +197,7 @@ static int HDF5_check_params(aiori_mod_opt_t * options){ /* * Create and open a file through the HDF5 interface. */ -static void *HDF5_Create(char *testFileName, int flags, aiori_mod_opt_t * param) +static aiori_fd_t *HDF5_Create(char *testFileName, int flags, aiori_mod_opt_t * param) { return HDF5_Open(testFileName, flags, param); } @@ -205,7 +205,7 @@ static void *HDF5_Create(char *testFileName, int flags, aiori_mod_opt_t * param) /* * Open a file through the HDF5 interface. */ -static void *HDF5_Open(char *testFileName, int flags, aiori_mod_opt_t * param) +static aiori_fd_t *HDF5_Open(char *testFileName, int flags, aiori_mod_opt_t * param) { HDF5_options_t *o = (HDF5_options_t*) param; hid_t accessPropList, createPropList; @@ -410,13 +410,13 @@ static void *HDF5_Open(char *testFileName, int flags, aiori_mod_opt_t * param) if (mpiHints != MPI_INFO_NULL) MPI_Info_free(&mpiHints); - return (fd); + return (aiori_fd_t*)(fd); } /* * Write or read access to file using the HDF5 interface. */ -static IOR_offset_t HDF5_Xfer(int access, void *fd, IOR_size_t * buffer, +static IOR_offset_t HDF5_Xfer(int access, aiori_fd_t *fd, IOR_size_t * buffer, IOR_offset_t length, aiori_mod_opt_t * param) { static int firstReadCheck = FALSE, startNewDataSet; @@ -495,15 +495,14 @@ static IOR_offset_t HDF5_Xfer(int access, void *fd, IOR_size_t * buffer, /* * Perform fsync(). */ -static void HDF5_Fsync(void *fd, aiori_mod_opt_t * param) +static void HDF5_Fsync(aiori_fd_t *fd, aiori_mod_opt_t * param) { - ; } /* * Close a file through the HDF5 interface. */ -static void HDF5_Close(void *fd, aiori_mod_opt_t * param) +static void HDF5_Close(aiori_fd_t *fd, aiori_mod_opt_t * param) { if(ior_param->dryRun) return; diff --git a/src/aiori-MMAP.c b/src/aiori-MMAP.c index 5a920a7..3b8c203 100644 --- a/src/aiori-MMAP.c +++ b/src/aiori-MMAP.c @@ -26,12 +26,12 @@ #include "utilities.h" /**************************** P R O T O T Y P E S *****************************/ -static void *MMAP_Create(char *, int flags, aiori_mod_opt_t *); -static void *MMAP_Open(char *, int flags, aiori_mod_opt_t *); -static IOR_offset_t MMAP_Xfer(int, void *, IOR_size_t *, +static aiori_fd_t *MMAP_Create(char *, int flags, aiori_mod_opt_t *); +static aiori_fd_t *MMAP_Open(char *, int flags, aiori_mod_opt_t *); +static IOR_offset_t MMAP_Xfer(int, aiori_fd_t *, IOR_size_t *, IOR_offset_t, aiori_mod_opt_t *); -static void MMAP_Close(void *, aiori_mod_opt_t *); -static void MMAP_Fsync(void *, aiori_mod_opt_t *); +static void MMAP_Close(aiori_fd_t *, aiori_mod_opt_t *); +static void MMAP_Fsync(aiori_fd_t *, aiori_mod_opt_t *); static option_help * MMAP_options(aiori_mod_opt_t ** init_backend_options, aiori_mod_opt_t * init_values); static void MMAP_init_xfer_options(IOR_param_t * params); static int MMAP_check_params(aiori_mod_opt_t * options); @@ -130,32 +130,32 @@ static void ior_mmap_file(int *file, int mflags, void *param) /* * Creat and open a file through the POSIX interface, then setup mmap. */ -static void *MMAP_Create(char *testFileName, int flags, aiori_mod_opt_t * param) +static aiori_fd_t *MMAP_Create(char *testFileName, int flags, aiori_mod_opt_t * param) { int *fd; - fd = POSIX_Create(testFileName, flags, param); + fd = (int*) POSIX_Create(testFileName, flags, param); if (ftruncate(*fd, ior_param->expectedAggFileSize) != 0) ERR("ftruncate() failed"); ior_mmap_file(fd, flags, param); - return ((void *)fd); + return ((aiori_fd_t *)fd); } /* * Open a file through the POSIX interface and setup mmap. */ -static void *MMAP_Open(char *testFileName, int flags, aiori_mod_opt_t * param) +static aiori_fd_t *MMAP_Open(char *testFileName, int flags, aiori_mod_opt_t * param) { int *fd; - fd = POSIX_Open(testFileName, flags, param); + fd = (int*) POSIX_Open(testFileName, flags, param); ior_mmap_file(fd, flags, param); - return ((void *)fd); + return ((aiori_fd_t *)fd); } /* * Write or read access to file using mmap */ -static IOR_offset_t MMAP_Xfer(int access, void *file, IOR_size_t * buffer, +static IOR_offset_t MMAP_Xfer(int access, aiori_fd_t *file, IOR_size_t * buffer, IOR_offset_t length, aiori_mod_opt_t * param) { mmap_options_t *o = (mmap_options_t*) param; @@ -178,7 +178,7 @@ static IOR_offset_t MMAP_Xfer(int access, void *file, IOR_size_t * buffer, /* * Perform msync(). */ -static void MMAP_Fsync(void *fd, aiori_mod_opt_t * param) +static void MMAP_Fsync(aiori_fd_t *fd, aiori_mod_opt_t * param) { mmap_options_t *o = (mmap_options_t*) param; if (msync(o->mmap_ptr, ior_param->expectedAggFileSize, MS_SYNC) != 0) @@ -188,7 +188,7 @@ static void MMAP_Fsync(void *fd, aiori_mod_opt_t * param) /* * Close a file through the POSIX interface, after tear down the mmap. */ -static void MMAP_Close(void *fd, aiori_mod_opt_t * param) +static void MMAP_Close(aiori_fd_t *fd, aiori_mod_opt_t * param) { mmap_options_t *o = (mmap_options_t*) param; if (munmap(o->mmap_ptr, ior_param->expectedAggFileSize) != 0) diff --git a/src/aiori-MPIIO.c b/src/aiori-MPIIO.c index f366872..81ec0be 100755 --- a/src/aiori-MPIIO.c +++ b/src/aiori-MPIIO.c @@ -33,13 +33,13 @@ static IOR_offset_t SeekOffset(MPI_File, IOR_offset_t, aiori_mod_opt_t *); -static void *MPIIO_Create(char *, int iorflags, aiori_mod_opt_t *); -static void *MPIIO_Open(char *, int flags, aiori_mod_opt_t *); -static IOR_offset_t MPIIO_Xfer(int, void *, IOR_size_t *, +static aiori_fd_t *MPIIO_Create(char *, int iorflags, aiori_mod_opt_t *); +static aiori_fd_t *MPIIO_Open(char *, int flags, aiori_mod_opt_t *); +static IOR_offset_t MPIIO_Xfer(int, aiori_fd_t *, IOR_size_t *, IOR_offset_t, aiori_mod_opt_t *); -static void MPIIO_Close(void *, aiori_mod_opt_t *); +static void MPIIO_Close(aiori_fd_t *, aiori_mod_opt_t *); static char* MPIIO_GetVersion(); -static void MPIIO_Fsync(void *, aiori_mod_opt_t *); +static void MPIIO_Fsync(aiori_fd_t *, aiori_mod_opt_t *); static void MPIIO_init_xfer_options(IOR_param_t * params); static int MPIIO_check_params(aiori_mod_opt_t * options); @@ -172,7 +172,7 @@ int MPIIO_Access(const char *path, int mode, aiori_mod_opt_t *module_options) /* * Create and open a file through the MPIIO interface. */ -static void *MPIIO_Create(char *testFileName, int iorflags, aiori_mod_opt_t * module_options) +static aiori_fd_t *MPIIO_Create(char *testFileName, int iorflags, aiori_mod_opt_t * module_options) { return MPIIO_Open(testFileName, iorflags, module_options); } @@ -180,7 +180,7 @@ static void *MPIIO_Create(char *testFileName, int iorflags, aiori_mod_opt_t * mo /* * Open a file through the MPIIO interface. Setup file view. */ -static void *MPIIO_Open(char *testFileName, int flags, aiori_mod_opt_t * module_options) +static aiori_fd_t *MPIIO_Open(char *testFileName, int flags, aiori_mod_opt_t * module_options) { mpiio_options_t * param = (mpiio_options_t*) module_options; int fd_mode = (int)0, @@ -328,7 +328,7 @@ static void *MPIIO_Open(char *testFileName, int flags, aiori_mod_opt_t * module_ /* * Write or read access to file using the MPIIO interface. */ -static IOR_offset_t MPIIO_Xfer(int access, void * fdp, IOR_size_t * buffer, +static IOR_offset_t MPIIO_Xfer(int access, aiori_fd_t * fdp, IOR_size_t * buffer, IOR_offset_t length, aiori_mod_opt_t * module_options) { /* NOTE: The second arg is (void *) for reads, and (const void *) @@ -464,7 +464,7 @@ static IOR_offset_t MPIIO_Xfer(int access, void * fdp, IOR_size_t * buffer, /* * Perform fsync(). */ -static void MPIIO_Fsync(void *fdp, aiori_mod_opt_t * module_options) +static void MPIIO_Fsync(aiori_fd_t *fdp, aiori_mod_opt_t * module_options) { mpiio_options_t * param = (mpiio_options_t*) module_options; if(param->dry_run) @@ -477,7 +477,7 @@ static void MPIIO_Fsync(void *fdp, aiori_mod_opt_t * module_options) /* * Close a file through the MPIIO interface. */ -static void MPIIO_Close(void *fdp, aiori_mod_opt_t * module_options) +static void MPIIO_Close(aiori_fd_t *fdp, aiori_mod_opt_t * module_options) { mpiio_options_t * param = (mpiio_options_t*) module_options; mpiio_fd_t * mfd = (mpiio_fd_t*) fdp; diff --git a/src/aiori-POSIX.c b/src/aiori-POSIX.c index 4ecc557..43c5261 100755 --- a/src/aiori-POSIX.c +++ b/src/aiori-POSIX.c @@ -68,9 +68,9 @@ #endif /**************************** P R O T O T Y P E S *****************************/ -static IOR_offset_t POSIX_Xfer(int, void *, IOR_size_t *, +static IOR_offset_t POSIX_Xfer(int, aiori_fd_t *, IOR_size_t *, IOR_offset_t, aiori_mod_opt_t *); -static void POSIX_Fsync(void *, aiori_mod_opt_t *); +static void POSIX_Fsync(aiori_fd_t *, aiori_mod_opt_t *); static void POSIX_Sync(aiori_mod_opt_t * ); static int POSIX_check_params(aiori_mod_opt_t * options); @@ -372,7 +372,7 @@ bool beegfs_createFilePath(char* filepath, mode_t mode, int numTargets, int chun /* * Creat and open a file through the POSIX interface. */ -void *POSIX_Create(char *testFileName, int flags, aiori_mod_opt_t * param) +aiori_fd_t *POSIX_Create(char *testFileName, int flags, aiori_mod_opt_t * param) { int fd_oflag = O_BINARY; int mode = 0664; @@ -387,7 +387,7 @@ void *POSIX_Create(char *testFileName, int flags, aiori_mod_opt_t * param) } if(ior_param->dryRun) - return 0; + return (aiori_fd_t*) 0; #ifdef HAVE_LUSTRE_LUSTRE_USER_H /* Add a #define for FASYNC if not available, as it forms part of @@ -483,7 +483,7 @@ void *POSIX_Create(char *testFileName, int flags, aiori_mod_opt_t * param) gpfs_free_all_locks(*fd); } #endif - return ((void *)fd); + return (aiori_fd_t*) fd; } /* @@ -503,7 +503,7 @@ int POSIX_Mknod(char *testFileName) /* * Open a file through the POSIX interface. */ -void *POSIX_Open(char *testFileName, int flags, aiori_mod_opt_t * param) +aiori_fd_t *POSIX_Open(char *testFileName, int flags, aiori_mod_opt_t * param) { int fd_oflag = O_BINARY; int *fd; @@ -519,7 +519,7 @@ void *POSIX_Open(char *testFileName, int flags, aiori_mod_opt_t * param) fd_oflag |= O_RDWR; if(ior_param->dryRun) - return 0; + return (aiori_fd_t*) 0; *fd = open64(testFileName, fd_oflag); if (*fd < 0) @@ -542,13 +542,13 @@ void *POSIX_Open(char *testFileName, int flags, aiori_mod_opt_t * param) gpfs_free_all_locks(*fd); } #endif - return ((void *)fd); + return (aiori_fd_t*) fd; } /* * Write or read access to file using the POSIX interface. */ -static IOR_offset_t POSIX_Xfer(int access, void *file, IOR_size_t * buffer, +static IOR_offset_t POSIX_Xfer(int access, aiori_fd_t *file, IOR_size_t * buffer, IOR_offset_t length, aiori_mod_opt_t * param) { int xferRetries = 0; @@ -587,8 +587,9 @@ static IOR_offset_t POSIX_Xfer(int access, void *file, IOR_size_t * buffer, if (rc == -1) ERRF("write(%d, %p, %lld) failed", fd, (void*)ptr, remaining); - if (ior_param->fsyncPerWrite == TRUE) - POSIX_Fsync(&fd, param); + if (ior_param->fsyncPerWrite == TRUE){ + POSIX_Fsync((aiori_fd_t*) &fd, param); + } } else { /* READ or CHECK */ if (verbose >= VERBOSE_4) { fprintf(stdout, @@ -634,7 +635,7 @@ static IOR_offset_t POSIX_Xfer(int access, void *file, IOR_size_t * buffer, /* * Perform fsync(). */ -static void POSIX_Fsync(void *fd, aiori_mod_opt_t * param) +static void POSIX_Fsync(aiori_fd_t *fd, aiori_mod_opt_t * param) { if (fsync(*(int *)fd) != 0) EWARNF("fsync(%d) failed", *(int *)fd); @@ -653,7 +654,7 @@ static void POSIX_Sync(aiori_mod_opt_t * param) /* * Close a file through the POSIX interface. */ -void POSIX_Close(void *fd, aiori_mod_opt_t * param) +void POSIX_Close(aiori_fd_t *fd, aiori_mod_opt_t * param) { if(ior_param->dryRun) return; diff --git a/src/aiori.h b/src/aiori.h index 7662e8f..76d9f6a 100755 --- a/src/aiori.h +++ b/src/aiori.h @@ -72,22 +72,26 @@ typedef struct aiori_mod_opt_t{ void * dummy; } aiori_mod_opt_t; +typedef struct aiori_fd_t{ + void * dummy; +} aiori_fd_t; + typedef struct ior_aiori { char *name; char *name_legacy; - void *(*create)(char *, int iorflags, aiori_mod_opt_t *); + aiori_fd_t *(*create)(char *, int iorflags, aiori_mod_opt_t *); int (*mknod)(char *); - void *(*open)(char *, int iorflags, aiori_mod_opt_t *); + aiori_fd_t *(*open)(char *, int iorflags, aiori_mod_opt_t *); /* Allow to set generic transfer options that shall be applied to any subsequent IO call. */ void (*init_xfer_options)(IOR_param_t * params); - IOR_offset_t (*xfer)(int, void *, IOR_size_t *, + IOR_offset_t (*xfer)(int, aiori_fd_t *, IOR_size_t *, IOR_offset_t, aiori_mod_opt_t *); - void (*close)(void *, aiori_mod_opt_t *); + void (*close)(aiori_fd_t *, aiori_mod_opt_t *); void (*delete)(char *, aiori_mod_opt_t *); char* (*get_version)(void); - void (*fsync)(void *, aiori_mod_opt_t *); + void (*fsync)(aiori_fd_t *, aiori_mod_opt_t *); IOR_offset_t (*get_file_size)(aiori_mod_opt_t * module_options, MPI_Comm, char *); int (*statfs) (const char *, ior_aiori_statfs_t *, aiori_mod_opt_t * module_options); int (*mkdir) (const char *path, mode_t mode, aiori_mod_opt_t * module_options); @@ -142,12 +146,12 @@ int aiori_posix_access (const char *path, int mode, aiori_mod_opt_t * module_opt int aiori_posix_stat (const char *path, struct stat *buf, aiori_mod_opt_t * module_options); void aiori_posix_init_xfer_options(IOR_param_t * params); -void *POSIX_Create(char *testFileName, int flags, aiori_mod_opt_t * module_options); +aiori_fd_t *POSIX_Create(char *testFileName, int flags, aiori_mod_opt_t * module_options); int POSIX_Mknod(char *testFileName); -void *POSIX_Open(char *testFileName, int flags, aiori_mod_opt_t * module_options); +aiori_fd_t *POSIX_Open(char *testFileName, int flags, aiori_mod_opt_t * module_options); IOR_offset_t POSIX_GetFileSize(aiori_mod_opt_t * test, MPI_Comm testComm, char *testFileName); void POSIX_Delete(char *testFileName, aiori_mod_opt_t * module_options); -void POSIX_Close(void *fd, aiori_mod_opt_t * module_options); +void POSIX_Close(aiori_fd_t *fd, aiori_mod_opt_t * module_options); option_help * POSIX_options(aiori_mod_opt_t ** init_backend_options, aiori_mod_opt_t * init_values); diff --git a/src/ior.c b/src/ior.c index 3323b7f..7dbf80b 100755 --- a/src/ior.c +++ b/src/ior.c @@ -55,7 +55,7 @@ static void InitTests(IOR_test_t * , MPI_Comm); static void TestIoSys(IOR_test_t *); static void ValidateTests(IOR_param_t *); static IOR_offset_t WriteOrRead(IOR_param_t *test, IOR_results_t *results, - void *fd, const int access, + aiori_fd_t *fd, const int access, IOR_io_buffers *ioBuffers); static void test_initialize(IOR_test_t * test){ @@ -1231,7 +1231,7 @@ static void TestIoSys(IOR_test_t *test) double startTime; int pretendRank; int rep; - void *fd; + aiori_fd_t *fd; MPI_Group orig_group, new_group; int range[3]; IOR_offset_t dataMoved; /* for data rate calculation */ @@ -1781,7 +1781,7 @@ IOR_offset_t *GetOffsetArrayRandom(IOR_param_t * test, int pretendRank, int acce } static IOR_offset_t WriteOrReadSingle(IOR_offset_t pairCnt, IOR_offset_t *offsetArray, int pretendRank, - IOR_offset_t * transferCount, int * errors, IOR_param_t * test, int * fd, IOR_io_buffers* ioBuffers, int access){ + IOR_offset_t * transferCount, int * errors, IOR_param_t * test, aiori_fd_t * fd, IOR_io_buffers* ioBuffers, int access){ IOR_offset_t amtXferred = 0; IOR_offset_t transfer; @@ -1850,7 +1850,7 @@ static IOR_offset_t WriteOrReadSingle(IOR_offset_t pairCnt, IOR_offset_t *offset * out the data to each block in transfer sizes, until the remainder left is 0. */ static IOR_offset_t WriteOrRead(IOR_param_t *test, IOR_results_t *results, - void *fd, const int access, IOR_io_buffers *ioBuffers) + aiori_fd_t *fd, const int access, IOR_io_buffers *ioBuffers) { int errors = 0; IOR_offset_t transferCount = 0; diff --git a/src/mdtest.c b/src/mdtest.c index b81b143..3e102de 100644 --- a/src/mdtest.c +++ b/src/mdtest.c @@ -346,7 +346,7 @@ static void remove_file (const char *path, uint64_t itemNum) { static void create_file (const char *path, uint64_t itemNum) { char curr_item[MAX_PATHLEN]; - void *aiori_fh = NULL; + aiori_fd_t *aiori_fh = NULL; if ( (itemNum % ITEM_COUNT==0 && (itemNum != 0))) { VERBOSE(3,5,"create file: "LLU"", itemNum); @@ -443,7 +443,7 @@ void collective_helper(const int dirs, const int create, const char* path, uint6 VERBOSE(3,5,"create file: %s", curr_item); if (create) { - void *aiori_fh; + aiori_fd_t *aiori_fh; //create files aiori_fh = backend->create (curr_item, IOR_WRONLY | IOR_CREAT, backend_options); @@ -622,7 +622,7 @@ void mdtest_stat(const int random, const int dirs, const long dir_iter, const ch void mdtest_read(int random, int dirs, const long dir_iter, char *path) { uint64_t parent_dir, item_num = 0; char item[MAX_PATHLEN], temp[MAX_PATHLEN]; - void *aiori_fh; + aiori_fd_t *aiori_fh; VERBOSE(1,-1,"Entering mdtest_read on %s", path ); From 5663593919f154a5705213c5dcad67dbec467a41 Mon Sep 17 00:00:00 2001 From: "Julian M. Kunkel" Date: Sun, 31 May 2020 12:50:03 +0100 Subject: [PATCH 45/52] Moved generic IOR information to "hint" structure. Backends should only use the "hints" if set. --- src/aiori-HDF5.c | 78 ++++++++++++++++++------------------ src/aiori-MMAP.c | 34 ++++++++-------- src/aiori-MPIIO.c | 100 +++++++++++++++++++++++----------------------- src/aiori-POSIX.c | 46 ++++++++++----------- src/aiori.h | 22 ++++++++-- src/ior.c | 30 +++++++++++--- src/ior.h | 5 ++- src/mdtest.c | 26 ++++++------ 8 files changed, 186 insertions(+), 155 deletions(-) diff --git a/src/aiori-HDF5.c b/src/aiori-HDF5.c index 6669902..cc32cbe 100755 --- a/src/aiori-HDF5.c +++ b/src/aiori-HDF5.c @@ -82,7 +82,7 @@ /**************************** P R O T O T Y P E S *****************************/ static IOR_offset_t SeekOffset(void *, IOR_offset_t, aiori_mod_opt_t *); -static void SetupDataSet(void *, aiori_mod_opt_t *); +static void SetupDataSet(void *, int flags, aiori_mod_opt_t *); static aiori_fd_t *HDF5_Create(char *, int flags, aiori_mod_opt_t *); static aiori_fd_t *HDF5_Open(char *, int flags, aiori_mod_opt_t *); static IOR_offset_t HDF5_Xfer(int, aiori_fd_t *, IOR_size_t *, @@ -93,7 +93,7 @@ static char* HDF5_GetVersion(); static void HDF5_Fsync(aiori_fd_t *, aiori_mod_opt_t *); static IOR_offset_t HDF5_GetFileSize(aiori_mod_opt_t *, MPI_Comm, char *); static int HDF5_Access(const char *, int, aiori_mod_opt_t *); -static void HDF5_init_xfer_options(IOR_param_t * params); +static void HDF5_init_xfer_options(aiori_xfer_hint_t * params); static int HDF5_check_params(aiori_mod_opt_t * options); /************************** O P T I O N S *****************************/ @@ -147,7 +147,7 @@ ior_aiori_t hdf5_aiori = { .close = HDF5_Close, .delete = HDF5_Delete, .get_version = HDF5_GetVersion, - .init_xfer_options = HDF5_init_xfer_options, + .xfer_hints = HDF5_init_xfer_options, .fsync = HDF5_Fsync, .get_file_size = HDF5_GetFileSize, .statfs = aiori_posix_statfs, @@ -167,10 +167,10 @@ hid_t memDataSpace; /* memory data space id */ int newlyOpenedFile; /* newly opened file */ /***************************** F U N C T I O N S ******************************/ -static IOR_param_t * ior_param = NULL; +static aiori_xfer_hint_t * hints = NULL; -static void HDF5_init_xfer_options(IOR_param_t * params){ - ior_param = params; +static void HDF5_init_xfer_options(aiori_xfer_hint_t * params){ + hints = params; } static int HDF5_check_params(aiori_mod_opt_t * options){ @@ -265,7 +265,7 @@ static aiori_fd_t *HDF5_Open(char *testFileName, int flags, aiori_mod_opt_t * pa * someday HDF5 implementation will allow subsets of MPI_COMM_WORLD */ /* store MPI communicator info for the file access property list */ - if (ior_param->filePerProc) { + if (hints->filePerProc) { comm = MPI_COMM_SELF; } else { comm = testComm; @@ -304,8 +304,8 @@ static aiori_fd_t *HDF5_Open(char *testFileName, int flags, aiori_mod_opt_t * pa #endif /* open file */ - if(! ior_param->dryRun){ - if (ior_param->open == WRITE) { /* WRITE */ + if(! hints->dryRun){ + if (flags & IOR_CREAT) { /* WRITE */ *fd = H5Fcreate(testFileName, H5F_ACC_TRUNC, createPropList, accessPropList); HDF5_CHECK(*fd, "cannot create file"); } else { /* READ or CHECK */ @@ -365,7 +365,7 @@ static aiori_fd_t *HDF5_Open(char *testFileName, int flags, aiori_mod_opt_t * pa HDF5_CHECK(xferPropList, "cannot create transfer property list"); /* set data transfer mode */ - if (ior_param->collective) { + if (hints->collective) { HDF5_CHECK(H5Pset_dxpl_mpio(xferPropList, H5FD_MPIO_COLLECTIVE), "cannot set collective data transfer mode"); } else { @@ -377,9 +377,9 @@ static aiori_fd_t *HDF5_Open(char *testFileName, int flags, aiori_mod_opt_t * pa /* set up memory data space for transfer */ memStart[0] = (hsize_t) 0; memCount[0] = (hsize_t) 1; - memStride[0] = (hsize_t) (ior_param->transferSize / sizeof(IOR_size_t)); - memBlock[0] = (hsize_t) (ior_param->transferSize / sizeof(IOR_size_t)); - memDataSpaceDims[0] = (hsize_t) ior_param->transferSize; + memStride[0] = (hsize_t) (hints->transferSize / sizeof(IOR_size_t)); + memBlock[0] = (hsize_t) (hints->transferSize / sizeof(IOR_size_t)); + memDataSpaceDims[0] = (hsize_t) hints->transferSize; memDataSpace = H5Screate_simple(NUM_DIMS, memDataSpaceDims, NULL); HDF5_CHECK(memDataSpace, "cannot create simple memory data space"); @@ -389,7 +389,7 @@ static aiori_fd_t *HDF5_Open(char *testFileName, int flags, aiori_mod_opt_t * pa memBlock), "cannot create hyperslab"); /* set up parameters for fpp or different dataset count */ - if (ior_param->filePerProc) { + if (hints->filePerProc) { tasksPerDataSet = 1; } else { if (o->individualDataSets) { @@ -397,10 +397,10 @@ static aiori_fd_t *HDF5_Open(char *testFileName, int flags, aiori_mod_opt_t * pa tasksPerDataSet = 1; } else { /* share single data set across all tasks in segment */ - tasksPerDataSet = ior_param->numTasks; + tasksPerDataSet = hints->numTasks; } } - dataSetDims[0] = (hsize_t) ((ior_param->blockSize / sizeof(IOR_size_t)) + dataSetDims[0] = (hsize_t) ((hints->blockSize / sizeof(IOR_size_t)) * tasksPerDataSet); /* create a simple data space containing information on size @@ -436,16 +436,16 @@ static IOR_offset_t HDF5_Xfer(int access, aiori_fd_t *fd, IOR_size_t * buffer, } /* determine by offset if need to start new data set */ - if (ior_param->filePerProc == TRUE) { + if (hints->filePerProc == TRUE) { segmentPosition = (IOR_offset_t) 0; - segmentSize = ior_param->blockSize; + segmentSize = hints->blockSize; } else { segmentPosition = - (IOR_offset_t) ((rank + rankOffset) % ior_param->numTasks) - * ior_param->blockSize; - segmentSize = (IOR_offset_t) (ior_param->numTasks) * ior_param->blockSize; + (IOR_offset_t) ((rank + rankOffset) % hints->numTasks) + * hints->blockSize; + segmentSize = (IOR_offset_t) (hints->numTasks) * hints->blockSize; } - if ((IOR_offset_t) ((ior_param->offset - segmentPosition) % segmentSize) == + if ((IOR_offset_t) ((hints->offset - segmentPosition) % segmentSize) == 0) { /* * ordinarily start a new data set, unless this is the @@ -457,7 +457,7 @@ static IOR_offset_t HDF5_Xfer(int access, aiori_fd_t *fd, IOR_size_t * buffer, } } - if(ior_param->dryRun) + if(hints->dryRun) return length; /* create new data set */ @@ -468,10 +468,10 @@ static IOR_offset_t HDF5_Xfer(int access, aiori_fd_t *fd, IOR_size_t * buffer, HDF5_CHECK(H5Sclose(fileDataSpace), "cannot close file data space"); } - SetupDataSet(fd, param); + SetupDataSet(fd, access == WRITE ? IOR_CREAT : IOR_RDWR, param); } - SeekOffset(fd, ior_param->offset, param); + SeekOffset(fd, hints->offset, param); /* this is necessary to reset variables for reaccessing file */ startNewDataSet = FALSE; @@ -504,9 +504,9 @@ static void HDF5_Fsync(aiori_fd_t *fd, aiori_mod_opt_t * param) */ static void HDF5_Close(aiori_fd_t *fd, aiori_mod_opt_t * param) { - if(ior_param->dryRun) + if(hints->dryRun) return; - //if (ior_param->fd_fppReadCheck == NULL) { + //if (hints->fd_fppReadCheck == NULL) { HDF5_CHECK(H5Dclose(dataSet), "cannot close data set"); HDF5_CHECK(H5Sclose(dataSpace), "cannot close data space"); HDF5_CHECK(H5Sclose(fileDataSpace), @@ -525,7 +525,7 @@ static void HDF5_Close(aiori_fd_t *fd, aiori_mod_opt_t * param) */ static void HDF5_Delete(char *testFileName, aiori_mod_opt_t * param) { - if(ior_param->dryRun) + if(hints->dryRun) return MPIIO_Delete(testFileName, param); return; @@ -564,17 +564,17 @@ static IOR_offset_t SeekOffset(void *fd, IOR_offset_t offset, hsize_t hsStride[NUM_DIMS], hsCount[NUM_DIMS], hsBlock[NUM_DIMS]; hsize_t hsStart[NUM_DIMS]; - if (ior_param->filePerProc == TRUE) { - segmentSize = (IOR_offset_t) ior_param->blockSize; + if (hints->filePerProc == TRUE) { + segmentSize = (IOR_offset_t) hints->blockSize; } else { segmentSize = - (IOR_offset_t) (ior_param->numTasks) * ior_param->blockSize; + (IOR_offset_t) (hints->numTasks) * hints->blockSize; } /* create a hyperslab representing the file data space */ if (o->individualDataSets) { /* start at zero offset if not */ - hsStart[0] = (hsize_t) ((offset % ior_param->blockSize) + hsStart[0] = (hsize_t) ((offset % hints->blockSize) / sizeof(IOR_size_t)); } else { /* start at a unique offset if shared */ @@ -582,8 +582,8 @@ static IOR_offset_t SeekOffset(void *fd, IOR_offset_t offset, (hsize_t) ((offset % segmentSize) / sizeof(IOR_size_t)); } hsCount[0] = (hsize_t) 1; - hsStride[0] = (hsize_t) (ior_param->transferSize / sizeof(IOR_size_t)); - hsBlock[0] = (hsize_t) (ior_param->transferSize / sizeof(IOR_size_t)); + hsStride[0] = (hsize_t) (hints->transferSize / sizeof(IOR_size_t)); + hsBlock[0] = (hsize_t) (hints->transferSize / sizeof(IOR_size_t)); /* retrieve data space from data set for hyperslab */ fileDataSpace = H5Dget_space(dataSet); @@ -597,7 +597,7 @@ static IOR_offset_t SeekOffset(void *fd, IOR_offset_t offset, /* * Create HDF5 data set. */ -static void SetupDataSet(void *fd, aiori_mod_opt_t * param) +static void SetupDataSet(void *fd, int flags, aiori_mod_opt_t * param) { HDF5_options_t *o = (HDF5_options_t*) param; char dataSetName[MAX_STR]; @@ -614,7 +614,7 @@ static void SetupDataSet(void *fd, aiori_mod_opt_t * param) /* may want to use individual access to each data set someday */ if (o->individualDataSets) { - dataSetID = (rank + rankOffset) % ior_param->numTasks; + dataSetID = (rank + rankOffset) % hints->numTasks; } else { dataSetID = 0; } @@ -622,7 +622,7 @@ static void SetupDataSet(void *fd, aiori_mod_opt_t * param) sprintf(dataSetName, "%s-%04d.%04d", "Dataset", dataSetID, dataSetSuffix++); - if (ior_param->open == WRITE) { /* WRITE */ + if (flags & IOR_CREAT) { /* WRITE */ /* create data set */ dataSetPropList = H5Pcreate(H5P_DATASET_CREATE); /* check if hdf5 available */ @@ -662,7 +662,7 @@ static void SetupDataSet(void *fd, aiori_mod_opt_t * param) static IOR_offset_t HDF5_GetFileSize(aiori_mod_opt_t * test, MPI_Comm testComm, char *testFileName) { - if(ior_param->dryRun) + if(hints->dryRun) return 0; return(MPIIO_GetFileSize(test, testComm, testFileName)); } @@ -672,7 +672,7 @@ HDF5_GetFileSize(aiori_mod_opt_t * test, MPI_Comm testComm, char *testFileName) */ static int HDF5_Access(const char *path, int mode, aiori_mod_opt_t *param) { - if(ior_param->dryRun) + if(hints->dryRun) return 0; return(MPIIO_Access(path, mode, param)); } diff --git a/src/aiori-MMAP.c b/src/aiori-MMAP.c index 3b8c203..453bc3a 100644 --- a/src/aiori-MMAP.c +++ b/src/aiori-MMAP.c @@ -33,7 +33,7 @@ static IOR_offset_t MMAP_Xfer(int, aiori_fd_t *, IOR_size_t *, static void MMAP_Close(aiori_fd_t *, aiori_mod_opt_t *); static void MMAP_Fsync(aiori_fd_t *, aiori_mod_opt_t *); static option_help * MMAP_options(aiori_mod_opt_t ** init_backend_options, aiori_mod_opt_t * init_values); -static void MMAP_init_xfer_options(IOR_param_t * params); +static void MMAP_xfer_hints(aiori_xfer_hint_t * params); static int MMAP_check_params(aiori_mod_opt_t * options); /************************** D E C L A R A T I O N S ***************************/ @@ -44,7 +44,7 @@ ior_aiori_t mmap_aiori = { .xfer = MMAP_Xfer, .close = MMAP_Close, .delete = POSIX_Delete, - .init_xfer_options = MMAP_init_xfer_options, + .xfer_hints = MMAP_xfer_hints, .get_version = aiori_get_version, .fsync = MMAP_Fsync, .get_file_size = POSIX_GetFileSize, @@ -82,15 +82,15 @@ static option_help * MMAP_options(aiori_mod_opt_t ** init_backend_options, aiori return help; } -static IOR_param_t * ior_param = NULL; +static aiori_xfer_hint_t * hints = NULL; -static void MMAP_init_xfer_options(IOR_param_t * params){ - ior_param = params; - aiori_posix_init_xfer_options(params); +static void MMAP_xfer_hints(aiori_xfer_hint_t * params){ + hints = params; + aiori_posix_xfer_hints(params); } static int MMAP_check_params(aiori_mod_opt_t * options){ - if (ior_param->fsyncPerWrite && (ior_param->transferSize & (sysconf(_SC_PAGESIZE) - 1))) + if (hints->fsyncPerWrite && (hints->transferSize & (sysconf(_SC_PAGESIZE) - 1))) ERR("transfer size must be aligned with PAGESIZE for MMAP with fsyncPerWrite"); return 0; } @@ -98,7 +98,7 @@ static int MMAP_check_params(aiori_mod_opt_t * options){ static void ior_mmap_file(int *file, int mflags, void *param) { int flags = PROT_READ; - IOR_offset_t size = ior_param->expectedAggFileSize; + IOR_offset_t size = hints->expectedAggFileSize; if (mflags & IOR_WRONLY || mflags & IOR_RDWR) flags |= PROT_WRITE; @@ -109,7 +109,7 @@ static void ior_mmap_file(int *file, int mflags, void *param) if (o->mmap_ptr == MAP_FAILED) ERR("mmap() failed"); - if (ior_param->randomOffset) + if (hints->randomOffset) flags = POSIX_MADV_RANDOM; else flags = POSIX_MADV_SEQUENTIAL; @@ -135,7 +135,7 @@ static aiori_fd_t *MMAP_Create(char *testFileName, int flags, aiori_mod_opt_t * int *fd; fd = (int*) POSIX_Create(testFileName, flags, param); - if (ftruncate(*fd, ior_param->expectedAggFileSize) != 0) + if (ftruncate(*fd, hints->expectedAggFileSize) != 0) ERR("ftruncate() failed"); ior_mmap_file(fd, flags, param); return ((aiori_fd_t *)fd); @@ -160,15 +160,15 @@ static IOR_offset_t MMAP_Xfer(int access, aiori_fd_t *file, IOR_size_t * buffer, { mmap_options_t *o = (mmap_options_t*) param; if (access == WRITE) { - memcpy(o->mmap_ptr + ior_param->offset, buffer, length); + memcpy(o->mmap_ptr + hints->offset, buffer, length); } else { - memcpy(buffer, o->mmap_ptr + ior_param->offset, length); + memcpy(buffer, o->mmap_ptr + hints->offset, length); } - if (ior_param->fsyncPerWrite == TRUE) { - if (msync(o->mmap_ptr + ior_param->offset, length, MS_SYNC) != 0) + if (hints->fsyncPerWrite == TRUE) { + if (msync(o->mmap_ptr + hints->offset, length, MS_SYNC) != 0) ERR("msync() failed"); - if (posix_madvise(o->mmap_ptr + ior_param->offset, length, + if (posix_madvise(o->mmap_ptr + hints->offset, length, POSIX_MADV_DONTNEED) != 0) ERR("madvise() failed"); } @@ -181,7 +181,7 @@ static IOR_offset_t MMAP_Xfer(int access, aiori_fd_t *file, IOR_size_t * buffer, static void MMAP_Fsync(aiori_fd_t *fd, aiori_mod_opt_t * param) { mmap_options_t *o = (mmap_options_t*) param; - if (msync(o->mmap_ptr, ior_param->expectedAggFileSize, MS_SYNC) != 0) + if (msync(o->mmap_ptr, hints->expectedAggFileSize, MS_SYNC) != 0) EWARN("msync() failed"); } @@ -191,7 +191,7 @@ static void MMAP_Fsync(aiori_fd_t *fd, aiori_mod_opt_t * param) static void MMAP_Close(aiori_fd_t *fd, aiori_mod_opt_t * param) { mmap_options_t *o = (mmap_options_t*) param; - if (munmap(o->mmap_ptr, ior_param->expectedAggFileSize) != 0) + if (munmap(o->mmap_ptr, hints->expectedAggFileSize) != 0) ERR("munmap failed"); o->mmap_ptr = NULL; POSIX_Close(fd, param); diff --git a/src/aiori-MPIIO.c b/src/aiori-MPIIO.c index 81ec0be..bc1b8b4 100755 --- a/src/aiori-MPIIO.c +++ b/src/aiori-MPIIO.c @@ -40,7 +40,7 @@ static IOR_offset_t MPIIO_Xfer(int, aiori_fd_t *, IOR_size_t *, static void MPIIO_Close(aiori_fd_t *, aiori_mod_opt_t *); static char* MPIIO_GetVersion(); static void MPIIO_Fsync(aiori_fd_t *, aiori_mod_opt_t *); -static void MPIIO_init_xfer_options(IOR_param_t * params); +static void MPIIO_xfer_hints(aiori_xfer_hint_t * params); static int MPIIO_check_params(aiori_mod_opt_t * options); /************************** D E C L A R A T I O N S ***************************/ @@ -52,7 +52,6 @@ typedef struct{ } mpiio_fd_t; typedef struct { - int dry_run; int showHints; /* show hints */ int useFileView; /* use MPI_File_set_view */ int preallocate; /* preallocate file size */ @@ -71,7 +70,6 @@ static option_help * MPIIO_options(aiori_mod_opt_t ** init_backend_options, aior *init_backend_options = (aiori_mod_opt_t*) o; option_help h [] = { - {0, "mpiio.dryRun", "Dry run, disable actual IO", OPTION_FLAG, 'd', & o->dry_run}, {0, "mpiio.hintsFileName","Full name for hints file", OPTION_OPTIONAL_ARGUMENT, 's', & o->hintsFileName}, {0, "mpiio.showHints", "Show MPI hints", OPTION_FLAG, 'd', & o->showHints}, {0, "mpiio.preallocate", "Preallocate file size", OPTION_FLAG, 'd', & o->preallocate}, @@ -91,7 +89,7 @@ ior_aiori_t mpiio_aiori = { .name_legacy = NULL, .create = MPIIO_Create, .get_options = MPIIO_options, - .init_xfer_options = MPIIO_init_xfer_options, + .xfer_hints = MPIIO_xfer_hints, .open = MPIIO_Open, .xfer = MPIIO_Xfer, .close = MPIIO_Close, @@ -108,30 +106,30 @@ ior_aiori_t mpiio_aiori = { }; /***************************** F U N C T I O N S ******************************/ -static IOR_param_t * ior_param = NULL; +static aiori_xfer_hint_t * hints = NULL; -static void MPIIO_init_xfer_options(IOR_param_t * params){ - ior_param = params; +static void MPIIO_xfer_hints(aiori_xfer_hint_t * params){ + hints = params; } static int MPIIO_check_params(aiori_mod_opt_t * module_options){ mpiio_options_t * param = (mpiio_options_t*) module_options; if ((param->useFileView == TRUE) && (sizeof(MPI_Aint) < 8) /* used for 64-bit datatypes */ - &&((ior_param->numTasks * ior_param->blockSize) > + &&((hints->numTasks * hints->blockSize) > (2 * (IOR_offset_t) GIBIBYTE))) ERR("segment size must be < 2GiB"); if (param->useSharedFilePointer) ERR("shared file pointer not implemented"); if (param->useStridedDatatype) ERR("strided datatype not implemented"); - if (param->useStridedDatatype && (ior_param->blockSize < sizeof(IOR_size_t) - || ior_param->transferSize < + if (param->useStridedDatatype && (hints->blockSize < sizeof(IOR_size_t) + || hints->transferSize < sizeof(IOR_size_t))) ERR("need larger file size for strided datatype in MPIIO"); - if (ior_param->randomOffset && ior_param->collective) + if (hints->randomOffset && hints->collective) ERR("random offset not available with collective MPIIO"); - if (ior_param->randomOffset && param->useFileView) + if (hints->randomOffset && param->useFileView) ERR("random offset not available with MPIIO fileviews"); return 0; @@ -143,7 +141,7 @@ static int MPIIO_check_params(aiori_mod_opt_t * module_options){ int MPIIO_Access(const char *path, int mode, aiori_mod_opt_t *module_options) { mpiio_options_t * param = (mpiio_options_t*) module_options; - if(param->dry_run){ + if(hints->dryRun){ return MPI_SUCCESS; } MPI_File fd; @@ -186,7 +184,7 @@ static aiori_fd_t *MPIIO_Open(char *testFileName, int flags, aiori_mod_opt_t * m int fd_mode = (int)0, offsetFactor, tasksPerFile, - transfersPerBlock = ior_param->blockSize / ior_param->transferSize; + transfersPerBlock = hints->blockSize / hints->transferSize; struct fileTypeStruct { int globalSizes[2], localSizes[2], startIndices[2]; } fileTypeStruct; @@ -227,7 +225,7 @@ static aiori_fd_t *MPIIO_Open(char *testFileName, int flags, aiori_mod_opt_t * m */ fd_mode |= MPI_MODE_UNIQUE_OPEN; - if (ior_param->filePerProc) { + if (hints->filePerProc) { comm = MPI_COMM_SELF; } else { comm = testComm; @@ -246,7 +244,7 @@ static aiori_fd_t *MPIIO_Open(char *testFileName, int flags, aiori_mod_opt_t * m ShowHints(&mpiHints); fprintf(stdout, "}\n"); } - if(! param->dry_run){ + if(! hints->dryRun){ MPI_CHECKF(MPI_File_open(comm, testFileName, fd_mode, mpiHints, & mfd->fd), "cannot open file: %s", testFileName); if (flags & IOR_TRUNC) { @@ -255,7 +253,7 @@ static aiori_fd_t *MPIIO_Open(char *testFileName, int flags, aiori_mod_opt_t * m } /* show hints actually attached to file handle */ - if (rank == 0 && param->showHints && ! param->dry_run) { + if (rank == 0 && param->showHints && ! hints->dryRun) { if (mpiHints != MPI_INFO_NULL) MPI_CHECK(MPI_Info_free(&mpiHints), "MPI_Info_free failed"); MPI_CHECK(MPI_File_get_info(mfd->fd, &mpiHints), @@ -266,29 +264,29 @@ static aiori_fd_t *MPIIO_Open(char *testFileName, int flags, aiori_mod_opt_t * m } /* preallocate space for file */ - if (param->preallocate && ior_param->open == WRITE && ! param->dry_run) { + if (param->preallocate && flags & IOR_CREAT && ! hints->dryRun) { MPI_CHECK(MPI_File_preallocate(mfd->fd, - (MPI_Offset) (ior_param->segmentCount + (MPI_Offset) (hints->segmentCount * - ior_param->blockSize * - ior_param->numTasks)), + hints->blockSize * + hints->numTasks)), "cannot preallocate file"); } /* create file view */ if (param->useFileView) { /* create contiguous transfer datatype */ MPI_CHECK(MPI_Type_contiguous - (ior_param->transferSize / sizeof(IOR_size_t), + (hints->transferSize / sizeof(IOR_size_t), MPI_LONG_LONG_INT, & mfd->transferType), "cannot create contiguous datatype"); MPI_CHECK(MPI_Type_commit(& mfd->transferType), "cannot commit datatype"); - if (ior_param->filePerProc) { + if (hints->filePerProc) { offsetFactor = 0; tasksPerFile = 1; } else { - offsetFactor = (rank + rankOffset) % ior_param->numTasks; - tasksPerFile = ior_param->numTasks; + offsetFactor = (rank + rankOffset) % hints->numTasks; + tasksPerFile = hints->numTasks; } /* @@ -312,7 +310,7 @@ static aiori_fd_t *MPIIO_Open(char *testFileName, int flags, aiori_mod_opt_t * m MPI_CHECK(MPI_Type_commit(& mfd->fileType), "cannot commit datatype"); - if(! param->dry_run){ + if(! hints->dryRun){ MPI_CHECK(MPI_File_set_view(mfd->fd, (MPI_Offset) 0, mfd->transferType, mfd->fileType, "native", @@ -336,7 +334,7 @@ static IOR_offset_t MPIIO_Xfer(int access, aiori_fd_t * fdp, IOR_size_t * buffer will get "assignment from incompatible pointer-type" warnings, if we only use this one set of signatures. */ mpiio_options_t * param = (mpiio_options_t*) module_options; - if(param->dry_run) + if(hints->dryRun) return length; mpiio_fd_t * mfd = (mpiio_fd_t*) fdp; @@ -388,7 +386,7 @@ static IOR_offset_t MPIIO_Xfer(int access, aiori_fd_t * fdp, IOR_size_t * buffer */ if (param->useFileView) { /* find offset in file */ - if (SeekOffset(mfd->fd, ior_param->offset, module_options) < + if (SeekOffset(mfd->fd, hints->offset, module_options) < 0) { /* if unsuccessful */ length = -1; @@ -400,11 +398,11 @@ static IOR_offset_t MPIIO_Xfer(int access, aiori_fd_t * fdp, IOR_size_t * buffer * e.g., 'IOR -s 2 -b 32K -t 32K -a MPIIO -S' */ if (param->useStridedDatatype) { - length = ior_param->segmentCount; + length = hints->segmentCount; } else { length = 1; } - if (ior_param->collective) { + if (hints->collective) { /* individual, collective call */ MPI_CHECK(Access_all (mfd->fd, buffer, length, @@ -417,7 +415,7 @@ static IOR_offset_t MPIIO_Xfer(int access, aiori_fd_t * fdp, IOR_size_t * buffer mfd->transferType, &status), "cannot access noncollective"); } - length *= ior_param->transferSize; /* for return value in bytes */ + length *= hints->transferSize; /* for return value in bytes */ } } else { /* @@ -427,7 +425,7 @@ static IOR_offset_t MPIIO_Xfer(int access, aiori_fd_t * fdp, IOR_size_t * buffer if (param->useSharedFilePointer) { /* find offset in file */ if (SeekOffset - (mfd->fd, ior_param->offset, module_options) < 0) { + (mfd->fd, hints->offset, module_options) < 0) { /* if unsuccessful */ length = -1; } else { @@ -443,16 +441,16 @@ static IOR_offset_t MPIIO_Xfer(int access, aiori_fd_t * fdp, IOR_size_t * buffer "useSharedFilePointer not implemented\n"); } } else { - if (ior_param->collective) { + if (hints->collective) { /* explicit, collective call */ MPI_CHECK(Access_at_all - (mfd->fd, ior_param->offset, + (mfd->fd, hints->offset, buffer, length, MPI_BYTE, &status), "cannot access explicit, collective"); } else { /* explicit, noncollective call */ MPI_CHECK(Access_at - (mfd->fd, ior_param->offset, + (mfd->fd, hints->offset, buffer, length, MPI_BYTE, &status), "cannot access explicit, noncollective"); } @@ -467,7 +465,7 @@ static IOR_offset_t MPIIO_Xfer(int access, aiori_fd_t * fdp, IOR_size_t * buffer static void MPIIO_Fsync(aiori_fd_t *fdp, aiori_mod_opt_t * module_options) { mpiio_options_t * param = (mpiio_options_t*) module_options; - if(param->dry_run) + if(hints->dryRun) return; mpiio_fd_t * mfd = (mpiio_fd_t*) fdp; if (MPI_File_sync(mfd->fd) != MPI_SUCCESS) @@ -481,7 +479,7 @@ static void MPIIO_Close(aiori_fd_t *fdp, aiori_mod_opt_t * module_options) { mpiio_options_t * param = (mpiio_options_t*) module_options; mpiio_fd_t * mfd = (mpiio_fd_t*) fdp; - if(! param->dry_run){ + if(! hints->dryRun){ MPI_CHECK(MPI_File_close(& mfd->fd), "cannot close file"); } if (param->useFileView == TRUE) { @@ -500,7 +498,7 @@ static void MPIIO_Close(aiori_fd_t *fdp, aiori_mod_opt_t * module_options) void MPIIO_Delete(char *testFileName, aiori_mod_opt_t * module_options) { mpiio_options_t * param = (mpiio_options_t*) module_options; - if(param->dry_run) + if(hints->dryRun) return; MPI_CHECKF(MPI_File_delete(testFileName, (MPI_Info) MPI_INFO_NULL), "cannot delete file: %s", testFileName); @@ -530,29 +528,29 @@ static IOR_offset_t SeekOffset(MPI_File fd, IOR_offset_t offset, tempOffset = offset; - if (ior_param->filePerProc) { + if (hints->filePerProc) { offsetFactor = 0; tasksPerFile = 1; } else { - offsetFactor = (rank + rankOffset) % ior_param->numTasks; - tasksPerFile = ior_param->numTasks; + offsetFactor = (rank + rankOffset) % hints->numTasks; + tasksPerFile = hints->numTasks; } if (param->useFileView) { /* recall that offsets in a file view are counted in units of transfer size */ - if (ior_param->filePerProc) { - tempOffset = tempOffset / ior_param->transferSize; + if (hints->filePerProc) { + tempOffset = tempOffset / hints->transferSize; } else { /* * this formula finds a file view offset for a task * from an absolute offset */ - tempOffset = ((ior_param->blockSize / ior_param->transferSize) + tempOffset = ((hints->blockSize / hints->transferSize) * (tempOffset / - (ior_param->blockSize * tasksPerFile))) - + (((tempOffset % (ior_param->blockSize * tasksPerFile)) - - (offsetFactor * ior_param->blockSize)) - / ior_param->transferSize); + (hints->blockSize * tasksPerFile))) + + (((tempOffset % (hints->blockSize * tasksPerFile)) + - (offsetFactor * hints->blockSize)) + / hints->transferSize); } } MPI_CHECK(MPI_File_seek(fd, tempOffset, MPI_SEEK_SET), @@ -568,14 +566,14 @@ IOR_offset_t MPIIO_GetFileSize(aiori_mod_opt_t * module_options, MPI_Comm testCo char *testFileName) { mpiio_options_t * test = (mpiio_options_t*) module_options; - if(test->dry_run) + if(hints->dryRun) return 0; IOR_offset_t aggFileSizeFromStat, tmpMin, tmpMax, tmpSum; MPI_File fd; MPI_Comm comm; MPI_Info mpiHints = MPI_INFO_NULL; - if (ior_param->filePerProc == TRUE) { + if (hints->filePerProc == TRUE) { comm = MPI_COMM_SELF; } else { comm = testComm; @@ -591,7 +589,7 @@ IOR_offset_t MPIIO_GetFileSize(aiori_mod_opt_t * module_options, MPI_Comm testCo if (mpiHints != MPI_INFO_NULL) MPI_CHECK(MPI_Info_free(&mpiHints), "MPI_Info_free failed"); - if (ior_param->filePerProc == TRUE) { + if (hints->filePerProc == TRUE) { MPI_CHECK(MPI_Allreduce(&aggFileSizeFromStat, &tmpSum, 1, MPI_LONG_LONG_INT, MPI_SUM, testComm), "cannot total data moved"); diff --git a/src/aiori-POSIX.c b/src/aiori-POSIX.c index 43c5261..35395f4 100755 --- a/src/aiori-POSIX.c +++ b/src/aiori-POSIX.c @@ -149,7 +149,7 @@ ior_aiori_t posix_aiori = { .xfer = POSIX_Xfer, .close = POSIX_Close, .delete = POSIX_Delete, - .init_xfer_options = aiori_posix_init_xfer_options, + .xfer_hints = aiori_posix_xfer_hints, .get_version = aiori_get_version, .fsync = POSIX_Fsync, .get_file_size = POSIX_GetFileSize, @@ -166,16 +166,14 @@ ior_aiori_t posix_aiori = { /***************************** F U N C T I O N S ******************************/ -static IOR_param_t * ior_param = NULL; +static aiori_xfer_hint_t * hints = NULL; -void aiori_posix_init_xfer_options(IOR_param_t * params){ - ior_param = params; +void aiori_posix_xfer_hints(aiori_xfer_hint_t * params){ + hints = params; } static int POSIX_check_params(aiori_mod_opt_t * param){ posix_options_t * o = (posix_options_t*) param; - if (ior_param->useExistingTestFile && o->lustre_set_striping) - ERR("Lustre stripe options are incompatible with useExistingTestFile"); if (o->beegfs_chunkSize != -1 && (!ISPOWEROFTWO(o->beegfs_chunkSize) || o->beegfs_chunkSize < (1<<16))) ERR("beegfsChunkSize must be a power of two and >64k"); if(o->lustre_stripe_count != -1 || o->lustre_stripe_size != 0) @@ -219,7 +217,7 @@ void gpfs_access_start(int fd, IOR_offset_t length, int access) take_locks.access.structLen = sizeof(take_locks.access); take_locks.access.structType = GPFS_ACCESS_RANGE; - take_locks.access.start = ior_param->offset; + take_locks.access.start = hints->offset; take_locks.access.length = length; take_locks.access.isWrite = (access == WRITE); @@ -244,7 +242,7 @@ void gpfs_access_end(int fd, IOR_offset_t length, int access) free_locks.free.structLen = sizeof(free_locks.free); free_locks.free.structType = GPFS_FREE_RANGE; - free_locks.free.start = ior_param->offset; + free_locks.free.start = hints->offset; free_locks.free.length = length; rc = gpfs_fcntl(fd, &free_locks); @@ -386,7 +384,7 @@ aiori_fd_t *POSIX_Create(char *testFileName, int flags, aiori_mod_opt_t * param) set_o_direct_flag(&fd_oflag); } - if(ior_param->dryRun) + if(hints->dryRun) return (aiori_fd_t*) 0; #ifdef HAVE_LUSTRE_LUSTRE_USER_H @@ -399,7 +397,7 @@ aiori_fd_t *POSIX_Create(char *testFileName, int flags, aiori_mod_opt_t * param) /* In the single-shared-file case, task 0 has to creat the file with the Lustre striping options before any other processes open the file */ - if (!ior_param->filePerProc && rank != 0) { + if (!hints->filePerProc && rank != 0) { MPI_CHECK(MPI_Barrier(testComm), "barrier error"); fd_oflag |= O_RDWR; *fd = open64(testFileName, fd_oflag, mode); @@ -436,7 +434,7 @@ aiori_fd_t *POSIX_Create(char *testFileName, int flags, aiori_mod_opt_t * param) MPI_CHECK(MPI_Abort(MPI_COMM_WORLD, -1), "MPI_Abort() error"); } - if (!ior_param->filePerProc) + if (!hints->filePerProc) MPI_CHECK(MPI_Barrier(testComm), "barrier error"); } @@ -518,7 +516,7 @@ aiori_fd_t *POSIX_Open(char *testFileName, int flags, aiori_mod_opt_t * param) fd_oflag |= O_RDWR; - if(ior_param->dryRun) + if(hints->dryRun) return (aiori_fd_t*) 0; *fd = open64(testFileName, fd_oflag); @@ -558,7 +556,7 @@ static IOR_offset_t POSIX_Xfer(int access, aiori_fd_t *file, IOR_size_t * buffer int fd; posix_options_t * o = (posix_options_t*) param; - if(ior_param->dryRun) + if(hints->dryRun) return length; fd = *(int *)file; @@ -571,8 +569,8 @@ static IOR_offset_t POSIX_Xfer(int access, aiori_fd_t *file, IOR_size_t * buffer /* seek to offset */ - if (lseek64(fd, ior_param->offset, SEEK_SET) == -1) - ERRF("lseek64(%d, %lld, SEEK_SET) failed", fd, ior_param->offset); + if (lseek64(fd, hints->offset, SEEK_SET) == -1) + ERRF("lseek64(%d, %lld, SEEK_SET) failed", fd, hints->offset); while (remaining > 0) { /* write/read file */ @@ -581,13 +579,13 @@ static IOR_offset_t POSIX_Xfer(int access, aiori_fd_t *file, IOR_size_t * buffer fprintf(stdout, "task %d writing to offset %lld\n", rank, - ior_param->offset + length - remaining); + hints->offset + length - remaining); } rc = write(fd, ptr, remaining); if (rc == -1) ERRF("write(%d, %p, %lld) failed", fd, (void*)ptr, remaining); - if (ior_param->fsyncPerWrite == TRUE){ + if (hints->fsyncPerWrite == TRUE){ POSIX_Fsync((aiori_fd_t*) &fd, param); } } else { /* READ or CHECK */ @@ -595,7 +593,7 @@ static IOR_offset_t POSIX_Xfer(int access, aiori_fd_t *file, IOR_size_t * buffer fprintf(stdout, "task %d reading from offset %lld\n", rank, - ior_param->offset + length - remaining); + hints->offset + length - remaining); } rc = read(fd, ptr, remaining); if (rc == 0) @@ -611,8 +609,8 @@ static IOR_offset_t POSIX_Xfer(int access, aiori_fd_t *file, IOR_size_t * buffer rank, access == WRITE ? "write()" : "read()", rc, remaining, - ior_param->offset + length - remaining); - if (ior_param->singleXferAttempt == TRUE) + hints->offset + length - remaining); + if (hints->singleXferAttempt == TRUE) MPI_CHECK(MPI_Abort(MPI_COMM_WORLD, -1), "barrier error"); if (xferRetries > MAX_RETRY) @@ -656,7 +654,7 @@ static void POSIX_Sync(aiori_mod_opt_t * param) */ void POSIX_Close(aiori_fd_t *fd, aiori_mod_opt_t * param) { - if(ior_param->dryRun) + if(hints->dryRun) return; if (close(*(int *)fd) != 0) ERRF("close(%d) failed", *(int *)fd); @@ -668,7 +666,7 @@ void POSIX_Close(aiori_fd_t *fd, aiori_mod_opt_t * param) */ void POSIX_Delete(char *testFileName, aiori_mod_opt_t * param) { - if(ior_param->dryRun) + if(hints->dryRun) return; if (unlink(testFileName) != 0){ EWARNF("[RANK %03d]: unlink() of file \"%s\" failed\n", @@ -682,7 +680,7 @@ void POSIX_Delete(char *testFileName, aiori_mod_opt_t * param) IOR_offset_t POSIX_GetFileSize(aiori_mod_opt_t * test, MPI_Comm testComm, char *testFileName) { - if(ior_param->dryRun) + if(hints->dryRun) return 0; struct stat stat_buf; IOR_offset_t aggFileSizeFromStat, tmpMin, tmpMax, tmpSum; @@ -692,7 +690,7 @@ IOR_offset_t POSIX_GetFileSize(aiori_mod_opt_t * test, MPI_Comm testComm, } aggFileSizeFromStat = stat_buf.st_size; - if (ior_param->filePerProc == TRUE) { + if (hints->filePerProc == TRUE) { MPI_CHECK(MPI_Allreduce(&aggFileSizeFromStat, &tmpSum, 1, MPI_LONG_LONG_INT, MPI_SUM, testComm), "cannot total data moved"); diff --git a/src/aiori.h b/src/aiori.h index 76d9f6a..bbd775d 100755 --- a/src/aiori.h +++ b/src/aiori.h @@ -24,7 +24,6 @@ #include #include -#include "ior.h" #include "iordef.h" /* IOR Definitions */ #include "option.h" @@ -63,8 +62,23 @@ typedef struct ior_aiori_statfs { uint64_t f_ffree; } ior_aiori_statfs_t; +/* + This structure contains information about the expected IO pattern that may be used to optimize data access. Optimally, it should be stored for each file descriptor, at the moment it can only be set globally per aiori backend module. + */ typedef struct aiori_xfer_hint_t{ - + int dryRun; /* do not perform any I/Os just run evtl. inputs print dummy output */ + int filePerProc; /* single file or file-per-process */ + int collective; /* collective I/O */ + int numTasks; /* number of tasks for test */ + int numNodes; /* number of nodes for test */ + int randomOffset; /* access is to random offsets */ + int fsyncPerWrite; /* fsync() after each write */ + IOR_offset_t segmentCount; /* number of segments (or HDF5 datasets) */ + IOR_offset_t blockSize; /* contiguous bytes to write per task */ + IOR_offset_t transferSize; /* size of transfer in bytes */ + IOR_offset_t offset; /* offset for read/write */ + IOR_offset_t expectedAggFileSize; /* calculated aggregate file size */ + int singleXferAttempt; /* do not retry transfer if incomplete */ } aiori_xfer_hint_t; /* this is a dummy structure to create some type safety */ @@ -85,7 +99,7 @@ typedef struct ior_aiori { /* Allow to set generic transfer options that shall be applied to any subsequent IO call. */ - void (*init_xfer_options)(IOR_param_t * params); + void (*xfer_hints)(aiori_xfer_hint_t * params); IOR_offset_t (*xfer)(int, aiori_fd_t *, IOR_size_t *, IOR_offset_t, aiori_mod_opt_t *); void (*close)(aiori_fd_t *, aiori_mod_opt_t *); @@ -144,7 +158,7 @@ int aiori_posix_mkdir (const char *path, mode_t mode, aiori_mod_opt_t * module_o int aiori_posix_rmdir (const char *path, aiori_mod_opt_t * module_options); int aiori_posix_access (const char *path, int mode, aiori_mod_opt_t * module_options); int aiori_posix_stat (const char *path, struct stat *buf, aiori_mod_opt_t * module_options); -void aiori_posix_init_xfer_options(IOR_param_t * params); +void aiori_posix_xfer_hints(aiori_xfer_hint_t * params); aiori_fd_t *POSIX_Create(char *testFileName, int flags, aiori_mod_opt_t * module_options); int POSIX_Mknod(char *testFileName); diff --git a/src/ior.c b/src/ior.c index 7dbf80b..32666b5 100755 --- a/src/ior.c +++ b/src/ior.c @@ -58,6 +58,27 @@ static IOR_offset_t WriteOrRead(IOR_param_t *test, IOR_results_t *results, aiori_fd_t *fd, const int access, IOR_io_buffers *ioBuffers); +static void ior_set_xfer_hints(IOR_param_t * p){ + aiori_xfer_hint_t * hints = & p->hints; + hints->dryRun = p->dryRun; + hints->filePerProc = p->filePerProc; + hints->collective = p->collective; + hints->numTasks = p->numTasks; + hints->numNodes = p->numNodes; + hints->randomOffset = p->randomOffset; + hints->fsyncPerWrite = p->fsyncPerWrite; + hints->segmentCount = p->segmentCount; + hints->blockSize = p->blockSize; + hints->transferSize = p->transferSize; + hints->offset = p->offset; + hints->expectedAggFileSize = p->expectedAggFileSize; + hints->singleXferAttempt = p->singleXferAttempt; + + if(backend->xfer_hints){ + backend->xfer_hints(hints); + } +} + static void test_initialize(IOR_test_t * test){ verbose = test->params.verbose; backend = test->params.backend; @@ -67,9 +88,7 @@ static void test_initialize(IOR_test_t * test){ if(backend->initialize){ backend->initialize(test->params.backend_options); } - if(backend->init_xfer_options){ - backend->init_xfer_options(& test->params); - } + ior_set_xfer_hints(& test->params); } static void test_finalize(IOR_test_t * test){ @@ -1643,9 +1662,8 @@ static void ValidateTests(IOR_param_t * test) if ((strcasecmp(test->api, "NCMPI") == 0) && test->filePerProc) ERR("file-per-proc not available in current NCMPI"); - if(test->backend->init_xfer_options){ - test->backend->init_xfer_options(test); - } + backend = test->backend; + ior_set_xfer_hints(test); /* allow the backend to validate the options */ if(test->backend->check_params){ int check = test->backend->check_params(test->backend_options); diff --git a/src/ior.h b/src/ior.h index d208507..7724dab 100755 --- a/src/ior.h +++ b/src/ior.h @@ -37,6 +37,7 @@ #endif #include "option.h" #include "iordef.h" +#include "aiori.h" #define ISPOWEROFTWO(x) ((x != 0) && !(x & (x - 1))) /******************** DATA Packet Type ***************************************/ @@ -79,8 +80,6 @@ typedef struct IO_BUFFERS * USER_GUIDE */ -struct ior_aiori; - typedef struct { const struct ior_aiori * backend; @@ -177,6 +176,8 @@ typedef struct int id; /* test's unique ID */ int intraTestBarriers; /* barriers between open/op and op/close */ + + aiori_xfer_hint_t hints; } IOR_param_t; /* each pointer for a single test */ diff --git a/src/mdtest.c b/src/mdtest.c index 3e102de..9ef91ef 100644 --- a/src/mdtest.c +++ b/src/mdtest.c @@ -167,8 +167,8 @@ static uid_t uid; /* Use the POSIX backend by default */ static const ior_aiori_t *backend; static void * backend_options; - -static IOR_param_t param; +static aiori_xfer_hint_t hints; +static char * api = NULL; /* This structure describes the processing status for stonewalling */ typedef struct{ @@ -376,7 +376,7 @@ static void create_file (const char *path, uint64_t itemNum) { * !collective_creates */ } else { - param.filePerProc = !shared_file; + hints.filePerProc = !shared_file; VERBOSE(3,5,"create_remove_items_helper (non-collective, shared): open..." ); aiori_fh = backend->create (curr_item, IOR_WRONLY | IOR_CREAT, backend_options); @@ -391,8 +391,8 @@ static void create_file (const char *path, uint64_t itemNum) { * According to Bill Loewe, writes are only done one time, so they are always at * offset 0 (zero). */ - param.offset = 0; - param.fsyncPerWrite = sync_file; + hints.offset = 0; + hints.fsyncPerWrite = sync_file; if ( write_bytes != (size_t) backend->xfer (WRITE, aiori_fh, (IOR_size_t *) write_buffer, write_bytes, backend_options)) { FAIL("unable to write file %s", curr_item); } @@ -1906,9 +1906,10 @@ mdtest_results_t * mdtest_run(int argc, char **argv, MPI_Comm world_com, FILE * aiori_supported_apis(APIs, APIs_legacy, MDTEST); char apiStr[1024]; sprintf(apiStr, "API for I/O [%s]", APIs); + memset(& hints, 0, sizeof(hints)); option_help options [] = { - {'a', NULL, apiStr, OPTION_OPTIONAL_ARGUMENT, 's', & param.api}, + {'a', NULL, apiStr, OPTION_OPTIONAL_ARGUMENT, 's', & api}, {'b', NULL, "branching factor of hierarchical directory structure", OPTION_OPTIONAL_ARGUMENT, 'd', & branch_factor}, {'d', NULL, "the directory in which the tests will run", OPTION_OPTIONAL_ARGUMENT, 's', & path}, {'B', NULL, "no barriers between phases", OPTION_OPTIONAL_ARGUMENT, 'd', & no_barriers}, @@ -1953,12 +1954,13 @@ mdtest_results_t * mdtest_run(int argc, char **argv, MPI_Comm world_com, FILE * }; options_all_t * global_options = airoi_create_all_module_options(options); option_parse(argc, argv, global_options); - updateParsedOptions(& param, global_options); - backend_options = param.backend_options; + backend = aiori_select(api); + if (backend == NULL) + ERR("Unrecognized I/O API"); + backend_options = airoi_update_module_options(backend, global_options); free(global_options->modules); free(global_options); - backend = param.backend; MPI_Comm_rank(testComm, &rank); MPI_Comm_size(testComm, &size); @@ -1966,8 +1968,8 @@ mdtest_results_t * mdtest_run(int argc, char **argv, MPI_Comm world_com, FILE * if (backend->initialize){ backend->initialize(backend_options); } - if(backend->init_xfer_options){ - backend->init_xfer_options(& param); + if(backend->xfer_hints){ + backend->xfer_hints(& hints); } if(backend->check_params){ backend->check_params(backend_options); @@ -2011,7 +2013,7 @@ mdtest_results_t * mdtest_run(int argc, char **argv, MPI_Comm world_com, FILE * valid_tests(); // option_print_current(options); - VERBOSE(1,-1, "api : %s", param.api); + VERBOSE(1,-1, "api : %s", api); VERBOSE(1,-1, "barriers : %s", ( barriers ? "True" : "False" )); VERBOSE(1,-1, "collective_creates : %s", ( collective_creates ? "True" : "False" )); VERBOSE(1,-1, "create_only : %s", ( create_only ? "True" : "False" )); From 8fa8ef0c02488fdb0957f555cbcbc9030aa0de26 Mon Sep 17 00:00:00 2001 From: "Julian M. Kunkel" Date: Sun, 31 May 2020 13:30:31 +0100 Subject: [PATCH 46/52] Call backend statfs() instead of only POSIX-specific variant. --- src/aiori.c | 49 ++++++++++++----- src/ior-internal.h | 1 - src/ior-output.c | 39 +------------ src/ior.c | 12 ++-- src/ior.h | 1 - src/utilities.c | 134 +++++++++++++++++++-------------------------- src/utilities.h | 2 +- 7 files changed, 99 insertions(+), 139 deletions(-) diff --git a/src/aiori.c b/src/aiori.c index be9c2b4..f66b9bc 100644 --- a/src/aiori.c +++ b/src/aiori.c @@ -154,27 +154,48 @@ void aiori_supported_apis(char * APIs, char * APIs_legacy, enum bench_type type) */ int aiori_posix_statfs (const char *path, ior_aiori_statfs_t *stat_buf, aiori_mod_opt_t * module_options) { - int ret; + // find the parent directory + char * fileName = strdup(path); + int i; + int directoryFound = FALSE; + + /* get directory for outfile */ + i = strlen(fileName); + while (i-- > 0) { + if (fileName[i] == '/') { + fileName[i] = '\0'; + directoryFound = TRUE; + break; + } + } + /* if no directory/, use '.' */ + if (directoryFound == FALSE) { + strcpy(fileName, "."); + } + + int ret; #if defined(HAVE_STATVFS) - struct statvfs statfs_buf; + struct statvfs statfs_buf; - ret = statvfs (path, &statfs_buf); + ret = statvfs (fileName, &statfs_buf); #else - struct statfs statfs_buf; + struct statfs statfs_buf; - ret = statfs (path, &statfs_buf); + ret = statfs (fileName, &statfs_buf); #endif - if (-1 == ret) { - return -1; - } + if (-1 == ret) { + perror("POSIX couldn't call statvfs"); + return -1; + } - stat_buf->f_bsize = statfs_buf.f_bsize; - stat_buf->f_blocks = statfs_buf.f_blocks; - stat_buf->f_bfree = statfs_buf.f_bfree; - stat_buf->f_files = statfs_buf.f_files; - stat_buf->f_ffree = statfs_buf.f_ffree; + stat_buf->f_bsize = statfs_buf.f_bsize; + stat_buf->f_blocks = statfs_buf.f_blocks; + stat_buf->f_bfree = statfs_buf.f_bfree; + stat_buf->f_files = statfs_buf.f_files; + stat_buf->f_ffree = statfs_buf.f_ffree; - return 0; + free(fileName); + return 0; } int aiori_posix_mkdir (const char *path, mode_t mode, aiori_mod_opt_t * module_options) diff --git a/src/ior-internal.h b/src/ior-internal.h index 9cc8406..fa7212e 100644 --- a/src/ior-internal.h +++ b/src/ior-internal.h @@ -17,7 +17,6 @@ void PrintShortSummary(IOR_test_t * test); void PrintLongSummaryAllTests(IOR_test_t *tests_head); void PrintLongSummaryHeader(); void PrintLongSummaryOneTest(IOR_test_t *test); -void DisplayFreespace(IOR_param_t * test); void GetTestFileName(char *, IOR_param_t *); void PrintRemoveTiming(double start, double finish, int rep); void PrintReducedResult(IOR_test_t *test, int access, double bw, double iops, double latency, diff --git a/src/ior-output.c b/src/ior-output.c index 2bffd40..15ffa7d 100644 --- a/src/ior-output.c +++ b/src/ior-output.c @@ -322,11 +322,8 @@ void ShowTestStart(IOR_param_t *test) PrintStartSection(); PrintKeyValInt("TestID", test->id); PrintKeyVal("StartTime", CurrentTimeString()); - /* if pvfs2:, then skip */ - if (strcasecmp(test->api, "DFS") && - Regex(test->testFileName, "^[a-z][a-z].*:") == 0) { - DisplayFreespace(test); - } + + ShowFileSystemSize(test); if (verbose >= VERBOSE_3 || outputFormat == OUTPUT_JSON) { char* data_packets[] = {"g","t","o","i"}; @@ -724,38 +721,6 @@ void PrintShortSummary(IOR_test_t * test) } } - -/* - * Display freespace (df). - */ -void DisplayFreespace(IOR_param_t * test) -{ - char fileName[MAX_STR] = { 0 }; - int i; - int directoryFound = FALSE; - - /* get outfile name */ - GetTestFileName(fileName, test); - - /* get directory for outfile */ - i = strlen(fileName); - while (i-- > 0) { - if (fileName[i] == '/') { - fileName[i] = '\0'; - directoryFound = TRUE; - break; - } - } - - /* if no directory/, use '.' */ - if (directoryFound == FALSE) { - strcpy(fileName, "."); - } - - ShowFileSystemSize(fileName); -} - - void PrintRemoveTiming(double start, double finish, int rep) { if (rank != 0 || verbose < VERBOSE_0) diff --git a/src/ior.c b/src/ior.c index 32666b5..46f0056 100755 --- a/src/ior.c +++ b/src/ior.c @@ -82,13 +82,14 @@ static void ior_set_xfer_hints(IOR_param_t * p){ static void test_initialize(IOR_test_t * test){ verbose = test->params.verbose; backend = test->params.backend; - if (rank == 0 && verbose >= VERBOSE_0) { - ShowTestStart(& test->params); - } if(backend->initialize){ backend->initialize(test->params.backend_options); } ior_set_xfer_hints(& test->params); + + if (rank == 0 && verbose >= VERBOSE_0) { + ShowTestStart(& test->params); + } } static void test_finalize(IOR_test_t * test){ @@ -1807,7 +1808,7 @@ static IOR_offset_t WriteOrReadSingle(IOR_offset_t pairCnt, IOR_offset_t *offset void *checkBuffer = ioBuffers->checkBuffer; void *readCheckBuffer = ioBuffers->readCheckBuffer; - test->offset = offsetArray[pairCnt]; + test->hints.offset = offsetArray[pairCnt]; // this looks inappropriate transfer = test->transferSize; if (access == WRITE) { @@ -1816,8 +1817,7 @@ static IOR_offset_t WriteOrReadSingle(IOR_offset_t pairCnt, IOR_offset_t *offset if (test->storeFileOffset == TRUE) { FillBuffer(buffer, test, test->offset, pretendRank); } - amtXferred = - backend->xfer(access, fd, buffer, transfer, test->backend_options); + amtXferred = backend->xfer(access, fd, buffer, transfer, test->backend_options); if (amtXferred != transfer) ERR("cannot write to file"); if (test->fsyncPerWrite) diff --git a/src/ior.h b/src/ior.h index 7724dab..9b1c464 100755 --- a/src/ior.h +++ b/src/ior.h @@ -89,7 +89,6 @@ typedef struct char * apiVersion; /* API version */ char * platform; /* platform type */ char * testFileName; /* full name for test */ - char * testFileName_fppReadCheck;/* filename for fpp read check */ char * options; /* options string */ // intermediate options int collective; /* collective I/O */ diff --git a/src/utilities.c b/src/utilities.c index 1f83c83..33b23d8 100755 --- a/src/utilities.c +++ b/src/utilities.c @@ -47,6 +47,7 @@ #include "utilities.h" #include "aiori.h" #include "ior.h" +#include "ior-internal.h" /************************** D E C L A R A T I O N S ***************************/ @@ -565,91 +566,66 @@ IOR_offset_t StringToBytes(char *size_str) /* * Displays size of file system and percent of data blocks and inodes used. */ -void ShowFileSystemSize(char *fileSystem) // this might be converted to an AIORI call +void ShowFileSystemSize(IOR_param_t * test) // this might be converted to an AIORI call { -#ifndef _WIN32 /* FIXME */ - char realPath[PATH_MAX]; - char *fileSystemUnitStr; - long long int totalFileSystemSize; - long long int freeFileSystemSize; - long long int totalInodes; - long long int freeInodes; - double totalFileSystemSizeHR; - double usedFileSystemPercentage; - double usedInodePercentage; -#ifdef __sun /* SunOS does not support statfs(), instead uses statvfs() */ - struct statvfs statusBuffer; -#else /* !__sun */ - struct statfs statusBuffer; -#endif /* __sun */ + ior_aiori_statfs_t stat; + if(! test->backend->statfs){ + WARN("Backend doesn't implement statfs"); + return; + } + char filename[MAX_PATHLEN]; + GetTestFileName(filename, test); + int ret = test->backend->statfs(filename, & stat, test->backend_options); + if( ret != 0 ){ + WARN("Backend returned error during statfs"); + return; + } + long long int totalFileSystemSize; + long long int freeFileSystemSize; + long long int totalInodes; + long long int freeInodes; + double totalFileSystemSizeHR; + double usedFileSystemPercentage; + double usedInodePercentage; + char *fileSystemUnitStr; -#ifdef __sun - if (statvfs(fileSystem, &statusBuffer) != 0) { - WARN("unable to statvfs() file system"); - return; - } -#else /* !__sun */ - if (statfs(fileSystem, &statusBuffer) != 0) { - WARN("unable to statfs() file system"); - return; - } -#endif /* __sun */ + totalFileSystemSize = stat.f_blocks * stat.f_bsize; + freeFileSystemSize = stat.f_bfree * stat.f_bsize; + usedFileSystemPercentage = (1 - ((double)freeFileSystemSize / (double)totalFileSystemSize)) * 100; + totalFileSystemSizeHR = (double)totalFileSystemSize / (double)(1<<30); - /* data blocks */ -#ifdef __sun - totalFileSystemSize = statusBuffer.f_blocks * statusBuffer.f_frsize; - freeFileSystemSize = statusBuffer.f_bfree * statusBuffer.f_frsize; -#else /* !__sun */ - totalFileSystemSize = statusBuffer.f_blocks * statusBuffer.f_bsize; - freeFileSystemSize = statusBuffer.f_bfree * statusBuffer.f_bsize; -#endif /* __sun */ + /* inodes */ + totalInodes = stat.f_files; + freeInodes = stat.f_ffree; + usedInodePercentage = (1 - ((double)freeInodes / (double)totalInodes)) * 100; - usedFileSystemPercentage = (1 - ((double)freeFileSystemSize - / (double)totalFileSystemSize)) * 100; - totalFileSystemSizeHR = - (double)totalFileSystemSize / (double)(1<<30); - fileSystemUnitStr = "GiB"; - if (totalFileSystemSizeHR > 1024) { - totalFileSystemSizeHR = (double)totalFileSystemSize / (double)((long long)1<<40); - fileSystemUnitStr = "TiB"; - } + fileSystemUnitStr = "GiB"; + if (totalFileSystemSizeHR > 1024) { + totalFileSystemSizeHR = (double)totalFileSystemSize / (double)((long long)1<<40); + fileSystemUnitStr = "TiB"; + } + if(outputFormat == OUTPUT_DEFAULT){ + fprintf(out_resultfile, "%-20s: %s\n", "Path", filename); + fprintf(out_resultfile, "%-20s: %.1f %s Used FS: %2.1f%% ", + "FS", totalFileSystemSizeHR, fileSystemUnitStr, + usedFileSystemPercentage); + fprintf(out_resultfile, "Inodes: %.1f Mi Used Inodes: %2.1f%%\n", + (double)totalInodes / (double)(1<<20), + usedInodePercentage); + fflush(out_logfile); + }else if(outputFormat == OUTPUT_JSON){ + fprintf(out_resultfile, " , \"Path\": \"%s\",", filename); + fprintf(out_resultfile, "\"Capacity\": \"%.1f %s\", \"Used Capacity\": \"%2.1f%%\",", + totalFileSystemSizeHR, fileSystemUnitStr, + usedFileSystemPercentage); + fprintf(out_resultfile, "\"Inodes\": \"%.1f Mi\", \"Used Inodes\" : \"%2.1f%%\"\n", + (double)totalInodes / (double)(1<<20), + usedInodePercentage); + }else if(outputFormat == OUTPUT_CSV){ - /* inodes */ - totalInodes = statusBuffer.f_files; - freeInodes = statusBuffer.f_ffree; - usedInodePercentage = - (1 - ((double)freeInodes / (double)totalInodes)) * 100; + } - /* show results */ - if (realpath(fileSystem, realPath) == NULL) { - WARN("unable to use realpath()"); - return; - } - - if(outputFormat == OUTPUT_DEFAULT){ - fprintf(out_resultfile, "%-20s: %s\n", "Path", realPath); - fprintf(out_resultfile, "%-20s: %.1f %s Used FS: %2.1f%% ", - "FS", totalFileSystemSizeHR, fileSystemUnitStr, - usedFileSystemPercentage); - fprintf(out_resultfile, "Inodes: %.1f Mi Used Inodes: %2.1f%%\n", - (double)totalInodes / (double)(1<<20), - usedInodePercentage); - fflush(out_logfile); - }else if(outputFormat == OUTPUT_JSON){ - fprintf(out_resultfile, " , \"Path\": \"%s\",", realPath); - fprintf(out_resultfile, "\"Capacity\": \"%.1f %s\", \"Used Capacity\": \"%2.1f%%\",", - totalFileSystemSizeHR, fileSystemUnitStr, - usedFileSystemPercentage); - fprintf(out_resultfile, "\"Inodes\": \"%.1f Mi\", \"Used Inodes\" : \"%2.1f%%\"\n", - (double)totalInodes / (double)(1<<20), - usedInodePercentage); - }else if(outputFormat == OUTPUT_CSV){ - - } - -#endif /* !_WIN32 */ - - return; + return; } /* diff --git a/src/utilities.h b/src/utilities.h index 2a9abe3..a03e17c 100755 --- a/src/utilities.h +++ b/src/utilities.h @@ -47,7 +47,7 @@ void set_o_direct_flag(int *fd); char *CurrentTimeString(void); int Regex(char *, char *); -void ShowFileSystemSize(char *); +void ShowFileSystemSize(IOR_param_t * test); void DumpBuffer(void *, size_t); void SeedRandGen(MPI_Comm); void SetHints (MPI_Info *, char *); From 3623f3b8bdf56d49f9307682c15fbbcffcd58a16 Mon Sep 17 00:00:00 2001 From: Mohamad Chaarawi Date: Sun, 31 May 2020 16:20:58 +0000 Subject: [PATCH 47/52] DFS: allow multiple IO phases when ior_run() is called - init/fini can be made multiple times - reset tunables on fini so they can change on a re-init Signed-off-by: Mohamad Chaarawi --- src/aiori-DAOS.c | 4 +--- src/aiori-DFS.c | 29 +++++++++++++++++++++++++---- src/ior.c | 2 ++ 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/src/aiori-DAOS.c b/src/aiori-DAOS.c index 7f07f7c..8fa1578 100644 --- a/src/aiori-DAOS.c +++ b/src/aiori-DAOS.c @@ -216,10 +216,8 @@ DAOS_Init() if (daos_initialized) return; - if (o.pool == NULL || o.svcl == NULL || o.cont == NULL) { - GERR("Invalid DAOS pool/cont\n"); + if (o.pool == NULL || o.svcl == NULL || o.cont == NULL) return; - } if (o.oclass) { objectClass = daos_oclass_name2id(o.oclass); diff --git a/src/aiori-DFS.c b/src/aiori-DFS.c index 6487488..e7b1d6b 100755 --- a/src/aiori-DFS.c +++ b/src/aiori-DFS.c @@ -42,6 +42,7 @@ static daos_handle_t poh, coh; static daos_oclass_id_t objectClass = OC_SX; static daos_oclass_id_t dir_oclass = OC_SX; static struct d_hash_table *dir_hash; +static bool dfs_init; struct aiori_dir_hdl { d_list_t entry; @@ -386,8 +387,16 @@ static void DFS_Init() { int rc; + /** in case we are already initialized, return */ + if (dfs_init) + return; + + /** shouldn't be fatal since it can be called with POSIX backend selection */ if (o.pool == NULL || o.svcl == NULL || o.cont == NULL) - ERR("Invalid pool or container options\n"); + return; + + rc = daos_init(); + DCHECK(rc, "Failed to initialize daos"); if (o.oclass) { objectClass = daos_oclass_name2id(o.oclass); @@ -401,9 +410,6 @@ DFS_Init() { GERR("Invalid DAOS directory object class %s\n", o.dir_oclass); } - rc = daos_init(); - DCHECK(rc, "Failed to initialize daos"); - rc = d_hash_table_create(0, 16, NULL, &hdl_hash_ops, &dir_hash); DCHECK(rc, "Failed to initialize dir hashtable"); @@ -457,6 +463,7 @@ DFS_Init() { rc = dfs_set_prefix(dfs, o.prefix); DCHECK(rc, "Failed to set DFS Prefix"); } + dfs_init = true; } static void @@ -510,6 +517,20 @@ DFS_Finalize() rc = daos_fini(); DCHECK(rc, "Failed to finalize DAOS"); + + /** reset tunables */ + o.pool = NULL; + o.svcl = NULL; + o.group = NULL; + o.cont = NULL; + o.chunk_size = 1048576; + o.oclass = NULL; + o.dir_oclass = NULL; + o.prefix = NULL; + o.destroy = 0; + objectClass = OC_SX; + dir_oclass = OC_SX; + dfs_init = false; } /* diff --git a/src/ior.c b/src/ior.c index 05070b0..361a9a4 100755 --- a/src/ior.c +++ b/src/ior.c @@ -1625,6 +1625,8 @@ static void ValidateTests(IOR_param_t * test) && (strcasecmp(test->api, "MPIIO") != 0) && (strcasecmp(test->api, "MMAP") != 0) && (strcasecmp(test->api, "HDFS") != 0) + && (strcasecmp(test->api, "DFS") != 0) + && (strcasecmp(test->api, "DAOS") != 0) && (strcasecmp(test->api, "Gfarm") != 0) && (strcasecmp(test->api, "RADOS") != 0) && (strcasecmp(test->api, "CEPHFS") != 0)) && test->fsync) From 3eb488939ddb42434afad5e741e17b8564644582 Mon Sep 17 00:00:00 2001 From: Sven Breuner Date: Wed, 3 Jun 2020 00:30:38 +0300 Subject: [PATCH 48/52] mdtest: allocate aligned buffers to support DirectIO --- src/mdtest.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mdtest.c b/src/mdtest.c index f82db1b..c8a8b47 100644 --- a/src/mdtest.c +++ b/src/mdtest.c @@ -633,8 +633,8 @@ void mdtest_read(int random, int dirs, const long dir_iter, char *path) { /* allocate read buffer */ if (read_bytes > 0) { - read_buffer = (char *)malloc(read_bytes); - if (read_buffer == NULL) { + int alloc_res = posix_memalign((void**)&read_buffer, sysconf(_SC_PAGESIZE), write_bytes); + if (alloc_res) { FAIL("out of memory"); } @@ -2125,8 +2125,8 @@ mdtest_results_t * mdtest_run(int argc, char **argv, MPI_Comm world_com, FILE * /* allocate and initialize write buffer with # */ if (write_bytes > 0) { - write_buffer = (char *)malloc(write_bytes); - if (write_buffer == NULL) { + int alloc_res = posix_memalign((void**)&write_buffer, sysconf(_SC_PAGESIZE), write_bytes); + if (alloc_res) { FAIL("out of memory"); } generate_memory_pattern(write_buffer, write_bytes); From c828a0f32c50c8644832b6fab21974880860e415 Mon Sep 17 00:00:00 2001 From: Sven Breuner Date: Wed, 3 Jun 2020 01:22:44 +0300 Subject: [PATCH 49/52] mdtest: use correct number of bytes for posix_memalign of read buffer Fixes a typo in initial posix_memalign commit for DirectIO support. --- src/mdtest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mdtest.c b/src/mdtest.c index c8a8b47..105837f 100644 --- a/src/mdtest.c +++ b/src/mdtest.c @@ -633,7 +633,7 @@ void mdtest_read(int random, int dirs, const long dir_iter, char *path) { /* allocate read buffer */ if (read_bytes > 0) { - int alloc_res = posix_memalign((void**)&read_buffer, sysconf(_SC_PAGESIZE), write_bytes); + int alloc_res = posix_memalign((void**)&read_buffer, sysconf(_SC_PAGESIZE), read_bytes); if (alloc_res) { FAIL("out of memory"); } From eb2cd27fac1f8962341dc4df63974ed5a39691df Mon Sep 17 00:00:00 2001 From: "Julian M. Kunkel" Date: Wed, 10 Jun 2020 17:47:07 +0100 Subject: [PATCH 50/52] Removed offset from IOR structure. --- src/aiori-DUMMY.c | 2 +- src/aiori-HDF5.c | 8 ++++---- src/aiori-MMAP.c | 12 ++++++------ src/aiori-MPIIO.c | 12 ++++++------ src/aiori-POSIX.c | 14 +++++++------- src/aiori.h | 5 ++--- src/ior.c | 29 ++++++++++++++--------------- src/ior.h | 1 - src/mdtest.c | 5 ++--- 9 files changed, 42 insertions(+), 46 deletions(-) diff --git a/src/aiori-DUMMY.c b/src/aiori-DUMMY.c index 2e4feb5..034fc98 100755 --- a/src/aiori-DUMMY.c +++ b/src/aiori-DUMMY.c @@ -116,7 +116,7 @@ static IOR_offset_t DUMMY_GetFileSize(aiori_mod_opt_t * options, MPI_Comm testCo return 0; } -static IOR_offset_t DUMMY_Xfer(int access, aiori_fd_t *file, IOR_size_t * buffer, IOR_offset_t length, aiori_mod_opt_t * options){ +static IOR_offset_t DUMMY_Xfer(int access, aiori_fd_t *file, IOR_size_t * buffer, IOR_offset_t length, IOR_offset_t offset, aiori_mod_opt_t * options){ if(verbose > 4){ fprintf(out_logfile, "DUMMY xfer: %p\n", file); } diff --git a/src/aiori-HDF5.c b/src/aiori-HDF5.c index cc32cbe..1e7f2bf 100755 --- a/src/aiori-HDF5.c +++ b/src/aiori-HDF5.c @@ -86,7 +86,7 @@ static void SetupDataSet(void *, int flags, aiori_mod_opt_t *); static aiori_fd_t *HDF5_Create(char *, int flags, aiori_mod_opt_t *); static aiori_fd_t *HDF5_Open(char *, int flags, aiori_mod_opt_t *); static IOR_offset_t HDF5_Xfer(int, aiori_fd_t *, IOR_size_t *, - IOR_offset_t, aiori_mod_opt_t *); + IOR_offset_t, IOR_offset_t, aiori_mod_opt_t *); static void HDF5_Close(aiori_fd_t *, aiori_mod_opt_t *); static void HDF5_Delete(char *, aiori_mod_opt_t *); static char* HDF5_GetVersion(); @@ -417,7 +417,7 @@ static aiori_fd_t *HDF5_Open(char *testFileName, int flags, aiori_mod_opt_t * pa * Write or read access to file using the HDF5 interface. */ static IOR_offset_t HDF5_Xfer(int access, aiori_fd_t *fd, IOR_size_t * buffer, - IOR_offset_t length, aiori_mod_opt_t * param) + IOR_offset_t length, IOR_offset_t offset, aiori_mod_opt_t * param) { static int firstReadCheck = FALSE, startNewDataSet; IOR_offset_t segmentPosition, segmentSize; @@ -445,7 +445,7 @@ static IOR_offset_t HDF5_Xfer(int access, aiori_fd_t *fd, IOR_size_t * buffer, * hints->blockSize; segmentSize = (IOR_offset_t) (hints->numTasks) * hints->blockSize; } - if ((IOR_offset_t) ((hints->offset - segmentPosition) % segmentSize) == + if ((IOR_offset_t) ((offset - segmentPosition) % segmentSize) == 0) { /* * ordinarily start a new data set, unless this is the @@ -471,7 +471,7 @@ static IOR_offset_t HDF5_Xfer(int access, aiori_fd_t *fd, IOR_size_t * buffer, SetupDataSet(fd, access == WRITE ? IOR_CREAT : IOR_RDWR, param); } - SeekOffset(fd, hints->offset, param); + SeekOffset(fd, offset, param); /* this is necessary to reset variables for reaccessing file */ startNewDataSet = FALSE; diff --git a/src/aiori-MMAP.c b/src/aiori-MMAP.c index 453bc3a..7ed3b90 100644 --- a/src/aiori-MMAP.c +++ b/src/aiori-MMAP.c @@ -29,7 +29,7 @@ static aiori_fd_t *MMAP_Create(char *, int flags, aiori_mod_opt_t *); static aiori_fd_t *MMAP_Open(char *, int flags, aiori_mod_opt_t *); static IOR_offset_t MMAP_Xfer(int, aiori_fd_t *, IOR_size_t *, - IOR_offset_t, aiori_mod_opt_t *); + IOR_offset_t, IOR_offset_t, aiori_mod_opt_t *); static void MMAP_Close(aiori_fd_t *, aiori_mod_opt_t *); static void MMAP_Fsync(aiori_fd_t *, aiori_mod_opt_t *); static option_help * MMAP_options(aiori_mod_opt_t ** init_backend_options, aiori_mod_opt_t * init_values); @@ -156,19 +156,19 @@ static aiori_fd_t *MMAP_Open(char *testFileName, int flags, aiori_mod_opt_t * pa * Write or read access to file using mmap */ static IOR_offset_t MMAP_Xfer(int access, aiori_fd_t *file, IOR_size_t * buffer, - IOR_offset_t length, aiori_mod_opt_t * param) + IOR_offset_t length, IOR_offset_t offset, aiori_mod_opt_t * param) { mmap_options_t *o = (mmap_options_t*) param; if (access == WRITE) { - memcpy(o->mmap_ptr + hints->offset, buffer, length); + memcpy(o->mmap_ptr + offset, buffer, length); } else { - memcpy(buffer, o->mmap_ptr + hints->offset, length); + memcpy(buffer, o->mmap_ptr + offset, length); } if (hints->fsyncPerWrite == TRUE) { - if (msync(o->mmap_ptr + hints->offset, length, MS_SYNC) != 0) + if (msync(o->mmap_ptr + offset, length, MS_SYNC) != 0) ERR("msync() failed"); - if (posix_madvise(o->mmap_ptr + hints->offset, length, + if (posix_madvise(o->mmap_ptr + offset, length, POSIX_MADV_DONTNEED) != 0) ERR("madvise() failed"); } diff --git a/src/aiori-MPIIO.c b/src/aiori-MPIIO.c index bc1b8b4..53eaad0 100755 --- a/src/aiori-MPIIO.c +++ b/src/aiori-MPIIO.c @@ -36,7 +36,7 @@ static IOR_offset_t SeekOffset(MPI_File, IOR_offset_t, aiori_mod_opt_t *); static aiori_fd_t *MPIIO_Create(char *, int iorflags, aiori_mod_opt_t *); static aiori_fd_t *MPIIO_Open(char *, int flags, aiori_mod_opt_t *); static IOR_offset_t MPIIO_Xfer(int, aiori_fd_t *, IOR_size_t *, - IOR_offset_t, aiori_mod_opt_t *); + IOR_offset_t, IOR_offset_t, aiori_mod_opt_t *); static void MPIIO_Close(aiori_fd_t *, aiori_mod_opt_t *); static char* MPIIO_GetVersion(); static void MPIIO_Fsync(aiori_fd_t *, aiori_mod_opt_t *); @@ -327,7 +327,7 @@ static aiori_fd_t *MPIIO_Open(char *testFileName, int flags, aiori_mod_opt_t * m * Write or read access to file using the MPIIO interface. */ static IOR_offset_t MPIIO_Xfer(int access, aiori_fd_t * fdp, IOR_size_t * buffer, - IOR_offset_t length, aiori_mod_opt_t * module_options) + IOR_offset_t length, IOR_offset_t offset, aiori_mod_opt_t * module_options) { /* NOTE: The second arg is (void *) for reads, and (const void *) for writes. Therefore, one of the two sets of assignments below @@ -386,7 +386,7 @@ static IOR_offset_t MPIIO_Xfer(int access, aiori_fd_t * fdp, IOR_size_t * buffer */ if (param->useFileView) { /* find offset in file */ - if (SeekOffset(mfd->fd, hints->offset, module_options) < + if (SeekOffset(mfd->fd, offset, module_options) < 0) { /* if unsuccessful */ length = -1; @@ -425,7 +425,7 @@ static IOR_offset_t MPIIO_Xfer(int access, aiori_fd_t * fdp, IOR_size_t * buffer if (param->useSharedFilePointer) { /* find offset in file */ if (SeekOffset - (mfd->fd, hints->offset, module_options) < 0) { + (mfd->fd, offset, module_options) < 0) { /* if unsuccessful */ length = -1; } else { @@ -444,13 +444,13 @@ static IOR_offset_t MPIIO_Xfer(int access, aiori_fd_t * fdp, IOR_size_t * buffer if (hints->collective) { /* explicit, collective call */ MPI_CHECK(Access_at_all - (mfd->fd, hints->offset, + (mfd->fd, offset, buffer, length, MPI_BYTE, &status), "cannot access explicit, collective"); } else { /* explicit, noncollective call */ MPI_CHECK(Access_at - (mfd->fd, hints->offset, + (mfd->fd, offset, buffer, length, MPI_BYTE, &status), "cannot access explicit, noncollective"); } diff --git a/src/aiori-POSIX.c b/src/aiori-POSIX.c index 35395f4..283a6ec 100755 --- a/src/aiori-POSIX.c +++ b/src/aiori-POSIX.c @@ -69,7 +69,7 @@ /**************************** P R O T O T Y P E S *****************************/ static IOR_offset_t POSIX_Xfer(int, aiori_fd_t *, IOR_size_t *, - IOR_offset_t, aiori_mod_opt_t *); + IOR_offset_t, IOR_offset_t, aiori_mod_opt_t *); static void POSIX_Fsync(aiori_fd_t *, aiori_mod_opt_t *); static void POSIX_Sync(aiori_mod_opt_t * ); static int POSIX_check_params(aiori_mod_opt_t * options); @@ -547,7 +547,7 @@ aiori_fd_t *POSIX_Open(char *testFileName, int flags, aiori_mod_opt_t * param) * Write or read access to file using the POSIX interface. */ static IOR_offset_t POSIX_Xfer(int access, aiori_fd_t *file, IOR_size_t * buffer, - IOR_offset_t length, aiori_mod_opt_t * param) + IOR_offset_t length, IOR_offset_t offset, aiori_mod_opt_t * param) { int xferRetries = 0; long long remaining = (long long)length; @@ -569,8 +569,8 @@ static IOR_offset_t POSIX_Xfer(int access, aiori_fd_t *file, IOR_size_t * buffer /* seek to offset */ - if (lseek64(fd, hints->offset, SEEK_SET) == -1) - ERRF("lseek64(%d, %lld, SEEK_SET) failed", fd, hints->offset); + if (lseek64(fd, offset, SEEK_SET) == -1) + ERRF("lseek64(%d, %lld, SEEK_SET) failed", fd, offset); while (remaining > 0) { /* write/read file */ @@ -579,7 +579,7 @@ static IOR_offset_t POSIX_Xfer(int access, aiori_fd_t *file, IOR_size_t * buffer fprintf(stdout, "task %d writing to offset %lld\n", rank, - hints->offset + length - remaining); + offset + length - remaining); } rc = write(fd, ptr, remaining); if (rc == -1) @@ -593,7 +593,7 @@ static IOR_offset_t POSIX_Xfer(int access, aiori_fd_t *file, IOR_size_t * buffer fprintf(stdout, "task %d reading from offset %lld\n", rank, - hints->offset + length - remaining); + offset + length - remaining); } rc = read(fd, ptr, remaining); if (rc == 0) @@ -609,7 +609,7 @@ static IOR_offset_t POSIX_Xfer(int access, aiori_fd_t *file, IOR_size_t * buffer rank, access == WRITE ? "write()" : "read()", rc, remaining, - hints->offset + length - remaining); + offset + length - remaining); if (hints->singleXferAttempt == TRUE) MPI_CHECK(MPI_Abort(MPI_COMM_WORLD, -1), "barrier error"); diff --git a/src/aiori.h b/src/aiori.h index bbd775d..37bc3c0 100755 --- a/src/aiori.h +++ b/src/aiori.h @@ -76,7 +76,6 @@ typedef struct aiori_xfer_hint_t{ IOR_offset_t segmentCount; /* number of segments (or HDF5 datasets) */ IOR_offset_t blockSize; /* contiguous bytes to write per task */ IOR_offset_t transferSize; /* size of transfer in bytes */ - IOR_offset_t offset; /* offset for read/write */ IOR_offset_t expectedAggFileSize; /* calculated aggregate file size */ int singleXferAttempt; /* do not retry transfer if incomplete */ } aiori_xfer_hint_t; @@ -100,8 +99,8 @@ typedef struct ior_aiori { Allow to set generic transfer options that shall be applied to any subsequent IO call. */ void (*xfer_hints)(aiori_xfer_hint_t * params); - IOR_offset_t (*xfer)(int, aiori_fd_t *, IOR_size_t *, - IOR_offset_t, aiori_mod_opt_t *); + IOR_offset_t (*xfer)(int access, aiori_fd_t *, IOR_size_t *, + IOR_offset_t size, IOR_offset_t offset, aiori_mod_opt_t *); void (*close)(aiori_fd_t *, aiori_mod_opt_t *); void (*delete)(char *, aiori_mod_opt_t *); char* (*get_version)(void); diff --git a/src/ior.c b/src/ior.c index 46f0056..0199f3f 100755 --- a/src/ior.c +++ b/src/ior.c @@ -70,7 +70,6 @@ static void ior_set_xfer_hints(IOR_param_t * p){ hints->segmentCount = p->segmentCount; hints->blockSize = p->blockSize; hints->transferSize = p->transferSize; - hints->offset = p->offset; hints->expectedAggFileSize = p->expectedAggFileSize; hints->singleXferAttempt = p->singleXferAttempt; @@ -385,7 +384,7 @@ CompareBuffers(void *expectedBuffer, if (verbose >= VERBOSE_3) { fprintf(out_logfile, "[%d] At file byte offset %lld, comparing %llu-byte transfer\n", - rank, test->offset, (long long)size); + rank, (long long) offset, (long long)size); } for (i = 0; i < length; i++) { if (testbuf[i] != goodbuf[i]) { @@ -394,7 +393,7 @@ CompareBuffers(void *expectedBuffer, fprintf(out_logfile, "[%d] At transfer buffer #%lld, index #%lld (file byte offset %lld):\n", rank, transferCount - 1, (long long)i, - test->offset + + (long long) offset + (IOR_size_t) (i * sizeof(IOR_size_t))); fprintf(out_logfile, "[%d] %s0x", rank, bufferLabel1); fprintf(out_logfile, "%016llx\n", goodbuf[i]); @@ -410,10 +409,10 @@ CompareBuffers(void *expectedBuffer, } } else if (verbose >= VERBOSE_5 && i % 4 == 0) { fprintf(out_logfile, - "[%d] PASSED offset = %lld bytes, transfer %lld\n", + "[%d] PASSED offset = %lu bytes, transfer %lld\n", rank, ((i * sizeof(unsigned long long)) + - test->offset), transferCount); + offset), transferCount); fprintf(out_logfile, "[%d] GOOD %s0x", rank, bufferLabel1); for (j = 0; j < 4; j++) fprintf(out_logfile, "%016llx ", goodbuf[i + j]); @@ -436,8 +435,8 @@ CompareBuffers(void *expectedBuffer, "%lld errors between buffer indices %lld and %lld.\n", (long long)errorCount, (long long)first, (long long)last); - fprintf(out_logfile, "[%d] File byte offset = %lld:\n", rank, - ((first * sizeof(unsigned long long)) + test->offset)); + fprintf(out_logfile, "[%d] File byte offset = %lu:\n", rank, + ((first * sizeof(unsigned long long)) + offset)); fprintf(out_logfile, "[%d] %s0x", rank, bufferLabel1); for (j = first; j < length && j < first + 4; j++) @@ -1808,16 +1807,16 @@ static IOR_offset_t WriteOrReadSingle(IOR_offset_t pairCnt, IOR_offset_t *offset void *checkBuffer = ioBuffers->checkBuffer; void *readCheckBuffer = ioBuffers->readCheckBuffer; - test->hints.offset = offsetArray[pairCnt]; // this looks inappropriate + IOR_offset_t offset = offsetArray[pairCnt]; // this looks inappropriate transfer = test->transferSize; if (access == WRITE) { /* fills each transfer with a unique pattern * containing the offset into the file */ if (test->storeFileOffset == TRUE) { - FillBuffer(buffer, test, test->offset, pretendRank); + FillBuffer(buffer, test, offset, pretendRank); } - amtXferred = backend->xfer(access, fd, buffer, transfer, test->backend_options); + amtXferred = backend->xfer(access, fd, buffer, transfer, offset, test->backend_options); if (amtXferred != transfer) ERR("cannot write to file"); if (test->fsyncPerWrite) @@ -1827,7 +1826,7 @@ static IOR_offset_t WriteOrReadSingle(IOR_offset_t pairCnt, IOR_offset_t *offset nanosleep( & wait, NULL); } } else if (access == READ) { - amtXferred = backend->xfer(access, fd, buffer, transfer, test->backend_options); + amtXferred = backend->xfer(access, fd, buffer, transfer, offset, test->backend_options); if (amtXferred != transfer) ERR("cannot read from file"); if (test->interIODelay > 0){ @@ -1838,10 +1837,10 @@ static IOR_offset_t WriteOrReadSingle(IOR_offset_t pairCnt, IOR_offset_t *offset memset(checkBuffer, 'a', transfer); if (test->storeFileOffset == TRUE) { - FillBuffer(readCheckBuffer, test, test->offset, pretendRank); + FillBuffer(readCheckBuffer, test, offset, pretendRank); } - amtXferred = backend->xfer(access, fd, checkBuffer, transfer, test->backend_options); + amtXferred = backend->xfer(access, fd, checkBuffer, transfer, offset, test->backend_options); if (amtXferred != transfer) ERR("cannot read from file write check"); (*transferCount)++; @@ -1851,12 +1850,12 @@ static IOR_offset_t WriteOrReadSingle(IOR_offset_t pairCnt, IOR_offset_t *offset } else if (access == READCHECK) { memset(checkBuffer, 'a', transfer); - amtXferred = backend->xfer(access, fd, checkBuffer, transfer, test->backend_options); + amtXferred = backend->xfer(access, fd, checkBuffer, transfer, offset, test->backend_options); if (amtXferred != transfer){ ERR("cannot read from file"); } if (test->storeFileOffset == TRUE) { - FillBuffer(readCheckBuffer, test, test->offset, pretendRank); + FillBuffer(readCheckBuffer, test, offset, pretendRank); } *errors += CompareBuffers(readCheckBuffer, checkBuffer, transfer, *transferCount, test, READCHECK); } diff --git a/src/ior.h b/src/ior.h index 9b1c464..202fffb 100755 --- a/src/ior.h +++ b/src/ior.h @@ -120,7 +120,6 @@ typedef struct IOR_offset_t segmentCount; /* number of segments (or HDF5 datasets) */ IOR_offset_t blockSize; /* contiguous bytes to write per task */ IOR_offset_t transferSize; /* size of transfer in bytes */ - IOR_offset_t offset; /* offset for read/write */ IOR_offset_t expectedAggFileSize; /* calculated aggregate file size */ int summary_every_test; /* flag to print summary every test, not just at end */ diff --git a/src/mdtest.c b/src/mdtest.c index 9ef91ef..3152f33 100644 --- a/src/mdtest.c +++ b/src/mdtest.c @@ -391,9 +391,8 @@ static void create_file (const char *path, uint64_t itemNum) { * According to Bill Loewe, writes are only done one time, so they are always at * offset 0 (zero). */ - hints.offset = 0; hints.fsyncPerWrite = sync_file; - if ( write_bytes != (size_t) backend->xfer (WRITE, aiori_fh, (IOR_size_t *) write_buffer, write_bytes, backend_options)) { + if ( write_bytes != (size_t) backend->xfer (WRITE, aiori_fh, (IOR_size_t *) write_buffer, write_bytes, 0, backend_options)) { FAIL("unable to write file %s", curr_item); } } @@ -716,7 +715,7 @@ void mdtest_read(int random, int dirs, const long dir_iter, char *path) { /* read file */ if (read_bytes > 0) { read_buffer[0] = 42; /* use a random value to ensure that the read_buffer is now different from the expected buffer and read isn't sometimes NOOP */ - if (read_bytes != (size_t) backend->xfer (READ, aiori_fh, (IOR_size_t *) read_buffer, read_bytes, backend_options)) { + if (read_bytes != (size_t) backend->xfer (READ, aiori_fh, (IOR_size_t *) read_buffer, read_bytes, 0, backend_options)) { FAIL("unable to read file %s", item); } if(verify_read){ From e08314f571e30766136cf9b18d4ccc2a15850bd1 Mon Sep 17 00:00:00 2001 From: Mohamad Chaarawi Date: Thu, 11 Jun 2020 17:26:58 +0000 Subject: [PATCH 51/52] update DFS and DAOS drivers to new aiori module interface. Signed-off-by: Mohamad Chaarawi --- src/aiori-DAOS.c | 200 ++++++++++++++++++++++----------------- src/aiori-DFS.c | 242 ++++++++++++++++++++++++++--------------------- 2 files changed, 248 insertions(+), 194 deletions(-) diff --git a/src/aiori-DAOS.c b/src/aiori-DAOS.c index 7f07f7c..c453b2e 100644 --- a/src/aiori-DAOS.c +++ b/src/aiori-DAOS.c @@ -24,15 +24,16 @@ #include #include +#include #include #include -#include "ior.h" #include "aiori.h" +#include "utilities.h" #include "iordef.h" /************************** O P T I O N S *****************************/ -struct daos_options{ +typedef struct { char *pool; char *svcl; char *group; @@ -40,49 +41,62 @@ struct daos_options{ int chunk_size; int destroy; char *oclass; -}; +} DAOS_options_t; -static struct daos_options o = { - .pool = NULL, - .svcl = NULL, - .group = NULL, - .cont = NULL, - .chunk_size = 1048576, - .destroy = 0, - .oclass = NULL, -}; +static option_help * DAOS_options(aiori_mod_opt_t ** init_backend_options, + aiori_mod_opt_t * init_values){ + DAOS_options_t * o = malloc(sizeof(DAOS_options_t)); -static option_help options [] = { - {0, "daos.pool", "pool uuid", OPTION_OPTIONAL_ARGUMENT, 's', &o.pool}, - {0, "daos.svcl", "pool SVCL", OPTION_OPTIONAL_ARGUMENT, 's', &o.svcl}, - {0, "daos.group", "server group", OPTION_OPTIONAL_ARGUMENT, 's', &o.group}, - {0, "daos.cont", "container uuid", OPTION_OPTIONAL_ARGUMENT, 's', &o.cont}, - {0, "daos.chunk_size", "chunk size", OPTION_OPTIONAL_ARGUMENT, 'd', &o.chunk_size}, - {0, "daos.destroy", "Destroy Container", OPTION_FLAG, 'd', &o.destroy}, - {0, "daos.oclass", "object class", OPTION_OPTIONAL_ARGUMENT, 's', &o.oclass}, - LAST_OPTION -}; + if (init_values != NULL) { + memcpy(o, init_values, sizeof(DAOS_options_t)); + } else { + memset(o, 0, sizeof(DAOS_options_t)); + /* initialize the options properly */ + o->chunk_size = 1048576; + } + + *init_backend_options = (aiori_mod_opt_t *) o; + + option_help h [] = { + {0, "daos.pool", "pool uuid", OPTION_OPTIONAL_ARGUMENT, 's', &o->pool}, + {0, "daos.svcl", "pool SVCL", OPTION_OPTIONAL_ARGUMENT, 's', &o->svcl}, + {0, "daos.group", "server group", OPTION_OPTIONAL_ARGUMENT, 's', &o->group}, + {0, "daos.cont", "container uuid", OPTION_OPTIONAL_ARGUMENT, 's', &o->cont}, + {0, "daos.chunk_size", "chunk size", OPTION_OPTIONAL_ARGUMENT, 'd', &o->chunk_size}, + {0, "daos.destroy", "Destroy Container", OPTION_FLAG, 'd', &o->destroy}, + {0, "daos.oclass", "object class", OPTION_OPTIONAL_ARGUMENT, 's', &o->oclass}, + LAST_OPTION + }; + + option_help * help = malloc(sizeof(h)); + memcpy(help, h, sizeof(h)); + return help; +} /**************************** P R O T O T Y P E S *****************************/ -static void DAOS_Init(); -static void DAOS_Fini(); -static void *DAOS_Create(char *, IOR_param_t *); -static void *DAOS_Open(char *, IOR_param_t *); -static int DAOS_Access(const char *, int, IOR_param_t *); -static IOR_offset_t DAOS_Xfer(int, void *, IOR_size_t *, - IOR_offset_t, IOR_param_t *); -static void DAOS_Close(void *, IOR_param_t *); -static void DAOS_Delete(char *, IOR_param_t *); +static void DAOS_Init(aiori_mod_opt_t *); +static void DAOS_Fini(aiori_mod_opt_t *); +static aiori_fd_t *DAOS_Create(char *, int, aiori_mod_opt_t *); +static aiori_fd_t *DAOS_Open(char *, int, aiori_mod_opt_t *); +static int DAOS_Access(const char *, int, aiori_mod_opt_t *); +static IOR_offset_t DAOS_Xfer(int, aiori_fd_t *, IOR_size_t *, IOR_offset_t, + IOR_offset_t, aiori_mod_opt_t *); +static void DAOS_Close(aiori_fd_t *, aiori_mod_opt_t *); +static void DAOS_Delete(char *, aiori_mod_opt_t *); static char* DAOS_GetVersion(); -static void DAOS_Fsync(void *, IOR_param_t *); -static IOR_offset_t DAOS_GetFileSize(IOR_param_t *, MPI_Comm, char *); +static void DAOS_Fsync(aiori_fd_t *, aiori_mod_opt_t *); +static IOR_offset_t DAOS_GetFileSize(aiori_mod_opt_t *, MPI_Comm, char *); static option_help * DAOS_options(); +static void DAOS_init_xfer_options(aiori_xfer_hint_t *); +static int DAOS_check_params(aiori_mod_opt_t *); /************************** D E C L A R A T I O N S ***************************/ ior_aiori_t daos_aiori = { .name = "DAOS", + .initialize = DAOS_Init, + .finalize = DAOS_Fini, .create = DAOS_Create, .open = DAOS_Open, .access = DAOS_Access, @@ -90,15 +104,17 @@ ior_aiori_t daos_aiori = { .close = DAOS_Close, .delete = DAOS_Delete, .get_version = DAOS_GetVersion, + .xfer_hints = DAOS_init_xfer_options, .fsync = DAOS_Fsync, .get_file_size = DAOS_GetFileSize, - .initialize = DAOS_Init, - .finalize = DAOS_Fini, - .get_options = DAOS_options, .statfs = aiori_posix_statfs, .mkdir = aiori_posix_mkdir, .rmdir = aiori_posix_rmdir, .stat = aiori_posix_stat, + .get_options = DAOS_options, + .xfer_hints = DAOS_init_xfer_options, + .check_params = DAOS_check_params, + .enable_mdtest = false, }; #define IOR_DAOS_MUR_SEED 0xDEAD10CC @@ -144,6 +160,22 @@ do { \ MPI_CHECK(MPI_Abort(MPI_COMM_WORLD, -1), "MPI_Abort() error"); \ } while (0) +static aiori_xfer_hint_t * hints = NULL; + +void DAOS_init_xfer_options(aiori_xfer_hint_t * params) +{ + hints = params; +} + +static int DAOS_check_params(aiori_mod_opt_t * options){ + DAOS_options_t *o = (DAOS_options_t *) options; + + if (o->pool == NULL || o->svcl == NULL || o->cont == NULL) + ERR("Invalid pool or container options\n"); + + return 0; +} + /* Distribute process 0's pool or container handle to others. */ static void HandleDistribute(daos_handle_t *handle, enum handleType type) @@ -202,29 +234,24 @@ HandleDistribute(daos_handle_t *handle, enum handleType type) free(global.iov_buf); } -static option_help * -DAOS_options() -{ - return options; -} - static void -DAOS_Init() +DAOS_Init(aiori_mod_opt_t * options) { + DAOS_options_t *o = (DAOS_options_t *)options; int rc; if (daos_initialized) return; - if (o.pool == NULL || o.svcl == NULL || o.cont == NULL) { + if (o->pool == NULL || o->svcl == NULL || o->cont == NULL) { GERR("Invalid DAOS pool/cont\n"); return; } - if (o.oclass) { - objectClass = daos_oclass_name2id(o.oclass); + if (o->oclass) { + objectClass = daos_oclass_name2id(o->oclass); if (objectClass == OC_UNKNOWN) - GERR("Invalid DAOS Object class %s\n", o.oclass); + GERR("Invalid DAOS Object class %s\n", o->oclass); } rc = daos_init(); @@ -237,25 +264,25 @@ DAOS_Init() static daos_pool_info_t po_info; static daos_cont_info_t co_info; - INFO(VERBOSE_1, "Connecting to pool %s", o.pool); + INFO(VERBOSE_1, "Connecting to pool %s", o->pool); - rc = uuid_parse(o.pool, uuid); - DCHECK(rc, "Failed to parse 'pool': %s", o.pool); + rc = uuid_parse(o->pool, uuid); + DCHECK(rc, "Failed to parse 'pool': %s", o->pool); - svcl = daos_rank_list_parse(o.svcl, ":"); + svcl = daos_rank_list_parse(o->svcl, ":"); if (svcl == NULL) ERR("Failed to allocate svcl"); - rc = daos_pool_connect(uuid, o.group, svcl, DAOS_PC_RW, + rc = daos_pool_connect(uuid, o->group, svcl, DAOS_PC_RW, &poh, &po_info, NULL); d_rank_list_free(svcl); - DCHECK(rc, "Failed to connect to pool %s", o.pool); + DCHECK(rc, "Failed to connect to pool %s", o->pool); - INFO(VERBOSE_1, "Create/Open Container %s", o.cont); + INFO(VERBOSE_1, "Create/Open Container %s", o->cont); uuid_clear(uuid); - rc = uuid_parse(o.cont, uuid); - DCHECK(rc, "Failed to parse 'cont': %s", o.cont); + rc = uuid_parse(o->cont, uuid); + DCHECK(rc, "Failed to parse 'cont': %s", o->cont); rc = daos_cont_open(poh, uuid, DAOS_COO_RW, &coh, &co_info, NULL); @@ -278,8 +305,9 @@ DAOS_Init() } static void -DAOS_Fini() +DAOS_Fini(aiori_mod_opt_t *options) { + DAOS_options_t *o = (DAOS_options_t *)options; int rc; if (!daos_initialized) @@ -288,18 +316,18 @@ DAOS_Fini() MPI_Barrier(MPI_COMM_WORLD); rc = daos_cont_close(coh, NULL); if (rc) { - DCHECK(rc, "Failed to close container %s (%d)", o.cont, rc); + DCHECK(rc, "Failed to close container %s (%d)", o->cont, rc); MPI_Abort(MPI_COMM_WORLD, -1); } MPI_Barrier(MPI_COMM_WORLD); - if (o.destroy) { + if (o->destroy) { if (rank == 0) { uuid_t uuid; double t1, t2; - INFO(VERBOSE_1, "Destroying DAOS Container %s", o.cont); - uuid_parse(o.cont, uuid); + INFO(VERBOSE_1, "Destroying DAOS Container %s", o->cont); + uuid_parse(o->cont, uuid); t1 = MPI_Wtime(); rc = daos_cont_destroy(poh, uuid, 1, NULL); t2 = MPI_Wtime(); @@ -310,7 +338,7 @@ DAOS_Fini() MPI_Bcast(&rc, 1, MPI_INT, 0, MPI_COMM_WORLD); if (rc) { if (rank == 0) - DCHECK(rc, "Failed to destroy container %s (%d)", o.cont, rc); + DCHECK(rc, "Failed to destroy container %s (%d)", o->cont, rc); MPI_Abort(MPI_COMM_WORLD, -1); } } @@ -319,7 +347,7 @@ DAOS_Fini() INFO(VERBOSE_1, "Disconnecting from DAOS POOL.."); rc = daos_pool_disconnect(poh, NULL); - DCHECK(rc, "Failed to disconnect from pool %s", o.pool); + DCHECK(rc, "Failed to disconnect from pool %s", o->pool); MPI_CHECK(MPI_Barrier(MPI_COMM_WORLD), "barrier error"); if (rank == 0) @@ -334,38 +362,38 @@ DAOS_Fini() static void gen_oid(const char *name, daos_obj_id_t *oid) { - oid->lo = d_hash_murmur64(name, strlen(name), IOR_DAOS_MUR_SEED); oid->hi = 0; daos_array_generate_id(oid, objectClass, true, 0); } -static void * -DAOS_Create(char *testFileName, IOR_param_t *param) +static aiori_fd_t * +DAOS_Create(char *testFileName, int flags, aiori_mod_opt_t *param) { + DAOS_options_t *o = (DAOS_options_t*) param; daos_obj_id_t oid; int rc; /** Convert file name into object ID */ gen_oid(testFileName, &oid); - + /** Create the array */ - if (param->filePerProc || rank == 0) { - rc = daos_array_create(coh, oid, DAOS_TX_NONE, 1, o.chunk_size, + if (hints->filePerProc || rank == 0) { + rc = daos_array_create(coh, oid, DAOS_TX_NONE, 1, o->chunk_size, &aoh, NULL); DCHECK(rc, "Failed to create array object\n"); } /** Distribute the array handle if not FPP */ - if (!param->filePerProc) + if (!hints->filePerProc) HandleDistribute(&aoh, ARRAY_HANDLE); - return &aoh; + return (aiori_fd_t*)(&aoh); } static int -DAOS_Access(const char *testFileName, int mode, IOR_param_t * param) +DAOS_Access(const char *testFileName, int mode, aiori_mod_opt_t * param) { daos_obj_id_t oid; daos_size_t cell_size, chunk_size; @@ -387,8 +415,8 @@ DAOS_Access(const char *testFileName, int mode, IOR_param_t * param) return rc; } -static void * -DAOS_Open(char *testFileName, IOR_param_t *param) +static aiori_fd_t * +DAOS_Open(char *testFileName, int flags, aiori_mod_opt_t *param) { daos_obj_id_t oid; @@ -396,7 +424,7 @@ DAOS_Open(char *testFileName, IOR_param_t *param) gen_oid(testFileName, &oid); /** Open the array */ - if (param->filePerProc || rank == 0) { + if (hints->filePerProc || rank == 0) { daos_size_t cell_size, chunk_size; int rc; @@ -409,15 +437,15 @@ DAOS_Open(char *testFileName, IOR_param_t *param) } /** Distribute the array handle if not FPP */ - if (!param->filePerProc) + if (!hints->filePerProc) HandleDistribute(&aoh, ARRAY_HANDLE); - return &aoh; + return (aiori_fd_t*)(&aoh); } static IOR_offset_t -DAOS_Xfer(int access, void *file, IOR_size_t *buffer, - IOR_offset_t length, IOR_param_t *param) +DAOS_Xfer(int access, aiori_fd_t *file, IOR_size_t *buffer, IOR_offset_t length, + IOR_offset_t off, aiori_mod_opt_t *param) { daos_array_iod_t iod; daos_range_t rg; @@ -428,7 +456,7 @@ DAOS_Xfer(int access, void *file, IOR_size_t *buffer, /** set array location */ iod.arr_nr = 1; rg.rg_len = length; - rg.rg_idx = param->offset; + rg.rg_idx = off; iod.arr_rgs = &rg; /** set memory location */ @@ -448,7 +476,7 @@ DAOS_Xfer(int access, void *file, IOR_size_t *buffer, } static void -DAOS_Close(void *file, IOR_param_t *param) +DAOS_Close(aiori_fd_t *file, aiori_mod_opt_t *param) { int rc; @@ -462,7 +490,7 @@ DAOS_Close(void *file, IOR_param_t *param) } static void -DAOS_Delete(char *testFileName, IOR_param_t *param) +DAOS_Delete(char *testFileName, aiori_mod_opt_t *param) { daos_obj_id_t oid; daos_size_t cell_size, chunk_size; @@ -500,13 +528,13 @@ DAOS_GetVersion() } static void -DAOS_Fsync(void *file, IOR_param_t *param) +DAOS_Fsync(aiori_fd_t *file, aiori_mod_opt_t *param) { return; } static IOR_offset_t -DAOS_GetFileSize(IOR_param_t *param, MPI_Comm testComm, char *testFileName) +DAOS_GetFileSize(aiori_mod_opt_t *param, MPI_Comm comm, char *testFileName) { daos_obj_id_t oid; daos_size_t size; @@ -519,7 +547,7 @@ DAOS_GetFileSize(IOR_param_t *param, MPI_Comm testComm, char *testFileName) gen_oid(testFileName, &oid); /** open the array to verify it exists */ - if (param->filePerProc || rank == 0) { + if (hints->filePerProc || rank == 0) { daos_size_t cell_size, chunk_size; rc = daos_array_open(coh, oid, DAOS_TX_NONE, DAOS_OO_RO, @@ -537,7 +565,7 @@ DAOS_GetFileSize(IOR_param_t *param, MPI_Comm testComm, char *testFileName) aoh.cookie = 0; } - if (!param->filePerProc) + if (!hints->filePerProc) MPI_Bcast(&size, 1, MPI_LONG, 0, MPI_COMM_WORLD); return size; diff --git a/src/aiori-DFS.c b/src/aiori-DFS.c index 6487488..7f8ab7a 100755 --- a/src/aiori-DFS.c +++ b/src/aiori-DFS.c @@ -27,15 +27,15 @@ #include #include +#include #include #include #include #include -#include "ior.h" -#include "iordef.h" #include "aiori.h" #include "utilities.h" +#include "iordef.h" dfs_t *dfs; static daos_handle_t poh, coh; @@ -56,7 +56,7 @@ enum handleType { }; /************************** O P T I O N S *****************************/ -struct dfs_options{ +typedef struct { char *pool; char *svcl; char *group; @@ -66,57 +66,69 @@ struct dfs_options{ char *dir_oclass; char *prefix; int destroy; -}; +} DFS_options_t; -static struct dfs_options o = { - .pool = NULL, - .svcl = NULL, - .group = NULL, - .cont = NULL, - .chunk_size = 1048576, - .oclass = NULL, - .dir_oclass = NULL, - .prefix = NULL, - .destroy = 0, -}; +static option_help * DFS_options(aiori_mod_opt_t ** init_backend_options, + aiori_mod_opt_t * init_values){ + DFS_options_t * o = malloc(sizeof(DFS_options_t)); -static option_help options [] = { - {0, "dfs.pool", "pool uuid", OPTION_OPTIONAL_ARGUMENT, 's', & o.pool}, - {0, "dfs.svcl", "pool SVCL", OPTION_OPTIONAL_ARGUMENT, 's', & o.svcl}, - {0, "dfs.group", "server group", OPTION_OPTIONAL_ARGUMENT, 's', & o.group}, - {0, "dfs.cont", "DFS container uuid", OPTION_OPTIONAL_ARGUMENT, 's', & o.cont}, - {0, "dfs.chunk_size", "chunk size", OPTION_OPTIONAL_ARGUMENT, 'd', &o.chunk_size}, - {0, "dfs.oclass", "object class", OPTION_OPTIONAL_ARGUMENT, 's', &o.oclass}, - {0, "dfs.dir_oclass", "directory object class", OPTION_OPTIONAL_ARGUMENT, 's', &o.dir_oclass}, - {0, "dfs.prefix", "mount prefix", OPTION_OPTIONAL_ARGUMENT, 's', & o.prefix}, - {0, "dfs.destroy", "Destroy DFS Container", OPTION_FLAG, 'd', &o.destroy}, - LAST_OPTION -}; + if (init_values != NULL) { + memcpy(o, init_values, sizeof(DFS_options_t)); + } else { + memset(o, 0, sizeof(DFS_options_t)); + /* initialize the options properly */ + o->chunk_size = 1048576; + } + + *init_backend_options = (aiori_mod_opt_t *) o; + + option_help h [] = { + {0, "dfs.pool", "pool uuid", OPTION_OPTIONAL_ARGUMENT, 's', &o->pool}, + {0, "dfs.svcl", "pool SVCL", OPTION_OPTIONAL_ARGUMENT, 's', &o->svcl}, + {0, "dfs.group", "server group", OPTION_OPTIONAL_ARGUMENT, 's', &o->group}, + {0, "dfs.cont", "DFS container uuid", OPTION_OPTIONAL_ARGUMENT, 's', &o->cont}, + {0, "dfs.chunk_size", "chunk size", OPTION_OPTIONAL_ARGUMENT, 'd', &o->chunk_size}, + {0, "dfs.oclass", "object class", OPTION_OPTIONAL_ARGUMENT, 's', &o->oclass}, + {0, "dfs.dir_oclass", "directory object class", OPTION_OPTIONAL_ARGUMENT, 's', + &o->dir_oclass}, + {0, "dfs.prefix", "mount prefix", OPTION_OPTIONAL_ARGUMENT, 's', &o->prefix}, + {0, "dfs.destroy", "Destroy DFS Container", OPTION_FLAG, 'd', &o->destroy}, + LAST_OPTION + }; + + option_help * help = malloc(sizeof(h)); + memcpy(help, h, sizeof(h)); + return help; +} /**************************** P R O T O T Y P E S *****************************/ -static void *DFS_Create(char *, IOR_param_t *); -static void *DFS_Open(char *, IOR_param_t *); -static IOR_offset_t DFS_Xfer(int, void *, IOR_size_t *, - IOR_offset_t, IOR_param_t *); -static void DFS_Close(void *, IOR_param_t *); -static void DFS_Delete(char *, IOR_param_t *); +static void DFS_Init(aiori_mod_opt_t *); +static void DFS_Finalize(aiori_mod_opt_t *); +static aiori_fd_t *DFS_Create(char *, int, aiori_mod_opt_t *); +static aiori_fd_t *DFS_Open(char *, int, aiori_mod_opt_t *); +static IOR_offset_t DFS_Xfer(int, aiori_fd_t *, IOR_size_t *, IOR_offset_t, + IOR_offset_t, aiori_mod_opt_t *); +static void DFS_Close(aiori_fd_t *, aiori_mod_opt_t *); +static void DFS_Delete(char *, aiori_mod_opt_t *); static char* DFS_GetVersion(); -static void DFS_Fsync(void *, IOR_param_t *); -static void DFS_Sync(IOR_param_t *); -static IOR_offset_t DFS_GetFileSize(IOR_param_t *, MPI_Comm, char *); -static int DFS_Statfs (const char *, ior_aiori_statfs_t *, IOR_param_t *); -static int DFS_Stat (const char *, struct stat *, IOR_param_t *); -static int DFS_Mkdir (const char *, mode_t, IOR_param_t *); -static int DFS_Rmdir (const char *, IOR_param_t *); -static int DFS_Access (const char *, int, IOR_param_t *); -static void DFS_Init(); -static void DFS_Finalize(); +static void DFS_Fsync(aiori_fd_t *, aiori_mod_opt_t *); +static void DFS_Sync(aiori_mod_opt_t *); +static IOR_offset_t DFS_GetFileSize(aiori_mod_opt_t *, MPI_Comm, char *); +static int DFS_Statfs (const char *, ior_aiori_statfs_t *, aiori_mod_opt_t *); +static int DFS_Stat (const char *, struct stat *, aiori_mod_opt_t *); +static int DFS_Mkdir (const char *, mode_t, aiori_mod_opt_t *); +static int DFS_Rmdir (const char *, aiori_mod_opt_t *); +static int DFS_Access (const char *, int, aiori_mod_opt_t *); static option_help * DFS_options(); +static void DFS_init_xfer_options(aiori_xfer_hint_t *); +static int DFS_check_params(aiori_mod_opt_t *); /************************** D E C L A R A T I O N S ***************************/ ior_aiori_t dfs_aiori = { .name = "DFS", + .initialize = DFS_Init, + .finalize = DFS_Finalize, .create = DFS_Create, .open = DFS_Open, .xfer = DFS_Xfer, @@ -126,14 +138,14 @@ ior_aiori_t dfs_aiori = { .fsync = DFS_Fsync, .sync = DFS_Sync, .get_file_size = DFS_GetFileSize, + .xfer_hints = DFS_init_xfer_options, .statfs = DFS_Statfs, .mkdir = DFS_Mkdir, .rmdir = DFS_Rmdir, .access = DFS_Access, .stat = DFS_Stat, - .initialize = DFS_Init, - .finalize = DFS_Finalize, .get_options = DFS_options, + .check_params = DFS_check_params, .enable_mdtest = true, }; @@ -165,6 +177,22 @@ do { \ MPI_CHECK(MPI_Abort(MPI_COMM_WORLD, -1), "MPI_Abort() error"); \ } while (0) +static aiori_xfer_hint_t * hints = NULL; + +void DFS_init_xfer_options(aiori_xfer_hint_t * params) +{ + hints = params; +} + +static int DFS_check_params(aiori_mod_opt_t * options){ + DFS_options_t *o = (DFS_options_t *) options; + + if (o->pool == NULL || o->svcl == NULL || o->cont == NULL) + ERR("Invalid pool or container options\n"); + + return 0; +} + static inline struct aiori_dir_hdl * hdl_obj(d_list_t *rlink) { @@ -378,27 +406,25 @@ lookup_insert_dir(const char *name, mode_t *mode) return hdl->oh; } -static option_help * DFS_options(){ - return options; -} - static void -DFS_Init() { +DFS_Init(aiori_mod_opt_t * options) +{ + DFS_options_t *o = (DFS_options_t *)options; int rc; - if (o.pool == NULL || o.svcl == NULL || o.cont == NULL) + if (o->pool == NULL || o->svcl == NULL || o->cont == NULL) ERR("Invalid pool or container options\n"); - if (o.oclass) { - objectClass = daos_oclass_name2id(o.oclass); + if (o->oclass) { + objectClass = daos_oclass_name2id(o->oclass); if (objectClass == OC_UNKNOWN) - GERR("Invalid DAOS object class %s\n", o.oclass); + GERR("Invalid DAOS object class %s\n", o->oclass); } - if (o.dir_oclass) { - dir_oclass = daos_oclass_name2id(o.dir_oclass); + if (o->dir_oclass) { + dir_oclass = daos_oclass_name2id(o->dir_oclass); if (dir_oclass == OC_UNKNOWN) - GERR("Invalid DAOS directory object class %s\n", o.dir_oclass); + GERR("Invalid DAOS directory object class %s\n", o->dir_oclass); } rc = daos_init(); @@ -413,21 +439,21 @@ DFS_Init() { daos_pool_info_t pool_info; daos_cont_info_t co_info; - rc = uuid_parse(o.pool, pool_uuid); - DCHECK(rc, "Failed to parse 'Pool uuid': %s", o.pool); + rc = uuid_parse(o->pool, pool_uuid); + DCHECK(rc, "Failed to parse 'Pool uuid': %s", o->pool); - rc = uuid_parse(o.cont, co_uuid); - DCHECK(rc, "Failed to parse 'Cont uuid': %s", o.cont); + rc = uuid_parse(o->cont, co_uuid); + DCHECK(rc, "Failed to parse 'Cont uuid': %s", o->cont); - svcl = daos_rank_list_parse(o.svcl, ":"); + svcl = daos_rank_list_parse(o->svcl, ":"); if (svcl == NULL) ERR("Failed to allocate svcl"); - INFO(VERBOSE_1, "Pool uuid = %s, SVCL = %s\n", o.pool, o.svcl); - INFO(VERBOSE_1, "DFS Container namespace uuid = %s\n", o.cont); + INFO(VERBOSE_1, "Pool uuid = %s, SVCL = %s\n", o->pool, o->svcl); + INFO(VERBOSE_1, "DFS Container namespace uuid = %s\n", o->cont); /** Connect to DAOS pool */ - rc = daos_pool_connect(pool_uuid, o.group, svcl, DAOS_PC_RW, + rc = daos_pool_connect(pool_uuid, o->group, svcl, DAOS_PC_RW, &poh, &pool_info, NULL); d_rank_list_free(svcl); DCHECK(rc, "Failed to connect to pool"); @@ -453,15 +479,16 @@ DFS_Init() { HandleDistribute(CONT_HANDLE); HandleDistribute(DFS_HANDLE); - if (o.prefix) { - rc = dfs_set_prefix(dfs, o.prefix); + if (o->prefix) { + rc = dfs_set_prefix(dfs, o->prefix); DCHECK(rc, "Failed to set DFS Prefix"); } } static void -DFS_Finalize() +DFS_Finalize(aiori_mod_opt_t *options) { + DFS_options_t *o = (DFS_options_t *)options; int rc; MPI_Barrier(MPI_COMM_WORLD); @@ -472,16 +499,16 @@ DFS_Finalize() MPI_Barrier(MPI_COMM_WORLD); rc = daos_cont_close(coh, NULL); - DCHECK(rc, "Failed to close container %s (%d)", o.cont, rc); + DCHECK(rc, "Failed to close container %s (%d)", o->cont, rc); MPI_Barrier(MPI_COMM_WORLD); - if (o.destroy) { + if (o->destroy) { if (rank == 0) { uuid_t uuid; double t1, t2; - INFO(VERBOSE_1, "Destorying DFS Container: %s\n", o.cont); - uuid_parse(o.cont, uuid); + INFO(VERBOSE_1, "Destorying DFS Container: %s\n", o->cont); + uuid_parse(o->cont, uuid); t1 = MPI_Wtime(); rc = daos_cont_destroy(poh, uuid, 1, NULL); t2 = MPI_Wtime(); @@ -492,7 +519,7 @@ DFS_Finalize() MPI_Bcast(&rc, 1, MPI_INT, 0, MPI_COMM_WORLD); if (rc) { if (rank == 0) - DCHECK(rc, "Failed to destroy container %s (%d)", o.cont, rc); + DCHECK(rc, "Failed to destroy container %s (%d)", o->cont, rc); MPI_Abort(MPI_COMM_WORLD, -1); } } @@ -515,17 +542,16 @@ DFS_Finalize() /* * Creat and open a file through the DFS interface. */ -static void * -DFS_Create(char *testFileName, IOR_param_t *param) +static aiori_fd_t * +DFS_Create(char *testFileName, int flags, aiori_mod_opt_t *param) { + DFS_options_t *o = (DFS_options_t*) param; char *name = NULL, *dir_name = NULL; dfs_obj_t *obj = NULL, *parent = NULL; - mode_t mode = 0644; + mode_t mode = 0664; int fd_oflag = 0; int rc; - assert(param); - rc = parse_filename(testFileName, &name, &dir_name); DCHECK(rc, "Failed to parse path %s", testFileName); assert(dir_name); @@ -535,20 +561,20 @@ DFS_Create(char *testFileName, IOR_param_t *param) if (parent == NULL) GERR("Failed to lookup parent dir"); - mode = S_IFREG | param->mode; - if (param->filePerProc || rank == 0) { + mode = S_IFREG | mode; + if (hints->filePerProc || rank == 0) { fd_oflag |= O_CREAT | O_RDWR | O_EXCL; rc = dfs_open(dfs, parent, name, mode, fd_oflag, - objectClass, o.chunk_size, NULL, &obj); + objectClass, o->chunk_size, NULL, &obj); DCHECK(rc, "dfs_open() of %s Failed", name); } - if (!param->filePerProc) { + if (!hints->filePerProc) { MPI_Barrier(MPI_COMM_WORLD); if (rank != 0) { fd_oflag |= O_RDWR; rc = dfs_open(dfs, parent, name, mode, fd_oflag, - objectClass, o.chunk_size, NULL, &obj); + objectClass, o->chunk_size, NULL, &obj); DCHECK(rc, "dfs_open() of %s Failed", name); } } @@ -558,27 +584,27 @@ DFS_Create(char *testFileName, IOR_param_t *param) if (dir_name) free(dir_name); - return ((void *)obj); + return (aiori_fd_t *)(obj); } /* * Open a file through the DFS interface. */ -static void * -DFS_Open(char *testFileName, IOR_param_t *param) +static aiori_fd_t * +DFS_Open(char *testFileName, int flags, aiori_mod_opt_t *param) { + DFS_options_t *o = (DFS_options_t*) param; char *name = NULL, *dir_name = NULL; dfs_obj_t *obj = NULL, *parent = NULL; - mode_t mode; - int rc; + mode_t mode = 0664; int fd_oflag = 0; + int rc; fd_oflag |= O_RDWR; - mode = S_IFREG | param->mode; + mode = S_IFREG | flags; rc = parse_filename(testFileName, &name, &dir_name); DCHECK(rc, "Failed to parse path %s", testFileName); - assert(dir_name); assert(name); @@ -587,7 +613,7 @@ DFS_Open(char *testFileName, IOR_param_t *param) GERR("Failed to lookup parent dir"); rc = dfs_open(dfs, parent, name, mode, fd_oflag, objectClass, - o.chunk_size, NULL, &obj); + o->chunk_size, NULL, &obj); DCHECK(rc, "dfs_open() of %s Failed", name); if (name) @@ -595,15 +621,15 @@ DFS_Open(char *testFileName, IOR_param_t *param) if (dir_name) free(dir_name); - return ((void *)obj); + return (aiori_fd_t *)(obj); } /* * Write or read access to file using the DFS interface. */ static IOR_offset_t -DFS_Xfer(int access, void *file, IOR_size_t *buffer, IOR_offset_t length, - IOR_param_t *param) +DFS_Xfer(int access, aiori_fd_t *file, IOR_size_t *buffer, IOR_offset_t length, + IOR_offset_t off, aiori_mod_opt_t *param) { int xferRetries = 0; long long remaining = (long long)length; @@ -626,20 +652,20 @@ DFS_Xfer(int access, void *file, IOR_size_t *buffer, IOR_offset_t length, /* write/read file */ if (access == WRITE) { - rc = dfs_write(dfs, obj, &sgl, param->offset, NULL); + rc = dfs_write(dfs, obj, &sgl, off, NULL); if (rc) { fprintf(stderr, "dfs_write() failed (%d)", rc); return -1; } ret = remaining; } else { - rc = dfs_read(dfs, obj, &sgl, param->offset, &ret, NULL); + rc = dfs_read(dfs, obj, &sgl, off, &ret, NULL); if (rc || ret == 0) fprintf(stderr, "dfs_read() failed(%d)", rc); } if (ret < remaining) { - if (param->singleXferAttempt == TRUE) + if (hints->singleXferAttempt == TRUE) exit(-1); if (xferRetries > MAX_RETRY) ERR("too many retries -- aborting"); @@ -659,7 +685,7 @@ DFS_Xfer(int access, void *file, IOR_size_t *buffer, IOR_offset_t length, * Perform fsync(). */ static void -DFS_Fsync(void *fd, IOR_param_t * param) +DFS_Fsync(aiori_fd_t *fd, aiori_mod_opt_t * param) { /* no cache in DFS, so this is a no-op currently */ dfs_sync(dfs); @@ -670,7 +696,7 @@ DFS_Fsync(void *fd, IOR_param_t * param) * Perform sync() on the dfs mount. */ static void -DFS_Sync(IOR_param_t * param) +DFS_Sync(aiori_mod_opt_t * param) { /* no cache in DFS, so this is a no-op currently */ dfs_sync(dfs); @@ -681,7 +707,7 @@ DFS_Sync(IOR_param_t * param) * Close a file through the DFS interface. */ static void -DFS_Close(void *fd, IOR_param_t * param) +DFS_Close(aiori_fd_t *fd, aiori_mod_opt_t * param) { dfs_release((dfs_obj_t *)fd); } @@ -690,7 +716,7 @@ DFS_Close(void *fd, IOR_param_t * param) * Delete a file through the DFS interface. */ static void -DFS_Delete(char *testFileName, IOR_param_t * param) +DFS_Delete(char *testFileName, aiori_mod_opt_t * param) { char *name = NULL, *dir_name = NULL; dfs_obj_t *parent = NULL; @@ -727,7 +753,7 @@ static char* DFS_GetVersion() * Use DFS stat() to return aggregate file size. */ static IOR_offset_t -DFS_GetFileSize(IOR_param_t * test, MPI_Comm comm, char *testFileName) +DFS_GetFileSize(aiori_mod_opt_t * test, MPI_Comm comm, char *testFileName) { dfs_obj_t *obj; daos_size_t fsize, tmpMin, tmpMax, tmpSum; @@ -745,7 +771,7 @@ DFS_GetFileSize(IOR_param_t * test, MPI_Comm comm, char *testFileName) dfs_release(obj); - if (test->filePerProc == TRUE) { + if (hints->filePerProc == TRUE) { MPI_CHECK(MPI_Allreduce(&fsize, &tmpSum, 1, MPI_LONG_LONG_INT, MPI_SUM, comm), "cannot total data moved"); @@ -770,13 +796,13 @@ DFS_GetFileSize(IOR_param_t * test, MPI_Comm comm, char *testFileName) } static int -DFS_Statfs(const char *path, ior_aiori_statfs_t *sfs, IOR_param_t * param) +DFS_Statfs(const char *path, ior_aiori_statfs_t *sfs, aiori_mod_opt_t * param) { return 0; } static int -DFS_Mkdir(const char *path, mode_t mode, IOR_param_t * param) +DFS_Mkdir(const char *path, mode_t mode, aiori_mod_opt_t * param) { dfs_obj_t *parent = NULL; char *name = NULL, *dir_name = NULL; @@ -804,7 +830,7 @@ DFS_Mkdir(const char *path, mode_t mode, IOR_param_t * param) } static int -DFS_Rmdir(const char *path, IOR_param_t * param) +DFS_Rmdir(const char *path, aiori_mod_opt_t * param) { dfs_obj_t *parent = NULL; char *name = NULL, *dir_name = NULL; @@ -833,7 +859,7 @@ DFS_Rmdir(const char *path, IOR_param_t * param) } static int -DFS_Access(const char *path, int mode, IOR_param_t * param) +DFS_Access(const char *path, int mode, aiori_mod_opt_t * param) { dfs_obj_t *obj = NULL; mode_t fmode; @@ -850,7 +876,7 @@ DFS_Access(const char *path, int mode, IOR_param_t * param) } static int -DFS_Stat(const char *path, struct stat *buf, IOR_param_t * param) +DFS_Stat(const char *path, struct stat *buf, aiori_mod_opt_t * param) { dfs_obj_t *parent = NULL; char *name = NULL, *dir_name = NULL; From c105d014b28ab681a9c356800f64e588843fd92a Mon Sep 17 00:00:00 2001 From: "Julian M. Kunkel" Date: Wed, 24 Jun 2020 09:23:01 +0100 Subject: [PATCH 52/52] Increased version number in preparation of a new release. --- META | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/META b/META index 782f846..4e3ed35 100755 --- a/META +++ b/META @@ -1,3 +1,3 @@ Package: ior -Version: 3.3.0+dev +Version: 3.4.0+dev Release: 0