We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 4d8cc2a + 4b697db commit 13fc900Copy full SHA for 13fc900
mkl_fft/_scipy_fft_backend.py
@@ -153,14 +153,13 @@ def __init__(self, workers):
153
154
def __enter__(self):
155
try:
156
- mkl.domain_set_num_threads(self.n_threads, domain='fft')
+ self.prev_num_threads = mkl.set_num_threads_local(self.n_threads)
157
except:
158
raise ValueError("Class argument {} result in invalid number of threads {}".format(self.workers, self.n_threads))
159
160
def __exit__(self, *args):
161
- # restore default
162
- n_threads = _hardware_counts.get_max_threads_count()
163
- mkl.domain_set_num_threads(n_threads, domain='fft')
+ # restore old value
+ mkl.set_num_threads_local(self.prev_num_threads)
164
165
166
@_implements(_fft.fft)
0 commit comments