-
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 (#6910)
- Loading branch information
1 parent
a816c42
commit a170ffe
Showing
7 changed files
with
109 additions
and
11 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,57 @@ | ||
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 }} | ||
env: | ||
GCLOUD_SERVICE_KEY: ${{ secrets.gcloud-service-key }} | ||
GOOGLE_APPLICATION_CREDENTIALS: /tmp/default_credentials.json | ||
BAZEL_JOBS: 16 | ||
BAZEL_REMOTE_CACHE: 1 | ||
steps: | ||
- name: Setup gcloud | ||
shell: bash | ||
run: | | ||
echo "${GCLOUD_SERVICE_KEY}" > $GOOGLE_APPLICATION_CREDENTIALS | ||
- name: Checkout repo | ||
uses: actions/checkout@v4 | ||
with: | ||
path: pytorch/xla | ||
- name: Build | ||
shell: bash | ||
run: | | ||
cd pytorch/xla/infra/ansible | ||
ansible-playbook playbook.yaml -vvv -e "stage=build_plugin arch=amd64 accelerator=cuda src_root=${GITHUB_WORKSPACE}" --skip-tags=fetch_srcs,install_deps | ||
- name: Upload wheel | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: cuda-plugin | ||
path: /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 plugin *.whl files in pytorch/xla/dist | ||
ansible.builtin.find: | ||
path: "/dist" | ||
pattern: "torch_xla_cuda_plugin*.whl" | ||
register: plugin_wheels | ||
|
||
- name: Install plugin wheels | ||
ansible.builtin.pip: | ||
name: "{{ 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
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