Skip to content

Initial GPU CI setup #29130

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 37 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
ca51b9c
Initial GPU CI setup
betatim May 29, 2024
1b06c5b
Give the workflow a name
betatim May 29, 2024
2bc3987
Execute workflow also on pull requests
betatim May 29, 2024
b376491
Look around
betatim May 29, 2024
0421a38
Mamba solver is already configured
betatim May 29, 2024
169a707
Conda permissions
betatim May 29, 2024
4736792
sudo make me a sandwich
betatim May 29, 2024
c66620e
sudo chown
betatim May 29, 2024
8397056
miniforge
betatim May 29, 2024
b30d217
miniforge
betatim May 29, 2024
56d4472
miniforge
betatim May 29, 2024
9b07c31
miniforge
betatim May 29, 2024
a6de469
miniforge
betatim May 29, 2024
1d9f1df
miniforge
betatim May 29, 2024
4dd748e
Use a dedicated env/lock file for array API
betatim May 29, 2024
bb7bfcd
Use inputs
betatim May 30, 2024
6f1832f
Fix cupy version
betatim May 30, 2024
f27d848
Use a cache for the conda environment
betatim May 30, 2024
d710236
Update path
betatim May 30, 2024
618fb38
Test the cache
betatim May 30, 2024
468a6c3
Enable build parallelism
betatim May 30, 2024
a6ef0a1
Restrict permissions of the GitHub token
betatim May 31, 2024
b409225
Remove unused build parallelism env var
betatim May 31, 2024
fe07d86
Set a meaningful tag
betatim May 31, 2024
08fcecb
Configure automatic lockfile update
betatim May 31, 2024
5e7b0da
Rename workflow job
betatim Jun 3, 2024
43b8537
Remove package constraints
betatim Jun 3, 2024
4d5b7c7
Merge branch 'main' into betatim/gpu-ci
betatim Jun 3, 2024
d19551d
Remove "pull_request" trigger
betatim Jun 3, 2024
e68fcc5
Add ability to use more than one channel
betatim Jun 4, 2024
0848964
Add comment about invalidating install cache
betatim Jun 4, 2024
7224cff
Fix script name typo
betatim Jun 4, 2024
be358ab
Trigger CUDA tests from update lockfile update workflow
betatim Jun 4, 2024
99bc922
Rename lock files
betatim Jun 4, 2024
7b02cd2
Explicitly state that runner is selected by group name
betatim Jun 4, 2024
8d08b60
Update
betatim Jun 4, 2024
39f9407
Move everything to script
thomasjpfan Jun 4, 2024
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
47 changes: 47 additions & 0 deletions .github/workflows/cuda-gpu-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: CUDA GPU
on:
workflow_dispatch:
inputs:
pr_id:
description: Test the contents of this Pull Request
required: true

permissions: read-all

jobs:
tests:
runs-on:
group: cuda-gpu-runner-group
name: Run Array API unit tests
steps:
- uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Checkout main repository
uses: actions/checkout@v2
- name: Checkout a particular Pull Request
if: inputs.pr_id
env:
PR_ID: ${{ inputs.pr_id }}
GH_TOKEN: ${{ github.token }}
run: |
gh pr checkout ${{ env.PR_ID }}
- name: Cache conda environment
id: cache-conda
uses: actions/cache@v3
with:
path: ~/conda
key: ${{ runner.os }}-build-${{ hashFiles('build_tools/github/create_gpu_environment.sh') }}-${{ hashFiles('build_tools/github/pylatest_conda_forge_cuda_array-api_linux-64_conda.lock') }}
- name: Install miniforge
if: ${{ steps.cache-conda.outputs.cache-hit != 'true' }}
run: bash build_tools/github/create_gpu_environment.sh
- name: Install scikit-learn
run: |
source "${HOME}/conda/etc/profile.d/conda.sh"
conda activate sklearn
pip install --verbose --no-build-isolation --config-settings editable-verbose=true --editable .
- name: Run array API tests
run: |
source "${HOME}/conda/etc/profile.d/conda.sh"
conda activate sklearn
pytest -k 'array_api'
14 changes: 14 additions & 0 deletions .github/workflows/update-lock-files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:
schedule:
- cron: '0 5 * * 1'

# XXX Set the right permissions, per step??
# Can we set read only at the global level here and then elevate to write for some steps?
#permissions: read-all

jobs:
update_lock_files:
if: github.repository == 'scikit-learn/scikit-learn'
Expand All @@ -25,6 +29,8 @@ jobs:
- name: cirrus-arm
update_script_args: "--select-tag arm"
additional_commit_message: "[cirrus arm]"
- name: array API
update_script_args: "--select-tag cuda"

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -56,6 +62,14 @@ jobs:
### Note
If the CI tasks fail, create a new branch based on this PR and add the required fixes to that branch.

# The CUDA workflow needs to be triggered explicitly as it uses an expensive runner
- name: Trigger additional tests
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the only way to test that this is correct is to merge this PR :-/

if: steps.cpr.outputs.pull-request-number != '' && matrix.name == 'array API'
env:
GH_TOKEN: ${{ github.token }}
run: |
gh workflow run .github/workflows/cuda-gpu-ci.yml -f pr_id=${{steps.cpr.outputs.pull-request-number}}

- name: Check Pull Request
if: steps.cpr.outputs.pull-request-number != ''
run: |
Expand Down
17 changes: 17 additions & 0 deletions build_tools/github/create_gpu_environment.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

set -e
set -x

curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh"
bash Miniforge3-$(uname)-$(uname -m).sh -b -p "${HOME}/conda"
source "${HOME}/conda/etc/profile.d/conda.sh"


# defines the get_dep and show_installed_libraries functions
source build_tools/shared.sh
conda activate base

# XXX switch once https://github.com/scikit-learn/scikit-learn/pull/29176 is merged
conda install -c conda-forge "$(get_dep conda-lock min)" -y
conda-lock install --name sklearn build_tools/github/pylatest_conda_forge_cuda_array-api_linux-64_conda.lock
Loading
Loading