-
Notifications
You must be signed in to change notification settings - Fork 487
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create common
setup
action to wrap setup steps (#7272)
- Loading branch information
1 parent
0025ca7
commit a5eba0f
Showing
9 changed files
with
157 additions
and
135 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
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 was deleted.
Oops, something went wrong.
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
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,86 @@ | ||
name: Set up PyTorch/XLA | ||
inputs: | ||
torch-commit: | ||
type: string | ||
description: PyTorch commit to check out, if provided | ||
cuda: | ||
type: boolean | ||
description: Whether to set up CUDA library paths | ||
default: false | ||
wheels-artifact: | ||
type: string | ||
description: | | ||
Artifact containing `torch` (cpu) and `torch-xla` wheels to install | ||
cuda-plugin-artifact: | ||
type: string | ||
description: Artifact containing `torch-xla-cuda-plugin` to install | ||
cuda-torch-artifact: | ||
type: string | ||
description: Artifact containing CUDA build of `torch` | ||
runs: | ||
using: "composite" | ||
steps: | ||
# See https://github.com/actions/checkout/issues/1014#issuecomment-1906802802 | ||
- name: Clean up workspace | ||
shell: bash | ||
run: | | ||
ls -la | ||
rm -rvf ${GITHUB_WORKSPACE}/* | ||
- name: Setup CUDA environment | ||
shell: bash | ||
run: | | ||
echo "PATH=$PATH:/usr/local/cuda-12.1/bin" >> $GITHUB_ENV | ||
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-12.1/lib64" >> $GITHUB_ENV | ||
if: ${{ inputs.cuda }} | ||
- name: Setup gcloud | ||
shell: bash | ||
run: | | ||
echo "${GCLOUD_SERVICE_KEY}" > /tmp/default_credentials.json | ||
echo "GOOGLE_APPLICATION_CREDENTIALS=/tmp/default_credentials.json" >> $GITHUB_ENV | ||
# GCLOUD_SERVICE_KEY needs to be set from the outside because for some | ||
# reason composite actions don't support secrets. | ||
# https://docs.github.com/en/actions/using-workflows/avoiding-duplication | ||
if: ${{ env.GCLOUD_SERVICE_KEY }} | ||
- name: Checkout PyTorch Repo | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: pytorch/pytorch | ||
path: pytorch | ||
ref: ${{ inputs.torch-commit }} | ||
submodules: recursive | ||
if: ${{ inputs.torch-commit }} | ||
- name: Checkout PyTorch/XLA Repo | ||
uses: actions/checkout@v4 | ||
with: | ||
path: pytorch/xla | ||
- name: Fetch PyTorch/XLA packages | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: ${{ inputs.wheels-artifact }} | ||
path: /tmp/wheels/ | ||
if: ${{ inputs.wheels-artifact }} | ||
- name: Fetch CUDA plugin | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: ${{ inputs.cuda-plugin-artifact }} | ||
path: /tmp/wheels/ | ||
if: ${{ inputs.cuda-plugin-artifact }} | ||
- name: Remove CPU `torch` build | ||
shell: bash | ||
run: | | ||
rm -rf /tmp/wheels/torch-* | ||
if: ${{ inputs.cuda-torch-artifact }} | ||
- name: Fetch CUDA `torch` build | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: ${{ inputs.cuda-torch-artifact }} | ||
path: /tmp/wheels/ | ||
if: ${{ inputs.cuda-torch-artifact }} | ||
- name: Install wheels | ||
shell: bash | ||
run: | | ||
pip install /tmp/wheels/*.whl | ||
echo "Import check..." | ||
python -c "import torch_xla" | ||
if: ${{ inputs.wheels-artifact }} |