QSMM supports a mechanism of deferred copying a probability profile from a source node to a destination node, where a copying operation itself only sets a correspondence between the two nodes—the source node becomes a probability profile source, and the destination node becomes a probability profile user. A node can be a probability profile source for multiple other nodes. Storage redirection functions described in Providing Initial Statistics provide read-only access for the destination node to the probability profile held in the source node.
A deferred copying operation provides copy-on-write behavior for the instances of
qsmm_cycle_s structures described in Structures for Accessing Storage.
Those instances hold a probability profile along with statistics on the event history.
The first operation of writing statistics to such an instance for the destination node causes allocating the instance and copying there a piece of information on the probability profile from the source node.
You can change the values of controlled probability variables for the destination node in the normal way.
An assembler program loaded into the source node provides information on how to update the state transition matrix and action emission matrix of the destination node when changing the values of controlled probability variables for the destination node.
Updating the state transition matrix and action emission matrix causes the allocation of instances of
qsmm_cycle_s for the destination node if they do not yet exist.
The following information held in a source node becomes automatically available for a destination node:
qsmm_enum_var_prob_outcalled for the destination node use this information.
qsmm_get_node_state_by_namecalled for the destination node retrieve this information. The function
qsmm_node_disasmcalled for the destination node can use this information. The functions
qsmm_mat_action_dump_v2called for the destination node use this information.
qsmm_node_disasmcalled to disassemble the destination node automatically applies the template.
You cannot perform the following operations on a node acting as a probability profile source for other nodes:
You cannot perform the following operations on a node acting as a user of a probability profile provided by another node:
Applying deferred copying operations makes sense when a multinode model allocates storage dynamically—uses map storage for holding statistics on the event history.
When dumping the state transition matrix or action emission matrix of a node acting as a probability profile user or disassembling such node, keep in mind that its set of probabilities of
QSMM_PROB_PROFILE type can be incomplete, as some instances of
qsmm_state_s structure from a source node might not yet be available for the destination node.
Therefore, avoid calculating probabilities of
QSMM_PROB_PROFILE type for a node acting as a probability profile user.
Using the deferred copying mechanism for nodes of a multinode model slows down all access operations to storage used by the multinode model approximately twice (even for other nodes of this model).
Use the following function to set a correspondence between two nodes of a multinode model where one node becomes a probability profile source and the other node becomes a probability profile user.
This function sets a node of a multinode model as the source of a probability profile and sets another node of this model as a user of this probability profile. The argument node_from specifies the identifier of the source node. The argument node_to specifies the identifier of the destination node. The argument rez1 is for future use and must be equal to 0.
The function clears event history statistics collected for the destination node.
If the destination node has a probability profile loaded, the function unloads the profile along with information dependent on it.
To clear the event history statistics and unload the profile, this function calls the function
qsmm_node_unload described in Unloading the Probability Profile.
If the source node has uncommitted assignments to controlled probability variables, the function
qsmm_set_node_profile_source calls the function
qsmm_node_var_realize for that node.
The function returns a non-negative value on success or a negative error code on failure. Currently, the function can return the following error codes.
The argument node_from is equal to the argument node_to.
The source or destination node does not exist.
The source node does not have a loaded probability profile.
The instruction class set of the source node and the instruction class set of the destination node are different.
The destination node has the number of states less than it is necessary to hold the probability profile of the source node.
The model instance does not exist.
The multinode model has positive length of look-ahead signal segment.
The source node is a user of a source probability profile provided by another node.
One of the following conditions is true:
qsmm_set_node_profile_sourcecalled the function
qsmm_node_var_realizefor the source node, and the latter function has failed because that node is a probability profile source for other nodes.
This error can leave the probability profile of the destination node in inconsistent state. If after removing a reason of this error a repeated call to this function succeeds, the probability profile becomes consistent.
qsmm_set_node_profile_source called the function
qsmm_node_var_realize for the source node, and the latter function failed because the sum of probabilities of
case instructions in a
choice instruction block would exceed 1.
A Storage API function reported storage failure.
Inconsistent statistics on an action choice state or cycle type detected.
Unable to convert a multibyte string to a wide string or vice versa according to a current locale.
There was not enough memory to perform the operation.
QSMM_ERR_NOMEM can leave the probability profile of the source or destination node in inconsistent state.
If after removing a reason of this error a repeated call to this function succeeds, the probability profile becomes consistent.
qsmm_node_unload described in the next section can break off a correspondence between a node acting as a probability profile source and a node acting as a probability profile user.