@@ -77,7 +77,7 @@ def setup(self, config):
7777 """
7878 # We create the following directory structure:
7979 # 1/ 2/ 3/ 4/ 5/ 6/
80- # <repo>/<logs>/<platform>/<design>/<experiment>-DATE /<id>/<cwd>
80+ # <repo>/<logs>/<platform>/<design>/<experiment>/<id>/<cwd>
8181 repo_dir = os .getcwd () + "/../" * 6
8282 self .repo_dir = os .path .abspath (repo_dir )
8383 self .parameters = parse_config (config , path = os .getcwd ())
@@ -88,7 +88,8 @@ def step(self):
8888 """
8989 Run step experiment and compute its score.
9090 """
91- metrics_file = openroad (self .repo_dir , self .parameters , self .variant )
91+ self ._variant = f"{ self .variant } -{ self .step_ } "
92+ metrics_file = openroad (self .repo_dir , self .parameters , self ._variant )
9293 self .step_ += 1
9394 (score , effective_clk_period , num_drc ) = self .evaluate (
9495 self .read_metrics (metrics_file )
@@ -709,7 +710,10 @@ def parse_arguments():
709710 help = "Time limit (in hours) for each trial run. Default is no limit." ,
710711 )
711712 tune_parser .add_argument (
712- "--resume" , action = "store_true" , help = "Resume previous run."
713+ "--resume" ,
714+ action = "store_true" ,
715+ help = "Resume previous run. Note that you must also set a unique experiment\
716+ name identifier via `--experiment NAME` to be able to resume." ,
713717 )
714718
715719 # Setup
@@ -797,8 +801,8 @@ def parse_arguments():
797801 )
798802 tune_parser .add_argument (
799803 "--resources_per_trial" ,
800- type = int ,
801- metavar = "<int >" ,
804+ type = float ,
805+ metavar = "<float >" ,
802806 default = 1 ,
803807 help = "Number of CPUs to request for each tuning job." ,
804808 )
@@ -874,7 +878,20 @@ def parse_arguments():
874878 )
875879 sys .exit (7 )
876880
877- arguments .experiment += f"-{ arguments .mode } -{ DATE } "
881+ # Check for experiment name and resume flag.
882+ if arguments .resume and arguments .experiment == "test" :
883+ print (
884+ '[ERROR TUN-0031] The flag "--resume"'
885+ ' requires that "--experiment NAME" is also given.'
886+ )
887+ sys .exit (1 )
888+
889+ # If the experiment name is the default, add a UUID to the end.
890+ if arguments .experiment == "test" :
891+ id = str (uuid ())[:8 ]
892+ arguments .experiment = f"{ arguments .mode } -{ id } "
893+ else :
894+ arguments .experiment += f"-{ arguments .mode } "
878895
879896 if arguments .timeout is not None :
880897 arguments .timeout = round (arguments .timeout * 3600 )
@@ -1075,7 +1092,7 @@ def sweep():
10751092 local_dir = LOCAL_DIR ,
10761093 resume = args .resume ,
10771094 stop = {"training_iteration" : args .iterations },
1078- resources_per_trial = {"cpu" : args .resources_per_trial },
1095+ resources_per_trial = {"cpu" : os . cpu_count () / args .jobs },
10791096 log_to_file = ["trail-out.log" , "trail-err.log" ],
10801097 trial_name_creator = lambda x : f"variant-{ x .trainable_name } -{ x .trial_id } -ray" ,
10811098 trial_dirname_creator = lambda x : f"variant-{ x .trainable_name } -{ x .trial_id } -ray" ,
0 commit comments