Prism 6.0 User's Guide

Attaching to a Running Process

Prism enables you to attach to running processes of scalar programs and message-passing programs.

Attaching to a Running Process (Serial Program)

As described in " Attaching to a Process", you can load a running process into Prism by specifying the name of the executable program and the process ID of the corresponding running process on the Prism command line.

You can also attach to a running process from within Prism.


Note -

To attach to the running process of a serial program, the process must be running on the same node as Prism.


To attach to a running process from within Prism:

  1. Find out the process's ID by issuing the Solaris command ps.

  2. Load the executable program for the process into Prism.

  3. Issue the attach command on the Prism command line, using the process's process ID as the argument.

With either method of attaching to the process, the process is interrupted; a message is displayed in the command window giving its current location, and its status is stopped. You can then work with the program in Prism as you normally would. The only difference in behavior is that it does not do its I/O in a special Xterm window; see " Program I/O".

To detach from a running process, issue the command detach from the Prism command line. The process continues to run in the background from the point at which it was stopped in Prism; it is no longer under the control of Prism. Note that you can detach any process in Prism via the detach command, not just processes that you have explicitly attached.


Note -

Use the kill command to terminate the process or job (rather than releasing it to run in the background) currently running within Prism.


Attaching to a Running Message-Passing Process

You can load the processes of a message-passing job into Prism.

To attach to running message-passing programs, obtain the job ID of the processes

For example, using the LSF environment:

host4-0 54 =>bjobs
JOBID USER STAT QUEUE FROM_HOST EXEC_HOST JOB_NAME SUBMIT_TIME
15232 jay  RUN  hpc   host4-0   host4-0   chess    Sep
24 13:35 host4-1
  1. Specify the job ID of the processes (not an individual process ID) on the prism command line, after the name of the executable program.

  2. Use the -n (or -np, -c, -p) option when you request that Prism attach to a job. Without one of these options, Prism assumes that the ID number is a process ID rather than a job ID.

For example,

% prism -n 2 mpiprog 15232

starts MP Prism and attaches to the running processes in job 15232. See the LSF Batch User's Guide for further information about bjobs. See the Sun MPI 4.0 User's Guide: With CRE for further information about mpps.

You can also attach to a single process of a message-passing program by specifying its process ID, just as you do in scalar Prism; see " Attaching to a Running Process (Serial Program)". If you do this, however, you won't be able to view or debug what is happening in the other processes.

If you attach to a program under MP Prism, your job will be automatically detached from MP Prism if you quit or run another program. You can detach from the job by issuing the detach command from within Prism.

MP Prism only lets you detach when all the processes in the job are stopped. The detach operation itself sets them all running again, outside control of the debugger.