-
Notifications
You must be signed in to change notification settings - Fork 57
Add GPU testing workflows and add gpu tox configuration #635
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
base: main
Are you sure you want to change the base?
Changes from 10 commits
5674e58
34e2c38
932b0dd
0256cc1
beaad09
eeabcaf
74c437e
bbce4e1
a23e2ef
b489b65
075fb9b
2ac9861
224919e
c15224f
6e656c7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Scienfitz marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
Scienfitz marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
name: GPU Tests | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
semantic: | ||
required: true | ||
type: string | ||
default: "3.10" | ||
tox: | ||
required: true | ||
type: string | ||
default: "py310" | ||
workflow_call: | ||
secrets: | ||
Scienfitz marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
APP_PRIVATE_KEY: | ||
required: true | ||
AWS_ROLE_TO_ASSUME: | ||
required: true | ||
inputs: | ||
semantic: | ||
required: true | ||
type: string | ||
default: "3.10" | ||
tox: | ||
required: true | ||
type: string | ||
default: "py310" | ||
|
||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }}-GPUTest | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
add-gpu-machine: | ||
runs-on: ubuntu-latest | ||
fabianliebig marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
permissions: | ||
contents: read | ||
id-token: write | ||
steps: | ||
- name: Generate a token | ||
id: generate-token | ||
uses: actions/create-github-app-token@v1 | ||
with: | ||
app-id: ${{ vars.APP_ID }} | ||
private-key: ${{ secrets.APP_PRIVATE_KEY }} | ||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v4 | ||
with: | ||
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }} | ||
role-session-name: Github_Add_Runner | ||
aws-region: eu-central-1 | ||
- name: Login to Amazon ECR | ||
id: login-ecr | ||
uses: aws-actions/amazon-ecr-login@v2 | ||
- name: Execute Lambda function | ||
run: | | ||
aws lambda invoke --function-name jit_runner_register_and_create_runner_container --cli-binary-format raw-in-base64-out --payload '{"github_api_secret": "${{ steps.generate-token.outputs.token }}", "count_container": 1, "container_compute": "XS-GPU", "repository": "${{ github.repository }}" }' response.json | ||
if ! grep -q '"statusCode": 200' response.json; then | ||
echo "Lambda function failed. statusCode is not 200." | ||
exit 1 | ||
fi | ||
gputest: | ||
needs: [add-gpu-machine] | ||
name: GPU Tests ${{ inputs.semantic }} | ||
Scienfitz marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
runs-on: gpu | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
id: setup-python | ||
with: | ||
python-version: ${{ inputs.semantic }} | ||
- uses: actions/cache@v4 | ||
with: | ||
path: .tox/gputest-${{ inputs.tox }} | ||
key: gputest-${{ inputs.tox }}-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('tox.ini') }} | ||
- name: Run GPU tests | ||
run: | | ||
pip install tox-uv | ||
tox -e gputest-${{ inputs.tox }} |
Scienfitz marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[tox] | ||
min_version = 4.9 | ||
env_list = {fulltest,coretest,lint,mypy,audit}-py{310,311,312,313} | ||
env_list = {fulltest,gputest,coretest,lint,mypy,audit}-py{310,311,312,313} | ||
isolated_build = True | ||
|
||
[testenv:fulltest,fulltest-py{310,311,312,313}] | ||
|
@@ -18,6 +18,20 @@ commands = | |
python --version | ||
pytest -p no:warnings --cov=baybe --durations=5 {posargs} | ||
|
||
[testenv:gputest,gputest-py{310,311,312,313}] | ||
description = Runs GPU tests | ||
extras = test | ||
passenv = | ||
CI | ||
BAYBE_NUMPY_USE_SINGLE_PRECISION | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. whats the intention of these flags? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe I misunderstood that. I thought that would configure which ENV variables will be parsed when set on the computer where Tox is executed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no thats right, so this was the intention? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought that might become important because if a remember correctly, @AVHopp mentioned that there was an issue regrading the precision when he started investigation GPUs. Maybe he can comment on that before I confuse something here. But it is probably better to add those flag when GPU support is tackled, so we can also remove it. Thanks for pointing it out :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no please dont change it yet, I think this line is reasonable if GPUs can indeed be run with double and single precision, if not possible generally then we should probably change it |
||
BAYBE_TORCH_USE_SINGLE_PRECISION | ||
BAYBE_PARALLEL_SIMULATION_RUNS | ||
setenv = | ||
BAYBE_TEST_ENV = GPUTEST | ||
commands = | ||
python --version | ||
python -c "import torch; assert torch.cuda.is_available()" | ||
|
||
[testenv:coretest,coretest-py{310,311,312,313}] | ||
description = Run PyTest with core functionality | ||
extras = test | ||
|
Uh oh!
There was an error while loading. Please reload this page.