:py:mod:`qsearch.parallelizers` =============================== .. py:module:: qsearch.parallelizers .. autoapi-nested-parse:: This module defines Parallelizer, which is a class that defines how to perform multiple circuits in parallel. Several implementations are provided. .. attribute:: LokyParallelizer A Parallelizer based on Loky, a "deadlock-free" ProcessPoolExecutor .. attribute:: MultiprocessingParallelizer A Parallelizer based on multiprocessing .. attribute:: ProcessPoolParallelizer A Parallelizer based on concurrent.futures.ProcessPoolExecutor .. attribute:: MPIParallelizer A distributed MPI based Parallelizer .. attribute:: SequentialParallelizer Mostly for debugging purposes, a Parallelizer that runs tasks one at a time. Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: qsearch.parallelizers.Parallelizer qsearch.parallelizers.LokyParallelizer qsearch.parallelizers.MultiprocessingParallelizer qsearch.parallelizers.ProcessPoolParallelizer qsearch.parallelizers.MPIParallelizer qsearch.parallelizers.SequentialParallelizer Functions ~~~~~~~~~ .. autoapisummary:: qsearch.parallelizers.default_num_tasks qsearch.parallelizers.evaluate_step qsearch.parallelizers.single_task qsearch.parallelizers.process_initializer Attributes ~~~~~~~~~~ .. autoapisummary:: qsearch.parallelizers.MPI qsearch.parallelizers.get_reusable_executor .. py:data:: MPI .. py:data:: get_reusable_executor .. py:function:: default_num_tasks(options) .. py:function:: evaluate_step(tup, options) .. py:function:: single_task(opts) .. py:function:: process_initializer() .. py:class:: Parallelizer Base class for all Parallelizers. Parallelizers calculate the value of multiple search nodes in parallel. .. py:method:: solve_circuits_parallel(self, tuples) Calculate the value of search tree nodes in parallel. .. py:method:: done(self) Finalize/Clean up any state needed to run the Parallelizer. .. py:class:: LokyParallelizer(options) Bases: :py:obj:`Parallelizer` A parallelizer based on Loky, a "deadlock-free" ProcessPoolExecutor. For more information on Loky see https://loky.readthedocs.io/en/stable/. .. py:method:: solve_circuits_parallel(self, tuples) Calculate the value of search tree nodes in parallel. .. py:class:: MultiprocessingParallelizer(options) Bases: :py:obj:`Parallelizer` A Parallelizer based on muliprocessing. Note this cannot be used with the MultiStart_Solvers! .. py:method:: solve_circuits_parallel(self, tuples) Calculate the value of search tree nodes in parallel. .. py:method:: done(self) Finalize/Clean up any state needed to run the Parallelizer. .. py:class:: ProcessPoolParallelizer(options) Bases: :py:obj:`Parallelizer` A Parallelizer based on concurrent.futures.ProcessPoolExecutor. .. py:method:: solve_circuits_parallel(self, tuples) Calculate the value of search tree nodes in parallel. .. py:method:: done(self) Finalize/Clean up any state needed to run the Parallelizer. .. py:class:: MPIParallelizer(options) Bases: :py:obj:`Parallelizer` A distributed MPI based Parallelizer. This implementation unfortunately requires some work on the part of the Project API or the user. .. py:method:: solve_circuits_parallel(self, tuples) Calculate the value of search tree nodes in parallel. .. py:method:: map_steps(self, new_steps) .. py:method:: done(self) Finalize/Clean up any state needed to run the Parallelizer. .. py:class:: SequentialParallelizer(options) Bases: :py:obj:`Parallelizer` A Paralleizer that isn't, it runs tasks one at a time (mostly for debugging). .. py:method:: solve_circuits_parallel(self, tuples) Calculate the value of search tree nodes in parallel.