-
Notifications
You must be signed in to change notification settings - Fork 486
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ansible stage for building CUDA plugin
- Loading branch information
1 parent
786484d
commit 4d7b5bc
Showing
7 changed files
with
104 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: build-cuda-plugin | ||
on: | ||
workflow_call: | ||
inputs: | ||
dev-image: | ||
required: true | ||
type: string | ||
description: Base image for builds | ||
runner: | ||
required: false | ||
type: string | ||
description: Runner type for the test | ||
default: linux.12xlarge | ||
cuda: | ||
required: false | ||
type: string | ||
description: Whether to build XLA with CUDA | ||
default: 1 | ||
|
||
secrets: | ||
gcloud-service-key: | ||
required: true | ||
description: Secret to access Bazel build cache | ||
|
||
outputs: | ||
docker-image: | ||
value: ${{ jobs.build.outputs.docker-image }} | ||
description: The docker image containing the built PyTorch. | ||
jobs: | ||
build: | ||
runs-on: ${{ inputs.runner }} | ||
container: | ||
image: ${{ inputs.dev-image }} | ||
volumes: | ||
- ${GITHUB_WORKSPACE}/dist/:/dist/ | ||
env: | ||
GCLOUD_SERVICE_KEY: ${{ secrets.gcloud-service-key }} | ||
BAZEL_JOBS: 16 | ||
BAZEL_REMOTE_CACHE: 1 | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v3 | ||
- name: Setup gcloud | ||
shell: bash | ||
run: | | ||
echo "${GCLOUD_SERVICE_KEY}" >> default_credentials.json | ||
- name: Build | ||
shell: bash | ||
run: | | ||
cd infra/ansible | ||
# TODO: don't clone everything again | ||
ansible-playbook playbook.yaml -e "stage=build_cuda arch=amd64 accelerator=cuda" --skip-tags=install_deps | ||
- name: actions/upload-artifact@v4 | ||
with: | ||
name: cuda-plugin | ||
path: ${GITHUB_WORKSPACE}/dist/*.whl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
- name: Create /dist directory for exported wheels | ||
ansible.builtin.file: | ||
path: /dist | ||
state: directory | ||
mode: '0755' | ||
|
||
- name: Build PyTorch/XLA CUDA Plugin | ||
ansible.builtin.command: | ||
cmd: pip wheel -w /dist plugins/cuda -v | ||
chdir: "{{ (src_root, 'pytorch/xla') | path_join }}" | ||
environment: "{{ env_vars }}" | ||
when: accelerator == "cuda" | ||
|
||
- name: Find XLA *.whl files in pytorch/xla/dist | ||
ansible.builtin.find: | ||
path: "/dist" | ||
pattern: "torch_xla_cuda_plugin*.whl" | ||
register: cuda_plugin_wheels | ||
|
||
- name: Install XLA wheels | ||
ansible.builtin.pip: | ||
name: "{{ cuda_plugin_wheels.files | map(attribute='path') }}" | ||
state: "forcereinstall" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,12 +4,12 @@ build-backend = "setuptools.build_meta" | |
|
||
[project] | ||
name = "torch_xla_cuda_plugin" | ||
version = "0.0.1" | ||
authors = [ | ||
{name = "PyTorch/XLA Dev Team", email = "[email protected]"}, | ||
] | ||
description = "PyTorch/XLA CUDA Plugin" | ||
requires-python = ">=3.8" | ||
dynamic = ["version"] | ||
|
||
[tool.setuptools.package-data] | ||
torch_xla_cuda_plugin = ["lib/*.so"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters