Using the SME Command-Line Interface

The SME consists of three primary applications, the Module Constructor (MCP), the Code Generator (CGP), and the SME Driver (Driver). The user may invoke these applications either through a command line interface or using the SME graphical user interface. ). The functionality of the applications was outlined in section 2 and the Overview document. In this section we discuss the most commomly used command line interface, accessed by invoking the SME script.

5.1 Using the SME Script

Building projects and models is accomplished by means the SME script, installed by the 'install' target of the makefile. The usage of the script (for most up-to-date info use 'SME -h' ) is as follows:

Usage:

SME [options] { project | model | scenario | import | build | run } [args]

options:

-h :print usage help

-p :parallel (MPI) code

-java <host> : Use java interface on <host> ( use localhost for local machine )

arguments:

project <pname> [pdir] :Sets current proj/workspace

model <mname> :Sets current model

scenario <sname> [prev_scen] :Sets current scenario Copies config files from previous scenario

import <modelName> <STELLA file> :import STELLA file

into model modelName

build :create/build current model.

run :run current model

clean <modelName> :delete unnecessary files

of model <modelName>

db <dbArgs> :SME database interface

The -p flag tells it to use MPI code (error messages result if an MPI version of the SME has not been installed).

5.1.1 Creating Projects

SME maintains a 'current' project and a 'current' project directory that are written into $HOME/.sme_project. These are accessed and changed through the SME script: the file is not meant to be modified manually. If you execute the SME script with no arguments it will tell you the current directory and project. To create a new project, execute:

SME project <projname> [projdir]

If you supply projdir this becomes the current root directory of the projects. This directory is not project-specific: the actual project will be created in a directory <projname> under it. If you do not supply projdir, the current one is used if set, otherwise the program will ask you if you want to use the current directory. If you have already created a project, executing

SME project <projname>

will make projname the current one.

5.1.2 Creating Models

SME maintains a 'current' model that is written into $HOME/.sme_project. It is accessed and changed through the SME script: the file is not meant to be modified manually. If you execute the SME script with no arguments it will tell you the current model. To set the current model nane, execute:

SME model <modelname>

which will make <modelname> the current one.

5.1.3 Importing Modules

To 'import' a set of modules from a STELLA equation file into the current model, execute:

SME import [<STELLA equation file>]

which will invoke the MCP application on the current imported equation file to create the corresponding set of SMML files, which will be put in the Models/<modelName>/ directory under the project workspace. If a <STELLA equation file> is specified then that file is imported into the Project (and becomes the current imported equation file). See section 6 for information on configuration options for the translator MCP which can be used to automate the process of adding/deleting SMML code to/from the SMML file (e.g. ignoring some variables or adding user-defined functions) each time it is generated.

5.1.4 Creating Scenarios

SME maintains a 'current' scenario that is written into $HOME/.sme_project. It is accessed and changed through the SME script: the file is not meant to be modified manually. If you execute the SME script with no arguments it will tell you the current scenario. If no scenario is specified, then the SME assumes a default scenario named "def".

A scenario is a named configuration of a model. A model can have have any number of scenarios. To set the current scenario name, execute:

SME scen <scenario_name> <old_scen>

which will make <scenario_name> the current scenario. It will copy the previous scenario's config file to create an initial configuration for the current scenario. The previous scenario is taken to be the last one specified (or "def") unless <old_scen> is provided to specify a different one. See section 6.1 for a more detailed discussion of configuration files.

5.1.5 Building Models

To create and/or build the current model, execute:

SME build

to build a simulation driver. This command first invokes the CGP application to convert the SMML files into C++ code to be linked into the SME Driver. The makefile will take care of all the dependencies and invoke the SMML and C++ compilers as needed.

After the C++ code has been generated, 'make' is invoked to build the model driver (MPI multiprocessing is used if it's installed and you supply the -p option).

5.1.6 Running Models

To run the current model, execute

SME run

The correct driver will be invoked for MPI or serial, according to the -p option. Refer to section 6 for information on Driver configuration options, section 7 for information on data formats, section 8 for information on use of the SME driver command-line interface, and section 12 for information on running the SME with the java interface.

5.1.7 SME Utilities

The command

SME clean

will delete the object files and the drivers associated with the current model. It will not delete the SMML file or any file that you import, so that you can run ‘SME build’ again after running ‘SME clean’.

The command:

SME db

will return a list of option for using the SME datbase interface. Execute SME db -help for a detailed description of the database interface.