This repository has been archived by the owner on Oct 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
773 lines (674 loc) · 23.3 KB
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
/*
** $Id: main.c,v 1.33 2011/01/24 00:07:19 rolf Exp $
**
** Rolf Riesen, September 2009 -- 2010, Sandia National Laboratories
** All time values are stored in doubles and are in minutes
**
** This file is part of app_model. App_model is free software and
** is distributed under the terms of the GNU General Public License
** Version 3. See the file LICENSE for details.
** Copyright 2009 Sandia Corporation. Under the terms of Contract
** DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government
** retains certain rights in this software.
**
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h> /* For strcmp(), strerror() */
#include <math.h> /* For sqrt() */
#include <getopt.h>
#include <errno.h>
#include <assert.h>
#include <gsl/gsl_sf_gamma.h>
#include "globals.h"
#include "app.h"
#include "report.h"
#include "rnd.h"
#include "rMPI_model.h"
#include "timing.h"
/*
** Change this when the output or the calculation changes
*/
#define VERSION "1.005"
/*
** Defaults for command line parameters
*/
#define DEFAULT_NODE_MTBF (43800) /* 5 years */
#define DEFAULT_NUM_BUNDLES (512)
#define DEFAULT_NUM_REDUNDANT (0)
#define DEFAULT_CHECKPOINT_TIME (5.0)
#define DEFAULT_RESTART_TIME (10.0)
#define DEFAULT_WORK_TIME (168.0)
#define DEFAULT_RAS_DELAY (0.0)
#define DEFAULT_SHAPE (0.5)
#define DEFAULT_SCALE DEFAULT_NODE_MTBF
/*
** Local functions
*/
static void calc(double *tau, double *calculated_sys_mtbf, double *calculated_app_mtbf,
double *calculated_fpi, int num_bundles,
int num_redundant, double node_mtbf, double checkpoint_time);
static void usage(int argc, char *argv[]);
static void banner(int argc, char *argv[], int num_bundles, int num_redundant, double checkpoint_time,
double restart_time, double work_time, double tau, int tau_given, double node_mtbf,
double calculated_sys_mtbf, int sys_mtbf_given, double calculated_app_mtbf, int app_mtbf_given,
int default_seed, rnd_t rnd, double scale, double shape, char *fname_interrupts, char *fname_faults, double ras_delay,
float soft_reboot_success_rate, float soft_time_to_reboot, FILE *fp_input,
char *fname_input, double calculated_fpi);
static struct option long_options[]= {
/* name, has arg, flag, val */
{"work_time", 1, NULL, 'w'},
{"num_bundles", 1, NULL, 'n'},
{"redundant", 1, NULL, 'r'},
{"verbose", 0, NULL, 'v'},
{"performance", 0, NULL, 'p'},
{"distribution", 1, NULL, 1100},
{"seed", 0, NULL, 's'},
{"checkpoint_time", 1, NULL, 'c'},
{"restart_time", 1, NULL, 'R'},
{"tau", 1, NULL, 't'},
{"mtbf_node", 1, NULL, 'm'},
{"mtbf_sys", 1, NULL, 1003},
{"mtbf_app", 1, NULL, 'a'},
{"delay_ras", 1, NULL, 'd'},
{"finterrupts", 1, NULL, 1000},
{"ffaults", 1, NULL, 1001},
{"soft_reboot", 1, NULL, 1002},
{"help", 0, NULL, 1004},
{"input", 1, NULL, 1005},
{"shape", 1, NULL, 1006},
{"scale", 1, NULL, 1007},
{"hotswap", 0, NULL, 1008},
{0, 0, 0, 0}
};
int
main(int argc, char *argv[])
{
int option_index = 0;
int ch, error;
char *endptr;
int verbose;
int num_bundles, num_redundant;
double checkpoint_time;
double restart_time;
double work_time;
double tau;
double node_mtbf;
double calculated_sys_mtbf;
double calculated_app_mtbf;
int default_seed;
double dist_shape;
double dist_scale;
rnd_t rnd;
char *fname_interrupts;
char *fname_faults;
char *fname_input;
FILE *fp_ints;
FILE *fp_faults;
FILE *fp_input;
double elapsed;
double ras_delay;
float soft_reboot_success_rate, soft_time_to_reboot;
int display_perf_info;
double t0, t1;
int tau_given;
int app_mtbf_given, sys_mtbf_given;
int help;
double daly;
double calculated_fpi;
int hotswap;
/* Defaults */
error= FALSE;
verbose= 0;
num_bundles= DEFAULT_NUM_BUNDLES;
num_redundant= DEFAULT_NUM_REDUNDANT;
node_mtbf= DEFAULT_NODE_MTBF;
default_seed= FALSE;
checkpoint_time= DEFAULT_CHECKPOINT_TIME;
restart_time= DEFAULT_RESTART_TIME;
work_time= DEFAULT_WORK_TIME;
tau= -1.0;
tau_given= FALSE;
fname_interrupts= "";
fname_faults= "";
fname_input= "";
rnd= RND_EXP;
dist_shape= DEFAULT_SHAPE;
dist_scale= DEFAULT_SCALE;
ras_delay= DEFAULT_RAS_DELAY;
soft_reboot_success_rate= -1.0;
display_perf_info= FALSE;
calculated_sys_mtbf= -1.0;
calculated_app_mtbf= -1.0;
sys_mtbf_given= FALSE;
app_mtbf_given= FALSE;
hotswap= FALSE;
help= FALSE;
/* check command line args */
while (1) {
ch= getopt_long(argc, argv, "a:m:c:r:w:t:n:R:vsd:p", long_options, &option_index);
if (ch == -1) {
break;
}
switch (ch) {
case 'a':
calculated_app_mtbf= strtod(optarg, &endptr);
if ((calculated_app_mtbf <= 0.0) && (endptr == optarg)) {
fprintf(stderr, "Invalid number for -mtbf_app %s\n", optarg);
error= TRUE;
}
calculated_app_mtbf= calculated_app_mtbf * 60.0;
app_mtbf_given= TRUE;
break;
case 'n':
num_bundles= strtol(optarg, (char **)NULL, 0);
if (num_bundles < 1) {
fprintf(stderr, "-n %s must be > 0\n", optarg);
error= TRUE;
}
break;
case 'r':
num_redundant= strtol(optarg, (char **)NULL, 0);
if (num_redundant < 0) {
fprintf(stderr, "-r %s must be >= 0\n", optarg);
error= TRUE;
}
break;
case 'p':
display_perf_info= TRUE;
break;
case 'v':
verbose++;
break;
case 1100:
if ((strcmp(optarg, "g") == 0) || (strcmp(optarg, "gamma") == 0)) {
rnd= RND_GAMMA;
} else
if ((strcmp(optarg, "e") == 0) || (strcmp(optarg, "exp") == 0)) {
rnd= RND_EXP;
} else
if ((strcmp(optarg, "w") == 0) || (strcmp(optarg, "weibull") == 0)) {
rnd= RND_WEIBULL;
} else {
fprintf(stderr, "Unknown random distribution function: \"%s\"\n", optarg);
error= TRUE;
}
break;
case 's':
default_seed= TRUE;
break;
case 'c':
checkpoint_time= strtod(optarg, &endptr);
if ((checkpoint_time <= 0.0) && (endptr == optarg)) {
fprintf(stderr, "Invalid number for -c %s\n", optarg);
error= TRUE;
}
break;
case 'R':
restart_time= strtod(optarg, &endptr);
if ((restart_time <= 0.0) && (endptr == optarg)) {
fprintf(stderr, "Invalid number for -R %s\n", optarg);
error= TRUE;
}
break;
case 'w':
work_time= strtod(optarg, &endptr);
if ((work_time <= 0.0) && (endptr == optarg)) {
fprintf(stderr, "Invalid number for -w %s\n", optarg);
error= TRUE;
}
break;
case 't':
tau= strtod(optarg, &endptr);
if ((tau <= 0.0) && (endptr == optarg)) {
fprintf(stderr, "Invalid number for -t %s\n", optarg);
error= TRUE;
}
tau_given= TRUE;
break;
case 'm':
node_mtbf= strtod(optarg, &endptr);
if ((node_mtbf <= 0.0) && (endptr == optarg)) {
fprintf(stderr, "Invalid number for -m %s\n", optarg);
error= TRUE;
}
break;
case 'd':
ras_delay= strtod(optarg, &endptr);
if ((ras_delay <= 0.0) && (endptr == optarg)) {
fprintf(stderr, "Invalid number for -d %s\n", optarg);
error= TRUE;
}
break;
case 1000:
fname_interrupts= optarg;
break;
case 1001:
fname_faults= optarg;
break;
case 1002:
sscanf(optarg, "%f,%f", &soft_reboot_success_rate, &soft_time_to_reboot);
if (soft_reboot_success_rate < 0.0 || soft_reboot_success_rate > 100.0) {
fprintf(stderr, "Soft reboot success rate must be 0%% - 100%%. Got %f\n",
soft_reboot_success_rate);
error= TRUE;
}
if (soft_time_to_reboot < 0.0) {
fprintf(stderr, "Soft reboot time must be >= 0.0 Got %f\n", soft_time_to_reboot);
error= TRUE;
}
break;
case 1003:
calculated_sys_mtbf= strtod(optarg, &endptr);
if ((calculated_sys_mtbf <= 0.0) && (endptr == optarg)) {
fprintf(stderr, "Invalid number for -mtbf_sys %s\n", optarg);
error= TRUE;
}
calculated_sys_mtbf= calculated_sys_mtbf * 60.0;
sys_mtbf_given= TRUE;
break;
case 1004:
help= TRUE;
break;
case 1005:
fname_input= optarg;
break;
case 1006:
dist_shape= strtod(optarg, &endptr);
if ((dist_shape <= 0.0) && (endptr == optarg)) {
fprintf(stderr, "Invalid input for --shape %s. Must be > 0\n", optarg);
error= TRUE;
}
break;
case 1007:
dist_scale= strtod(optarg, &endptr);
if ((dist_scale <= 0.0) && (endptr == optarg)) {
fprintf(stderr, "Invalid input for --scale %s. Must be > 0\n", optarg);
error= TRUE;
}
break;
case 1008:
hotswap= TRUE;
break;
default:
error= TRUE;
break;
}
}
if (optind < argc) {
error= TRUE;
fprintf(stderr, "No additional arguments expected!\n");
}
if (error || help) {
usage(argc, argv);
exit(1);
}
/*
** Open files if necessary
*/
if (strcmp(fname_interrupts, "") == 0) {
/* Default */
fp_ints= NULL;
} else if (strcmp(fname_interrupts, "-") == 0) {
fp_ints= stdout;
} else {
fp_ints= fopen(fname_interrupts, "w");
if (fp_ints == NULL) {
fprintf(stderr, "Could not open output file \"%s\": %s\n", fname_interrupts, strerror(errno));
exit(2);
}
}
if (strcmp(fname_faults, "") == 0) {
/* Default */
fp_faults= NULL;
} else if (strcmp(fname_faults, "-") == 0) {
fp_faults= stdout;
} else {
fp_faults= fopen(fname_faults, "w");
if (fp_faults == NULL) {
fprintf(stderr, "Could not open output file \"%s\": %s\n", fname_faults, strerror(errno));
exit(2);
}
}
if (strcmp(fname_input, "") == 0) {
/* Default */
fp_input= NULL;
} else if (strcmp(fname_input, "-") == 0) {
fp_input= stdin;
} else if (strcmp(fname_input, "") != 0) {
fp_input= fopen(fname_input, "r");
if (fp_input == NULL) {
fprintf(stderr, "Could not open input file \"%s\": %s\n", fname_input, strerror(errno));
exit(2);
}
}
/* Some sanity checks */
if (fp_input && (num_redundant > 0)) {
fprintf(stderr, "Redundant nodes not supported when reading faults from a file.\n");
exit(3);
}
/* Convert work time to minutes like everything else */
work_time= 60.0 * work_time;
node_mtbf= 60.0 * node_mtbf;
dist_scale= 60.0 * dist_scale;
init_rnd(rnd, node_mtbf, default_seed, dist_shape, dist_scale);
init_globals();
calc(&tau, &calculated_sys_mtbf, &calculated_app_mtbf, &calculated_fpi, num_bundles,
num_redundant, node_mtbf, checkpoint_time);
banner(argc, argv, num_bundles, num_redundant, checkpoint_time, restart_time, work_time,
tau, tau_given, node_mtbf, calculated_sys_mtbf, sys_mtbf_given, calculated_app_mtbf,
app_mtbf_given, default_seed, rnd, dist_scale, dist_shape, fname_interrupts,
fname_faults, ras_delay, soft_reboot_success_rate, soft_time_to_reboot, fp_input,
fname_input, calculated_fpi);
rMPI_init(num_bundles, num_bundles + num_redundant, fp_input, verbose);
t0= get_clock_value();
elapsed= app_model(verbose, tau, checkpoint_time, restart_time, work_time, ras_delay,
fp_ints, fp_faults, soft_time_to_reboot, soft_reboot_success_rate, hotswap);
t1= get_clock_value();
/* At this point we're one over */
interrupt_cnt--;
/*
** Without redundant nodes, the number of faults and interrupts must be the same.
** However, that is not true if ras_delay > 0, because that can consume more faults
** that there are interrupts.
*/
assert((num_redundant != 0) || (interrupt_cnt == fault_cnt) || (ras_delay > 0.0));
/* This is eq 20 from Daly:04:higher */
daly= calculated_app_mtbf *
exp(restart_time / calculated_app_mtbf) *
(exp((tau + checkpoint_time) / calculated_app_mtbf) - 1.0) *
(work_time / tau);
report_results(work_time, elapsed, calculated_sys_mtbf, calculated_app_mtbf,
display_perf_info, t1 - t0, daly, fp_input, calculated_fpi);
if (fp_ints) fclose(fp_ints);
if (fp_faults) fclose(fp_faults);
if (fp_input) fclose(fp_input);
return 0;
} /* end of main() */
#define pi (3.14159265358979323846264338327950288)
static double
Qm2(int n)
{
return sqrt(pi * n / 2.0) + (2.0/3.0);
} /* end of Qm2() */
static void
calc(double *tau, double *calculated_sys_mtbf, double *calculated_app_mtbf,
double *calculated_fpi, int num_bundles,
int num_redundant, double node_mtbf, double checkpoint_time)
{
#define pi (3.14159265358979323846264338327950288)
float p;
float r_none, r_double;
/*
** Calculate the system and application MTBI. We use it to calculate the
** optimal checkpoint interval (tau) using Daly's equation.
*/
/* Percentage of redundant nodes */
p= (float)num_redundant / (float)num_bundles;
if (*calculated_sys_mtbf < 0.0) {
/* Not provided by user */
*calculated_sys_mtbf= node_mtbf / (num_bundles * (1.0 + p));
}
/* Calculate the MTBF of the non-redundant portion of the system */
if (num_redundant >= num_bundles) {
/* Each bundle has redundant nodes */
r_none= 0.0;
} else {
/* Some bundles do not have redundant nodes */
r_none= node_mtbf / (num_bundles - num_redundant);
}
/* Calculate the MTBF for the bundles with 2 redundant nodes */
if (num_redundant > 0) {
r_double= (node_mtbf / (2.0 * num_redundant)) * Qm2(2.0 * num_redundant);
} else {
/* no bundles with redundant ndoes */
r_double= 0.0;
}
if (*calculated_app_mtbf < 0.0) {
/* Unless supplied by user */
if (num_redundant >= num_bundles) {
/* All bundles have redundant nodes */
*calculated_app_mtbf= r_double;
} else if (num_redundant > 0) {
/* Only some bundles have redundant nodes */
/* FIXME: This calculation is wrong, I think. */
*calculated_app_mtbf= 1.0 / ((1.0 / r_none) + (1.0 / r_double));
} else {
/* No bundles have redundant nodes */
*calculated_app_mtbf= r_none;
}
}
/*
** calculate optimal checkpoint interval (tau) using Daly's equation,
** unless the user supplied a specific tau.
*/
if (*tau < 0.0) {
if (checkpoint_time >= (2.0 * *calculated_app_mtbf)) {
*tau= *calculated_app_mtbf;
} else {
*tau= sqrt(2.0 * checkpoint_time * *calculated_app_mtbf) *
(1.0 +
(1.0 / 3.0) * sqrt(checkpoint_time / (2.0 * *calculated_app_mtbf)) +
(checkpoint_time / (9.0 * 2.0 * *calculated_app_mtbf))
) - checkpoint_time;
}
if (*tau < 0.0) {
printf(" ERROR: tau (checkpoint time) is negative!\n");
exit(4);
}
}
if (num_bundles == num_redundant) {
*calculated_fpi= Qm2(2.0 * num_bundles);
} else if (num_redundant == 0) {
*calculated_fpi= 1.0;
} else {
/* FIXME: Don't know how to do that yet */
*calculated_fpi= -3.0;
}
} /* end of calc() */
static void
usage(int argc, char *argv[])
{
int i;
fprintf(stderr, "Command line \"");
for (i= 0; i < argc; i++) {
fprintf(stderr, "%s", argv[i]);
if (i < (argc - 1)) {
fprintf(stderr, " ");
}
}
fprintf(stderr, "\"\n");
fprintf(stderr, "Usage: %s [-n num] [-r redundant] [-c checkpoint] [-R restart] "
"[-w work] [-t tau] [-m mtbf]\n"
"\t\t[-d delay] [--fi fi_name] [--ff ff_name] [--input ff_input]\n"
"\t\t[-v {-v}] [-p] [-s] [--distrib dist] [--scale a] [--shape b] [--soft_reboot <success rate>,<reboot time>]\n"
"\t\t[--mtbf_sys mtbf_sys] [-a mtbi_app] [--daly] [--help]\n", argv[0]);
fprintf(stderr, " -n num Number of bundles (active nodes) to simulate. (Default %d)\n",
DEFAULT_NUM_BUNDLES);
fprintf(stderr, " -r redundant Number of redundant nodes. (Default %d)\n",
DEFAULT_NUM_REDUNDANT);
fprintf(stderr, " -c checkpoint (minutes) Time to write a checkpoint. (Default %g minutes)\n",
DEFAULT_CHECKPOINT_TIME);
fprintf(stderr, " -R restart (minutes) Time to relaunch and read a checkpoint. (Default %g minutes)\n",
DEFAULT_RESTART_TIME);
fprintf(stderr, " -w work (hours) Time to do the application work. (Default %g hours)\n",
DEFAULT_WORK_TIME);
fprintf(stderr, " -t tau (minutes) Time between checkpoints. (tau_opt calculated if not specified)\n");
fprintf(stderr, " -m mtbf (hours) Node MTBF. (Default %.0f hours)\n",
(float)DEFAULT_NODE_MTBF);
fprintf(stderr, " --mtbf_sys mtbf_sys (h) Set system MTBF. (Only used for result comparisons)\n");
fprintf(stderr, " -a mtbi_app (hours) Application MTBI to calculate tau_opt. (Overrides node mtbf)\n");
fprintf(stderr, " -d delay (minutes) Multiple faults within this time count as one. (Default %g minutes)\n",
DEFAULT_RAS_DELAY);
fprintf(stderr, " --fi fi_name File name to write restart (interrupt) times. (Default /dev/null)\n");
fprintf(stderr, " --ff ff_name File name to write fault times. (Default /dev/null)\n");
fprintf(stderr, " --input ff_input File name to read fault times from. Prevents fault generation by sim.\n");
fprintf(stderr, " --distrib dist Random distribution function: exp (default), gamma, weibull\n");
fprintf(stderr, " --scale a (hours) Scale parameter for Weibull and gamma distribution. (Default %.3f)\n", (float)DEFAULT_SCALE);
fprintf(stderr, " --shape b Shape parameter for Weibull and gamma distribution. (Default %.3f)\n", DEFAULT_SHAPE);
fprintf(stderr, " -v Increase verbosity. Option may be repeated.\n");
fprintf(stderr, " -s Use fixed seed for random number generator (repeat runs)\n");
fprintf(stderr, " --soft_reboot success rate, Percentage of nodes that can be brought back to life doing a reboot (0 - 1.0)\n");
fprintf(stderr, " reboot time Nodes become available again after this many minutes\n");
fprintf(stderr, " -p Display simulation performance data\n");
fprintf(stderr, " --help This message\n");
fprintf(stderr, "\n");
fprintf(stderr, "\n");
fprintf(stderr, "app_model, version %s - a program that mimics a parallel\n", VERSION);
fprintf(stderr, "application's checkpoint/restart behavior on a system with\n");
fprintf(stderr, "redundant compute nodes.\n");
fprintf(stderr, "\n");
fprintf(stderr, "Copyright 2009 Sandia Corporation. Under the terms of Contract\n");
fprintf(stderr, "DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government\n");
fprintf(stderr, "retains certain rights in this software.\n");
fprintf(stderr, "\n");
fprintf(stderr, "This program has been released into the public domain using the\n");
fprintf(stderr, "GNU General Public License Version 3.\n");
fprintf(stderr, "\n");
fprintf(stderr, "Author: Rolf Riesen <[email protected]>\n");
} /* end of usage() */
static void
banner(
int argc,
char *argv[],
int num_bundles,
int num_redundant,
double checkpoint_time,
double restart_time,
double work_time,
double tau,
int tau_given,
double node_mtbf,
double calculated_sys_mtbf,
int sys_mtbf_given,
double calculated_app_mtbf,
int app_mtbf_given,
int default_seed,
rnd_t rnd,
double scale,
double shape,
char *fname_interrupts,
char *fname_faults,
double ras_delay,
float soft_reboot_success_rate,
float soft_time_to_reboot,
FILE *fp_input,
char *fname_input,
double calculated_fpi)
{
int i;
char str[1024];
printf("Version %s\n", VERSION);
printf("Command line \"");
for (i= 0; i < argc; i++) {
printf("%s", argv[i]);
if (i < (argc - 1)) {
printf(" ");
}
}
printf("\"\n");
printf("PARAMETERS\n");
printf(" Active nodes %12d\n", num_bundles);
printf(" Redundant nodes %12d\n", num_redundant);
printf(" Total nodes %12d\n", num_bundles + num_redundant);
printf(" Checkpoint duration %12.2f minutes\n", checkpoint_time);
printf(" Restart duration %12.2f minutes\n", restart_time);
printf(" Work to be done %12.2f hours\n", work_time / 60.0);
if (fp_input) {
printf(" Cannot calculate node MTBF\n");
} else {
printf(" Node MTBF %12.2f hours\n", node_mtbf / 60.0);
}
if (sys_mtbf_given) {
printf(" System MTBF %12.2f hours (%.3f minutes)\n", calculated_sys_mtbf / 60.0, calculated_sys_mtbf);
}
if (app_mtbf_given) {
printf(" Application MTBI %12.2f hours (%.3f minutes)\n", calculated_app_mtbf / 60.0, calculated_app_mtbf);
}
if (tau_given) {
printf(" Checkpoint interval %12.2f hours (%.3f minutes)\n", tau / 60.0, tau);
}
printf(" File for interrupt times \"%s\"\n", fname_interrupts);
printf(" File for fault times \"%s\"\n", fname_faults);
if (fp_input != NULL) {
printf(" File to read fault times from \"%s\"\n", fname_input);
}
if (default_seed) {
printf(" Seed for pseudo random generator fixed\n");
} else {
printf(" Seed for pseudo random generator random\n");
}
if (fp_input) {
printf(" Fault distribution: %13s\n", "Input file");
} else {
switch (rnd) {
case RND_EXP:
printf(" Fault distribution: exponential\n");
break;
case RND_GAMMA:
printf(" Fault distribution: gamma (scale %.3f, shape %.3f)\n",
scale, shape);
break;
case RND_WEIBULL:
if ((1.0 + 1.0 / shape) > GSL_SF_GAMMA_XMAX) {
fprintf(stderr, "Shape parameter %g is too large for gamma function!\n",
shape);
exit(1);
}
printf(" Fault distribution: weibull (scale %.3f, shape %.3f, gamma %.3f)\n",
scale, shape, gsl_sf_gamma(1.0 + 1.0 / shape));
break;
default:
fprintf(stderr, "Unknown random distribution!\n");
exit(1);
break;
}
}
/* Faults within this interval count as one */
printf(" RAS delay %12.2f minutes\n", ras_delay);
if (soft_reboot_success_rate < 0.0) {
printf(" Soft reboot time not used\n");
} else {
printf(" Soft reboot time %12.2f minutes\n", soft_time_to_reboot);
printf(" Soft reboot success %12.2f%%\n", soft_reboot_success_rate);
}
printf("\n");
printf("CALCULATED\n");
if (!sys_mtbf_given) {
if (fp_input) {
printf(" Cannot calculate system MTBF\n");
} else {
printf(" System MTBF %12.2f hours (%.3f minutes)\n", calculated_sys_mtbf / 60.0, calculated_sys_mtbf);
}
}
if (!app_mtbf_given) {
if (fp_input) {
printf(" Cannot estimate application MTBI\n");
} else {
printf(" Application MTBI %12.2f hours (%.3f minutes)\n", calculated_app_mtbf / 60.0, calculated_app_mtbf);
}
}
if (!tau_given) {
if (fp_input) {
printf(" Checkpoint interval %12.2f hours (%.3f minutes) (Default)\n", tau / 60.0, tau);
} else {
printf(" Checkpoint interval %12.2f hours (%.3f minutes)\n", tau / 60.0, tau);
}
}
if ((num_bundles == num_redundant) || (num_redundant == 0)) {
printf(" Faults/interrupt %12.2f\n", calculated_fpi);
} else {
sprintf(str, "1...???");
printf(" Faults/interrupt %12s\n", str);
}
if ((restart_time + checkpoint_time) > calculated_sys_mtbf) {
if ((restart_time + checkpoint_time) > (10.0 * calculated_sys_mtbf)) {
printf("WARNING: checkpoint + restart time > system MTBF! This WILL take extremly long!\n");
} else {
printf("WARNING: checkpoint + restart time > system MTBF! This may take quite a while.\n");
}
}
if (checkpoint_time >= work_time) {
printf("WARNING: checkpoint time >= work time! Daly model will be wrong.\n");
}
} /* end of banner() */