accelforge.util package#
Submodules#
accelforge.util.exceptions module#
Public exceptions for AccelForge.
accelforge.util.parallel module#
- accelforge.util.parallel.delayed(function)[source]#
Decorator used to capture the arguments of a function.
- accelforge.util.parallel.get_n_parallel_jobs()[source]#
Returns the number of parallel jobs being used. If parallel processing is not enabled, returns 1.
- Return type:
- accelforge.util.parallel.is_using_parallel_processing()[source]#
Returns True if parallel processing is enabled.
- Return type:
- accelforge.util.parallel.parallel(jobs, n_jobs=None, pbar=None, pbar_position=0, return_as=None)[source]#
Parallelizes a list of jobs.
- Parameters:
jobs (
list[tuple[Callable,tuple,dict]]) – The jobs to parallelize. The first element of each tuple is a function, the second is a tuple of arguments, and the third is a dictionary of keyword arguments.n_jobs (
int) – The number of jobs to run in parallel. If not provided, the number of parallel jobs is set to the number of CPU cores.pbar (
str) – A label for a progress bar. If not provided, no progress bar is shown.pbar_position (
int) – The position of the progress bar. If not provided, the progress bar is shown at the beginning of the output.return_as (
str) – The type of return value. If not provided, the return value is a list.
- Returns:
The result of the parallelized jobs.
- Return type:
Union[list[Any],Generator[Any,None,None],dict[Any,Any]]
Module contents#
- exception accelforge.util.EvaluationError[source]#
Bases:
ExceptionException raised when parsing fails.
This exception is raised when there’s an error parsing specifications, architectures, workloads, or mappings.
- Parameters:
- class accelforge.util.LiteralString[source]#
Bases:
strA string literal that should not be evaluated.
- accelforge.util.NUMPY_FLOAT_TYPE#
alias of
float32
- accelforge.util.get_n_parallel_jobs()[source]#
Returns the number of parallel jobs being used. If parallel processing is not enabled, returns 1.
- Return type:
- accelforge.util.is_using_parallel_processing()[source]#
Returns True if parallel processing is enabled.
- Return type:
- class accelforge.util.oset[source]#
-
Set that iterates in sorted order for deterministic behavior.
- difference(*others)[source]#
Return the difference of two or more sets as a new set.
(i.e. all elements that are in this set but not the others.)
- intersection(*others)[source]#
Return the intersection of two sets as a new set.
(i.e. all elements that are in both sets.)
- accelforge.util.parallel(jobs, n_jobs=None, pbar=None, pbar_position=0, return_as=None)[source]#
Parallelizes a list of jobs.
- Parameters:
jobs (
list[tuple[Callable,tuple,dict]]) – The jobs to parallelize. The first element of each tuple is a function, the second is a tuple of arguments, and the third is a dictionary of keyword arguments.n_jobs (
int) – The number of jobs to run in parallel. If not provided, the number of parallel jobs is set to the number of CPU cores.pbar (
str) – A label for a progress bar. If not provided, no progress bar is shown.pbar_position (
int) – The position of the progress bar. If not provided, the progress bar is shown at the beginning of the output.return_as (
str) – The type of return value. If not provided, the return value is a list.
- Returns:
The result of the parallelized jobs.
- Return type:
Union[list[Any],Generator[Any,None,None],dict[Any,Any]]