Prism 6.0 User's Guide

Executing a Program in MP Prism

You start execution of a program in MP Prism just as you do in scalar Prism--by issuing the run command or choosing the Run or Run (args) selection from the Execute menu. See "Executing a Program in Scalar Prism". You can also attach to an already-running program using the attach command, as described in " Attaching to a Running Message-Passing Process". Prism displays the program I/O in the same fashion as described in " Program I/O".

Note the key advantage of using Prism with a Sun MPI program: The Sun MPI program is viewed as a single parallel program; all processes of the parallel program are visible from within a single Prism session. You do not have to attach a separate debugger to each Sun MPI process.

Stepping and Continuing Through a Program

In MP Prism, menu actions such as Step and Next apply to the processes belonging to the current set of processes. The MP Prism term for a set of processes is pset. MP Prism supports several kinds of pre-defined psets as well as user-defined psets. For information about psets, see "Using Psets in MP Prism".

Scalar Prism (like other debuggers) waits for a step, next, or cont command to finish executing before letting you issue most other commands. This behavior is unnecessarily restrictive in MP Prism, however; therefore, if one process or set of processes is executing code, you can still issue commands that affect other processes. For example, you can switch to a different pset and start or stop execution of its processes.

Interrupting and Waiting for Processes

It is useful in debugging message-passing programs to wait for a specific process or set of processes to stop executing, or to be able to interrupt execution of individual processes. Because message-passing programs are distributed among multiple, separate machines, extra consideration must be given to controlling selected subsets of processes. MP Prism therefore provides the commands interrupt and wait.

Use the interrupt command to forcibly interrupt execution of a specified process or set of processes. The MP Prism term for a set of processes is pset. For information about psets, see "Using Psets in MP Prism".

For example,

interrupt pset 0

interrupts execution of process 0.

interrupt pset running

interrupts all processes in the predefined process set (pset) running.

Using the interrupt command resets the predefined pset interrupted so that it includes the newly interrupted processes. Processes leave this pset when they continue execution.

In MP Prism, the Interrupt selection from the Execute menu interrupts processes in the current pset that are running.

Use the wait command to wait for a specified process or processes to stop execution. A process is considered to have stopped if it has entered the done, break, interrupted, or error state.

There are two versions of the wait command:

(prism notx) wait every

waits for every process in the pset notx to stop. The current process will be whatever it would normally be; see " Current Pset". This is the default behavior of the wait command.

wait any pset foo

waits for the first process in pset foo to stop.

There are corresponding Wait Any and Wait Every selections in MP Prism's Execute menu. They apply to the processes of the current set.

You can end the wait by

Note that, if you prefer that step and next commands wait for processes to finish executing before letting you issue other commands, you can issue them along with the wait command. For example,

step; wait

This says: Execute the next line, then wait for all processes in the current pset to finish execution.

If you use this command sequence frequently, you can provide an alias for it via the alias command. Prism provides the default alias contw for these commands:

cont; wait

Execution Pointer

In Scalar Prism, the > symbol in the line-number region points to the next line to be executed; see " Using the Line-Number Region". In a message-passing program, there can be multiple execution points within the program. MP Prism marks all the execution points for the processes in the current set by a > in the line-number region (or a * if the current source position is the same as the current execution point). Shift-click on this symbol to display a pop-up window that shows the process(es) for which the symbol is the execution pointer.

Finding Out Execution Status

Issue the pstatus command to find out the execution status of processes. You can find out the execution status of the members of the specified process set (pset) if you issue pstatus with a pset qualifier. For information about psets and pset qualifiers, see "Using Psets in MP Prism".

Without a pset qualifier, pstatus displays the execution status of the members of the current set. For example,

(prism all) pstatus
process 0: running
process 1: stopped in procedure "pawn_moves" at "chess.c":49
process 2: interrupted in procedure "construct_move" at "chess.c":1187
process 3: interrupted in procedure "rook_check" at "chess.c":746

Setting MPI_INIT_TIMEOUT

Sun MPI has timeouts built into the software to help detect when there are problems starting an MPI job. However, you may trigger these timeouts erroneously when you are debugging programs, such as when using Prism. You should disable the timeouts prior to using Prism on a Sun MPI program. You can use the environment variable MPI_INIT_TIMEOUT to lengthen or disable the timeout time. When you set MPI_INIT_TIMEOUT to a positive integer, the timeout value is set to that time in seconds. When you set MPI_INIT_TIMEOUT to 0 or a negative integer, the timeout is disabled. The default value is 600 seconds (10 minutes).

For example, to disable timeouts (in a C shell):

% setenv MPI_INIT_TIMEOUT -1

Again in a C shell, to set timeouts to 5 minutes:

% setenv MPI_INIT_TIMEOUT 300

Executing a Program in the Commands-Only Mode of MP Prism

When you issue the run command to execute a program in the commands-only mode of MP Prism, the program starts up in the background. If the program needs to read terminal input, you must then issue the fg command at the (prism) prompt to run the program in the foreground. You cannot execute Prism commands while the program is executing in the foreground. To have the program run in the background and regain the (prism) prompt, type Control-z.

Quitting

Issuing the quit command terminates the debugging session. Before quitting, MP Prism will kill your debugged process if it was started with run, or it will detach from it if you previously attached.