Introduction to IPython parallel#
The following demos heavily rely on IPython-parallel to illustrate how
checkpointing works when using multiple MPI processes.
We illustrate what happens in parallel by launching three MPI processes
using IPython-parallel’s MPI engine support.
import logging
import ipyparallel as ipp
with ipp.Cluster(engines="mpi", n=3, log_level=logging.ERROR) as cluster:
# We send the query to run the function `hello_mpi` on all engines
query: ipp.AsyncResult = cluster[:].apply_async(hello_mpi)
# We wait for all engines to finish
query.wait()
# We check that all engines exited successfully
assert query.successful(), query.error
# We print the output from each engine
print("".join(query.stdout))
Hello from rank 0/2
Hello from rank 1/2
Hello from rank 2/2