Skip to content
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

Fixes for GPU tests and GPU workflow #200

Merged
merged 9 commits into from
Jan 31, 2025
23 changes: 23 additions & 0 deletions .github/workflows/selfhosted.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# CI workflow that runs on selfhosted GPU
name: Tests with gpu

on:
pull_request:
types: [labeled]

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true

jobs:
build:
if: contains(join(github.event.pull_request.labels.*.name), 'run-on')
uses: qiboteam/workflows/.github/workflows/selfhosted.yml@v1
with:
used-labels: ${{ toJSON(github.event.pull_request.labels.*.name) }}
python-version: "3.10"
artifact-url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
poetry-extras: "--with cuda11,tests"

secrets:
repo_token: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion src/qibojit/backends/clifford_operations_cpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import numpy as np
from numba import njit, prange, uint64

PARALLEL = False
PARALLEL = True


@njit("Tuple((u1[:], u1[:,:], u1[:,:]))(u1[:,:], u8)", parallel=PARALLEL, cache=True)
Expand Down
1 change: 1 addition & 0 deletions src/qibojit/backends/cpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def __init__(self):
4: self.gates.apply_four_qubit_gate_kernel,
5: self.gates.apply_five_qubit_gate_kernel,
}

if sys.platform == "darwin": # pragma: no cover
self.set_threads(psutil.cpu_count(logical=False))
else:
Expand Down
1 change: 1 addition & 0 deletions src/qibojit/tests/test_backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def test_thread_setter(backend):
original_threads = numba.get_num_threads()
backend.set_threads(1)
assert numba.get_num_threads() == 1
backend.set_threads(original_threads)


@pytest.mark.parametrize("array_type", [None, "float32", "float64"])
Expand Down
Loading