MCPcopy Create free account
hub / github.com/pydata/numexpr / set_nthreads

Function set_nthreads

numexpr3/utils.py:70–81  ·  view source on GitHub ↗

Sets a number of threads to be used in operations. Generally speaking one should use >= the number of physical cores. NumExpr does not benefit from Hyperthreading. During initialization time Numexpr sets the thread count by the ``_detect_number_of_threads()`` function.

(new_nthreads: int)

Source from the content-addressed store, hash-verified

68 return _nthreads
69
70def set_nthreads(new_nthreads: int) -> None:
71 """
72 Sets a number of threads to be used in operations. Generally speaking one should
73 use >= the number of physical cores. NumExpr does not benefit from
74 Hyperthreading.
75
76 During initialization time Numexpr sets the thread count by
77 the ``_detect_number_of_threads()`` function.
78 """
79 global _nthreads
80 _nthreads = int(new_nthreads)
81 numexpr3.interpreter.set_num_threads(_nthreads)
82
83def get_ncores() -> int:
84 global _ncores

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…