Skip to content

[aarch64] add support for torchdata wheel building #1309

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions build_aarch64_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,40 @@ def build_torchvision(host: RemoteHost, *,
return vision_wheel_name


def build_torchdata(host: RemoteHost, *,
branch: str = "master",
use_conda: bool = True,
git_clone_flags: str = "") -> str:
print('Checking out TorchData repo')
git_clone_flags += " --recurse-submodules"
build_version = checkout_repo(host,
branch=branch,
url="https://github.com/pytorch/data",
git_clone_flags=git_clone_flags,
mapping={
"v1.13.1": ("0.5.1", ""),
})
print('Building TorchData wheel')
build_vars = ""
if branch == 'nightly':
version = host.check_output(["if [ -f data/version.txt ]; then cat data/version.txt; fi"]).strip()
build_date = host.check_output("cd pytorch ; git log --pretty=format:%s -1").strip().split()[0].replace("-", "")
build_vars += f"BUILD_VERSION={version}.dev{build_date}"
elif build_version is not None:
build_vars += f"BUILD_VERSION={build_version}"
if host.using_docker():
build_vars += " CMAKE_SHARED_LINKER_FLAGS=-Wl,-z,max-page-size=0x10000"

host.run_cmd(f"cd data; {build_vars} python3 setup.py bdist_wheel")
wheel_name = host.list_dir("data/dist")[0]
embed_libgomp(host, use_conda, os.path.join('data', 'dist', wheel_name))

print('Copying TorchData wheel')
host.download_wheel(os.path.join('data', 'dist', wheel_name))

return wheel_name


def build_torchtext(host: RemoteHost, *,
branch: str = "master",
use_conda: bool = True,
Expand Down Expand Up @@ -512,6 +546,7 @@ def start_build(host: RemoteHost, *,
vision_wheel_name = build_torchvision(host, branch=branch, use_conda=use_conda, git_clone_flags=git_clone_flags)
build_torchaudio(host, branch=branch, use_conda=use_conda, git_clone_flags=git_clone_flags)
build_torchtext(host, branch=branch, use_conda=use_conda, git_clone_flags=git_clone_flags)
build_torchdata(host, branch=branch, use_conda=use_conda, git_clone_flags=git_clone_flags)

return pytorch_wheel_name, vision_wheel_name

Expand Down