This module contains all of the functions needed to write the metawards command line application.

The metawards command line application will automatically run itself in one of three modes;


This is the default mode, and is used when you normally run metawards to perform calculations using a single computer. Key functions that are used in main mode are;

This mode is used to run either single model runs, or to run multiple runs in parallel on the same computer via a multiprocessing pool.


This is the mode used when metawards detects that it should be running as a worker process as part of a simulation run on a large cluster. If this is the case, then the application will go to sleep until it is called upon as part of a parallel run on multiple computers via either a scoop mapping pool, or an mpi4py MPI pool.

The worker will automatically detect whether scoop or mpi4py is being used based on which of these modules have been loaded via the -m scoop or -m mpi4py command line injector.

The key function used in worker mode is;


This is the mode used when metawards detects that it is being run across multiple computer nodes in a cluster. This is detected automatically via environment variables from common queueing systems that supply a hostfile, or by manually specifying a hostfile via the --hostfile command line argument.

The metawards application will choose to parallelise over the cluster using mpi4py or scoop, depending on what the user specifies, which modules are installed, or automatically choosing in the order scoop > mpi4py (this order is simply because MPI is more error-prone to use automatically).

Key functions used in supervisor mode are;

All of the above functions (and others in the package) are described in more detail here;