dcnum.os_env_st
Attributes
environment variables that define number of threads libraries will use |
Classes
Context manager for starting a process with specific environment |
Functions
Warn via logs when environment variables are not set to single thread |
|
Set the environment variable to single thread |
Module Contents
- dcnum.os_env_st.os_env_threading = ['MKL_NUM_THREADS', 'NUMBA_NUM_THREADS', 'NUMEXPR_NUM_THREADS', 'NUMPY_NUM_THREADS',...
environment variables that define number of threads libraries will use
- class dcnum.os_env_st.RequestSingleThreaded[source]
Context manager for starting a process with specific environment
When entering the context, the environment variables defined in
os_env_threadingare all set to “1”, telling the relevant libraries that they should work in single-threaded mode. When exiting the context, these environment variables are reset to their original values (or unset if applicable).Note that it makes only sense to use this context manager when starting new multiprocessing processes. When the process spawns, the environment from the current thread is copied. Setting the environment variable after e.g. importing numpy has no effect on how many threads numpy will use.
- previous_env