<< >> Title Contents Index Home Help

Parallel Statements


See Section 15.1.4.6 of the PGI User's Guide for an introduction to PGDBG statements.

Parallel Compound/Block Statements

Example:

pgdbg [all] 0>[*] break main; 
cont; wait; print f@11@i
ii.) pgdbg [all] 0>[*] break main;
[*]cont; [*]wait; [*]print f@11@i

i. and ii. are equivalent. Each command in a compound statement is executed in order. The target p/t-set is broadcast to all statements. Use the wait command if subsequent commands require threads to be stopped (the print command above). The commands in a compound statement are executed together in order.

The threadwait and procwait environment variables do not affect how commands within a compound statement are processed. These pgienv environment variables describe to PGDBG under what conditions (runstate of program) it should accept the next (compound) statement.

Parallel If, Else Statements

Example:
pgdbg [all] 0> [*] if (i==1) {break func; c; wait} else {sync func2}

A prefix p/t-set parallelizes an 'if' statement. An 'if' statement executes in the context of the current thread by default. The above example is equivalent to:

   [*] if (i==1) ==> [s]
       [s]break func; [s]c; [s]wait;
   else ==> [s']
       [s']sync func2
Where [s] is the subset of [*] for which (i==1), and [s'] is the subset of [*] for which (i!=1).  

Parallel While Statements

Example:

 pgdbg [all] 0> [*] while (i<10) {n; wait; print i}

A prefix p/t-set parallelizes a 'while' statement. A 'while' statement executes in the context of the current thread by default. The above example is equivalent to:

   [*] ==> [s]
   while(|[s]|){
   [s] if (i<10) ==> [s]
       [s]n; [s]wait; [s]print i;
   }
Where [s] is the subset of [*] for which (i<10). The 'while' statement terminates when [s] is the empty set (or a 'return') statement is executed in the body of the 'while'.

Return Statements

The `return' statement is defined only in serial context, since it cannot return multiple values. When 'return' is used in a parallel statement, it will return last value evaluated.


<< >> Title Contents Index Home Help