ipyparallel.readthedocs.io Open in urlscan Pro
2606:4700::6811:2152  Public Scan

Submitted URL: http://ipyparallel.readthedocs.io/
Effective URL: https://ipyparallel.readthedocs.io/en/latest/
Submission: On May 24 via api from GB — Scanned from GB

Form analysis 2 forms found in the DOM

GET search.html

<form class="bd-search d-flex align-items-center" action="search.html" method="get">
  <i class="icon fas fa-search"></i>
  <input type="search" class="form-control" name="q" id="search-input" placeholder="Search the docs ..." aria-label="Search the docs ..." autocomplete="off">
</form>

GET //readthedocs.org/projects/ipyparallel/search/

<form id="flyout-search-form" class="wy-form" target="_blank" action="//readthedocs.org/projects/ipyparallel/search/" method="get">
  <input type="text" name="q" aria-label="Search docs" placeholder="Search docs">
</form>

Text Content

ipyparallel

 * Tutorial
 * Reference
 * examples
 * Changelog
 * API Reference

 * GitHub

Interact with your database in familiar languages using MongoDB Atlas.
Ad by EthicalAds   ·   Monetize your site
On this page
 * Using IPython for parallel computing
   * Installing IPython Parallel
   * Quickstart
   * Contents
 * IPython Parallel API
 * Indices and tables




USING IPYTHON FOR PARALLEL COMPUTING#

> Release
> 
> 8.4.0.dev
> 
> Date
> 
> 2022-05-18


INSTALLING IPYTHON PARALLEL#

As of 4.0, IPython parallel is now a standalone package called ipyparallel. You
can install it with:

pip install ipyparallel


or:

conda install ipyparallel


As of IPython Parallel 7, this will include installing/enabling an extension for
both the classic Jupyter Notebook and JupyterLab ≥ 3.0.


QUICKSTART#

IPython Parallel

A quick example to:

 1. allocate a cluster (collection of IPython engines for use in parallel)

 2. run a collection of tasks on the cluster

 3. wait interactively for results

 4. cleanup resources after the task is done

import time
import ipyparallel as ipp

task_durations = [1] * 25
# request a cluster
with ipp.Cluster() as rc:
    # get a view on the cluster
    view = rc.load_balanced_view()
    # submit the tasks
    asyncresult = view.map_async(time.sleep, task_durations)
    # wait interactively for results
    asyncresult.wait_interactive()
    # retrieve actual results
    result = asyncresult.get()
# at this point, the cluster processes have been shutdown


You can similarly run MPI code using IPyParallel (requires mpi4py):

import ipyparallel as ipp

def mpi_example():
    from mpi4py import MPI
    comm = MPI.COMM_WORLD
    return f"Hello World from rank {comm.Get_rank()}. total ranks={comm.Get_size()}"

# request an MPI cluster with 4 engines
with ipp.Cluster(engines='mpi', n=4) as rc:
    # get a broadcast_view on the cluster which is best
    # suited for MPI style computation
    view = rc.broadcast_view()
    # run the mpi_example function on all engines in parallel
    r = view.apply_sync(mpi_example)
    # Retrieve and print the result from the engines
    print("\n".join(r))
# at this point, the cluster processes have been shutdown




Follow the tutorial to learn more.


CONTENTS#

 * Tutorial
   * Overview and getting started
   * Starting the IPython controller and engines
   * IPython’s Direct interface
   * Parallel Magic Commands
   * The IPython task interface
   * The AsyncResult object
   * Parallel examples
 * Reference
   * Using MPI with IPython
   * IPython’s Task Database
   * Security details of IPython Parallel
   * DAG Dependencies
   * Details of Parallel Computing with IPython
   * Messaging for Parallel Computing
   * Connection Diagrams of The IPython ZMQ Cluster
   * Launchers

 * examples
   * Tutorials
   * Examples
   * Integrating IPython Parallel with other tools
   * Non-notebook examples

 * Changelog


IPYTHON PARALLEL API#

 * API Reference
   * Classes
   * Decorators
   * Exceptions


INDICES AND TABLES#

 * Index

 * Module Index

 * Search Page

next

Tutorial

© Copyright 2022, The IPython Development Team.


Created using Sphinx 4.5.0.


  v: latest
Versions latest stable 8.3.0 8.2.0 8.1.0 8.0.0 7.1.0 7.0.1 7.0.0 6.2.3 6.2.2
6.2.1 6.2.0 6.1.1 6.1.0 6.0.2 6.0.1 5.2.0 5.1.1 5.1.0 5.0.1 5.0.0 On Read the
Docs Project Home Builds Downloads On GitHub View Edit Search


--------------------------------------------------------------------------------

Hosted by Read the Docs · Privacy Policy