Skip to content

Commit ffae0e8

Browse files
committed
remove git interface
Signed-off-by: Jack Luar <[email protected]>
1 parent a0a9e19 commit ffae0e8

File tree

2 files changed

+11
-133
lines changed

2 files changed

+11
-133
lines changed

tools/AutoTuner/src/autotuner/distributed.py

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,6 @@
104104
ORFS_FLOW_DIR = os.path.abspath(
105105
os.path.join(os.path.dirname(__file__), "../../../../flow")
106106
)
107-
# URL to ORFS GitHub repository
108-
ORFS_URL = "https://github.com/The-OpenROAD-Project/OpenROAD-flow-scripts"
109107
# Global variable for args
110108
args = None
111109

@@ -316,60 +314,6 @@ def parse_arguments():
316314
name identifier via `--experiment NAME` to be able to resume.",
317315
)
318316

319-
# Setup
320-
parser.add_argument(
321-
"--git_clean",
322-
action="store_true",
323-
help="Clean binaries and build files."
324-
" WARNING: may lose previous data."
325-
" Use carefully.",
326-
)
327-
parser.add_argument(
328-
"--git_clone",
329-
action="store_true",
330-
help="Force new git clone."
331-
" WARNING: may lose previous data."
332-
" Use carefully.",
333-
)
334-
parser.add_argument(
335-
"--git_clone_args",
336-
type=str,
337-
metavar="<str>",
338-
default="",
339-
help="Additional git clone arguments.",
340-
)
341-
parser.add_argument(
342-
"--git_latest", action="store_true", help="Use latest version of OpenROAD app."
343-
)
344-
parser.add_argument(
345-
"--git_or_branch",
346-
type=str,
347-
metavar="<str>",
348-
default="",
349-
help="OpenROAD app branch to use.",
350-
)
351-
parser.add_argument(
352-
"--git_orfs_branch",
353-
type=str,
354-
metavar="<str>",
355-
default="master",
356-
help="OpenROAD-flow-scripts branch to use.",
357-
)
358-
parser.add_argument(
359-
"--git_url",
360-
type=str,
361-
metavar="<url>",
362-
default=ORFS_URL,
363-
help="OpenROAD-flow-scripts repo URL to use.",
364-
)
365-
parser.add_argument(
366-
"--build_args",
367-
type=str,
368-
metavar="<str>",
369-
default="",
370-
help="Additional arguments given to ./build_openroad.sh.",
371-
)
372-
373317
# ML
374318
tune_parser.add_argument(
375319
"--algorithm",

tools/AutoTuner/src/autotuner/utils.py

Lines changed: 11 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -571,91 +571,25 @@ def read_tune_pbt(name, this):
571571
return config, sdc_file, fr_file
572572

573573

574-
def clone(args, path):
575-
"""
576-
Clone base repo in the remote machine. Only used for Kubernetes at GCP.
577-
"""
578-
if args.git_clone:
579-
run_command(args, f"rm -rf {path}")
580-
if not os.path.isdir(f"{path}/.git"):
581-
git_command = "git clone --depth 1 --recursive --single-branch"
582-
git_command += f" {args.git_clone_args}"
583-
git_command += f" --branch {args.git_orfs_branch}"
584-
git_command += f" {args.git_url} {path}"
585-
run_command(args, git_command)
586-
587-
588-
def build(args, base, install):
589-
"""
590-
Build OpenROAD, Yosys and other dependencies.
591-
"""
592-
build_command = f'cd "{base}"'
593-
if args.git_clean:
594-
build_command += " && git clean -xdf tools"
595-
build_command += " && git submodule foreach --recursive git clean -xdf"
596-
if (
597-
args.git_clean
598-
or not os.path.isfile(f"{install}/OpenROAD/bin/openroad")
599-
or not os.path.isfile(f"{install}/yosys/bin/yosys")
600-
):
601-
build_command += ' && bash -ic "./build_openroad.sh'
602-
# Some GCP machines have 200+ cores. Let's be reasonable...
603-
build_command += f" --local --nice --threads {min(32, cpu_count())}"
604-
if args.git_latest:
605-
build_command += " --latest"
606-
build_command += f' {args.build_args}"'
607-
run_command(args, build_command)
608-
609-
610-
@ray.remote
611-
def setup_repo(args, base):
612-
"""
613-
Clone ORFS repository and compile binaries.
614-
"""
615-
print(f"[INFO TUN-0000] Remote folder: {base}")
616-
install = f"{base}/tools/install"
617-
if args.server is not None:
618-
clone(base)
619-
build(base, install)
620-
return install
621-
622-
623574
def prepare_ray_server(args):
624575
"""
625576
Prepares Ray server and returns basic directories.
626577
"""
627578
# Connect to remote Ray server if any, otherwise will run locally
628579
if args.server is not None:
629-
# At GCP we have a NFS folder that is present for all worker nodes.
630-
# This allows to build required binaries once. We clone, build and
631-
# store intermediate files at LOCAL_DIR.
632-
with open(args.config) as config_file:
633-
local_dir = "/shared-data/autotuner"
634-
local_dir += f"-orfs-{args.git_orfs_branch}"
635-
if args.git_or_branch != "":
636-
local_dir += f"-or-{args.git_or_branch}"
637-
if args.git_latest:
638-
local_dir += "-or-latest"
639580
# Connect to ray server before first remote execution.
640581
ray.init(f"ray://{args.server}:{args.port}")
641-
# Remote functions return a task id and are non-blocking. Since we
642-
# need the setup repo before continuing, we call ray.get() to wait
643-
# for its completion.
644-
install_path = ray.get(setup_repo.remote(local_dir))
645-
orfs_flow_dir = os.path.join(local_dir, "flow")
646-
local_dir += f"/flow/logs/{args.platform}/{args.design}"
647-
print("[INFO TUN-0001] NFS setup completed.")
648-
else:
649-
orfs_dir = getattr(args, "orfs", None)
650-
# For local runs, use the same folder as other ORFS utilities.
651-
orfs_flow_dir = os.path.abspath(
652-
os.path.join(orfs_dir, "flow")
653-
if orfs_dir
654-
else os.path.join(os.path.dirname(__file__), "../../../../flow")
655-
)
656-
local_dir = f"logs/{args.platform}/{args.design}"
657-
local_dir = os.path.join(orfs_flow_dir, local_dir)
658-
install_path = os.path.abspath(os.path.join(orfs_flow_dir, "../tools/install"))
582+
print("[INFO TUN-0001] Connected to Ray server.")
583+
# Common variables used for local and remote runs.
584+
orfs_dir = getattr(args, "orfs", None)
585+
orfs_flow_dir = os.path.abspath(
586+
os.path.join(orfs_dir, "flow")
587+
if orfs_dir
588+
else os.path.join(os.path.dirname(__file__), "../../../../flow")
589+
)
590+
local_dir = f"logs/{args.platform}/{args.design}"
591+
local_dir = os.path.join(orfs_flow_dir, local_dir)
592+
install_path = os.path.abspath(os.path.join(orfs_flow_dir, "../tools/install"))
659593
return local_dir, orfs_flow_dir, install_path
660594

661595

0 commit comments

Comments
 (0)