accelforge.util package#
Submodules#
accelforge.util.exceptions module#
Public exceptions for AccelForge.
- exception accelforge.util.exceptions.EvaluationError[source]#
Bases:
ExceptionException raised when parsing fails.
This exception is raised when there’s an error parsing specifications, architectures, workloads, or mappings.
- Parameters:
*args – Standard exception arguments.
source_field (Any, optional) – The field where the error occurred.
message (str, optional) – Error message describing what went wrong.
**kwargs – Additional keyword arguments.
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, 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, optional) – 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, optional) – A label for a progress bar. If not provided, no progress bar is shown.
return_as (Literal["list", "generator", "generator_unordered"], optional) – The type of return value. If not provided, the return value is a list.
- Returns:
The result of the parallelized jobs.
- Return type:
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:
*args – Standard exception arguments.
source_field (Any, optional) – The field where the error occurred.
message (str, optional) – Error message describing what went wrong.
**kwargs – Additional keyword arguments.
- 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:
- accelforge.util.parallel(jobs, n_jobs=None, pbar=None, 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, optional) – 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, optional) – A label for a progress bar. If not provided, no progress bar is shown.
return_as (Literal["list", "generator", "generator_unordered"], optional) – The type of return value. If not provided, the return value is a list.
- Returns:
The result of the parallelized jobs.
- Return type: