welcome: please sign in
location: Diff for "Middleware/MpiStart/DeveloperDocumentation"
Differences between revisions 1 and 2
Revision 1 as of 2010-11-15 16:42:04
Size: 5310
Editor: enol
Comment:
Revision 2 as of 2010-11-15 16:43:50
Size: 5315
Editor: enol
Comment:
Deletions are marked like this. Additions are marked like this.
Line 17: Line 17:
 - `error_msg`: always prints message
 - `debug_msg`: prints message if both `I2G_MPI_START_VERBOSE` and `I2G_MPI_START_DEBUG` are set
 - `info_msg` & `warn_msg`: print message if `I2G_MPI_START_VERBOSE` is set
 * `error_msg`: always prints message
 * `debug_msg`: prints message if both `I2G_MPI_START_VERBOSE` and `I2G_MPI_START_DEBUG` are set
 * `info_msg` & `warn_msg`: print message if `I2G_MPI_START_VERBOSE` is set
Line 29: Line 29:
 - scheduler_available  * scheduler_available
Line 34: Line 34:
 - scheduler_get_machinefile  * scheduler_get_machinefile
Line 38: Line 38:
 - SCHEDULER_NAME  * SCHEDULER_NAME
Line 58: Line 58:
 - mpi_start  * mpi_start
Line 61: Line 61:
  1. setup parallel environment if necessary (e.g. start daemons)
  2. activate the pre-run hooks (call mpi_start_pre_run_hook)
  3. call mpi_exec to start the parallel job
  4. activate the post-run hooks (call mpi_start_post_run_hook)
  5. shutdown parallel environment if necessary (e.g. shutdown daemons)
  1. setup parallel environment if necessary (e.g. start daemons)
  2. activate the pre-run hooks (call mpi_start_pre_run_hook)
   3. call mpi_exec to start the parallel job
  4. activate the post-run hooks (call mpi_start_post_run_hook)
   5. shutdown parallel environment if necessary (e.g. shutdown daemons)
Line 68: Line 68:
 - mpi_exec  * mpi_exec
Line 81: Line 81:
 - `mpi_start_export_variable var_name [value]` Adds the variable `var_name` to `MPI_START_ENV_VARIABLES` and to the wrapper script, if `value` is defined, set it also in the wrapper.
 - `mpi_start_execute_wrapper cmd_line`: Executes the specified command line in `cmd_line`. If `MPI_START_DO_NOT_USE_WRAPPER` is set to 1 it will not use a wrapper and therefore the environment variables may not be defined.
 * `mpi_start_export_variable var_name [value]` Adds the variable `var_name` to `MPI_START_ENV_VARIABLES` and to the wrapper script, if `value` is defined, set it also in the wrapper.
 * `mpi_start_execute_wrapper cmd_line`: Executes the specified command line in `cmd_line`. If `MPI_START_DO_NOT_USE_WRAPPER` is set to 1 it will not use a wrapper and therefore the environment variables may not be defined.

Developer information

This section gives an overview about the interfaces of different components of MPI-Start for developing new plugins.

Variables

All necessary information of the mpi-start program are provided via environment variables. See ../UserDocumentation and ../SiteConfiguration for a list of those variables.

Logging and debugging

The I2G_MPI_START_VERBOSE variable can be set to 1 to turn on the additional output. For debugging purpose the I2G_MPI_START_DEBUG variable can be set to 1 to enable the debugging output. The variable I2G_MPI_START_TRACE can be set to 1 to trace every operation that is performed by mpi-start (goes to stderr).

The functions for logging messages to output are the following:

  • error_msg: always prints message

  • debug_msg: prints message if both I2G_MPI_START_VERBOSE and I2G_MPI_START_DEBUG are set

  • info_msg & warn_msg: print message if I2G_MPI_START_VERBOSE is set

The dump_vars function dumps the complete environment to the output.

Scheduler plugins

A scheduler plugin is responsible for detection of a runtime system and the definition of process distribution variables. A scheduler plugin must provide the following functions and variables:

  • scheduler_available
    • This function is called to detect if the job is running in the supported environment or not. If the supported environment is found 0 must be returned, else -1.
  • scheduler_get_machinefile
    • After the successfully detection of a scheduler environment this function is called to set the all process distribution variables.
  • SCHEDULER_NAME
    • A variable containing the name of the scheduler, it may be used later by the execution environment plugins to select the best way for starting the application.

The process distribution variables that the scheduler plugin must set are:

Variable

Meaning

MPI_START_MACHINEFILE

This variable points a machinefile in the standard format. In the standard format there is one host per line. If multiple processes should run on a host this host must be inserted multiple times.

MPI_START_HOSTFILE

Variable pointing to a file with a list of available hosts with one host per line without host duplicates

MPI_START_HOST_SLOTS_FILE

Variable pointing to a file where for each line there is a hostname and the number of slots allocated in that host.

MPI_START_NHOSTS

Number of hosts allocated (number of lines in the MPI_START_HOSTFILE file)

MPI_START_NSLOTS

Number of slots allocated (number of lines in the MPI_START_MACHINEFILE file)

MPI_START_NSLOTS_PER_HOST

Number of slots allocated in each host. If the slots are not equally distributed, put here the maximum number of slots available on every host.

Execution environment plugins

A Execution Environment plugin is responsible for setting up the environment for the specified execution environment (MPI) version. It has to provide the following functions:

  • mpi_start
    • This function is called by the mpi-start core to start a parallel job. This function consists (at least) of the following steps:
      1. setup parallel environment if necessary (e.g. start daemons)
      2. activate the pre-run hooks (call mpi_start_pre_run_hook)
      3. call mpi_exec to start the parallel job
      4. activate the post-run hooks (call mpi_start_post_run_hook)
      5. shutdown parallel environment if necessary (e.g. shutdown daemons)

      A generic_mpistart.sh file contains this core functionality for development of new plugins.

  • mpi_exec
    • This function actually perform the execution of the parallel job (mpirun/mpiexec). This functionality has been separated from the setup/shutdown phase to allow usage of the parallel environment in the pre-/post-run hooks.

Several internal variables may change the behavior of the execution environment:

Variable

Meaning

MPI_START_SCHEDULER

Name of the scheduler plugin loaded

MPI_START_MPI_PREFIX

Path of the execution environment

In order to provide a different environment for the user application, MPI-Start uses a wrapper that is executed as a different process. In this wrapper, the variables defined in the MPI_START_ENV_VARIABLES are exported to the environment. The use of the wrapper can be controlled with the functions:

  • mpi_start_export_variable var_name [value] Adds the variable var_name to MPI_START_ENV_VARIABLES and to the wrapper script, if value is defined, set it also in the wrapper.

  • mpi_start_execute_wrapper cmd_line: Executes the specified command line in cmd_line. If MPI_START_DO_NOT_USE_WRAPPER is set to 1 it will not use a wrapper and therefore the environment variables may not be defined.

Clean up

When mpi-start finishes its execution the clean_up function is called. This will remove any temporary files created by MPI-Start by default (e.g. host files) and any other file appended to the MPI_START_CLEANUP_FILES variable.

Hooks

See Hooks Frameworkfor a complete description of the hooks mechanism and how to develop new hooks.

eciencia: Middleware/MpiStart/DeveloperDocumentation (last edited 2011-11-24 15:55:00 by enol)