Skip to content

Commit 6a6fad1

Browse files
authored
[aarch64] add support for torchdata wheel building (#1309)
1 parent 9aa10c3 commit 6a6fad1

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

build_aarch64_wheel.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,40 @@ def build_torchvision(host: RemoteHost, *,
321321
return vision_wheel_name
322322

323323

324+
def build_torchdata(host: RemoteHost, *,
325+
branch: str = "master",
326+
use_conda: bool = True,
327+
git_clone_flags: str = "") -> str:
328+
print('Checking out TorchData repo')
329+
git_clone_flags += " --recurse-submodules"
330+
build_version = checkout_repo(host,
331+
branch=branch,
332+
url="https://github.com/pytorch/data",
333+
git_clone_flags=git_clone_flags,
334+
mapping={
335+
"v1.13.1": ("0.5.1", ""),
336+
})
337+
print('Building TorchData wheel')
338+
build_vars = ""
339+
if branch == 'nightly':
340+
version = host.check_output(["if [ -f data/version.txt ]; then cat data/version.txt; fi"]).strip()
341+
build_date = host.check_output("cd pytorch ; git log --pretty=format:%s -1").strip().split()[0].replace("-", "")
342+
build_vars += f"BUILD_VERSION={version}.dev{build_date}"
343+
elif build_version is not None:
344+
build_vars += f"BUILD_VERSION={build_version}"
345+
if host.using_docker():
346+
build_vars += " CMAKE_SHARED_LINKER_FLAGS=-Wl,-z,max-page-size=0x10000"
347+
348+
host.run_cmd(f"cd data; {build_vars} python3 setup.py bdist_wheel")
349+
wheel_name = host.list_dir("data/dist")[0]
350+
embed_libgomp(host, use_conda, os.path.join('data', 'dist', wheel_name))
351+
352+
print('Copying TorchData wheel')
353+
host.download_wheel(os.path.join('data', 'dist', wheel_name))
354+
355+
return wheel_name
356+
357+
324358
def build_torchtext(host: RemoteHost, *,
325359
branch: str = "master",
326360
use_conda: bool = True,
@@ -512,6 +546,7 @@ def start_build(host: RemoteHost, *,
512546
vision_wheel_name = build_torchvision(host, branch=branch, use_conda=use_conda, git_clone_flags=git_clone_flags)
513547
build_torchaudio(host, branch=branch, use_conda=use_conda, git_clone_flags=git_clone_flags)
514548
build_torchtext(host, branch=branch, use_conda=use_conda, git_clone_flags=git_clone_flags)
549+
build_torchdata(host, branch=branch, use_conda=use_conda, git_clone_flags=git_clone_flags)
515550

516551
return pytorch_wheel_name, vision_wheel_name
517552

0 commit comments

Comments
 (0)