Skip to content

Commit

Permalink
fix: rolling back
Browse files Browse the repository at this point in the history
  • Loading branch information
BrunoLiegiBastonLiegi committed Jan 24, 2025
1 parent 4e4e611 commit 36844fa
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 17 deletions.
3 changes: 1 addition & 2 deletions src/qibojit/backends/clifford_operations_cpu.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
"""Set of custom Numba operations for the Clifford backend."""

import numpy as np
from numba import njit, prange, set_num_threads, uint64
from numba import njit, prange, uint64

set_num_threads(1)
PARALLEL = True


Expand Down
10 changes: 0 additions & 10 deletions src/qibojit/backends/cpu.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import os
import sys

import numpy as np
Expand Down Expand Up @@ -26,15 +25,6 @@
"GeneralizedfSim": "apply_fsim",
}

if os.environ.get("NUMBA_NUM_THREADS") is None:
NTHREADS = (
psutil.cpu_count(logical=False)
if sys.platform == "darwin"
else len(psutil.Process().cpu_affinity())
)

os.environ["NUMBA_NUM_THREADS"] = str(NTHREADS)


class NumbaBackend(NumpyBackend):
def __init__(self):
Expand Down
8 changes: 3 additions & 5 deletions src/qibojit/tests/test_backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,10 @@ def test_device_setter(backend):


def test_thread_setter(backend):
# import numba
import numba

# original_threads = numba.get_num_threads()
with pytest.raises(RuntimeError):
backend.set_threads(1)
# assert numba.get_num_threads() == 1
original_threads = numba.get_num_threads()
assert numba.get_num_threads() == 1


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

0 comments on commit 36844fa

Please sign in to comment.