How to use the loky.process_executor.ProcessPoolExecutor function in loky

To help you get started, we’ve selected a few loky examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github qucontrol / krotov / src / krotov / parallelization.py View on Github external
def _parallel_map_fw_prop_step_loky(shared, values, task_args):
    """Loky-based implementation of :func:`parallel_map_fw_prop_step`."""
    tlist = task_args[4]
    pulses = task_args[2]
    time_index = task_args[5]
    n = len(values)
    if time_index == 0:
        # we only send the full task_args through IPC once, for the first time
        # step. Subsequent time steps will reuse the data
        shared.executors = [
            LokyProcessPoolExecutor(
                max_workers=1,
                initializer=partial(
                    _pmfw_initializer, limit_thread_pool=USE_THREADPOOL_LIMITS
                ),
                initargs=(
                    state_index,
                    task_args[0][state_index],  # initial_state
                    task_args[1][state_index],  # objective
                    task_args[2],  # pulses
                    task_args[3],  # pulses_mapping
                    task_args[4],  # tlist
                    task_args[6][state_index],  # propagator
                ),
            )
            for state_index in range(n)
        ]

loky

A robust implementation of concurrent.futures.ProcessPoolExecutor

BSD-3-Clause
Latest version published 10 months ago

Package Health Score

73 / 100
Full package analysis