Global Functions in the SST Python Module

The SST core python module provides a set of global functions not attached to any particular class. These functions generally fall into one of the following categories: general control and informational functions, functions to get handles to existing objects and statistic enable and control functions. These functions are described below. Following those descriptions is a section on general notes on statistics.

General Control and Informational Functions


setProgramOption(option,value)

Sets the specified program option for the simulation. These mirror the options available on the sst command line. Parameters set in the python file will be overwritten by options set on the command line. Use sst –help to get a list of available options.

Parameters



getProgramOptions()

Returns a dictionary with the current values of the program options. This will include all program options, not just those set in the python file.

Parameters



getMPIRankCount()

Returns the number of physical MPI ranks in the simulation

Parameters



getSSTThreadCount()

Returns the threads per rank specified for the simulation

Parameters



setSSTThreadCount(threads)

Sets the number of threads per rank for the simulation. These values can be overwritten by using -n on the command line.

Parameters



pushNamePrefix(prefix)

Pushes a name prefix onto the name stack. This prefix will be added on the names of all Components and Links. The names in the stack are separated by a period. Example, if pushNamePrefix(“base”) and pushNamePrefix(“next”) were called in that order, the prefixed name would be “base.next”. Prefixes can be popped from the stack using popNamePrefix().

Parameters



popNamePrefix()

Pops a prefix from the name stack. See pushNamePrefix for how name stacks are used.

Parameters



exit()

Causes the simulation to exit.

Parameters


Functions to Get Handles to Existing Objects


findComponentByName(name)

In many cases, Components and SubComponents will be created using library functions and the user will not have direct access to their handles. In some instances, the provided python modules will have accessor functions that can provide handles to these elements. If this is not provided by the library, the user can call the findComponentByName() function to get a handle to the desired element. The function can find handles for both Components and SubComponents. The use of this function presupposes a knowledge of the naming convention of the elements in the build functions of the library.

Parameters


Statistic Enable and Control Functions

The following functions are used to enable statistics on Components and SubComponents using the name or type of the element. See General Notes on Statistics for more information.


enableAllStatisticsForAllComponents(stat_params_dict)

Enables all statistics for all Components in the simulation that have already been instanced.

Parameters



enableAllStatisticsForComponentName(name, stat_params_dict, apply_to_children=False)

Enables all statistics for the Component named in the call. This call works for both Components and SubComponents.

Parameters



enableStatisticForComponentName(name, stat, stat_params_dict, apply_to_children=False)

Enables a statistic for the component on which the call is made.

Parameters



enableStatisticsForComponentName(name, stat, stat_params_dict, apply_to_children=False)

Enables a list of statistics for the component on which the call is made.

Parameters



enableAllStatisticsForComponentType(type, stat_params_dict, apply_to_children=False)

Enables all statistics for all previously instanced Components/SubComponents of the type specified in the call. This call works for both Components and SubComponents.

Parameters



enableStatisticForComponentType(type, stat, stat_params_dict, apply_to_children=False)

Enables a the specified statistic for all previously instanced Components/SubComponents of the type specified in the call. This call works for both Components and SubComponents.

Parameters



enableStatisticsForComponentType(type, stat_list, stat_params_dict, apply_to_children=False)

Enables a list of statistics for all previously instanced Components/SubComponents of the type specified in the call. This call works for both Components and SubComponents.

Parameters



setStatisticLoadLevelForComponentName(name, level, apply_to_children=False)

Sets the statistic load level for the named component.

Parameters



setStatisticLoadLevelForComponentType(type, level, apply_to_children=False)

Sets the statistic load level for all components of the specified type.

Parameters



setStatisticLoadLevel(level)

Set the global statistic load level. This level is used if individual load levels are not set. Also, the load level is only used for statistics not specifically enabled (i.e., not enabled using one of the enableAllStatistics variants).

Parameters



getStatisticLoadLevel()

Return the global statistic load level

Parameters



setStatisticOutput(stat_output_module)

Sets the global StatisticOutput to be of the module type specified

Parameters



setStatisticOutputOption(option, value)

Set the specified option for the StatisticOutput object.

Parameters



setStatisticOutputOptions(options)

Set the specified options for the StatisticOutput object

Parameters


General Notes on Statistics

There are a number of ways to enable statistics on Components and SubComponents. There are a set of functions that can be called directly on Component/SubComponent handles and a set of functions that are provided by the sst python module that use name or type to find the elements on which to enable statistics. There may also be specific methods provided by element library python modules.

Statistic load levels

It is possible to set load levels both globally and per Component/SubComponent. Each statistic defined in Components/SubComponents has a load level assigned to it in order to help with finer grained control with using the enableAllStatistics* functions. Load levels only apply to statistics not explicitly enabled. Also, local load levels will override global load levels.

The precedence for enabling statistics is as follows: If a statistic is explicitly enabled (does not use one of the enableAllStatistics* functions), it will be enabled. Else, if the set load level meets the minimum for a statistic and all statistics for the component have been enabled, the statistic will be enabled. The local load level will be used, if set, otherwise the global load level will be used.

Statistic parameters

Statistic parameters are used to pass the parameters to the statistics subsystem and to the the statistics themselves and are specified in a python dictionary. In addition to statistic specific parameters, the following parameters are supported: