Skip to content

Commit a7bf4a3

Browse files
authored
Merge pull request #44 from chyumin/ci-test-gpu
Ci test gpu
2 parents 0fc7960 + 2757b18 commit a7bf4a3

4 files changed

Lines changed: 106 additions & 25 deletions

File tree

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: CI-Test in AWS for GPU
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
deploy-runner:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: iterative/setup-cml@v1
11+
- uses: actions/checkout@v3
12+
- name: Deploy runner on EC2
13+
env:
14+
REPO_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
15+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
16+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
17+
run: |
18+
cml runner \
19+
--cloud=aws \
20+
--cloud-region=us-east-2 \
21+
--cloud-type=g4dn.xlarge \
22+
--labels=cml-gpu
23+
test-gpu-sorters:
24+
needs: deploy-runner
25+
runs-on: [self-hosted, cml-gpu]
26+
timeout-minutes: 360 # 6h
27+
container:
28+
image: docker://iterativeai/cml:0-dvc2-base1-gpu
29+
options: --privileged --gpus all
30+
steps:
31+
- uses: actions/checkout@v3
32+
33+
- name: Install dependencies
34+
run: |
35+
sudo apt-get update
36+
sudo apt-get install -y wget squashfs-tools
37+
pip install -U pip
38+
pip install -r requirements_test.txt
39+
40+
- uses: eWaterCycle/setup-singularity@v7
41+
with:
42+
singularity-version: 3.8.3
43+
44+
- name: Run test singularity containers with GPU
45+
env:
46+
REPO_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
47+
run: |
48+
pytest -sv tests/test_containers_gpu.py

requirements_test.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
git+https://github.com/SpikeInterface/spikeinterface.git#egg=spikeinterface[full]
2-
docker==5.0.3
32
spython==0.2.1
43
pytest==7.1.2

tests/test_containers_gpu.py

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import os
2+
import shutil
3+
4+
import pytest
5+
6+
import spikeinterface.extractors as se
7+
import spikeinterface.sorters as ss
8+
9+
os.environ['SINGULARITY_DISABLE_CACHE'] = 'true'
10+
11+
12+
@pytest.fixture(autouse=True)
13+
def work_dir(request, tmp_path):
14+
"""
15+
This fixture, along with "run_kwargs" creates one folder per
16+
test function using built-in tmp_path pytest fixture
17+
18+
The tmp_path will be the working directory for the test function
19+
20+
At the end of the each test function, a clean up will be done
21+
"""
22+
os.chdir(tmp_path)
23+
yield
24+
os.chdir(request.config.invocation_dir)
25+
shutil.rmtree(str(tmp_path))
26+
27+
28+
@pytest.fixture
29+
def run_kwargs(work_dir):
30+
test_recording, _ = se.toy_example(
31+
duration=30,
32+
seed=0,
33+
num_channels=64,
34+
num_segments=1
35+
)
36+
test_recording = test_recording.save(name='toy')
37+
return dict(recording=test_recording, verbose=True, singularity_image=True)
38+
39+
40+
def test_kilosort2(run_kwargs):
41+
sorting = ss.run_kilosort2(output_folder="kilosort2", **run_kwargs)
42+
print(sorting)
43+
44+
45+
def test_kilosort2_5(run_kwargs):
46+
sorting = ss.run_kilosort2_5(output_folder="kilosort2_5", **run_kwargs)
47+
print(sorting)
48+
49+
50+
def test_kilosort3(run_kwargs):
51+
sorting = ss.run_kilosort3(output_folder="kilosort3", **run_kwargs)
52+
print(sorting)
53+
54+
55+
@pytest.mark.skip(reason="Need to check errors")
56+
def test_pykilosort(run_kwargs):
57+
sorting = ss.run_pykilosort(output_folder="pykilosort", **run_kwargs)
58+
print(sorting)

tests/test_singularity_containers.py

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -76,27 +76,3 @@ def test_hdsort(run_kwargs):
7676
def test_kilosort1(run_kwargs):
7777
sorting = ss.run_kilosort(output_folder="kilosort", useGPU=False, **run_kwargs)
7878
print(sorting)
79-
80-
81-
@pytest.mark.skip(reason="GPU required")
82-
def test_kilosort2(run_kwargs):
83-
sorting = ss.run_kilosort2(output_folder="kilosort2", **run_kwargs)
84-
print(sorting)
85-
86-
87-
@pytest.mark.skip(reason="GPU required")
88-
def test_kilosort2_5(run_kwargs):
89-
sorting = ss.run_kilosort2_5(output_folder="kilosort2_5", **run_kwargs)
90-
print(sorting)
91-
92-
93-
@pytest.mark.skip(reason="GPU required")
94-
def test_kilosort3(run_kwargs):
95-
sorting = ss.run_kilosort3(output_folder="kilosort3", **run_kwargs)
96-
print(sorting)
97-
98-
99-
@pytest.mark.skip(reason="GPU required")
100-
def test_pykilosort(run_kwargs):
101-
sorting = ss.run_pykilosort(output_folder="pykilosort", **run_kwargs)
102-
print(sorting)

0 commit comments

Comments
 (0)