Files
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

106 lines
3.5 KiB
Python
Executable File

#!/usr/bin/env python
# Copyright Advanced Micro Devices, Inc.
# SPDX-License-Identifier: MIT
"""Checks out UCCL.
Helper script to checkout upstream UCCL sources without cloning the full repo.
Primary usage:
./uccl_repo.py checkout
The checkout process combines the following activities:
* Clones the uccl repository into `THIS_MAIN_REPO_NAME` with a requested `--repo-hashtag`
tag (default to latest release).
* Configures UCCL submodules to be ignored for any local changes (so that
the result is suitable for development with local patches).
* Applies "base" patches to the uccl repo and any submodules (by using
`git am` with patches from `patches/uccl_ref_to_THIS_PATCHES_DIR_name(<repo-hashtag>)/<repo-name>/base`).
* Records some tag information for subsequent activities.
For one-shot builds and CI use, the above is sufficient. But this tool can also
be used to develop. Any commits made to UCCL or any of its submodules can
be saved locally in TheRock by running `./uccl_repo.py save-patches`. If checked
in, CI runs for that revision will incorporate them the same as anyone
interactively using this tool.
"""
import argparse
from pathlib import Path
import sys
import repo_management
THIS_MAIN_REPO_NAME = "uccl"
THIS_DIR = Path(__file__).resolve().parent
THIS_PATCHES_DIR = THIS_DIR / "patches" / THIS_MAIN_REPO_NAME
def main(cl_args: list[str]):
def add_common(command_parser: argparse.ArgumentParser):
command_parser.add_argument(
"--repo",
type=Path,
default=THIS_DIR / THIS_MAIN_REPO_NAME,
help="Git repository path",
)
command_parser.add_argument(
"--patch-dir",
type=Path,
default=THIS_PATCHES_DIR,
help="Git repository patch path",
)
command_parser.add_argument(
"--repo-name",
type=Path,
default=THIS_MAIN_REPO_NAME,
help="Subdirectory name in which to checkout repo",
)
command_parser.add_argument(
"--repo-hashtag",
default=default_repo_hashtag,
help="Git repository ref/tag to checkout",
)
command_parser.add_argument(
"--patchset",
help="patch dir subdirectory (defaults to mangled --repo-hashtag)",
)
p = argparse.ArgumentParser("uccl_repo.py")
default_repo_hashtag = "main"
sub_p = p.add_subparsers(required=True)
checkout_p = sub_p.add_parser("checkout", help="Clone UCCL locally and checkout")
add_common(checkout_p)
checkout_p.add_argument(
"--gitrepo-origin",
default="https://github.com/uccl-project/uccl.git",
help="git repository url",
)
checkout_p.add_argument("--depth", type=int, help="Fetch depth")
checkout_p.add_argument("--jobs", default=10, type=int, help="Number of fetch jobs")
checkout_p.add_argument(
"--patch",
action=argparse.BooleanOptionalAction,
default=True,
help="Apply patches for the repo-hashtag",
)
checkout_p.set_defaults(func=repo_management.do_checkout)
save_patches_p = sub_p.add_parser(
"save-patches", help="Save local commits as patch files for later application"
)
add_common(save_patches_p)
save_patches_p.set_defaults(func=repo_management.do_save_patches)
args = p.parse_args(cl_args)
# Hard-set an "option" as disabled (post-parse) to keep repo_management.py happy
setattr(args, "hipify", False)
args.func(args)
if __name__ == "__main__":
main(sys.argv[1:])