Events in MP Prism can take a pset qualifier. You can specify this in an event field in MP Prism's Event Table, as shown in Figure 4-2.
If you don't supply a pset qualifier, the event applies to the current pset. If you create the event before changing the current set, the event applies to the default set, which is all.
Thus,
stop in receive pset notx
sets a breakpoint in the receive routine for the processes in the set notx. Each process in the set stops when it reaches this routine. It is possible, of course, that some processes may never reach this routine. This becomes an issue when you include actions in an event; see below.
If all the processes in the pset have stopped, you can continue them by issuing a command like
cont pset notx
Here is another example:
stop if x > 10
This command stops execution for any process in the current pset if the process's value for the variable x is greater than 10.
Prism evaluates the expression in the condition locally--that is, separately for each process. Similarly, if a and b are arrays,
stop if sum(a) > sum(b)
stops execution for a process in the current set if the sum of the values of a in that process is greater than the sum of the values of b.
All processes that are stopped at breakpoints are members of the predefined pset break.
If you use a dynamic pset as a qualifier for an event, its membership is evaluated when you issue the command defining the event. Thus, the command
stop at 10 pset interrupted
creates a breakpoint only in the processes that are interrupted at the time the command is issued. If no processes are currently interrupted, you receive an error message.
One result of this is that you cannot define events that involve dynamic psets before the program starts execution.
If you use a user-defined variable pset as a qualifier, its membership is determined by the most recent eval pset command you issued for that pset.
As is the case with dynamic psets, you cannot define events that involve variable psets before the program starts execution.
Events in both MP Prism and scalar Prism can take action clauses. For example, in MP Prism the following action clause prints x for the pset foo when the members of foo are stopped at line 10:
stop at 10 {print x} pset foo
Associating an action with an event forces a global synchronization at the breakpoint or tracepoint. In the example above, every process in pset foo must stop at line 10 before x can be printed. If a member does not stop at line 10, the action never takes place. In a trace event, all processes in the pset must stop at the specified place and synchronize; the action then takes place, and the processes automatically continue execution.
You can include an eval pset command as an event action. For example,
stop in send {eval pset sending}
evaluates the pset sending when all the members of the current pset are stopped in send. You receive error messages if it is impossible to evaluate membership in a pset (for example, because a variable in the set definition is not active).
Note these limitations in using event actions: i:
I n MP Prism, you cannot include a pset qualifier in the action. The command in the action clause takes its pset from the pset of the event.
In both MP Prism and scalar Prism, you cannot include commands that affect program execution, specifically:
In both MP Prism and scalar Prism, you cannot include the load, reload, return, and core commands.
Issue the show events command with a process number as an argument to display all events associated with that process. For example,
(prism) show events (1) trace (2) when stopped { print board } (prism) disable 1 event 1 disabled (prism) show events (1) trace (disabled) (2) when stopped { print board }
Issuing show events with no arguments has its standard behavior; that is, it prints out all events.
If you create an event that applies to a particular pset, and subsequently delete the pset, the event continues to exist. Its printed representation, however, is changed so that it shows the processes that were members of the pset at the time you deleted the set.