__init__.py 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. """
  2. The ``elephant.parallel`` package provides classes to parallelize calls to any
  3. user-specified function.
  4. The typical use case is calling a function many times with different
  5. parameters.
  6. .. note:: This parallelization module is independent from Elephant and can be
  7. used to parallelize mutually independent calls to arbitrary
  8. functions.
  9. Tutorial
  10. --------
  11. :doc:`View tutorial <../tutorials/parallel>`
  12. Run tutorial interactively:
  13. .. image:: https://mybinder.org/badge.svg
  14. :target: https://mybinder.org/v2/gh/NeuralEnsemble/elephant/master
  15. ?filepath=doc/tutorials/parallel.ipynb
  16. Available Executors
  17. -------------------
  18. .. autosummary::
  19. :toctree: toctree/parallel/
  20. ProcessPoolExecutor
  21. MPIPoolExecutor
  22. MPICommExecutor
  23. :copyright: Copyright 2014-2020 by the Elephant team, see `doc/authors.rst`.
  24. :license: Modified BSD, see LICENSE.txt for details.
  25. """
  26. import warnings
  27. from .parallel import ProcessPoolExecutor, SingleProcess
  28. try:
  29. from .mpi import MPIPoolExecutor, MPICommExecutor
  30. except ImportError:
  31. # mpi4py is missing
  32. warnings.warn("mpi4py package is missing. Please run 'pip install mpi4py' "
  33. "in a terminal to activate MPI features.")
  34. __all__ = [
  35. "ProcessPoolExecutor",
  36. "SingleProcess",
  37. "MPIPoolExecutor",
  38. "MPICommExecutor"
  39. ]