##// END OF EJS Templates
rename '--cluster' flag to '--parallel' in ProfileApp...
rename '--cluster' flag to '--parallel' in ProfileApp Now, to instruct the profile to include parallel scripts, you would do: $> ipython profile create foo --parallel instead of $> ipython profile create foo --cluster docs updated accordingly.

File last commit:

r4038:e6accb86
r4038:e6accb86
Show More
parallel_process.txt
504 lines | 18.7 KiB | text/plain | TextLexer
/ docs / source / parallel / parallel_process.txt
MinRK
clone parallel docs to parallelz
r3586 .. _parallel_process:
===========================================
Starting the IPython controller and engines
===========================================
To use IPython for parallel computing, you need to start one instance of
the controller and one or more instances of the engine. The controller
and each engine can run on different machines or on the same machine.
Because of this, there are many different possibilities.
Broadly speaking, there are two ways of going about starting a controller and engines:
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 * In an automated manner using the :command:`ipcluster` command.
* In a more manual way using the :command:`ipcontroller` and
:command:`ipengine` commands.
MinRK
clone parallel docs to parallelz
r3586
This document describes both of these methods. We recommend that new users
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 start with the :command:`ipcluster` command as it simplifies many common usage
MinRK
clone parallel docs to parallelz
r3586 cases.
General considerations
======================
Before delving into the details about how you can start a controller and
engines using the various methods, we outline some of the general issues that
come up when starting the controller and engines. These things come up no
matter which method you use to start your IPython cluster.
Let's say that you want to start the controller on ``host0`` and engines on
hosts ``host1``-``hostn``. The following steps are then required:
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 1. Start the controller on ``host0`` by running :command:`ipcontroller` on
MinRK
clone parallel docs to parallelz
r3586 ``host0``.
MinRK
update process/security docs in parallelz
r3617 2. Move the JSON file (:file:`ipcontroller-engine.json`) created by the
MinRK
clone parallel docs to parallelz
r3586 controller from ``host0`` to hosts ``host1``-``hostn``.
3. Start the engines on hosts ``host1``-``hostn`` by running
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 :command:`ipengine`. This command has to be told where the JSON file
MinRK
update process/security docs in parallelz
r3617 (:file:`ipcontroller-engine.json`) is located.
At this point, the controller and engines will be connected. By default, the JSON files
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 created by the controller are put into the :file:`~/.ipython/cluster_default/security`
MinRK
update process/security docs in parallelz
r3617 directory. If the engines share a filesystem with the controller, step 2 can be skipped as
the engines will automatically look at that location.
The final step required to actually use the running controller from a client is to move
the JSON file :file:`ipcontroller-client.json` from ``host0`` to any host where clients
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 will be run. If these file are put into the :file:`~/.ipython/cluster_default/security`
MinRK
update process/security docs in parallelz
r3617 directory of the client's host, they will be found automatically. Otherwise, the full path
to them has to be passed to the client's constructor.
MinRK
clone parallel docs to parallelz
r3586
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 Using :command:`ipcluster`
MinRK
Doc tweaks and updates
r3663 ===========================
MinRK
clone parallel docs to parallelz
r3586
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 The :command:`ipcluster` command provides a simple way of starting a
MinRK
clone parallel docs to parallelz
r3586 controller and engines in the following situations:
1. When the controller and engines are all run on localhost. This is useful
for testing or running on a multicore computer.
MinRK
parallel docs, tests, default config updated to newconfig
r3990 2. When engines are started using the :command:`mpiexec` command that comes
MinRK
clone parallel docs to parallelz
r3586 with most MPI [MPI]_ implementations
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647 3. When engines are started using the PBS [PBS]_ batch system
(or other `qsub` systems, such as SGE).
MinRK
clone parallel docs to parallelz
r3586 4. When the controller is started on localhost and the engines are started on
remote nodes using :command:`ssh`.
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647 5. When engines are started using the Windows HPC Server batch system.
MinRK
clone parallel docs to parallelz
r3586
.. note::
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 Currently :command:`ipcluster` requires that the
MinRK
move ipcluster create|list to `ipython profile create|list`...
r4024 :file:`~/.ipython/profile_<name>/security` directory live on a shared filesystem that is
MinRK
clone parallel docs to parallelz
r3586 seen by both the controller and engines. If you don't have a shared file
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 system you will need to use :command:`ipcontroller` and
:command:`ipengine` directly.
MinRK
clone parallel docs to parallelz
r3586
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 Under the hood, :command:`ipcluster` just uses :command:`ipcontroller`
and :command:`ipengine` to perform the steps described above.
MinRK
clone parallel docs to parallelz
r3586
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 The simplest way to use ipcluster requires no configuration, and will
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647 launch a controller and a number of engines on the local machine. For instance,
to start one controller and 4 engines on localhost, just do::
MinRK
clone parallel docs to parallelz
r3586
MinRK
parallel docs, tests, default config updated to newconfig
r3990 $ ipcluster start n=4
MinRK
clone parallel docs to parallelz
r3586
MinRK
parallel docs, tests, default config updated to newconfig
r3990 To see other command line options, do::
MinRK
clone parallel docs to parallelz
r3586
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 $ ipcluster -h
MinRK
clone parallel docs to parallelz
r3586
MinRK
update process/security docs in parallelz
r3617
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647 Configuring an IPython cluster
==============================
MinRK
update process/security docs in parallelz
r3617
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647 Cluster configurations are stored as `profiles`. You can create a new profile with::
MinRK
rename '--cluster' flag to '--parallel' in ProfileApp...
r4038 $ ipython profile create --parallel profile=myprofile
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 This will create the directory :file:`IPYTHONDIR/cluster_myprofile`, and populate it
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647 with the default configuration files for the three IPython cluster commands. Once
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 you edit those files, you can continue to call ipcluster/ipcontroller/ipengine
MinRK
parallel docs, tests, default config updated to newconfig
r3990 with no arguments beyond ``p=myprofile``, and any configuration will be maintained.
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647
There is no limit to the number of profiles you can have, so you can maintain a profile for each
of your common use cases. The default profile will be used whenever the
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 profile argument is not specified, so edit :file:`IPYTHONDIR/cluster_default/*_config.py` to
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647 represent your most common use case.
The configuration files are loaded with commented-out settings and explanations,
which should cover most of the available possibilities.
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 Using various batch systems with :command:`ipcluster`
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647 ------------------------------------------------------
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 :command:`ipcluster` has a notion of Launchers that can start controllers
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647 and engines with various remote execution schemes. Currently supported
MinRK
parallel docs, tests, default config updated to newconfig
r3990 models include :command:`ssh`, :command`mpiexec`, PBS-style (Torque, SGE),
and Windows HPC Server.
MinRK
clone parallel docs to parallelz
r3586
MinRK
update process/security docs in parallelz
r3617 .. note::
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647 The Launchers and configuration are designed in such a way that advanced
users can subclass and configure them to fit their own system that we
have not yet supported (such as Condor)
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 Using :command:`ipcluster` in mpiexec/mpirun mode
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647 --------------------------------------------------
MinRK
update process/security docs in parallelz
r3617
MinRK
clone parallel docs to parallelz
r3586 The mpiexec/mpirun mode is useful if you:
1. Have MPI installed.
2. Your systems are configured to use the :command:`mpiexec` or
:command:`mpirun` commands to start MPI processes.
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647 If these are satisfied, you can create a new profile::
MinRK
rename '--cluster' flag to '--parallel' in ProfileApp...
r4038 $ ipython profile create --parallel profile=mpi
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 and edit the file :file:`IPYTHONDIR/cluster_mpi/ipcluster_config.py`.
MinRK
clone parallel docs to parallelz
r3586
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 There, instruct ipcluster to use the MPIExec launchers by adding the lines:
MinRK
clone parallel docs to parallelz
r3586
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647 .. sourcecode:: python
MinRK
parallel docs, tests, default config updated to newconfig
r3990 c.IPClusterEnginesApp.engine_launcher = 'IPython.parallel.apps.launcher.MPIExecEngineSetLauncher'
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647
If the default MPI configuration is correct, then you can now start your cluster, with::
MinRK
clone parallel docs to parallelz
r3586
MinRK
parallel docs, tests, default config updated to newconfig
r3990 $ ipcluster start n=4 profile=mpi
MinRK
clone parallel docs to parallelz
r3586
This does the following:
1. Starts the IPython controller on current host.
2. Uses :command:`mpiexec` to start 4 engines.
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647 If you have a reason to also start the Controller with mpi, you can specify:
.. sourcecode:: python
MinRK
parallel docs, tests, default config updated to newconfig
r3990 c.IPClusterStartApp.controller_launcher = 'IPython.parallel.apps.launcher.MPIExecControllerLauncher'
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647
.. note::
The Controller *will not* be in the same MPI universe as the engines, so there is not
much reason to do this unless sysadmins demand it.
MinRK
clone parallel docs to parallelz
r3586 On newer MPI implementations (such as OpenMPI), this will work even if you
don't make any calls to MPI or call :func:`MPI_Init`. However, older MPI
implementations actually require each process to call :func:`MPI_Init` upon
starting. The easiest way of having this done is to install the mpi4py
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 [mpi4py]_ package and then specify the ``c.MPI.use`` option in :file:`ipengine_config.py`:
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647
.. sourcecode:: python
MinRK
clone parallel docs to parallelz
r3586
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647 c.MPI.use = 'mpi4py'
MinRK
clone parallel docs to parallelz
r3586
Unfortunately, even this won't work for some MPI implementations. If you are
having problems with this, you will likely have to use a custom Python
executable that itself calls :func:`MPI_Init` at the appropriate time.
Fortunately, mpi4py comes with such a custom Python executable that is easy to
install and use. However, this custom Python executable approach will not work
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 with :command:`ipcluster` currently.
MinRK
clone parallel docs to parallelz
r3586
More details on using MPI with IPython can be found :ref:`here <parallelmpi>`.
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 Using :command:`ipcluster` in PBS mode
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647 ---------------------------------------
MinRK
clone parallel docs to parallelz
r3586
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647 The PBS mode uses the Portable Batch System [PBS]_ to start the engines.
As usual, we will start by creating a fresh profile::
MinRK
rename '--cluster' flag to '--parallel' in ProfileApp...
r4038 $ ipython profile create --parallel profile=pbs
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 And in :file:`ipcluster_config.py`, we will select the PBS launchers for the controller
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647 and engines:
MinRK
update process/security docs in parallelz
r3617
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647 .. sourcecode:: python
MinRK
update process/security docs in parallelz
r3617
MinRK
organize IPython.parallel into subpackages
r3673 c.Global.controller_launcher = 'IPython.parallel.apps.launcher.PBSControllerLauncher'
c.Global.engine_launcher = 'IPython.parallel.apps.launcher.PBSEngineSetLauncher'
MinRK
update process/security docs in parallelz
r3617
MinRK
updates to docs and examples
r3670 IPython does provide simple default batch templates for PBS and SGE, but you may need
to specify your own. Here is a sample PBS script template:
MinRK
clone parallel docs to parallelz
r3586
.. sourcecode:: bash
#PBS -N ipython
#PBS -j oe
#PBS -l walltime=00:10:00
MinRK
add EvalFormatter for batch system (PBS) launcher templates...
r4004 #PBS -l nodes={n/4}:ppn=4
#PBS -q {queue}
MinRK
clone parallel docs to parallelz
r3586
MinRK
add EvalFormatter for batch system (PBS) launcher templates...
r4004 cd $PBS_O_WORKDIR
export PATH=$HOME/usr/local/bin
export PYTHONPATH=$HOME/usr/local/lib/python2.7/site-packages
/usr/local/bin/mpiexec -n {n} ipengine profile_dir={profile_dir}
MinRK
clone parallel docs to parallelz
r3586
There are a few important points about this template:
MinRK
add EvalFormatter for batch system (PBS) launcher templates...
r4004 1. This template will be rendered at runtime using IPython's :class:`EvalFormatter`.
This is simply a subclass of :class:`string.Formatter` that allows simple expressions
on keys.
MinRK
clone parallel docs to parallelz
r3586
2. Instead of putting in the actual number of engines, use the notation
MinRK
add EvalFormatter for batch system (PBS) launcher templates...
r4004 ``{n}`` to indicate the number of engines to be started. You can also use
expressions like ``{n/4}`` in the template to indicate the number of nodes.
There will always be ``{n}`` and ``{profile_dir}`` variables passed to the formatter.
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647 These allow the batch system to know how many engines, and where the configuration
MinRK
add EvalFormatter for batch system (PBS) launcher templates...
r4004 files reside. The same is true for the batch queue, with the template variable
``{queue}``.
MinRK
clone parallel docs to parallelz
r3586
MinRK
add EvalFormatter for batch system (PBS) launcher templates...
r4004 3. Any options to :command:`ipengine` can be given in the batch script
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 template, or in :file:`ipengine_config.py`.
MinRK
clone parallel docs to parallelz
r3586
MinRK
add EvalFormatter for batch system (PBS) launcher templates...
r4004 4. Depending on the configuration of you system, you may have to set
MinRK
clone parallel docs to parallelz
r3586 environment variables in the script template.
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647 The controller template should be similar, but simpler:
.. sourcecode:: bash
#PBS -N ipython
#PBS -j oe
#PBS -l walltime=00:10:00
#PBS -l nodes=1:ppn=4
MinRK
add EvalFormatter for batch system (PBS) launcher templates...
r4004 #PBS -q {queue}
MinRK
clone parallel docs to parallelz
r3586
MinRK
add EvalFormatter for batch system (PBS) launcher templates...
r4004 cd $PBS_O_WORKDIR
export PATH=$HOME/usr/local/bin
export PYTHONPATH=$HOME/usr/local/lib/python2.7/site-packages
ipcontroller profile_dir={profile_dir}
MinRK
clone parallel docs to parallelz
r3586
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647 Once you have created these scripts, save them with names like
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 :file:`pbs.engine.template`. Now you can load them into the :file:`ipcluster_config` with:
MinRK
clone parallel docs to parallelz
r3586
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647 .. sourcecode:: python
MinRK
updates to docs and examples
r3670 c.PBSEngineSetLauncher.batch_template_file = "pbs.engine.template"
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647
MinRK
updates to docs and examples
r3670 c.PBSControllerLauncher.batch_template_file = "pbs.controller.template"
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 Alternately, you can just define the templates as strings inside :file:`ipcluster_config`.
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647
MinRK
updates to docs and examples
r3670 Whether you are using your own templates or our defaults, the extra configurables available are
MinRK
add EvalFormatter for batch system (PBS) launcher templates...
r4004 the number of engines to launch (``{n}``, and the batch system queue to which the jobs are to be
submitted (``{queue}``)). These are configurables, and can be specified in
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 :file:`ipcluster_config`:
MinRK
updates to docs and examples
r3670
.. sourcecode:: python
c.PBSLauncher.queue = 'veryshort.q'
MinRK
add EvalFormatter for batch system (PBS) launcher templates...
r4004 c.IPClusterEnginesApp.n = 64
MinRK
updates to docs and examples
r3670
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647 Note that assuming you are running PBS on a multi-node cluster, the Controller's default behavior
of listening only on localhost is likely too restrictive. In this case, also assuming the
nodes are safely behind a firewall, you can simply instruct the Controller to listen for
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 connections on all its interfaces, by adding in :file:`ipcontroller_config`:
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647
.. sourcecode:: python
MinRK
update mpi doc
r3649 c.RegistrationFactory.ip = '*'
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647
You can now run the cluster with::
MinRK
parallel docs, tests, default config updated to newconfig
r3990 $ ipcluster start profile=pbs n=128
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 Additional configuration options can be found in the PBS section of :file:`ipcluster_config`.
MinRK
clone parallel docs to parallelz
r3586
MinRK
update process/security docs in parallelz
r3617 .. note::
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647 Due to the flexibility of configuration, the PBS launchers work with simple changes
to the template for other :command:`qsub`-using systems, such as Sun Grid Engine,
and with further configuration in similar batch systems like Condor.
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 Using :command:`ipcluster` in SSH mode
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647 ---------------------------------------
MinRK
update process/security docs in parallelz
r3617
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 The SSH mode uses :command:`ssh` to execute :command:`ipengine` on remote
nodes and :command:`ipcontroller` can be run remotely as well, or on localhost.
MinRK
clone parallel docs to parallelz
r3586
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647 .. note::
MinRK
clone parallel docs to parallelz
r3586
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647 When using this mode it highly recommended that you have set up SSH keys
and are using ssh-agent [SSH]_ for password-less logins.
MinRK
clone parallel docs to parallelz
r3586
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647 As usual, we start by creating a clean profile::
MinRK
clone parallel docs to parallelz
r3586
MinRK
rename '--cluster' flag to '--parallel' in ProfileApp...
r4038 $ ipython profile create --parallel profile=ssh
MinRK
clone parallel docs to parallelz
r3586
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 To use this mode, select the SSH launchers in :file:`ipcluster_config.py`:
MinRK
clone parallel docs to parallelz
r3586
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647 .. sourcecode:: python
MinRK
clone parallel docs to parallelz
r3586
MinRK
organize IPython.parallel into subpackages
r3673 c.Global.engine_launcher = 'IPython.parallel.apps.launcher.SSHEngineSetLauncher'
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647 # and if the Controller is also to be remote:
MinRK
organize IPython.parallel into subpackages
r3673 c.Global.controller_launcher = 'IPython.parallel.apps.launcher.SSHControllerLauncher'
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647
MinRK
clone parallel docs to parallelz
r3586
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647 The controller's remote location and configuration can be specified:
MinRK
clone parallel docs to parallelz
r3586
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647 .. sourcecode:: python
MinRK
clone parallel docs to parallelz
r3586
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647 # Set the user and hostname for the controller
# c.SSHControllerLauncher.hostname = 'controller.example.com'
# c.SSHControllerLauncher.user = os.environ.get('USER','username')
MinRK
clone parallel docs to parallelz
r3586
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 # Set the arguments to be passed to ipcontroller
# note that remotely launched ipcontroller will not get the contents of
# the local ipcontroller_config.py unless it resides on the *remote host*
MinRK
add EvalFormatter for batch system (PBS) launcher templates...
r4004 # in the location specified by the `profile_dir` argument.
# c.SSHControllerLauncher.program_args = ['--reuse', 'ip=0.0.0.0', 'profile_dir=/path/to/cd']
MinRK
clone parallel docs to parallelz
r3586
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647 .. note::
MinRK
clone parallel docs to parallelz
r3586
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647 SSH mode does not do any file movement, so you will need to distribute configuration
files manually. To aid in this, the `reuse_files` flag defaults to True for ssh-launched
Controllers, so you will only need to do this once, unless you override this flag back
to False.
MinRK
clone parallel docs to parallelz
r3586
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647 Engines are specified in a dictionary, by hostname and the number of engines to be run
on that host.
MinRK
clone parallel docs to parallelz
r3586
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647 .. sourcecode:: python
c.SSHEngineSetLauncher.engines = { 'host1.example.com' : 2,
'host2.example.com' : 5,
MinRK
add EvalFormatter for batch system (PBS) launcher templates...
r4004 'host3.example.com' : (1, ['profile_dir=/home/different/location']),
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647 'host4.example.com' : 8 }
MinRK
clone parallel docs to parallelz
r3586
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647 * The `engines` dict, where the keys are the host we want to run engines on and
the value is the number of engines to run on that host.
* on host3, the value is a tuple, where the number of engines is first, and the arguments
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 to be passed to :command:`ipengine` are the second element.
MinRK
clone parallel docs to parallelz
r3586
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647 For engines without explicitly specified arguments, the default arguments are set in
a single location:
MinRK
clone parallel docs to parallelz
r3586
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647 .. sourcecode:: python
MinRK
clone parallel docs to parallelz
r3586
MinRK
add EvalFormatter for batch system (PBS) launcher templates...
r4004 c.SSHEngineSetLauncher.engine_args = ['profile_dir=/path/to/cluster_ssh']
MinRK
clone parallel docs to parallelz
r3586
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 Current limitations of the SSH mode of :command:`ipcluster` are:
MinRK
clone parallel docs to parallelz
r3586
* Untested on Windows. Would require a working :command:`ssh` on Windows.
Also, we are using shell scripts to setup and execute commands on remote
hosts.
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647 * No file movement -
MinRK
clone parallel docs to parallelz
r3586
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 Using the :command:`ipcontroller` and :command:`ipengine` commands
MinRK
update process/security docs in parallelz
r3617 ====================================================================
MinRK
clone parallel docs to parallelz
r3586
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 It is also possible to use the :command:`ipcontroller` and :command:`ipengine`
MinRK
clone parallel docs to parallelz
r3586 commands to start your controller and engines. This approach gives you full
control over all aspects of the startup process.
Starting the controller and engine on your local machine
--------------------------------------------------------
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 To use :command:`ipcontroller` and :command:`ipengine` to start things on your
MinRK
clone parallel docs to parallelz
r3586 local machine, do the following.
First start the controller::
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 $ ipcontroller
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647
MinRK
clone parallel docs to parallelz
r3586 Next, start however many instances of the engine you want using (repeatedly)
the command::
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 $ ipengine
MinRK
clone parallel docs to parallelz
r3586
The engines should start and automatically connect to the controller using the
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 JSON files in :file:`~/.ipython/cluster_default/security`. You are now ready to use the
MinRK
clone parallel docs to parallelz
r3586 controller and engines from IPython.
.. warning::
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647
The order of the above operations may be important. You *must*
start the controller before the engines, unless you are reusing connection
information (via `-r`), in which case ordering is not important.
MinRK
clone parallel docs to parallelz
r3586
.. note::
On some platforms (OS X), to put the controller and engine into the
background you may need to give these commands in the form ``(ipcontroller
&)`` and ``(ipengine &)`` (with the parentheses) for them to work
properly.
Starting the controller and engines on different hosts
------------------------------------------------------
When the controller and engines are running on different hosts, things are
slightly more complicated, but the underlying ideas are the same:
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 1. Start the controller on a host using :command:`ipcontroller`.
MinRK
move ipcluster create|list to `ipython profile create|list`...
r4024 2. Copy :file:`ipcontroller-engine.json` from :file:`~/.ipython/profile_<name>/security` on
MinRK
clone parallel docs to parallelz
r3586 the controller's host to the host where the engines will run.
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 3. Use :command:`ipengine` on the engine's hosts to start the engines.
MinRK
clone parallel docs to parallelz
r3586
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 The only thing you have to be careful of is to tell :command:`ipengine` where
MinRK
update process/security docs in parallelz
r3617 the :file:`ipcontroller-engine.json` file is located. There are two ways you
MinRK
clone parallel docs to parallelz
r3586 can do this:
MinRK
move ipcluster create|list to `ipython profile create|list`...
r4024 * Put :file:`ipcontroller-engine.json` in the :file:`~/.ipython/profile_<name>/security`
MinRK
clone parallel docs to parallelz
r3586 directory on the engine's host, where it will be found automatically.
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 * Call :command:`ipengine` with the ``--file=full_path_to_the_file``
MinRK
clone parallel docs to parallelz
r3586 flag.
MinRK
update process/security docs in parallelz
r3617 The ``--file`` flag works like this::
MinRK
clone parallel docs to parallelz
r3586
MinRK
update process/security docs in parallelz
r3617 $ ipengine --file=/path/to/my/ipcontroller-engine.json
MinRK
clone parallel docs to parallelz
r3586
.. note::
If the controller's and engine's hosts all have a shared file system
MinRK
move ipcluster create|list to `ipython profile create|list`...
r4024 (:file:`~/.ipython/profile_<name>/security` is the same on all of them), then things
MinRK
clone parallel docs to parallelz
r3586 will just work!
MinRK
update process/security docs in parallelz
r3617 Make JSON files persistent
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647 --------------------------
MinRK
clone parallel docs to parallelz
r3586
MinRK
update process/security docs in parallelz
r3617 At fist glance it may seem that that managing the JSON files is a bit
annoying. Going back to the house and key analogy, copying the JSON around
MinRK
clone parallel docs to parallelz
r3586 each time you start the controller is like having to make a new key every time
you want to unlock the door and enter your house. As with your house, you want
MinRK
update process/security docs in parallelz
r3617 to be able to create the key (or JSON file) once, and then simply use it at
MinRK
clone parallel docs to parallelz
r3586 any point in the future.
MinRK
parallel docs, tests, default config updated to newconfig
r3990 To do this, the only thing you have to do is specify the `--reuse` flag, so that
MinRK
update process/security docs in parallelz
r3617 the connection information in the JSON files remains accurate::
MinRK
clone parallel docs to parallelz
r3586
MinRK
parallel docs, tests, default config updated to newconfig
r3990 $ ipcontroller --reuse
MinRK
clone parallel docs to parallelz
r3586
MinRK
update process/security docs in parallelz
r3617 Then, just copy the JSON files over the first time and you are set. You can
MinRK
clone parallel docs to parallelz
r3586 start and stop the controller and engines any many times as you want in the
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647 future, just make sure to tell the controller to reuse the file.
MinRK
clone parallel docs to parallelz
r3586
.. note::
You may ask the question: what ports does the controller listen on if you
don't tell is to use specific ones? The default is to use high random port
numbers. We do this for two reasons: i) to increase security through
obscurity and ii) to multiple controllers on a given host to start and
automatically use different ports.
Log files
---------
All of the components of IPython have log files associated with them.
These log files can be extremely useful in debugging problems with
MinRK
move ipcluster create|list to `ipython profile create|list`...
r4024 IPython and can be found in the directory :file:`~/.ipython/profile_<name>/log`.
MinRK
update process/security docs in parallelz
r3617 Sending the log files to us will often help us to debug any problems.
MinRK
clone parallel docs to parallelz
r3586
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 Configuring `ipcontroller`
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647 ---------------------------
MinRK
Doc tweaks and updates
r3663 Ports and addresses
*******************
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647
MinRK
Doc tweaks and updates
r3663
Database Backend
****************
.. seealso::
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647
MinRK
rebase IPython.parallel after removal of IPython.kernel...
r3672 Configuring `ipengine`
MinRK
adjustments to PBS/SGE, SSH Launchers + docs update
r3647 -----------------------
.. note::
TODO
MinRK
clone parallel docs to parallelz
r3586
MinRK
Doc tweaks and updates
r3663
.. [PBS] Portable Batch System. http://www.openpbs.org/
.. [SSH] SSH-Agent http://en.wikipedia.org/wiki/ssh-agent