ashdisperse.config package
Submodules
ashdisperse.config.config module
- ashdisperse.config.config.get_chunk_size() int
Get the current chunk size used for processing.
This function retrieves the value of the internal variable _chunk_size, which determines the number of items processed in each chunk.
- Returns:
The chunk size.
- Return type:
int
- Example:
>>> ashdisperse.config.get_chunk_size() >>> 8
- ashdisperse.config.config.get_max_threads() int
Get the maximum number of threads available on the system
- Returns:
maximum number of threads
- Return type:
int
- Example:
>>> ashdisperse.config.get_max_threads() >>> 8
- ashdisperse.config.config.get_num_threads() int
Get the number of threads available for computation.
This function retrieves the number of threads that can be used, typically for parallel processing, by calling the underlying numba.get_num_threads() function.
- Returns:
The number of available threads for parallel processing.
- Return type:
int
- Example:
>>> ashdisperse.config.get_num_threads() >>> 4
- ashdisperse.config.config.get_threading_layer() str
Get the numba threading layer
- Returns:
threading layer used by numba
- Return type:
str
- Example:
>>> ashdisperse.config.get_theading_layer() >>> "omp"
- ashdisperse.config.config.set_chunk_size(n: int = 8) None
Set the global chunk size used for processing.
- Parameters:
n (int, optional) – The desired chunk size. Must be a positive integer. Defaults to 8.
- Example:
>>> ashdisperse.config.set_chunk_size(16) # Sets the chunk size to 16 >>> ashdisperse.config.get_chunk_size() >>> 16
- ashdisperse.config.config.set_default_threads(n=None)
Set the default number of threads for processing.
- Parameters:
n (int or None, optional) – Number of threads to set. If None, sets to one less than the maximum available threads.
- Example:
>>> ashdisperse.config.set_default_threads() # Sets threads to max_threads - 1 >>> ashdisperse.config.get_default_threads() >>> 7
>>> ashdisperse.config.set_default_threads(4) # Sets threads to 4 >>> ashdisperse.config.get_default_threads() >>> 4
- ashdisperse.config.config.set_num_threads(n)
Set the number of threads to be used for computation, ensuring it does not exceed the maximum recommended threads. Issues warnings if the requested number of threads is greater than or equal to the maximum, and adjusts accordingly.
Also attempts to set MKL threads locally to 1 for compatibility.
- Parameters:
n (int) – The desired number of threads to use for computation.
- Example:
>>> ashdisperse.config.set_num_threads(6) >>> ashdisperse.config.get_num_threads() >>> 6
- ashdisperse.config.config.set_threading_layer(thread_layer: str = 'tbb') None
Set the numba threading layer
- Parameters:
thread_layer (str, optional) – threading layer selected from “tbb”, “omp” and “workqueue”, defaults to “tbb”
- Raises:
ValueError – if thread_layer not one of “tbb”, “omp” or “workqueue”
- Example:
>>> ashdisperse.config.set_threading_layer("omp") >>> ashdisperse.config.get_threading_layer() >>> "omp"