|
72 | 72 | # URL to ORFS GitHub repository |
73 | 73 | ORFS_URL = "https://github.com/The-OpenROAD-Project/OpenROAD-flow-scripts" |
74 | 74 |
|
| 75 | +TEMPLATE = """ |
| 76 | +Expected figures for this experiment. |
| 77 | + Wall time: {runtime:.2f} hours |
| 78 | + Number of Samples: |
| 79 | + Samples per minute: {num_samples_per_minute:.2f} |
| 80 | + Design runtime of 10 min: {num_samples_10min:.2f} |
| 81 | + Design runtime of 1h: {num_samples_1h:.2f} |
| 82 | + Number of iterations |
| 83 | + Design runtime of 10 min: {num_iterations_10min:.2f} |
| 84 | + Design runtime of 1h: {num_iterations_1h:.2f} |
| 85 | +""" |
| 86 | + |
| 87 | + |
| 88 | +def calculate_expected_numbers(runtime, num_samples): |
| 89 | + # Runtime - hours |
| 90 | + return TEMPLATE.format( |
| 91 | + runtime=runtime, |
| 92 | + num_samples_per_minute=num_samples / (runtime * 60), |
| 93 | + num_samples_10min=(num_samples / (runtime * 60)) * 10, |
| 94 | + num_samples_1h=(num_samples / (runtime * 60)) * 60, |
| 95 | + num_iterations_10min=((num_samples / (runtime * 60)) * 10) / num_samples, |
| 96 | + num_iterations_1h=((num_samples / (runtime * 60)) * 60) / num_samples, |
| 97 | + ) |
| 98 | + |
75 | 99 |
|
76 | 100 | class AutoTunerBase(tune.Trainable): |
77 | 101 | """ |
@@ -415,7 +439,7 @@ def parse_arguments(): |
415 | 439 | type=int, |
416 | 440 | metavar="<int>", |
417 | 441 | default=int(np.floor(cpu_count() / 2)), |
418 | | - help="Number of cpus to be used.", |
| 442 | + help="CPU Hours", |
419 | 443 | ) |
420 | 444 | parser.add_argument( |
421 | 445 | "--openroad_threads", |
@@ -485,6 +509,15 @@ def parse_arguments(): |
485 | 509 | jobs = int(args.cpu_budget / args.resources_per_trial) |
486 | 510 | args.jobs = jobs |
487 | 511 |
|
| 512 | + # Calculate timeout based on cpu_budget |
| 513 | + if args.cpu_budget is not None: |
| 514 | + args.timeout = args.cpu_budget / os.cpu_count() |
| 515 | + template = calculate_expected_numbers(args.timeout, args.samples) |
| 516 | + print(template) |
| 517 | + ans = input("Do you want to continue? [Y/n]") |
| 518 | + if ans.lower() != "y": |
| 519 | + sys.exit(0) |
| 520 | + |
488 | 521 | return args |
489 | 522 |
|
490 | 523 |
|
|
0 commit comments