From 70a35109dac4792e0c39b6517fcdd218c6e4503a Mon Sep 17 00:00:00 2001 From: Joshua Fife Date: Wed, 1 Nov 2023 22:05:47 -0600 Subject: [PATCH 1/4] fixed sdc file copy and parmys abs path to temp folder issue --- vtr_flow/scripts/run_vtr_flow.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/vtr_flow/scripts/run_vtr_flow.py b/vtr_flow/scripts/run_vtr_flow.py index 3d584274e3f..416a711feb9 100755 --- a/vtr_flow/scripts/run_vtr_flow.py +++ b/vtr_flow/scripts/run_vtr_flow.py @@ -383,7 +383,7 @@ def vtr_command_argparser(prog=None): help="Tells VPR the amount of iterations allowed to obtain the critical path.", ) vpr.add_argument( - "-fix_pins", + "--fix_pins", type=str, help="Controls how the placer handles I/O pads during placement.", ) @@ -424,7 +424,7 @@ def vtr_command_argparser(prog=None): help="Tells VPR to run routing stage", ) vpr.add_argument( - "-sdc_file", default=None, type=str, help="Path to SDC timing constraints file." + "--sdc_file", default=None, type=str, help="Path to SDC timing constraints file." ) vpr.add_argument( "-read_vpr_constraints", default=None, type=str, help="Path to vpr constraints file." @@ -524,7 +524,11 @@ def vtr_command_main(arg_list, prog=None): error_status = "Error" assert args.temp_dir + temp_dir = Path(args.temp_dir) + if not str(temp_dir).startswith("/"): + temp_dir = Path(os.getcwd() + "/" + args.temp_dir) + # Specify how command should be run command_runner = vtr.CommandRunner( track_memory=args.track_memory_usage, @@ -538,6 +542,9 @@ def vtr_command_main(arg_list, prog=None): exit_status = 0 return_status = 0 try: + # Create temp dir + os.makedirs(temp_dir, exist_ok=True) + vpr_args = process_unknown_args(unknown_args) vpr_args = process_vpr_args(args, prog, temp_dir, vpr_args) if args.sdc_file: @@ -765,11 +772,10 @@ def get_sdc_file(sdc_file, prog, temp_dir): takes in the sdc_file and returns a path to that file if it exists. """ if not sdc_file.startswith("/"): - sdc_file = Path(prog).parent.parent / sdc_file + sdc_file = os.getcwd() + "/" + str(sdc_file) sdc_file_name = Path(sdc_file).name sdc_file_copy = Path(temp_dir) / Path(sdc_file_name) shutil.copy(str(sdc_file), str(sdc_file_copy)) - return str(vtr.verify_file(sdc_file_copy, "sdc file")) @@ -778,7 +784,7 @@ def get_read_vpr_constraints(read_vpr_constraints, prog, temp_dir): takes in the read_vpr_constraints and returns a path to that file if it exists. """ if not read_vpr_constraints.startswith("/"): - read_vpr_constraints = Path(prog).parent.parent / read_vpr_constraints + read_vpr_constraints = os.getcwd() + "/" + str(read_vpr_constraints) vpr_constraint_file_name = Path(read_vpr_constraints).name vpr_constraint_file_copy = Path(temp_dir) / Path(vpr_constraint_file_name) shutil.copy(str(read_vpr_constraints), str(vpr_constraint_file_copy)) From 1425bdf9ada8ab7d5c00db4c80b3cf9645861e22 Mon Sep 17 00:00:00 2001 From: Joshua Fife Date: Thu, 2 Nov 2023 09:23:42 -0600 Subject: [PATCH 2/4] fixed python formating --- vtr_flow/scripts/run_vtr_flow.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/vtr_flow/scripts/run_vtr_flow.py b/vtr_flow/scripts/run_vtr_flow.py index 416a711feb9..e288f2b5099 100755 --- a/vtr_flow/scripts/run_vtr_flow.py +++ b/vtr_flow/scripts/run_vtr_flow.py @@ -524,11 +524,9 @@ def vtr_command_main(arg_list, prog=None): error_status = "Error" assert args.temp_dir - temp_dir = Path(args.temp_dir) if not str(temp_dir).startswith("/"): temp_dir = Path(os.getcwd() + "/" + args.temp_dir) - # Specify how command should be run command_runner = vtr.CommandRunner( track_memory=args.track_memory_usage, @@ -548,11 +546,11 @@ def vtr_command_main(arg_list, prog=None): vpr_args = process_unknown_args(unknown_args) vpr_args = process_vpr_args(args, prog, temp_dir, vpr_args) if args.sdc_file: - sdc_file_copy = get_sdc_file(args.sdc_file, prog, temp_dir) + sdc_file_copy = get_sdc_file(args.sdc_file, temp_dir) vpr_args["sdc_file"] = Path(sdc_file_copy).name if args.read_vpr_constraints: vpr_constraint_file_copy = get_read_vpr_constraints( - args.read_vpr_constraints, prog, temp_dir + args.read_vpr_constraints, temp_dir ) vpr_args["read_vpr_constraints"] = Path(vpr_constraint_file_copy).name @@ -767,7 +765,7 @@ def process_vpr_args(args, prog, temp_dir, vpr_args): return vpr_args -def get_sdc_file(sdc_file, prog, temp_dir): +def get_sdc_file(sdc_file, temp_dir): """ takes in the sdc_file and returns a path to that file if it exists. """ @@ -779,7 +777,7 @@ def get_sdc_file(sdc_file, prog, temp_dir): return str(vtr.verify_file(sdc_file_copy, "sdc file")) -def get_read_vpr_constraints(read_vpr_constraints, prog, temp_dir): +def get_read_vpr_constraints(read_vpr_constraints, temp_dir): """ takes in the read_vpr_constraints and returns a path to that file if it exists. """ From c218cbf9e75a74687dd0b16892af62df8a3a3137 Mon Sep 17 00:00:00 2001 From: Joshua Fife Date: Tue, 4 Jun 2024 11:50:13 -0600 Subject: [PATCH 3/4] added comment to explain creation of absolute path --- vtr_flow/scripts/run_vtr_flow.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vtr_flow/scripts/run_vtr_flow.py b/vtr_flow/scripts/run_vtr_flow.py index e288f2b5099..bea79f4394e 100755 --- a/vtr_flow/scripts/run_vtr_flow.py +++ b/vtr_flow/scripts/run_vtr_flow.py @@ -525,6 +525,8 @@ def vtr_command_main(arg_list, prog=None): assert args.temp_dir temp_dir = Path(args.temp_dir) + # Create an absolute path is it is not already provided. + # Parmys throws an error if an absolute path is not provided. if not str(temp_dir).startswith("/"): temp_dir = Path(os.getcwd() + "/" + args.temp_dir) # Specify how command should be run From 9ce7dcf30b0345a048f83465b4bb533e68d1e8be Mon Sep 17 00:00:00 2001 From: Joshua Fife Date: Fri, 7 Jun 2024 21:38:34 -0600 Subject: [PATCH 4/4] fixed lint problems --- vtr_flow/scripts/run_vtr_flow.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vtr_flow/scripts/run_vtr_flow.py b/vtr_flow/scripts/run_vtr_flow.py index bea79f4394e..68e81c3aa98 100755 --- a/vtr_flow/scripts/run_vtr_flow.py +++ b/vtr_flow/scripts/run_vtr_flow.py @@ -525,7 +525,7 @@ def vtr_command_main(arg_list, prog=None): assert args.temp_dir temp_dir = Path(args.temp_dir) - # Create an absolute path is it is not already provided. + # Create an absolute path is it is not already provided. # Parmys throws an error if an absolute path is not provided. if not str(temp_dir).startswith("/"): temp_dir = Path(os.getcwd() + "/" + args.temp_dir)