File tree Expand file tree Collapse file tree 2 files changed +18
-6
lines changed
Expand file tree Collapse file tree 2 files changed +18
-6
lines changed Original file line number Diff line number Diff line change @@ -444,6 +444,13 @@ def parse_arguments():
444444 default = int (np .floor (cpu_count () / 2 )),
445445 help = "CPU Hours" ,
446446 )
447+ parser .add_argument (
448+ "--jobs" ,
449+ type = int ,
450+ metavar = "<int>" ,
451+ default = int (np .floor (cpu_count () / 2 )),
452+ help = "Max number of concurrent jobs." ,
453+ )
447454 parser .add_argument (
448455 "--openroad_threads" ,
449456 type = int ,
@@ -508,14 +515,17 @@ def parse_arguments():
508515 if args .timeout is not None :
509516 args .timeout = round (args .timeout * 3600 )
510517
511- # Calculate jobs
512- jobs = int (args .cpu_budget / args .resources_per_trial )
513- args .jobs = jobs
514-
515518 # Calculate timeout based on cpu_budget
516519 if args .cpu_budget is not None :
517520 args .timeout = round (args .cpu_budget / os .cpu_count () * 3600 )
518- template = calculate_expected_numbers (args .timeout , args .samples )
521+ args .timeout_per_trial = round (
522+ args .cpu_budget / (args .jobs * args .resources_per_trial ) * 3600
523+ )
524+ overall_timeout = min (args .timeout , args .timeout_per_trial )
525+ if args .mode == "tune" :
526+ template = calculate_expected_numbers (overall_timeout , args .samples )
527+ else :
528+ template = calculate_expected_numbers (overall_timeout , 1 )
519529 print (template )
520530 if not args .yes :
521531 ans = input ("Are you sure you want to proceed? (y/n): " )
Original file line number Diff line number Diff line change @@ -29,7 +29,8 @@ def setUp(self):
2929 # limit jobs because ray.get() does not terminate if jobs > number of samples
3030 core = os .cpu_count ()
3131 self .resources_per_trial = 1
32- self .cpu_budget = 4 if core >= 4 else core
32+ self .jobs = 4
33+ self .cpu_budget = 1 # test should terminate in 1/(4*1) = 0.25 hours
3334 self .experiment = f"smoke-test-sweep-{ self .platform } "
3435 self .command = (
3536 "python3 -m autotuner.distributed"
@@ -38,6 +39,7 @@ def setUp(self):
3839 f" --experiment { self .experiment } "
3940 f" --config { self .config } "
4041 f" --cpu_budget { self .cpu_budget } "
42+ f" --jobs { self .jobs } "
4143 f" --yes"
4244 f" sweep --resources_per_trial { self .resources_per_trial } "
4345 )
You can’t perform that action at this time.
0 commit comments