hic3defdr.util.parallelization module¶
-
hic3defdr.util.parallelization.
parallel_apply
(fn, kwargs_list, n_threads=None)[source]¶ Applies a function in parallel over a list of kwarg dicts, using a specified number of threads.
Parameters: - fn (function) – The function to parallelize.
- kwargs_list (list of dict) – The function will be called
len(kwargs_list)
times. Each time it is called it will use a different element of this list to determine the kwargs the function will be called with. - n_threads (int) – Specify the number of subprocesses to use for parallelization. Pass -1 to use as many subprocesses as there are CPUs.
-
hic3defdr.util.parallelization.
parallel_map
(fn, kwargs_list, n_threads=None)[source]¶ Maps a function in parallel over a list of kwarg dicts, using a specified number of threads.
Parameters: - fn (function) – The function to parallelize.
- kwargs_list (list of dict) – The function will be called
len(kwargs_list)
times. Each time it is called it will use a different element of this list to determine the kwargs the function will be called with. - n_threads (int) – Specify the number of subprocesses to use for parallelization. Pass -1 to use as many subprocesses as there are CPUs.