MetaWards.app
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;
- main
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;cli()
: The main command line interfaceparse_args()
: Parse command line arguments
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.
- worker
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;get_parallel_scheme()
: Auto-detect scoop or mpi4py
- supervisor
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 ahostfile
, or by manually specifying ahostfile
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;get_hostfile()
: Get the hostfileget_cores_per_node()
: Work out the number of cores per compute nodeget_threads_per_task()
: Work out the number of threads per model runscoop_supervisor()
: Run a scoop supervisor to start and manage jobsmpi_supervisor()
: Run a mpi4py supervisor to start and manage jobs
All of the above functions (and others in the metawards.app package) are described in more detail here;