From 110153cf3ab88b034c8b1d7b05121d38b4616a0a Mon Sep 17 00:00:00 2001 From: Jean-Yves VET Date: Mon, 11 Feb 2019 14:49:14 +0100 Subject: [PATCH] mdtest: Enable IME native interface This patch makes mdtest allow IME native interface. It also defines a generic way to enable mdtest with each backend. --- src/aiori-DUMMY.c | 37 +++++++++++++++++++------------------ src/aiori-IME.c | 1 + src/aiori-POSIX.c | 1 + src/aiori.c | 37 ++++++++++++++++++++++++++----------- src/aiori.h | 9 ++++++++- src/mdtest.c | 10 +++------- src/parse_options.c | 2 +- 7 files changed, 59 insertions(+), 38 deletions(-) diff --git a/src/aiori-DUMMY.c b/src/aiori-DUMMY.c index a378c2c..675a91b 100755 --- a/src/aiori-DUMMY.c +++ b/src/aiori-DUMMY.c @@ -138,22 +138,23 @@ static int DUMMY_stat (const char *path, struct stat *buf, IOR_param_t * param){ } ior_aiori_t dummy_aiori = { - "DUMMY", - NULL, - DUMMY_Create, - DUMMY_Open, - DUMMY_Xfer, - DUMMY_Close, - DUMMY_Delete, - DUMMY_getVersion, - DUMMY_Fsync, - DUMMY_GetFileSize, - DUMMY_statfs, - DUMMY_mkdir, - DUMMY_rmdir, - DUMMY_access, - DUMMY_stat, - NULL, - NULL, - DUMMY_options + .name = "DUMMY", + .name_legacy = NULL, + .create = DUMMY_Create, + .open = DUMMY_Open, + .xfer = DUMMY_Xfer, + .close = DUMMY_Close, + .delete = DUMMY_Delete, + .get_version = DUMMY_getVersion, + .fsync = DUMMY_Fsync, + .get_file_size = DUMMY_GetFileSize, + .statfs = DUMMY_statfs, + .mkdir = DUMMY_mkdir, + .rmdir = DUMMY_rmdir, + .access = DUMMY_access, + .stat = DUMMY_stat, + .initialize = NULL, + .finalize = NULL, + .get_options = DUMMY_options, + .enable_mdtest = true, }; diff --git a/src/aiori-IME.c b/src/aiori-IME.c index 95c48f2..ef7b3cf 100755 --- a/src/aiori-IME.c +++ b/src/aiori-IME.c @@ -79,6 +79,7 @@ ior_aiori_t ime_aiori = { .stat = IME_Stat, .initialize = IME_Initialize, .finalize = IME_Finalize, + .enable_mdtest = true, }; /***************************** F U N C T I O N S ******************************/ diff --git a/src/aiori-POSIX.c b/src/aiori-POSIX.c index 94d0a7e..ca7c4a2 100755 --- a/src/aiori-POSIX.c +++ b/src/aiori-POSIX.c @@ -90,6 +90,7 @@ ior_aiori_t posix_aiori = { .rmdir = aiori_posix_rmdir, .access = aiori_posix_access, .stat = aiori_posix_stat, + .enable_mdtest = true, }; /***************************** F U N C T I O N S ******************************/ diff --git a/src/aiori.c b/src/aiori.c index f483435..11f11b4 100644 --- a/src/aiori.c +++ b/src/aiori.c @@ -92,17 +92,32 @@ void airoi_parse_options(int argc, char ** argv, option_help * global_options){ free(opt.modules); } -void aiori_supported_apis(char * APIs, char * APIs_legacy){ - ior_aiori_t **tmp = available_aiori; - if(*tmp != NULL){ - APIs += sprintf(APIs, "%s", (*tmp)->name); - tmp++; - for (; *tmp != NULL; ++tmp) { - APIs += sprintf(APIs, "|%s", (*tmp)->name); - if ((*tmp)->name_legacy != NULL) - APIs_legacy += sprintf(APIs_legacy, "|%s", (*tmp)->name_legacy); - } - } +void aiori_supported_apis(char * APIs, char * APIs_legacy, enum bench_type type) +{ + ior_aiori_t **tmp = available_aiori; + char delimiter = ' '; + + while (*tmp != NULL) + { + if ((type == MDTEST) && !(*tmp)->enable_mdtest) + { + tmp++; + continue; + } + + if (delimiter == ' ') + { + APIs += sprintf(APIs, "%s", (*tmp)->name); + delimiter = '|'; + } + else + APIs += sprintf(APIs, "%c%s", delimiter, (*tmp)->name); + + if ((*tmp)->name_legacy != NULL) + APIs_legacy += sprintf(APIs_legacy, "%c%s", + delimiter, (*tmp)->name_legacy); + tmp++; + } } /** diff --git a/src/aiori.h b/src/aiori.h index 7fb013d..727af58 100755 --- a/src/aiori.h +++ b/src/aiori.h @@ -22,6 +22,7 @@ #endif /* not MPI_FILE_NULL */ #include +#include #include "ior.h" #include "iordef.h" /* IOR Definitions */ @@ -83,8 +84,14 @@ typedef struct ior_aiori { void (*initialize)(); /* called once per program before MPI is started */ void (*finalize)(); /* called once per program after MPI is shutdown */ option_help * (*get_options)(); + bool enable_mdtest; } ior_aiori_t; +enum bench_type { + IOR, + MDTEST +}; + extern ior_aiori_t dummy_aiori; extern ior_aiori_t hdf5_aiori; extern ior_aiori_t hdfs_aiori; @@ -102,7 +109,7 @@ 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); +void aiori_supported_apis(char * APIs, char * APIs_legacy, enum bench_type type); void airoi_parse_options(int argc, char ** argv, option_help * global_options); const char *aiori_default (void); diff --git a/src/mdtest.c b/src/mdtest.c index 6ae6838..8a81979 100644 --- a/src/mdtest.c +++ b/src/mdtest.c @@ -150,7 +150,7 @@ static mdtest_results_t * summary_table; static pid_t pid; static uid_t uid; -/* just use the POSIX backend for now */ +/* Use the POSIX backend by default */ static const char *backend_name = "POSIX"; static const ior_aiori_t *backend; @@ -1323,7 +1323,7 @@ void print_help (void) { char APIs[1024]; char APIs_legacy[1024]; - aiori_supported_apis(APIs, APIs_legacy); + aiori_supported_apis(APIs, APIs_legacy, MDTEST); char apiStr[1024]; sprintf(apiStr, "API for I/O [%s]", APIs); @@ -1573,10 +1573,6 @@ void valid_tests() { FAIL("-c not compatible with -B"); } - if (strcasecmp(backend_name, "POSIX") != 0 && strcasecmp(backend_name, "DUMMY") != 0) { - FAIL("-a only supported interface is POSIX (and DUMMY) right now!"); - } - /* check for shared file incompatibilities */ if (unique_dir_per_task && shared_file && rank == 0) { FAIL("-u not compatible with -S"); @@ -2131,7 +2127,7 @@ mdtest_results_t * mdtest_run(int argc, char **argv, MPI_Comm world_com, FILE * int randomize = 0; char APIs[1024]; char APIs_legacy[1024]; - aiori_supported_apis(APIs, APIs_legacy); + aiori_supported_apis(APIs, APIs_legacy, MDTEST); char apiStr[1024]; sprintf(apiStr, "API for I/O [%s]", APIs); diff --git a/src/parse_options.c b/src/parse_options.c index b265953..5a093b8 100755 --- a/src/parse_options.c +++ b/src/parse_options.c @@ -467,7 +467,7 @@ IOR_test_t *ParseCommandLine(int argc, char **argv) char APIs[1024]; char APIs_legacy[1024]; - aiori_supported_apis(APIs, APIs_legacy); + aiori_supported_apis(APIs, APIs_legacy, IOR); char apiStr[1024]; sprintf(apiStr, "API for I/O [%s]", APIs);