Skip to content

Commit fec0645

Browse files
JulianKunkelglennklockwood
authored andcommitted
Changed the parser.
The parser now supports concurrent parsing of all plugin options. Moved HDF5 collective_md option into the backend as an example. Example: ./src/ior -a dummy --dummy.delay-xfer=50000
1 parent efaa0c4 commit fec0645

File tree

11 files changed

+177
-186
lines changed

11 files changed

+177
-186
lines changed

doc/sphinx/userDoc/options.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,8 +289,9 @@ HDF5-ONLY
289289

290290
* setAlignment - HDF5 alignment in bytes (e.g.: 8, 4k, 2m, 1g) [1]
291291

292-
* collectiveMetadata - enable HDF5 collective metadata (available since
293-
HDF5-1.10.0)
292+
HDF5-backend options
293+
^^^^^^^^^^^^^^^^^^^^
294+
* -c | --collectiveMetadata - enable HDF5 collective metadata (available since HDF5-1.10.0)
294295

295296
MPIIO-, HDF5-, AND NCMPI-ONLY
296297
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

src/aiori-DUMMY.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ static struct dummy_options o = {
2929
};
3030

3131
static option_help options [] = {
32-
{'c', "delay-create", "Delay per create in usec", OPTION_OPTIONAL_ARGUMENT, 'l', & o.delay_creates},
33-
{'x', "delay-xfer", "Delay per xfer in usec", OPTION_OPTIONAL_ARGUMENT, 'l', & o.delay_xfer},
34-
{'z', "delay-only-rank0", "Delay only Rank0", OPTION_FLAG, 'd', & o.delay_rank_0_only},
32+
{0, "dummy.delay-create", "Delay per create in usec", OPTION_OPTIONAL_ARGUMENT, 'l', & o.delay_creates},
33+
{0, "dummy.delay-xfer", "Delay per xfer in usec", OPTION_OPTIONAL_ARGUMENT, 'l', & o.delay_xfer},
34+
{0, "dummy.delay-only-rank0", "Delay only Rank0", OPTION_FLAG, 'd', & o.delay_rank_0_only},
3535
LAST_OPTION
3636
};
3737

src/aiori-HDF5.c

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ static char* HDF5_GetVersion();
9393
static void HDF5_Fsync(void *, IOR_param_t *);
9494
static IOR_offset_t HDF5_GetFileSize(IOR_param_t *, MPI_Comm, char *);
9595
static int HDF5_Access(const char *, int, IOR_param_t *);
96+
static option_help * HDF5_get_options();
9697

9798
/************************** D E C L A R A T I O N S ***************************/
9899

@@ -111,6 +112,7 @@ ior_aiori_t hdf5_aiori = {
111112
.rmdir = aiori_posix_rmdir,
112113
.access = HDF5_Access,
113114
.stat = aiori_posix_stat,
115+
.get_options = HDF5_get_options
114116
};
115117

116118
static hid_t xferPropList; /* xfer property list */
@@ -120,8 +122,27 @@ hid_t fileDataSpace; /* file data space id */
120122
hid_t memDataSpace; /* memory data space id */
121123
int newlyOpenedFile; /* newly opened file */
122124

125+
/************************** O P T I O N S *****************************/
126+
struct HDF5_options{
127+
int collective_md;
128+
};
123129
/***************************** F U N C T I O N S ******************************/
124130

131+
132+
static struct HDF5_options o = {
133+
.collective_md = 0
134+
};
135+
136+
static option_help options [] = {
137+
{0, "hdf5.collectiveMetadata", "Use collectiveMetadata (available since HDF5-1.10.0)", OPTION_FLAG, 'd', & o.collective_md},
138+
LAST_OPTION
139+
};
140+
141+
static option_help * HDF5_get_options(){
142+
return options;
143+
}
144+
145+
125146
/*
126147
* Create and open a file through the HDF5 interface.
127148
*/
@@ -229,7 +250,7 @@ static void *HDF5_Open(char *testFileName, IOR_param_t * param)
229250
"cannot set alignment");
230251

