IOR
parse_options.c
Go to the documentation of this file.
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  */
4 /******************************************************************************\
5 * *
6 * Copyright (c) 2003, The Regents of the University of California *
7 * See the file COPYRIGHT for a complete copyright notice and license. *
8 * *
9 ********************************************************************************
10 *
11 * Parse commandline functions.
12 *
13 \******************************************************************************/
14 
15 #ifdef HAVE_CONFIG_H
16 #include "config.h"
17 #endif
18 
19 #include <stdio.h>
20 #include <stdlib.h>
21 #include <ctype.h>
22 #include <string.h>
23 
24 #if defined(HAVE_STRINGS_H)
25 #include <strings.h>
26 #endif
27 
28 #include "utilities.h"
29 #include "ior.h"
30 #include "aiori.h"
31 #include "parse_options.h"
32 #include "option.h"
33 #include "aiori.h"
34 
35 #define ISPOWEROFTWO(x) ((x != 0) && !(x & (x - 1)))
36 
38 
40 
41 
44 
45 
46 /*
47  * Check and correct all settings of each test in queue for correctness.
48  */
49 static void CheckRunSettings(IOR_test_t *tests)
50 {
51  IOR_test_t *ptr;
52  IOR_param_t *params;
53 
54  for (ptr = tests; ptr != NULL; ptr = ptr->next) {
55  params = &ptr->params;
56 
57  /* If no write/read/check action requested, set both write and read */
58  if (params->writeFile == FALSE
59  && params->readFile == FALSE
60  && params->checkWrite == FALSE
61  && params->checkRead == FALSE) {
62  params->readFile = TRUE;
63  params->writeFile = TRUE;
64  }
65 
66  /* If only read or write is requested, then fix the default
67  * openFlags to not be open RDWR. It matters in the case
68  * of HDFS, which doesn't support opening RDWR.
69  * (We assume int-valued params are exclusively 0 or 1.)
70  */
71  if ((params->openFlags & IOR_RDWR)
72  && ((params->readFile | params->checkRead | params->checkWrite)
73  ^ params->writeFile)) {
74 
75  params->openFlags &= ~(IOR_RDWR);
76  if (params->readFile | params->checkRead) {
77  params->openFlags |= IOR_RDONLY;
78  params->openFlags &= ~(IOR_CREAT|IOR_EXCL);
79  }
80  else
81  params->openFlags |= IOR_WRONLY;
82  }
83  }
84 }
85 
86 /*
87  * Set flags from commandline string/value pairs.
88  */
89 void DecodeDirective(char *line, IOR_param_t *params, options_all_t * module_options)
90 {
91  char option[MAX_STR];
92  char value[MAX_STR];
93  int rc;
94  int initialized;
95 
96  rc = sscanf(line, " %[^=# \t\r\n] = %[^# \t\r\n] ", option, value);
97  if (rc != 2 && rank == 0) {
98  fprintf(out_logfile, "Syntax error in configuration options: %s\n",
99  line);
100  MPI_CHECK(MPI_Initialized(&initialized), "MPI_Initialized() error");
101  if (initialized)
102  MPI_CHECK(MPI_Abort(MPI_COMM_WORLD, -1), "MPI_Abort() error");
103  else
104  exit(-1);
105  }
106  if (strcasecmp(option, "api") == 0) {
107  params->api = strdup(value);
108 
109  params->backend = aiori_select(params->api);
110  if (params->backend == NULL){
111  fprintf(out_logfile, "Could not load backend API %s\n", params->api);
112  exit(-1);
113  }
114  } else if (strcasecmp(option, "summaryFile") == 0) {
115  if (rank == 0){
116  out_resultfile = fopen(value, "w");
117  if (out_resultfile == NULL){
118  FAIL("Cannot open output file for writes!");
119  }
120  printf("Writing output to %s\n", value);
121  }
122  } else if (strcasecmp(option, "summaryFormat") == 0) {
123  if(strcasecmp(value, "default") == 0){
125  }else if(strcasecmp(value, "JSON") == 0){
127  }else if(strcasecmp(value, "CSV") == 0){
129  }else{
130  FAIL("Unknown summaryFormat");
131  }
132  } else if (strcasecmp(option, "refnum") == 0) {
133  params->referenceNumber = atoi(value);
134  } else if (strcasecmp(option, "debug") == 0) {
135  params->debug = strdup(value);
136  } else if (strcasecmp(option, "platform") == 0) {
137  params->platform = strdup(value);
138  } else if (strcasecmp(option, "testfile") == 0) {
139  params->testFileName = strdup(value);
140  } else if (strcasecmp(option, "hintsfilename") == 0) {
141  params->hintsFileName = strdup(value);
142  } else if (strcasecmp(option, "deadlineforstonewalling") == 0) {
143  params->deadlineForStonewalling = atoi(value);
144  } else if (strcasecmp(option, "stoneWallingWearOut") == 0) {
145  params->stoneWallingWearOut = atoi(value);
146  } else if (strcasecmp(option, "stoneWallingWearOutIterations") == 0) {
147  params->stoneWallingWearOutIterations = atoll(value);
148  } else if (strcasecmp(option, "stoneWallingStatusFile") == 0) {
149  params->stoneWallingStatusFile = strdup(value);
150  } else if (strcasecmp(option, "maxtimeduration") == 0) {
151  params->maxTimeDuration = atoi(value);
152  } else if (strcasecmp(option, "outlierthreshold") == 0) {
153  params->outlierThreshold = atoi(value);
154  } else if (strcasecmp(option, "numnodes") == 0) {
155  params->numNodes = atoi(value);
156  } else if (strcasecmp(option, "numtasks") == 0) {
157  params->numTasks = atoi(value);
158  } else if (strcasecmp(option, "numtasksonnode0") == 0) {
159  params->numTasksOnNode0 = atoi(value);
160  } else if (strcasecmp(option, "repetitions") == 0) {
161  params->repetitions = atoi(value);
162  } else if (strcasecmp(option, "intertestdelay") == 0) {
163  params->interTestDelay = atoi(value);
164  } else if (strcasecmp(option, "interiodelay") == 0) {
165  params->interIODelay = atoi(value);
166  } else if (strcasecmp(option, "readfile") == 0) {
167  params->readFile = atoi(value);
168  } else if (strcasecmp(option, "writefile") == 0) {
169  params->writeFile = atoi(value);
170  } else if (strcasecmp(option, "fileperproc") == 0) {
171  params->filePerProc = atoi(value);
172  } else if (strcasecmp(option, "taskpernodeoffset") == 0) {
173  params->taskPerNodeOffset = atoi(value);
174  } else if (strcasecmp(option, "reordertasksconstant") == 0) {
175  params->reorderTasks = atoi(value);
176  } else if (strcasecmp(option, "reordertasksrandom") == 0) {
177  params->reorderTasksRandom = atoi(value);
178  } else if (strcasecmp(option, "reordertasksrandomSeed") == 0) {
179  params->reorderTasksRandomSeed = atoi(value);
180  } else if (strcasecmp(option, "reordertasks") == 0) {
181  /* Backwards compatibility for the "reorderTasks" option.
182  MUST follow the other longer reordertasks checks. */
183  params->reorderTasks = atoi(value);
184  } else if (strcasecmp(option, "checkwrite") == 0) {
185  params->checkWrite = atoi(value);
186  } else if (strcasecmp(option, "checkread") == 0) {
187  params->checkRead = atoi(value);
188  } else if (strcasecmp(option, "keepfile") == 0) {
189  params->keepFile = atoi(value);
190  } else if (strcasecmp(option, "keepfilewitherror") == 0) {
191  params->keepFileWithError = atoi(value);
192  } else if (strcasecmp(option, "multiFile") == 0) {
193  params->multiFile = atoi(value);
194  } else if (strcasecmp(option, "quitonerror") == 0) {
195  params->quitOnError = atoi(value);
196  } else if (strcasecmp(option, "segmentcount") == 0) {
197  params->segmentCount = string_to_bytes(value);
198  } else if (strcasecmp(option, "blocksize") == 0) {
199  params->blockSize = string_to_bytes(value);
200  } else if (strcasecmp(option, "transfersize") == 0) {
201  params->transferSize = string_to_bytes(value);
202  } else if (strcasecmp(option, "setalignment") == 0) {
203  params->setAlignment = string_to_bytes(value);
204  } else if (strcasecmp(option, "singlexferattempt") == 0) {
205  params->singleXferAttempt = atoi(value);
206  } else if (strcasecmp(option, "individualdatasets") == 0) {
207  params->individualDataSets = atoi(value);
208  } else if (strcasecmp(option, "intraTestBarriers") == 0) {
209  params->intraTestBarriers = atoi(value);
210  } else if (strcasecmp(option, "nofill") == 0) {
211  params->noFill = atoi(value);
212  } else if (strcasecmp(option, "verbose") == 0) {
213  params->verbose = atoi(value);
214  } else if (strcasecmp(option, "settimestampsignature") == 0) {
215  params->setTimeStampSignature = atoi(value);
216  } else if (strcasecmp(option, "collective") == 0) {
217  params->collective = atoi(value);
218  } else if (strcasecmp(option, "preallocate") == 0) {
219  params->preallocate = atoi(value);
220  } else if (strcasecmp(option, "storefileoffset") == 0) {
221  params->storeFileOffset = atoi(value);
222  } else if (strcasecmp(option, "usefileview") == 0) {
223  params->useFileView = atoi(value);
224  } else if (strcasecmp(option, "usesharedfilepointer") == 0) {
225  params->useSharedFilePointer = atoi(value);
226  } else if (strcasecmp(option, "usestrideddatatype") == 0) {
227  params->useStridedDatatype = atoi(value);
228  } else if (strcasecmp(option, "showhints") == 0) {
229  params->showHints = atoi(value);
230  } else if (strcasecmp(option, "uniqueDir") == 0) {
231  params->uniqueDir = atoi(value);
232  } else if (strcasecmp(option, "useexistingtestfile") == 0) {
233  params->useExistingTestFile = atoi(value);
234  } else if (strcasecmp(option, "fsyncperwrite") == 0) {
235  params->fsyncPerWrite = atoi(value);
236  } else if (strcasecmp(option, "fsync") == 0) {
237  params->fsync = atoi(value);
238  } else if (strcasecmp(option, "randomoffset") == 0) {
239  params->randomOffset = atoi(value);
240  } else if (strcasecmp(option, "memoryPerTask") == 0) {
241  params->memoryPerTask = string_to_bytes(value);
242  params->memoryPerNode = 0;
243  } else if (strcasecmp(option, "memoryPerNode") == 0) {
244  params->memoryPerNode = NodeMemoryStringToBytes(value);
245  params->memoryPerTask = 0;
246  } else if (strcasecmp(option, "lustrestripecount") == 0) {
247 #ifndef HAVE_LUSTRE_LUSTRE_USER_H
248  ERR("ior was not compiled with Lustre support");
249 #endif
250  params->lustre_stripe_count = atoi(value);
251  params->lustre_set_striping = 1;
252  } else if (strcasecmp(option, "lustrestripesize") == 0) {
253 #ifndef HAVE_LUSTRE_LUSTRE_USER_H
254  ERR("ior was not compiled with Lustre support");
255 #endif
256  params->lustre_stripe_size = string_to_bytes(value);
257  params->lustre_set_striping = 1;
258  } else if (strcasecmp(option, "lustrestartost") == 0) {
259 #ifndef HAVE_LUSTRE_LUSTRE_USER_H
260  ERR("ior was not compiled with Lustre support");
261 #endif
262  params->lustre_start_ost = atoi(value);
263  params->lustre_set_striping = 1;
264  } else if (strcasecmp(option, "lustreignorelocks") == 0) {
265 #ifndef HAVE_LUSTRE_LUSTRE_USER_H
266  ERR("ior was not compiled with Lustre support");
267 #endif
268  params->lustre_ignore_locks = atoi(value);
269  } else if (strcasecmp(option, "gpfshintaccess") == 0) {
270 #ifndef HAVE_GPFS_FCNTL_H
271  ERR("ior was not compiled with GPFS hint support");
272 #endif
273  params->gpfs_hint_access = atoi(value);
274  } else if (strcasecmp(option, "gpfsreleasetoken") == 0) {
275 #ifndef HAVE_GPFS_FCNTL_H
276  ERR("ior was not compiled with GPFS hint support");
277 #endif
278  params->gpfs_release_token = atoi(value);
279  } else if (strcasecmp(option, "beegfsNumTargets") == 0) {
280 #ifndef HAVE_BEEGFS_BEEGFS_H
281  ERR("ior was not compiled with BeeGFS support");
282 #endif
283  params->beegfs_numTargets = atoi(value);
284  if (params->beegfs_numTargets < 1)
285  ERR("beegfsNumTargets must be >= 1");
286  } else if (strcasecmp(option, "beegfsChunkSize") == 0) {
287  #ifndef HAVE_BEEGFS_BEEGFS_H
288  ERR("ior was not compiled with BeeGFS support");
289  #endif
290  params->beegfs_chunkSize = string_to_bytes(value);
291  if (!ISPOWEROFTWO(params->beegfs_chunkSize) || params->beegfs_chunkSize < (1<<16))
292  ERR("beegfsChunkSize must be a power of two and >64k");
293  } else if (strcasecmp(option, "summaryalways") == 0) {
294  params->summary_every_test = atoi(value);
295  } else {
296  // backward compatibility for now
297  if (strcasecmp(option, "useo_direct") == 0) {
298  strcpy(option, "--posix.odirect");
299  }
300  int parsing_error = option_parse_key_value(option, value, module_options);
301  if(parsing_error){
302  if (rank == 0)
303  fprintf(out_logfile, "Unrecognized parameter \"%s\"\n",
304  option);
305  MPI_CHECK(MPI_Initialized(&initialized), "MPI_Initialized() error");
306  if (initialized)
307  MPI_CHECK(MPI_Abort(MPI_COMM_WORLD, -1), "MPI_Abort() error");
308  else
309  exit(-1);
310  }
311  }
312 }
313 
314 
315 /*
316  * Parse a single line, which may contain multiple comma-seperated directives
317  */
318 void ParseLine(char *line, IOR_param_t * test, options_all_t * module_options)
319 {
320  char *start, *end;
321 
322  char * newline = strdup(line);
323  start = newline;
324  do {
325  end = strchr(start, '#');
326  if (end != NULL){
327  *end = '\0';
328  end = NULL; // stop parsing after comment
329  }
330  end = strchr(start, ',');
331  if (end != NULL){
332  *end = '\0';
333  }
334  if(strlen(start) < 3){
335  fprintf(out_logfile, "Invalid option substring string: \"%s\" in \"%s\"\n", start, line);
336  exit(1);
337  }
338  DecodeDirective(start, test, module_options);
339  start = end + 1;
340  } while (end != NULL);
341  free(newline);
342 }
343 
344 
345 static void decodeDirectiveWrapper(char *line){
346  ParseLine(line, parameters, global_options);
347 }
348 
349 /*
350  * Determines if the string "haystack" contains only the string "needle", and
351  * possibly whitespace before and after needle. Function is case insensitive.
352  */
353 int contains_only(char *haystack, char *needle)
354 {
355  char *ptr, *end;
356 
357  end = haystack + strlen(haystack);
358  /* skip over leading shitspace */
359  for (ptr = haystack; ptr < end; ptr++) {
360  if (!isspace(*ptr))
361  break;
362  }
363  /* check for "needle" */
364  if (strncasecmp(ptr, needle, strlen(needle)) != 0)
365  return 0;
366  /* make sure the rest of the line is only whitspace as well */
367  for (ptr += strlen(needle); ptr < end; ptr++) {
368  if (!isspace(*ptr))
369  return 0;
370  }
371 
372  return 1;
373 }
374 
375 /*
376  * Read the configuration script, allocating and filling in the structure of
377  * global parameters.
378  */
379 IOR_test_t *ReadConfigScript(char *scriptName)
380 {
381  int test_num = 0;
382  int runflag = 0;
383  char linebuf[MAX_STR];
384  char empty[MAX_STR];
385  char *ptr;
386  FILE *file;
387  IOR_test_t *head = NULL;
388  IOR_test_t *tail = NULL;
389 
390  option_help ** option_p = & global_options->modules[0].options;
391 
392  /* Initialize the first test */
393  head = CreateTest(& initialTestParams, test_num++);
394  tail = head;
395  *option_p = createGlobalOptions(& ((IOR_test_t*) head)->params); /* The current options */
396 
397  /* open the script */
398  file = fopen(scriptName, "r");
399  if (file == NULL)
400  ERR("fopen() failed");
401 
402  /* search for the "IOR START" line */
403  while (fgets(linebuf, MAX_STR, file) != NULL) {
404  if (contains_only(linebuf, "ior start")) {
405  break;
406  }
407  }
408 
409  /* Iterate over a block of IOR commands */
410  while (fgets(linebuf, MAX_STR, file) != NULL) {
411  /* skip over leading whitespace */
412  ptr = linebuf;
413  while (isspace(*ptr))
414  ptr++;
415 
416  /* skip empty lines */
417  if (sscanf(ptr, "%s", empty) == -1)
418  continue;
419 
420  /* skip lines containing only comments */
421  if (sscanf(ptr, " #%s", empty) == 1)
422  continue;
423 
424  if (contains_only(ptr, "ior stop")) {
425  break;
426  } else if (contains_only(ptr, "run")) {
427  if (runflag) {
428  /* previous line was a "run" as well
429  create duplicate test */
430  tail->next = CreateTest(&tail->params, test_num++);
431  AllocResults(tail);
432  ((IOR_test_t*) tail)->params.backend_options = airoi_update_module_options(((IOR_test_t*) tail)->params.backend, global_options);
433 
434  tail = tail->next;
435  *option_p = createGlobalOptions(& ((IOR_test_t*) tail->next)->params);
436  }
437  runflag = 1;
438  } else if (runflag) {
439  /* If this directive was preceded by a "run" line, then
440  create and initialize a new test structure */
441  runflag = 0;
442  tail->next = CreateTest(&tail->params, test_num++);
443  *option_p = createGlobalOptions(& ((IOR_test_t*) tail->next)->params);
444  AllocResults(tail);
445  ((IOR_test_t*) tail)->params.backend_options = airoi_update_module_options(((IOR_test_t*) tail)->params.backend, global_options);
446 
447  tail = tail->next;
448  ParseLine(ptr, &tail->params, global_options);
449  } else {
450  ParseLine(ptr, &tail->params, global_options);
451  }
452  }
453 
454  /* close the script */
455  if (fclose(file) != 0)
456  ERR("fclose() of script file failed");
457  AllocResults(tail); /* copy the actual module options into the test */
458  ((IOR_test_t*) tail)->params.backend_options = airoi_update_module_options(((IOR_test_t*) tail)->params.backend, global_options);
459 
460  return head;
461 }
462 
463 
465  char APIs[1024];
466  char APIs_legacy[1024];
467  aiori_supported_apis(APIs, APIs_legacy, IOR);
468  char apiStr[1024];
469  sprintf(apiStr, "API for I/O [%s]", APIs);
470 
471  option_help o [] = {
472  {'a', NULL, apiStr, OPTION_OPTIONAL_ARGUMENT, 's', & params->api},
473  {'A', NULL, "refNum -- user supplied reference number to include in the summary", OPTION_OPTIONAL_ARGUMENT, 'd', & params->referenceNumber},
474  {'b', NULL, "blockSize -- contiguous bytes to write per task (e.g.: 8, 4k, 2m, 1g)", OPTION_OPTIONAL_ARGUMENT, 'l', & params->blockSize},
475  {'c', NULL, "collective -- collective I/O", OPTION_FLAG, 'd', & params->collective},
476  {'C', NULL, "reorderTasks -- changes task ordering for readback (useful to avoid client cache)", OPTION_FLAG, 'd', & params->reorderTasks},
477  {'d', NULL, "interTestDelay -- delay between reps in seconds", OPTION_OPTIONAL_ARGUMENT, 'd', & params->interTestDelay},
478  {'D', NULL, "deadlineForStonewalling -- seconds before stopping write or read phase", OPTION_OPTIONAL_ARGUMENT, 'd', & params->deadlineForStonewalling},
479  {.help=" -O stoneWallingWearOut=1 -- once the stonewalling timout is over, all process finish to access the amount of data", .arg = OPTION_OPTIONAL_ARGUMENT},
480  {.help=" -O stoneWallingWearOutIterations=N -- stop after processing this number of iterations, needed for reading data back written with stoneWallingWearOut", .arg = OPTION_OPTIONAL_ARGUMENT},
481  {.help=" -O stoneWallingStatusFile=FILE -- this file keeps the number of iterations from stonewalling during write and allows to use them for read", .arg = OPTION_OPTIONAL_ARGUMENT},
482  {'e', NULL, "fsync -- perform a fsync() operation at the end of each read/write phase", OPTION_FLAG, 'd', & params->fsync},
483  {'E', NULL, "useExistingTestFile -- do not remove test file before write access", OPTION_FLAG, 'd', & params->useExistingTestFile},
484  {'f', NULL, "scriptFile -- test script name", OPTION_OPTIONAL_ARGUMENT, 's', & params->testscripts},
485  {'F', NULL, "filePerProc -- file-per-process", OPTION_FLAG, 'd', & params->filePerProc},
486  {'g', NULL, "intraTestBarriers -- use barriers between open, write/read, and close", OPTION_FLAG, 'd', & params->intraTestBarriers},
487  /* This option toggles between Incompressible Seed and Time stamp sig based on -l,
488  * so we'll toss the value in both for now, and sort it out in initialization
489  * after all the arguments are in and we know which it keep.
490  */
491  {'G', NULL, "setTimeStampSignature -- set value for time stamp signature/random seed", OPTION_OPTIONAL_ARGUMENT, 'd', & params->setTimeStampSignature},
492  {'H', NULL, "showHints -- show hints", OPTION_FLAG, 'd', & params->showHints},
493  {'i', NULL, "repetitions -- number of repetitions of test", OPTION_OPTIONAL_ARGUMENT, 'd', & params->repetitions},
494  {'I', NULL, "individualDataSets -- datasets not shared by all procs [not working]", OPTION_FLAG, 'd', & params->individualDataSets},
495  {'j', NULL, "outlierThreshold -- warn on outlier N seconds from mean", OPTION_OPTIONAL_ARGUMENT, 'd', & params->outlierThreshold},
496  {'J', NULL, "setAlignment -- HDF5 alignment in bytes (e.g.: 8, 4k, 2m, 1g)", OPTION_OPTIONAL_ARGUMENT, 'd', & params->setAlignment},
497  {'k', NULL, "keepFile -- don't remove the test file(s) on program exit", OPTION_FLAG, 'd', & params->keepFile},
498  {'K', NULL, "keepFileWithError -- keep error-filled file(s) after data-checking", OPTION_FLAG, 'd', & params->keepFileWithError},
499  {'l', NULL, "datapacket type-- type of packet that will be created [offset|incompressible|timestamp|o|i|t]", OPTION_OPTIONAL_ARGUMENT, 's', & params->buffer_type},
500  {'m', NULL, "multiFile -- use number of reps (-i) for multiple file count", OPTION_FLAG, 'd', & params->multiFile},
501  {'M', NULL, "memoryPerNode -- hog memory on the node (e.g.: 2g, 75%)", OPTION_OPTIONAL_ARGUMENT, 's', & params->memoryPerNodeStr},
502  {'n', NULL, "noFill -- no fill in HDF5 file creation", OPTION_FLAG, 'd', & params->noFill},
503  {'N', NULL, "numTasks -- number of tasks that are participating in the test (overrides MPI)", OPTION_OPTIONAL_ARGUMENT, 'd', & params->numTasks},
504  {'o', NULL, "testFile -- full name for test", OPTION_OPTIONAL_ARGUMENT, 's', & params->testFileName},
505  {'O', NULL, "string of IOR directives (e.g. -O checkRead=1,lustreStripeCount=32)", OPTION_OPTIONAL_ARGUMENT, 'p', & decodeDirectiveWrapper},
506  {'p', NULL, "preallocate -- preallocate file size", OPTION_FLAG, 'd', & params->preallocate},
507  {'P', NULL, "useSharedFilePointer -- use shared file pointer [not working]", OPTION_FLAG, 'd', & params->useSharedFilePointer},
508  {'q', NULL, "quitOnError -- during file error-checking, abort on error", OPTION_FLAG, 'd', & params->quitOnError},
509  {'Q', NULL, "taskPerNodeOffset for read tests use with -C & -Z options (-C constant N, -Z at least N)", OPTION_OPTIONAL_ARGUMENT, 'd', & params->taskPerNodeOffset},
510  {'r', NULL, "readFile -- read existing file", OPTION_FLAG, 'd', & params->readFile},
511  {'R', NULL, "checkRead -- verify that the output of read matches the expected signature (used with -G)", OPTION_FLAG, 'd', & params->checkRead},
512  {'s', NULL, "segmentCount -- number of segments", OPTION_OPTIONAL_ARGUMENT, 'd', & params->segmentCount},
513  {'S', NULL, "useStridedDatatype -- put strided access into datatype [not working]", OPTION_FLAG, 'd', & params->useStridedDatatype},
514  {'t', NULL, "transferSize -- size of transfer in bytes (e.g.: 8, 4k, 2m, 1g)", OPTION_OPTIONAL_ARGUMENT, 'l', & params->transferSize},
515  {'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},
516  {'u', NULL, "uniqueDir -- use unique directory name for each file-per-process", OPTION_FLAG, 'd', & params->uniqueDir},
517  {'U', NULL, "hintsFileName -- full name for hints file", OPTION_OPTIONAL_ARGUMENT, 's', & params->hintsFileName},
518  {'v', NULL, "verbose -- output information (repeating flag increases level)", OPTION_FLAG, 'd', & params->verbose},
519  {'V', NULL, "useFileView -- use MPI_File_set_view", OPTION_FLAG, 'd', & params->useFileView},
520  {'w', NULL, "writeFile -- write file", OPTION_FLAG, 'd', & params->writeFile},
521  {'W', NULL, "checkWrite -- check read after write", OPTION_FLAG, 'd', & params->checkWrite},
522  {'x', NULL, "singleXferAttempt -- do not retry transfer if incomplete", OPTION_FLAG, 'd', & params->singleXferAttempt},
523  {'X', NULL, "reorderTasksRandomSeed -- random seed for -Z option", OPTION_OPTIONAL_ARGUMENT, 'd', & params->reorderTasksRandomSeed},
524  {'Y', NULL, "fsyncPerWrite -- perform sync operation after every write operation", OPTION_FLAG, 'd', & params->fsyncPerWrite},
525  {'z', NULL, "randomOffset -- access is to random, not sequential, offsets within a file", OPTION_FLAG, 'd', & params->randomOffset},
526  {'Z', NULL, "reorderTasksRandom -- changes task ordering to random ordering for readback", OPTION_FLAG, 'd', & params->reorderTasksRandom},
527  {.help=" -O summaryFile=FILE -- store result data into this file", .arg = OPTION_OPTIONAL_ARGUMENT},
528  {.help=" -O summaryFormat=[default,JSON,CSV] -- use the format for outputing the summary", .arg = OPTION_OPTIONAL_ARGUMENT},
529  {0, "dryRun", "do not perform any I/Os just run evtl. inputs print dummy output", OPTION_FLAG, 'd', & params->dryRun},
530  LAST_OPTION,
531  };
532  option_help * options = malloc(sizeof(o));
533  memcpy(options, & o, sizeof(o));
534  return options;
535 }
536 
537 
538 /*
539  * Parse Commandline.
540  */
541 IOR_test_t *ParseCommandLine(int argc, char **argv)
542 {
543  init_IOR_Param_t(& initialTestParams);
544 
545  IOR_test_t *tests = NULL;
546 
547  initialTestParams.platform = GetPlatformName();
548 
549  option_help * options = createGlobalOptions( & initialTestParams);
550  parameters = & initialTestParams;
551  global_options = airoi_create_all_module_options(options);
552  option_parse(argc, argv, global_options);
553  updateParsedOptions(& initialTestParams, global_options);
554 
555  if (initialTestParams.testscripts){
556  tests = ReadConfigScript(initialTestParams.testscripts);
557  }else{
558  tests = CreateTest(&initialTestParams, 0);
559  AllocResults(tests);
560  }
561 
562  CheckRunSettings(tests);
563 
564  return (tests);
565 }
option_module * modules
Definition: option.h:34
int reorderTasks
Definition: ior.h:112
int uniqueDir
Definition: ior.h:134
int lustre_stripe_count
Definition: ior.h:195
IOR_offset_t setAlignment
Definition: ior.h:173
int quitOnError
Definition: ior.h:121
int reorderTasksRandomSeed
Definition: ior.h:115
int showHints
Definition: ior.h:132
static void CheckRunSettings(IOR_test_t *tests)
Definition: parse_options.c:49
int lustre_stripe_size
Definition: ior.h:196
int multiFile
Definition: ior.h:105
#define ERR(MSG)
Definition: iordef.h:184
#define LAST_OPTION
Definition: option.h:37
char * GetPlatformName()
Definition: ior.c:664
void * airoi_update_module_options(const ior_aiori_t *backend, options_all_t *opt)
Definition: aiori.c:85
int filePerProc
Definition: ior.h:111
int option_parse(int argc, char **argv, options_all_t *opt_all)
Definition: option.c:376
int noFill
Definition: ior.h:172
int repetitions
Definition: ior.h:103
IOR_offset_t segmentCount
Definition: ior.h:123
int useStridedDatatype
Definition: ior.h:131
CURLcode rc
Definition: aiori-S3.c:121
int keepFile
Definition: ior.h:118
int contains_only(char *haystack, char *needle)
int checkRead
Definition: ior.h:117
enum OutputFormat_t outputFormat
Definition: utilities.c:64
int useSharedFilePointer
Definition: ior.h:130
int numTasksOnNode0
Definition: ior.h:101
IOR_offset_t transferSize
Definition: ior.h:125
size_t memoryPerNode
Definition: ior.h:152
IOR_param_t params
Definition: ior.h:235
int gpfs_release_token
Definition: ior.h:203
IOR_param_t initialTestParams
Definition: parse_options.c:37
int storeFileOffset
Definition: ior.h:136
int summary_every_test
Definition: ior.h:133
int numNodes
Definition: ior.h:100
int setTimeStampSignature
Definition: ior.h:145
#define IOR_RDONLY
Definition: aiori.h:34
unsigned int openFlags
Definition: ior.h:88
int fsyncPerWrite
Definition: ior.h:162
int interTestDelay
Definition: ior.h:106
int lustre_start_ost
Definition: ior.h:197
int maxTimeDuration
Definition: ior.h:142
char * testFileName
Definition: ior.h:93
char * stoneWallingStatusFile
Definition: ior.h:140
option_help * createGlobalOptions(IOR_param_t *params)
int taskPerNodeOffset
Definition: ior.h:113
#define IOR_CREAT
Definition: aiori.h:38
const ior_aiori_t * aiori_select(const char *api)
Definition: aiori.c:291
#define IOR_EXCL
Definition: aiori.h:40
int fsync
Definition: ior.h:163
char * hintsFileName
Definition: ior.h:95
struct IOR_test_t * next
Definition: ior.h:237
char * testscripts
Definition: ior.h:154
int outlierThreshold
Definition: ior.h:143
int intraTestBarriers
Definition: ior.h:210
int reorderTasksRandom
Definition: ior.h:114
static option_help options[]
Definition: aiori-CEPHFS.c:54
int checkWrite
Definition: ior.h:116
Definition: aiori.h:94
int verbose
Definition: ior.h:144
#define MPI_CHECK(MPI_STATUS, MSG)
Definition: iordef.h:224
void updateParsedOptions(IOR_param_t *options, options_all_t *global_options)
Definition: utilities.c:121
int dryRun
Definition: ior.h:98
char * platform
Definition: ior.h:92
int singleXferAttempt
Definition: ior.h:161
#define FAIL(...)
Definition: utilities.h:42
int interIODelay
Definition: ior.h:107
FILE * out_resultfile
Definition: utilities.c:63
options_all_t * airoi_create_all_module_options(option_help *global_options)
Definition: aiori.c:99
int option_parse_key_value(char *key, char *val, options_all_t *opt_all)
Definition: option.c:364
void aiori_supported_apis(char *APIs, char *APIs_legacy, enum bench_type type)
Definition: aiori.c:118
int stoneWallingWearOut
Definition: ior.h:138
IOR_test_t * CreateTest(IOR_param_t *init_params, int test_num)
Definition: ior.c:530
void ParseLine(char *line, IOR_param_t *test, options_all_t *module_options)
#define IOR_WRONLY
Definition: aiori.h:35
int keepFileWithError
Definition: ior.h:119
#define FALSE
Definition: iordef.h:71
int useExistingTestFile
Definition: ior.h:135
int beegfs_numTargets
Definition: ior.h:206
void init_IOR_Param_t(IOR_param_t *p)
Definition: ior.c:175
static options_all_t * global_options
Definition: parse_options.c:43
int useFileView
Definition: ior.h:129
int readFile
Definition: ior.h:109
int randomOffset
Definition: ior.h:150
char * buffer_type
Definition: ior.h:155
int numTasks
Definition: ior.h:99
size_t memoryPerTask
Definition: ior.h:151
int referenceNumber
Definition: ior.h:89
int lustre_ignore_locks
Definition: ior.h:199
int individualDataSets
Definition: ior.h:171
int writeFile
Definition: ior.h:110
int64_t string_to_bytes(char *size_str)
Definition: option.c:13
void DecodeDirective(char *line, IOR_param_t *params, options_all_t *module_options)
Definition: parse_options.c:89
uint64_t stoneWallingWearOutIterations
Definition: ior.h:139
#define MAX_STR
Definition: iordef.h:108
int collective
Definition: ior.h:122
static void decodeDirectiveWrapper(char *line)
option_help * options
Definition: option.h:28
IOR_test_t * ReadConfigScript(char *scriptName)
const struct ior_aiori * backend
Definition: ior.h:85
static IOR_param_t * parameters
Definition: parse_options.c:42
#define IOR_RDWR
Definition: aiori.h:36
char * debug
Definition: ior.h:86
IOR_test_t * ParseCommandLine(int argc, char **argv)
int preallocate
Definition: ior.h:128
int deadlineForStonewalling
Definition: ior.h:137
char * api
Definition: ior.h:90
#define ISPOWEROFTWO(x)
Definition: parse_options.c:35
size_t NodeMemoryStringToBytes(char *size_str)
Definition: utilities.c:89
char * memoryPerNodeStr
Definition: ior.h:153
FILE * out_logfile
Definition: utilities.c:62
int rank
Definition: utilities.c:57
int gpfs_hint_access
Definition: ior.h:202
IOR_offset_t blockSize
Definition: ior.h:124
#define TRUE
Definition: iordef.h:75
int lustre_set_striping
Definition: ior.h:198
static struct cephfs_options o
Definition: aiori-CEPHFS.c:48
int beegfs_chunkSize
Definition: ior.h:207
#define NULL
Definition: iordef.h:79
void AllocResults(IOR_test_t *test)
Definition: ior.c:509