parameter_sweep.parallel.parallel_manager

Module Contents

Classes

ParallelManager

Abstract Base Class for Parallel Manager implementations.

parallelActor

Functions

build_and_execute(do_build, do_build_kwargs, ...)

Entrypoint for implementations of the parallel manager to use for running the

class parameter_sweep.parallel.parallel_manager.ParallelManager

Abstract Base Class for Parallel Manager implementations.

ROOT_PROCESS_RANK = 0
abstract is_root_process()

Return whether the current process should be considered as the root of the parallel group it is a part of.

abstract get_rank()

Get the process’s rank number in its parallel peer group.

abstract number_of_worker_processes()

Return how many total processes are running local simulations.

abstract sync_with_peers()

Implement a synchronization point with any peer processes.

abstract sync_array_with_peers(data)

Synchronize an array with all peers processes. The data parameter is either: - (if root) the source of truth that will be broadcast to all processes - (if not root) an empty buffer that will hold the data sent from root once the function returns

abstract sync_pyobject_with_peers(obj)

Synchronize a python object with all peer processes. The obj parameter is either: - (if root) the source of truth that will be broadcast to all processes - (if not root) ignored

Different from sync_array_with_peers in that it returns the synced object rather than using an existing buffer.

abstract combine_data_with_peers(data)

Combine the data from each peer into a list. The return value will be a list of all the data elements provided by each process that calls this function.

With multiple processes, this must: - act as a synchronization point - return the list in the same order on each process

abstract gather_arrays_to_root(sendbuf, recvbuf_spec)

Gather the data in the send buffer to the root process. Parameters are: - sendbuf: the data to be sent from this process - recvbuf_spec: a tuple of (receive buffer, list of sizes) where the list of sizes is how much data will come from each process. Ignored if not the root process.

abstract sum_values_and_sync(sendbuf, recvbuf)

Sum a list of values from each process and sync the result to all processes. Parameters: - sendbuf: an array of values the local process is contributing to the sum - recvbuf: an array of a single value that will hold the summed result (same on each process) when the function returns.

Note: this is a specific case of a global reduce (with sum() as the reducing function). If more than sum() is needed in the future, this function should be extended to receive an Op argument.

abstract scatter(do_build, do_build_kwargs, do_execute, all_parameters)

Scatter the specified execution out, as defined by the implementation’s parallelism, for a list of parameters. Args: - do_build: a function that builds the arguments necessary for the execution function. expected to return a list that will be exploded and passed into the do_execute function as arguments. - do_build_kwargs: a dictionary of keyword arguments for the do_build function - do_execute: the execution function. expected to take in the list of local parameters as its first argument. any arguments after that should match the list returned by the do_build function. - all_parameters: a list of all parameters to be run. included so that different implementations of the parallel manager can make decisions about splitting and parallelization.

abstract gather()

Gather the results of the computation that was kicked off via a previous scatter. Returns: - a list of LocalResults, representing the results for each process. each result will be the return value of the do_execute function from scatter() for one process.

abstract results_from_local_tree(results)

Given a list of LocalResults objects, return a sublist of the ones the current process is responsible for.

parameter_sweep.parallel.parallel_manager.build_and_execute(do_build, do_build_kwargs, do_execute, local_parameters)

Entrypoint for implementations of the parallel manager to use for running the build and execute functions. Defined at the top level so that it’s picklable.

For a description of the first three arguments, see the scatter() function above. The fourth argument is the list of local parameters that should be run by this process.

class parameter_sweep.parallel.parallel_manager.parallelActor(do_build, do_build_kwargs, do_execute, local_parameters)
build_model()
execute(local_parameters)