231252
#ifdef HAVE_H5PSET_ALL_COLL_METADATA_OPS
232-
if (param->collective_md) {
253+
if (o.collective_md) {
233254
/* more scalable metadata */
234255

235256
HDF5_CHECK(H5Pset_all_coll_metadata_ops(accessPropList, 1),

src/aiori-RADOS.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ static struct rados_options o = {
4141
};
4242

4343
static option_help options [] = {
44-
{'u', "user", "Username for the RADOS cluster", OPTION_REQUIRED_ARGUMENT, 's', & o.user},
45-
{'c', "conf", "Config file for the RADOS cluster", OPTION_REQUIRED_ARGUMENT, 's', & o.conf},
46-
{'p', "pool", "RADOS pool to use for I/O", OPTION_REQUIRED_ARGUMENT, 's', & o.pool},
44+
{0, "rados.user", "Username for the RADOS cluster", OPTION_REQUIRED_ARGUMENT, 's', & o.user},
45+
{0, "rados.conf", "Config file for the RADOS cluster", OPTION_REQUIRED_ARGUMENT, 's', & o.conf},
46+
{0, "rados.pool", "RADOS pool to use for I/O", OPTION_REQUIRED_ARGUMENT, 's', & o.pool},
4747
LAST_OPTION
4848
};
4949

src/aiori.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,26 @@ ior_aiori_t *available_aiori[] = {
6161
NULL
6262
};
6363

64+
void airoi_parse_options(int argc, char ** argv, option_help * global_options){
65+
int airoi_c = aiori_count();
66+
options_all opt;
67+
opt.module_count = airoi_c + 1;
68+
opt.modules = malloc(sizeof(option_module) * (airoi_c + 1));
69+
opt.modules[0].prefix = NULL;
70+
opt.modules[0].options = global_options;
71+
ior_aiori_t **tmp = available_aiori;
72+
for (int i=1; *tmp != NULL; ++tmp, i++) {
73+
opt.modules[i].prefix = (*tmp)->name;
74+
if((*tmp)->get_options != NULL){
75+
opt.modules[i].options = (*tmp)->get_options();
76+
}else{
77+
opt.modules[i].options = NULL;
78+
}
79+
}
80+
option_parse(argc, argv, &opt);
81+
free(opt.modules);
82+
}
83+
6484
void aiori_supported_apis(char * APIs){
6585
ior_aiori_t **tmp = available_aiori;
6686
if(*tmp != NULL){

src/aiori.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ void aiori_finalize();
102102
const ior_aiori_t *aiori_select (const char *api);
103103
int aiori_count (void);
104104
void aiori_supported_apis(char * APIs);
105+
void airoi_parse_options(int argc, char ** argv, option_help * global_options);
105106
const char *aiori_default (void);
106107

107108
/* some generic POSIX-based backend calls */

src/ior.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@ typedef struct
175175
char* URI; /* "path" to target object */
176176
size_t part_number; /* multi-part upload increment (PER-RANK!) */
177177
char* UploadId; /* key for multi-part-uploads */
178-
int collective_md; /* use collective metatata optimization */
179178

180179
/* RADOS variables */
181180
rados_t rados_cluster; /* RADOS cluster handle */

src/mdtest.c

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2217,35 +2217,13 @@ mdtest_results_t * mdtest_run(int argc, char **argv, MPI_Comm world_com, FILE *
22172217
{'Z', NULL, "print time instead of rate", OPTION_FLAG, 'd', & print_time},
22182218
LAST_OPTION
22192219
};
2220-
int printhelp = 0;
2221-
int parsed_options = option_parse(argc, argv, options, & printhelp);
2220+
airoi_parse_options(argc, argv, options);
22222221

22232222
backend = aiori_select(backend_name);
22242223
if (NULL == backend) {
22252224
FAIL("Could not find suitable backend to use");
22262225
}
22272226

2228-
if(backend->get_options != NULL){
2229-
option_parse(argc - parsed_options, argv + parsed_options, backend->get_options(), & printhelp);
2230-
}
2231-
2232-
if(printhelp != 0){
2233-
printf("Usage: %s ", argv[0]);
2234-
2235-
option_print_help(options, 0);
2236-
2237-
if(backend->get_options != NULL){
2238-
printf("\nPlugin options for backend %s\n", backend_name);
2239-
option_print_help(backend->get_options(), 1);
2240-
}
2241-
if(printhelp == 1){
2242-
exit(0);
2243-
}else{
2244-
exit(1);
2245-
}
2246-
}
2247-
2248-
22492227
MPI_Comm_rank(testComm, &rank);
22502228
MPI_Comm_size(testComm, &size);
22512229

0 commit comments

Comments
 (0)