13 #define _XOPEN_SOURCE 700
24 #include "getopt_long.h"
29 #include "partest_opts.h"
36 options->bluegene = 0;
37 options->bluegene_np = 0;
38 options->bluegene_sort = 0;
39 options->bufsize = 10 MB;
40 options->totalsize = 20 MB;
41 options->chunksize = options->totalsize;
42 options->fsblksize = 2.0 MB;
46 options->numfiles = 1;
47 options->startoffset = 0;
48 options->read_task_offset = 0;
49 options->collectiveopenforread = 1;
50 options->collectivewrite = 0;
51 options->collectiveread = 0;
53 options->unlink_files = 0;
54 options->suppress_checksum = 0;
55 options->serialize_blocknum = -1;
56 options->mpiio_lb = -1;
57 options->mpiio_bs = -1;
58 options->mpiio_sa = -1;
59 options->factor = 0.0;
61 options->do_write = 1;
63 options->use_posix = 0;
64 #if defined(_SION_SIONFWD)
65 options->use_sionfwd = 0;
67 #ifdef _SION_IME_NATIVE
68 options->use_ime_native = 0;
71 options->globalsize = -1;
73 strcpy(options->filename,
"partest_parfile.sion");
78 int parse_options_std (
int argc,
char **argv,
_test_options *options) {
85 if (argv[i][0] ==
'-') {
88 strcpy(options->filename, argv[++i]);
91 options->factor = atof(argv[++i]);
94 options->numfiles = atoi(argv[++i]);
97 options->bufsize = (sion_int64) atoi(argv[++i]);
100 options->bufsize = (sion_int64) atoi(argv[++i]) MB;
103 options->globalsize = (sion_int64) atoi(argv[++i]);
106 options->globalsize = (sion_int64) atoi(argv[++i]) * 1024 MB;
109 options->do_write = 0;
112 options->do_read = 0;
115 options->use_posix = 1;
117 #if defined(_SION_SIONFWD)
119 options->use_sionfwd = 1;
122 #ifdef _SION_IME_NATIVE
124 options->use_ime_native = 1;
128 options->totalsize = (sion_int64) atoi(argv[++i]);
131 options->totalsize = (sion_int64) atoi(argv[++i]) MB;
134 options->chunksize = (sion_int64) atoi(argv[++i]);
137 options->chunksize = (sion_int64) atoi(argv[++i]) MB;
140 options->fsblksize = atoi(argv[++i]);
143 options->fsblksize = atof(argv[++i]) MB;
146 options->startoffset = (sion_int64) atoi(argv[++i]);
149 options->bluegene = 1;
152 options->bluegene_np = atoi(argv[++i]);
155 options->type = atoi(argv[++i]);
158 options->mpiio_lb = atoi(argv[++i]);
161 options->mpiio_bs = atoi(argv[++i]);
164 options->mpiio_sa = atoi(argv[++i]);
167 options->read_task_offset = atoi(argv[++i]);
170 options->unlink_files = atoi(argv[++i]);
173 options->serialize_blocknum = atoi(argv[++i]);
176 options->suppress_checksum = 1;
179 options->collectivewrite++;
182 options->collectiveread++;
185 options->collmsa = 1;
197 printf(
"Arg default: %s\n", argv[i]);
202 printf(
"Arg error: %s\n", argv[i]);
211 #if defined(_SION_SIONFWD)
212 #define SIONFWD_OPT_CHAR "l"
214 #define SIONFWD_OPT_CHAR ""
217 #ifdef _SION_IME_NATIVE
218 #define IME_NATIVE_OPT_CHAR "i"
220 #define IME_NATIVE_OPT_CHAR ""
223 int parse_options_long (
int argc,
char **argv,
_test_options *options) {
226 int option_index = 0;
227 static struct option long_options[] = {
228 {
"filename", required_argument, 0,
'f'},
229 {
"numfiles", required_argument, 0,
'n'},
230 {
"chunksize", required_argument, 0,
'r'},
231 {
"fsblksize", required_argument, 0,
'q'},
232 {
"testtype", required_argument, 0,
'T'},
233 {
"bufsize", required_argument, 0,
'b'},
234 {
"totalsize", required_argument, 0,
'g'},
235 {
"localsize", required_argument, 0,
's'},
236 {
"factor", required_argument, 0,
'F'},
237 {
"write", required_argument, 0,
'W'},
238 {
"read", required_argument, 0,
'R'},
240 {
"verbose", required_argument, 0,
'v'},
241 {
"nochecksum",required_argument, 0,
'C'},
242 {
"debugtask", required_argument, 0,
'd'},
243 {
"Debugtask", required_argument, 0,
'D'},
245 {
"posix", required_argument, 0,
'L'},
246 #if defined(_SION_SIONFWD)
247 {
"sionfwd", required_argument, 0,
'l'},
249 #ifdef _SION_IME_NATIVE
250 {
"ime_native", required_argument, 0,
'i'},
252 {
"collwrite", required_argument, 0,
'M'},
253 {
"collread", required_argument, 0,
'm'},
254 {
"collmsa", required_argument, 0,
'c'},
256 {
"taskoffset",required_argument, 0,
'Z'},
257 {
"byteoffset",required_argument, 0,
'O'},
258 {
"serialized",required_argument, 0,
'j'},
259 {
"unlinkfiles",required_argument, 0,
'X'},
260 {
"bgionode", required_argument, 0,
'P'},
261 {
"bgtaskperionode", required_argument, 0,
'p'},
262 {
"bgtasksort", required_argument, 0,
'Y'},
263 {
"hintlargeblock", required_argument, 0,
'w'},
264 {
"hintiobufsize", required_argument, 0,
'Q'},
265 {
"hintsparseacess", required_argument, 0,
'x'},
272 c = getopt_long(argc, argv,
273 "f:n:r:q:T:b:g:s:F:W:R:vCdDL"
274 SIONFWD_OPT_CHAR IME_NATIVE_OPT_CHAR
276 long_options, &option_index);
282 printf(
"option %s", long_options[option_index].name);
284 printf(
" with arg %s", optarg);
288 strcpy(options->filename, optarg);
291 options->numfiles = atoi(optarg);
294 options->chunksize = to_bytes(optarg);
297 options->fsblksize = to_bytes(optarg);
301 options->type = atoi(optarg);
304 options->bufsize = to_bytes(optarg);
307 options->globalsize = to_bytes(optarg);
310 options->totalsize = to_bytes(optarg);
313 options->factor = atoi(optarg);
316 options->do_write = atoi(optarg);
319 options->do_read = atoi(optarg);
324 options->verbose = atoi(optarg);
325 }
else options->verbose = 1;
331 options->suppress_checksum = atoi(optarg);
332 }
else options->suppress_checksum = 1;
337 options->debug = atoi(optarg);
338 }
else options->debug = 1;
343 options->Debug = atoi(optarg);
344 }
else options->Debug = 1;
349 options->use_posix = atoi(optarg);
350 }
else options->use_posix = 1;
353 #if defined(_SION_SIONFWD)
356 options->use_sionfwd = atoi(optarg);
358 options->use_sionfwd = 1;
363 #ifdef _SION_IME_NATIVE
366 options->use_ime_native = atoi(optarg);
368 options->use_ime_native = 1;
375 options->collectivewrite = atoi(optarg);
376 }
else options->collectivewrite = 1;
381 options->collectiveread = atoi(optarg);
382 }
else options->collectiveread = 1;
386 options->collmsa = 1;
390 options->read_task_offset = atoi(optarg);
394 options->startoffset = atoi(optarg);
398 options->serialize_blocknum = atoi(optarg);
403 options->unlink_files = atoi(optarg);
404 }
else options->unlink_files = 1;
409 options->bluegene = atoi(optarg);
410 }
else options->bluegene = 1;
414 options->bluegene_np = atoi(optarg);
418 options->bluegene_sort = atoi(optarg);
423 options->mpiio_lb = atoi(optarg);
424 }
else options->mpiio_lb = 1;
428 options->mpiio_bs = atoi(optarg);
433 options->mpiio_sa = atoi(optarg);
434 }
else options->mpiio_sa = 1;
438 printf(
"?? getopt_long returned character code 0%o ??\n", c);
450 MPI_Bcast(options->filename, FNAMELEN, MPI_CHAR, 0, MPI_COMM_WORLD);
451 MPI_Bcast(&options->factor, 1, MPI_DOUBLE, 0, MPI_COMM_WORLD);
453 MPI_Bcast(&options->bufsize, 1, SION_MPI_INT64, 0, MPI_COMM_WORLD);
454 MPI_Bcast(&options->totalsize, 1, SION_MPI_INT64, 0, MPI_COMM_WORLD);
455 MPI_Bcast(&options->globalsize, 1, SION_MPI_INT64, 0, MPI_COMM_WORLD);
456 MPI_Bcast(&options->chunksize, 1, SION_MPI_INT64, 0, MPI_COMM_WORLD);
457 MPI_Bcast(&options->fsblksize, 1, SION_MPI_INT32, 0, MPI_COMM_WORLD);
459 MPI_Bcast(&options->type, 1, MPI_INT, 0, MPI_COMM_WORLD);
460 MPI_Bcast(&options->verbose, 1, MPI_INT, 0, MPI_COMM_WORLD);
461 MPI_Bcast(&options->bluegene, 1, MPI_INT, 0, MPI_COMM_WORLD);
462 MPI_Bcast(&options->bluegene_np, 1, MPI_INT, 0, MPI_COMM_WORLD);
463 MPI_Bcast(&options->unlink_files, 1, MPI_INT, 0, MPI_COMM_WORLD);
464 MPI_Bcast(&options->serialize_blocknum, 1, MPI_INT, 0, MPI_COMM_WORLD);
466 MPI_Bcast(&options->collectivewrite, 1, MPI_INT, 0, MPI_COMM_WORLD);
467 MPI_Bcast(&options->collectiveread, 1, MPI_INT, 0, MPI_COMM_WORLD);
468 MPI_Bcast(&options->collmsa, 1, MPI_INT, 0, MPI_COMM_WORLD);
470 MPI_Bcast(&options->numfiles, 1, MPI_INT, 0, MPI_COMM_WORLD);
471 MPI_Bcast(&options->debug, 1, MPI_INT, 0, MPI_COMM_WORLD);
472 MPI_Bcast(&options->Debug, 1, MPI_INT, 0, MPI_COMM_WORLD);
473 MPI_Bcast(&options->read_task_offset, 1, MPI_INT, 0, MPI_COMM_WORLD);
475 MPI_Bcast(&options->suppress_checksum, 1, MPI_INT, 0, MPI_COMM_WORLD);
476 MPI_Bcast(&options->do_read, 1, MPI_INT, 0, MPI_COMM_WORLD);
477 MPI_Bcast(&options->do_write, 1, MPI_INT, 0, MPI_COMM_WORLD);
478 MPI_Bcast(&options->use_posix, 1, MPI_INT, 0, MPI_COMM_WORLD);
479 #if defined(_SION_SIONFWD)
480 MPI_Bcast(&options->use_sionfwd, 1, MPI_INT, 0, MPI_COMM_WORLD);
482 #ifdef _SION_IME_NATIVE
483 MPI_Bcast(&options->use_ime_native, 1, MPI_INT, 0, MPI_COMM_WORLD);
490 void usage_long(
char *name) {
492 fprintf(stderr,
"Usage: %s options\n\n", name);
493 fprintf(stderr,
"Options:\n");
495 fprintf(stderr,
" Sion File Settings:\n");
496 fprintf(stderr,
" [-f filename] (--filename[=]) filename of direct access file\n");
497 fprintf(stderr,
" [-n <number of files>] (--numfiles[=]) number of files (def: 1)\n");
498 fprintf(stderr,
" [-r <chunksize>] (--chunksize[=]) sion chunk size (see size format)\n");
499 fprintf(stderr,
" [-q <fsblksize>] (--fsblksize[=]) size of filesystem blocks (see\n");
500 fprintf(stderr,
" size format)\n");
502 fprintf(stderr,
" Test Configuration:\n");
503 fprintf(stderr,
" [-T <type>] (--testtype[=]) type of test\n");
504 fprintf(stderr,
" (0:SION, standard),\n");
505 fprintf(stderr,
" (1: SION:, independant read),\n");
506 fprintf(stderr,
" (2:MPI IO), (3: Task-Local-File)\n");
507 fprintf(stderr,
" [-b <bufsize>] (--bufsize[=]) size of blocks written in ONE\n");
508 fprintf(stderr,
" fwrite (see size format)\n");
509 fprintf(stderr,
" [-g <totalsize>] (--totalsize[=]) global total size of data written\n");
510 fprintf(stderr,
" (see size format)\n");
511 fprintf(stderr,
" [-s <localsize>] (--localsize[=]) local size of data written by each\n");
512 fprintf(stderr,
" processor (see size format)\n");
513 fprintf(stderr,
" [-F <factor>] (--factor[=]) factor for random size\n");
514 fprintf(stderr,
" (0.0 to 1.0, def: 0.0)\n");
515 fprintf(stderr,
" [-R (0|1)] (--read[=]) switch read off/on\n");
516 fprintf(stderr,
" [-W (0|1|2)] (--write[=]) switch write off, on, or double\n");
517 fprintf(stderr,
" write\n");
519 fprintf(stderr,
" Special Test Options:\n");
520 fprintf(stderr,
" [-v] (--verbose[=](0|1)) verbose print info for each\n");
521 fprintf(stderr,
" task\n");
522 fprintf(stderr,
" [-C] (--nochecksum[=](0|1)) suppress checksum\n");
523 fprintf(stderr,
" [-d] (--debugtask[=](0|1)) debug task 0\n");
524 fprintf(stderr,
" [-D] (--Debugtask[=](0|1)) debug task n\n");
525 fprintf(stderr,
" [-L] (--posix[=](0|1)) use POSIX calls instead of\n");
526 fprintf(stderr,
" ANSI calls\n");
527 #if defined(_SION_SIONFWD)
528 fprintf(stderr,
" [-l] (--sionfwd[=](0|1)) use I/O forwarding via SIONfwd\n");
530 #ifdef _SION_IME_NATIVE
531 fprintf(stderr,
" [-i] (--ime_native[=](0|1)) use IME native calls instead of\n");
532 fprintf(stderr,
" ANSI calls\n");
534 fprintf(stderr,
" [-M] (--collwrite[=](0|1)) use collective write if\n");
535 fprintf(stderr,
" possible\n");
536 fprintf(stderr,
" [-m] (--collread[=](0|1)) use collective read if\n");
537 fprintf(stderr,
" possible\n");
538 fprintf(stderr,
" [-c] (--collmsa) optimize collective I/O for\n");
539 fprintf(stderr,
" modular supercomputers\n");
540 fprintf(stderr,
" [-Z <offset>] (--taskoffset[=]) shift tasks numbering for\n");
541 fprintf(stderr,
" reading by offset to prevent\n");
542 fprintf(stderr,
" data caching of file-system\n");
543 fprintf(stderr,
" (default: 0)\n");
544 fprintf(stderr,
" [-O <bytes>] (--byteoffset[=]) start offset, write <bytes>\n");
545 fprintf(stderr,
" first before using blksize\n");
546 fprintf(stderr,
" (default: 0)\n");
547 fprintf(stderr,
" [-j <#tasks>] (--serialized[=]) serialize I/O, only I/O of\n");
548 fprintf(stderr,
" #tasks are running in parallel\n");
549 fprintf(stderr,
" (-1 -> all tasks in parallel,\n");
550 fprintf(stderr,
" -2 -> use transactions,\n");
551 fprintf(stderr,
" -def: -1)\n");
552 fprintf(stderr,
" [-X] (--unlinkfiles[=](0|1)) remove files after test\n");
554 fprintf(stderr,
" Blue Gene/L, Blue Gene/P , Blue Gene/Q:\n");
555 fprintf(stderr,
" [-P <mode>] (--bgionode[=](0|1|2)) order tasks by BG I/O-node\n");
556 fprintf(stderr,
" (0 none, 1 ION, 2 IOB)\n");
557 fprintf(stderr,
" [-Y <sort>] (--bgtaskperionode[=]) number of tasks per BG\n");
558 fprintf(stderr,
" I/O-node\n");
559 fprintf(stderr,
" [-p <numtasks>] (--bgtasksort[=](0|1)) sort task inside local\n");
560 fprintf(stderr,
" communicator (0 distance to\n");
561 fprintf(stderr,
" ION, 1 global rank)\n");
563 fprintf(stderr,
" MPI-IO, GPFS options:\n");
564 fprintf(stderr,
" [-w] (--hintlargeblock[=](0|1)) Hint MPI-IO, IBM, Large\n");
565 fprintf(stderr,
" Block IO\n");
566 fprintf(stderr,
" [-Q <size>] (--hintiobufsize[=]) Hint MPI-IO, IBM, IO\n");
567 fprintf(stderr,
" bufsize in KB\n");
568 fprintf(stderr,
" [-x] (--hintsparseacess[=](0|1)) Hint MPI-IO, IBM, sparse\n");
569 fprintf(stderr,
" access\n");
571 fprintf(stderr,
" Size Formats: <d>[k, K, kib, kiB, Kib, KiB] for kibi bytes\n");
572 fprintf(stderr,
" <d>[kb, kB, Kb, KB] for kilo bytes\n");
573 fprintf(stderr,
" similarly for [M, G, T]\n");
577 void usage(
char *name) {
579 fprintf(stderr,
"Usage: %s options\n\n", name);
580 fprintf(stderr,
"Options:\n\n");
582 fprintf(stderr,
" Sion File Settings:\n");
583 fprintf(stderr,
" [-f filename] filename of direct access file\n");
584 fprintf(stderr,
" [-n <number of files>] number of files\n");
585 fprintf(stderr,
" [-r <chunksize>] sion chunk size in bytes\n");
586 fprintf(stderr,
" [-R <chunksize>] sion chunk size in MBytes\n");
587 fprintf(stderr,
" [-q <fsblksize>] size of filesystem blocks in bytes\n");
588 fprintf(stderr,
" [-Q <fsblksize>] size of filesystem blocks in MBytes\n");
590 fprintf(stderr,
" Test Configuration:\n");
591 fprintf(stderr,
" [-F <factor>] factor for random size (0.0 to 1.0, def: 0.0)\n");
592 fprintf(stderr,
" [-b <bufsize>] size of blocks written in ONE fwrite in bytes\n");
593 fprintf(stderr,
" [-B <bufsize>] size of blocks written in ONE fwrite in MBytes\n");
594 fprintf(stderr,
" [-g <globaltotalsize>] global total size of data written in bytes\n");
595 fprintf(stderr,
" [-G <globaltotalsize>] global total size of data written in GBytes\n");
596 fprintf(stderr,
" [-s <totalsize>] total size of data written by each processor in bytes\n");
597 fprintf(stderr,
" [-S <totalsize>] total size of data written by each processor in MBytes\n");
598 fprintf(stderr,
" [-T <type>] type of test (0): w/o collective read; (2): MPI IO\n");
599 fprintf(stderr,
" [-v] verbose print info for each task\n");
600 fprintf(stderr,
" [-C] suppress checksum\n");
601 fprintf(stderr,
" [-I] only read data\n");
602 fprintf(stderr,
" [-O] only write data\n");
603 fprintf(stderr,
" [-d] debug task 0\n");
604 fprintf(stderr,
" [-D] debug task n\n");
605 fprintf(stderr,
" [-L] use POSIX calls instead of ANSI call\n");
606 fprintf(stderr,
" [-M] use collective write if possible\n");
607 fprintf(stderr,
" [-m] use collective read if possible\n");
608 fprintf(stderr,
" [-c] optimize collective I/O for modular supercomputers\n");
609 fprintf(stderr,
" [-Z <offset>] shift tasks numbering for reading by offset to ommit\n");
610 fprintf(stderr,
" data caching of file-system (default: 0)\n");
611 fprintf(stderr,
" [-o <bytes>] start offset, write <bytes> first before using blksize\n");
612 fprintf(stderr,
" (default: 0)\n");
613 fprintf(stderr,
" [-j <#tasks>] serialize I/O, only I/O of #tasks are running in\n");
614 fprintf(stderr,
" parallel (-1 -> all tasks in parallel, -2 -> use\n");
615 fprintf(stderr,
" transactions, def: -1)\n");
617 fprintf(stderr,
" Blue Gene/L, Blue Gene/P , Blue Gene/Q:\n");
618 fprintf(stderr,
" [-P <mode>] order tasks by BG I/O-node (0 none, 1 ION, 2 IOB)\n");
619 fprintf(stderr,
" [-Y <sort>] number of tasks per BG I/O-node\n");
620 fprintf(stderr,
" [-p <numtasks>] number of tasks per BG I/O-node\n");
622 fprintf(stderr,
" MPI-IO, GPFS options:\n");
623 fprintf(stderr,
" [-w <1|0>] Hint MPI-IO, IBM, Large Block IO\n");
624 fprintf(stderr,
" [-W <size>] Hint MPI-IO, IBM, IO bufsize in KB\n");
625 fprintf(stderr,
" [-x <1|0>] Hint MPI-IO, IBM, sparse access\n");
643 sion_int64 to_bytes (
char *option) {
645 sion_int64 size = -1;
646 sion_int64 factor = 1024;
647 char char1=
'\0',char2=
'\0',char3=
'\0';
648 rc = sscanf(option,
"%lld%c%c%c", &size, &char1,&char2,&char3);
649 if (rc == 3 && ( (char2==
'b') || (char2==
'B') )) {
653 if ( (char1==
'T') || (char1==
't') ) size*=factor*factor*factor*factor;
654 if ( (char1==
'G') || (char1==
'g') ) size*=factor*factor*factor;
655 if ( (char1==
'M') || (char1==
'm') ) size*=factor*factor;
656 if ( (char1==
'K') || (char1==
'k') ) size*=factor;