Skip to content

Commit

Permalink
add GPU test
Browse files Browse the repository at this point in the history
  • Loading branch information
Intron7 committed Dec 5, 2024
1 parent 8315e2f commit 8044b28
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 3 deletions.
11 changes: 11 additions & 0 deletions .cirun.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
runners:
- name: aws-gpu-runner
cloud: aws
instance_type: g4dn.xlarge
machine_image: ami-067a4ba2816407ee9
region: eu-north-1
preemptible:
- true
- false
labels:
- cirun-aws-gpu
65 changes: 65 additions & 0 deletions .github/workflows/test-gpu.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: GPU-CI

on:
push:
branches: [main]
pull_request:
types:
- labeled
- opened
- synchronize

# Cancel the job if new commits are pushed
# https://stackoverflow.com/questions/66335225/how-to-cancel-previous-runs-in-the-pr-when-you-push-new-commitsupdate-the-curre
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: flying-sheep/check@v1
with:
success: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'run-gpu-ci') }}
test:
name: GPU Tests
needs: check
runs-on: "cirun-aws-gpu--${{ github.run_id }}"
timeout-minutes: 30

defaults:
run:
shell: bash -el {0}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Nvidia SMI sanity check
run: nvidia-smi

- name: Install Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Install UV
uses: hynek/setup-cached-uv@v2
with:
cache-dependency-path: pyproject.toml

- name: Install scirpy
run: uv pip install --system -e ".[dev,test,rpack,dandelion,diversity,parasail,cupy]"
- name: Pip list
run: pip list

- name: Run test
run: pytest -m gpu

- name: Remove 'run-gpu-ci' Label
if: always()
uses: actions-ecosystem/action-remove-labels@v1
with:
labels: "run-gpu-ci"
github_token: ${{ secrets.GITHUB_TOKEN }}
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ fail_fast: false
default_language_version:
python: python3
default_stages:
- commit
- push
- pre-commit
- pre-push
minimum_pre_commit_version: 2.16.0
repos:
- repo: https://github.com/pre-commit/mirrors-prettier
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ test = [
'coverage',
'black',
]
cupy = [
'cupy-cuda12x',
]
dandelion = [
'sc-dandelion>=0.3.5',
]
Expand Down
2 changes: 1 addition & 1 deletion src/scirpy/ir_dist/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -1085,7 +1085,7 @@ def calc_block_gpu(

# Set the number of blocks for the calculation. A higher number can be more memory friendly, whereas
# a lower number can improve the performance.
block_width = 4096
# block_width = 4096
n_blocks = 10 # or use: seqs_mat2.shape[0] // block_width + 1

seqs_mat2_blocks = np.array_split(seqs_mat2, n_blocks)
Expand Down

0 comments on commit 8044b28

Please sign in to comment.