Skip to content

Commit fd314bf

Browse files
committed
add comman-line option to artificially increase problem size
1 parent e26f658 commit fd314bf

File tree

3 files changed

+44
-21
lines changed

3 files changed

+44
-21
lines changed

src/e3sm_io.c

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ void print_info (MPI_Info *info_used) {
258258
}
259259

260260
/*----< usage() >------------------------------------------------------------*/
261-
static void usage (char *argv0) {
261+
static void usage(char *argv0) {
262262
char *help = "Usage: %s [OPTION] FILE\n\
263263
[-h] Print this help message\n\
264264
[-v] Verbose mode\n\
@@ -281,6 +281,8 @@ static void usage (char *argv0) {
281281
[-g num] Number of subfiles, used by Log-based VOL and ADIOS I/O only,\n\
282282
-1 for one subfile per compute node, 0 to disable subfiling,\n\
283283
(default: 0).\n\
284+
[-e num] Artificially increase the problem size num times, by\n\
285+
multiplying the last dimesnion size by num. (default: 1)\n\
284286
[-t time] Add sleep time to emulate the computation in order to \n\
285287
overlapping I/O when Async VOL is used.\n\
286288
[-i path] Input file path (folder name when subfiling is used, file\n\
@@ -365,6 +367,7 @@ int main (int argc, char **argv) {
365367
cfg.xtype = NC_DOUBLE;
366368
cfg.sort_reqs = 1;
367369
cfg.isReqSorted = 0;
370+
cfg.factor = 1;
368371

369372
for (i = 0; i < MAX_NUM_DECOMP; i++) {
370373
cfg.G_case.nvars_D[i] = 0;
@@ -388,7 +391,7 @@ int main (int argc, char **argv) {
388391
ffreq = 1;
389392

390393
/* command-line arguments */
391-
while ((i = getopt (argc, argv, "vkur:s:o:i:jmqf:ha:x:g:y:pt:")) != EOF)
394+
while ((i = getopt (argc, argv, "vkur:s:o:i:jmqf:ha:x:g:y:pt:e:")) != EOF)
392395
switch (i) {
393396
case 'v':
394397
cfg.verbose = 1;
@@ -409,48 +412,48 @@ int main (int argc, char **argv) {
409412
cfg.io_stride = atoi (optarg);
410413
break;
411414
case 'a':
412-
if (strcmp (optarg, "pnetcdf") == 0)
415+
if (strcmp(optarg, "pnetcdf") == 0)
413416
cfg.api = pnetcdf;
414-
else if (strcmp (optarg, "hdf5") == 0)
417+
else if (strcmp(optarg, "hdf5") == 0)
415418
cfg.api = hdf5;
416-
else if (strcmp (optarg, "hdf5_md") == 0)
419+
else if (strcmp(optarg, "hdf5_md") == 0)
417420
cfg.api = hdf5_md;
418-
else if (strcmp (optarg, "hdf5_log") == 0)
421+
else if (strcmp(optarg, "hdf5_log") == 0)
419422
cfg.api = hdf5_log;
420-
else if (strcmp (optarg, "netcdf4") == 0)
423+
else if (strcmp(optarg, "netcdf4") == 0)
421424
cfg.api = netcdf4;
422-
else if (strcmp (optarg, "adios") == 0)
425+
else if (strcmp(optarg, "adios") == 0)
423426
cfg.api = adios;
424427
else
425428
ERR_OUT("Unknown API")
426429
break;
427430
/*
428431
case 'l':
429-
if (strcmp (optarg, "contig") == 0)
432+
if (strcmp(optarg, "contig") == 0)
430433
cfg.layout = contig;
431-
else if (strcmp (optarg, "chunk") == 0)
434+
else if (strcmp(optarg, "chunk") == 0)
432435
cfg.layout = chunk;
433436
else
434437
ERR_OUT("Unknown layout")
435438
break;
436439
*/
437440
case 'x':
438-
if (strcmp (optarg, "canonical") == 0)
441+
if (strcmp(optarg, "canonical") == 0)
439442
cfg.strategy = canonical;
440-
else if (strcmp (optarg, "log") == 0)
443+
else if (strcmp(optarg, "log") == 0)
441444
cfg.strategy = log;
442-
else if (strcmp (optarg, "blob") == 0)
445+
else if (strcmp(optarg, "blob") == 0)
443446
cfg.strategy = blob;
444447
else
445448
ERR_OUT("Unknown I/O strategy")
446449
break;
447450

448451
case 'o':
449-
strncpy (cfg.out_path, optarg, E3SM_IO_MAX_PATH);
452+
strncpy(cfg.out_path, optarg, E3SM_IO_MAX_PATH);
450453
cfg.wr = 1;
451454
break;
452455
case 'i':
453-
strncpy (cfg.in_path, optarg, E3SM_IO_MAX_PATH);
456+
strncpy(cfg.in_path, optarg, E3SM_IO_MAX_PATH);
454457
cfg.rd = 1;
455458
break;
456459
case 'm':
@@ -485,24 +488,27 @@ int main (int argc, char **argv) {
485488
cfg.profiling = 1;
486489
break;
487490
case 'z':
488-
if (strcmp (optarg, "deflate") == 0)
491+
if (strcmp(optarg, "deflate") == 0)
489492
cfg.filter = deflate;
490-
else if (strcmp (optarg, "zlib") == 0)
493+
else if (strcmp(optarg, "zlib") == 0)
491494
cfg.filter = deflate;
492495
else
493496
ERR_OUT("Unknown filter")
494497
break;
498+
case 'e':
499+
cfg.factor = atoi(optarg);
500+
break;
495501
case 'h':
496502
default:
497-
if (cfg.rank == 0) usage (argv[0]);
503+
if (cfg.rank == 0) usage(argv[0]);
498504
goto err_out;
499505
}
500506

501507
if (optind >= argc || argv[optind] == NULL) { /* input file is mandatory */
502-
if (!cfg.rank) usage (argv[0]);
508+
if (!cfg.rank) usage(argv[0]);
503509
ERR_OUT("Decomposition file not provided")
504510
}
505-
strncpy (cfg.decomp_path, argv[optind], E3SM_IO_MAX_PATH);
511+
strncpy(cfg.decomp_path, argv[optind], E3SM_IO_MAX_PATH);
506512

507513
cfg.F_case_h0.nrecs = 1; /* force only one record for F h0 case */
508514
cfg.F_case_h1.nrecs = nrecs;

src/e3sm_io.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ typedef struct e3sm_io_config {
123123
MPI_Info info;
124124
int num_iotasks;
125125
int num_subfiles;
126+
int factor; /* artificially increase problem size */
126127

127128
char in_path[E3SM_IO_MAX_PATH];
128129
char out_path[E3SM_IO_MAX_PATH];

src/read_decomp.cpp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ int read_decomp(e3sm_io_config *cfg, e3sm_io_decom *decom) {
208208
*/
209209

210210
/* id: D1, D2, ... D6, indicates different decompositions */
211-
for (id = 0; id < decom->num_decomp; id++) {
211+
for (id=0; id<decom->num_decomp; id++) {
212212
decom->contig_nreqs[id] = 0;
213213
decom->disps[id] = NULL;
214214
decom->blocklens[id] = NULL;
@@ -504,6 +504,22 @@ int read_decomp(e3sm_io_config *cfg, e3sm_io_decom *decom) {
504504
}
505505
}
506506

507+
/* Artificially increase the problem size */
508+
if (cfg->factor > 1) {
509+
if (decom->num_decomp != 6 || decom->ndims[id] > 1) {
510+
/* If G case, increasing size of last dimensions nVertLevels
511+
* and nVertLevelsP1 only.
512+
*/
513+
decom->dims[id][decom->ndims[id] - 1] *= cfg->factor;
514+
for (i=0; i<decom->contig_nreqs[id]; i++) {
515+
decom->disps[id][i] *= cfg->factor;
516+
decom->blocklens[id][i] *= cfg->factor;
517+
}
518+
for (i=0; i<decom->raw_nreqs[id]; i++)
519+
decom->raw_offsets[id][i] *= cfg->factor;
520+
}
521+
}
522+
507523
if (cfg->verbose) {
508524
int min_blocklen = decom->blocklens[id][0];
509525
int max_blocklen = decom->blocklens[id][0];

0 commit comments

Comments
 (0)