Next: , Previous: , Up: Assembler Programs   [Contents][Index]


5.11 Cloning the Probability Profile

When there is a need to load the same probability profile into multiple nodes, an assembler program can be loaded into one node, and then the probability profile can be copied to other nodes. In QSMM, the process of copying a probability profile from one node to the other node is called “cloning the probability profile”. Cloning a probability profile from a node to other nodes is faster than loading the same assembler program into them.

To clone a probability profile, use the function described below.

Function: int qsmm_node_profile_clone (qsmm_t model, int node_from, int node_to, unsigned int flags)

This function copies a probability profile from one node of a multinode model specified by handle model to the other node. Argument node_from specifies a source node identifier. Argument node_to specifies a destination node identifier. The function clears event history statistics that might have been collected for the destination node. If the destination node already has a probability profile loaded, then that profile along with additional information this function may copy (see a description of argument flags below) will be first unloaded. To clear the event history statistics and unload the profile, this function implicitly calls the function qsmm_node_unload described in Unloading the Probability Profile. Probability profiles manually written to storage without prior calling the function qsmm_node_asm cannot be copied by the function qsmm_node_profile_clone.

Argument flags is a bitmask, which specifies types of additional information that should be copied from node node_from to node node_to along with the probability profile. Bits of the bitmask, which are taken into account, are represented by the following macros that can be merged by bitwise “or.”

Macro: QSMM_NODE_CLONE_VARS

Copy definitions of controlled and output probability variables and arrays, so values of controlled probability variables of node node_to can be set, and values of output probability variables and arrays of that node can be retrieved, as they can be set and retrieved for node node_from. Before copying the definitions of controlled probability variables, the function qsmm_node_var_realize is implicitly called for node node_from if that node has uncommitted assignments to those variables.

Macro: QSMM_NODE_CLONE_STATE_NAMES

Copy names assigned to node states by arguments of stt instructions. You will be able to retrieve that information for node node_to by the functions qsmm_get_node_state_name and qsmm_get_node_state_by_name and use that information when disassembling node node_to and dumping the state transition matrix and the action emission matrix of node node_to.

Macro: QSMM_NODE_CLONE_TEMPLATE

If node node_from has an assembler program template associated with it, then copy that template. The template will be used when disassembling node node_to.

The function returns a non-negative value on success or a negative error code on failure. Currently, the following error codes can be returned.

QSMM_ERR_INVAL

The value of node_from is equal to the value of node_to.

QSMM_ERR_NOTFOUND

A node with identifier node_from or node_to does not exist.

QSMM_ERR_NOSTATE

A node with identifier node_to has the number of states less than it is required to hold the probability profile of a node with identifier node_from.

QSMM_ERR_NOSAMENC

Instruction class sets that represent node classes, to which nodes node_from and node_to belong, are not the same.

QSMM_ERR_NOPROF

A probability profile is not loaded into a node with identifier node_from.

QSMM_ERR_PROFSRCU

A node with identifier node_from is a user of a source probability profile provided by another node.

QSMM_ERR_PROFSRCP

One of the following conditions is met:

  • – a node with identifier node_to is a source of probability profile for other nodes;
  • – the function qsmm_node_var_realize was implicitly called, and it turned out that a node with identifier node_from is a source of probability profile for other nodes.
QSMM_ERR_PSUMGT1

The function qsmm_node_var_realize was implicitly called for node node_from, and it turned out that the sum of probabilities of case instructions in a choice instruction block or the sum of elements of a probabilities list used by a casels instruction will exceed 1 if assignments to controlled probability variables are committed. This could leave the model instance in indeterminate state. If the model instance is in indeterminate state, then after removing a reason of the error, the operation can be repeated, and if the function succeeds, then the model instance state will become determinate.

QSMM_ERR_UNTIMELY

The model instance does not exist.

QSMM_ERR_UNSUPPLA

The multinode model has positive length of the look-ahead signal segment.

QSMM_ERR_STORAGE

Statistics storage failure. This could leave the model instance in indeterminate state. If the model instance is in indeterminate state, then after removing a reason of the error, the operation can be repeated, and if the function succeeds, then the model instance state will become determinate.

QSMM_ERR_NOMEM

There was not enough memory to perform the operation. This could leave the model instance in indeterminate state. If the model instance is in indeterminate state, then after removing a reason of the error, the operation can be repeated, and if the function succeeds, then the model instance state will become determinate.


Next: , Previous: , Up: Assembler Programs   [Contents][Index]