Skip to content

Commit a889b2c

Browse files
committed
update job name, setup singularity, isolate gpu tests
install sing deps
1 parent 707d5ca commit a889b2c

4 files changed

Lines changed: 79 additions & 26 deletions

File tree

.github/workflows/test_containers_gpu.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
--cloud-region=us-east-2 \
2323
--cloud-type=g4dn.xlarge \
2424
--labels=cml-gpu
25-
train-model:
25+
test-gpu-sorters:
2626
needs: deploy-runner
2727
runs-on: [self-hosted, cml-gpu]
2828
timeout-minutes: 4320 # 72h
@@ -31,9 +31,14 @@ jobs:
3131
options: --gpus all
3232
steps:
3333
- uses: actions/checkout@v3
34+
35+
- uses: eWaterCycle/setup-singularity@v7
36+
with:
37+
singularity-version: 3.8.3
38+
3439
- name: Run test singularity containers with GPU
3540
env:
3641
REPO_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
3742
run: |
3843
pip install -r requirements_test.txt
39-
pytest -sv tests/test_singularity_containers.py::test_kilosort3
44+
pytest -sv tests/test_singularity_containers.py::test_tridesclous

.github/workflows/test_containers_singularity.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,21 @@ jobs:
2020
with:
2121
python-version: 3.8
2222

23+
24+
- name: Install singularity dependencies
25+
run: |
26+
sudo apt-get update && sudo apt-get install -y \
27+
build-essential \
28+
libssl-dev \
29+
uuid-dev \
30+
libgpgme11-dev \
31+
squashfs-tools \
32+
libseccomp-dev \
33+
wget \
34+
pkg-config \
35+
git \
36+
cryptsetup
37+
2338
- uses: eWaterCycle/setup-singularity@v7
2439
with:
2540
singularity-version: 3.8.3

tests/test_containers_gpu.py

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
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+
def test_pykilosort(run_kwargs):
56+
sorting = ss.run_pykilosort(output_folder="pykilosort", **run_kwargs)
57+
print(sorting)

tests/test_singularity_containers.py

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

0 commit comments

Comments
 (0)