📄 node13.htm
字号:
<HTML>
<HEAD>
<!-- This file was generated by tohtml from mpichntman.tex -->
<!-- with the command
tohtml -default -dosnl -gaudy -basedef mpiman.def mpichntman.tex
-->
<TITLE>Debugging</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<HR><H2><A NAME="Node13">Debugging</a></H2>
<A HREF="node12.htm#Node12"><IMG WIDTH=16 HEIGHT=16 SRC="previous.xbm"></A><A HREF="node8.htm#Node8"><IMG WIDTH=16 HEIGHT=16 SRC="up.xbm"></A><A HREF="node13.htm#Node14"><IMG WIDTH=16 HEIGHT=16 SRC="next.xbm"></A><BR>
<b>Up: </b><A HREF="node8.htm#Node8"> Programming Tips</a>
<b>Next: </b><A HREF="node13.htm#Node14"> The printf Approach</a>
<b>Previous: </b><A HREF="node12.htm#Node12"> Compiling and linking with gcc or g77</a>
<P>
Debugging parallel programs is notoriously difficult.
Parallel programs are subject not only to the usual kinds of bugs but also to new kinds
having to do with timing and synchronization errors. Often,
the program ``hangs,'' for example when a process is waiting for a
message to arrive that is never sent or is sent with the wrong tag. Parallel
bugs often disappear precisely when you adds code to try to identify the
bug, which is particularly frustrating. In this section we discuss several
approaches to parallel debugging.
<P>
<menu>
</menu>
<P>
<HR>
<A HREF="node12.htm#Node12"><IMG WIDTH=16 HEIGHT=16 SRC="previous.xbm"></A><A HREF="node8.htm#Node8"><IMG WIDTH=16 HEIGHT=16 SRC="up.xbm"></A><A HREF="node13.htm#Node14"><IMG WIDTH=16 HEIGHT=16 SRC="next.xbm"></A><BR>
<b>Up: </b><A HREF="node8.htm#Node8"> Programming Tips</a>
<b>Next: </b><A HREF="node13.htm#Node14"> The printf Approach</a>
<b>Previous: </b><A HREF="node12.htm#Node12"> Compiling and linking with gcc or g77</a>
<P>
<HR><H3><A NAME="Node14">The printf Approach</a></H3>
<A HREF="node13.htm#Node13"><IMG WIDTH=16 HEIGHT=16 SRC="previous.xbm"></A><A HREF="node13.htm#Node13"><IMG WIDTH=16 HEIGHT=16 SRC="up.xbm"></A><A HREF="node13.htm#Node15"><IMG WIDTH=16 HEIGHT=16 SRC="next.xbm"></A><BR>
<b>Up: </b><A HREF="node13.htm#Node13"> Debugging</a>
<b>Next: </b><A HREF="node13.htm#Node15"> Error handlers</a>
<b>Previous: </b><A HREF="node13.htm#Node13"> Debugging</a>
<P>
Just as in sequential debugging, you often wish to trace interesting events
in the program by printing trace messages. Usually you wish to identify a
message by the rank of the process emitting it. This can be done explicitly
by putting the rank in the trace message.
<P>
It is recommended that you call fflush(stdout) after your printf statements to ensure
the output gets forwarded to the root without delay.
<P>
<P>
<HR>
<A HREF="node13.htm#Node13"><IMG WIDTH=16 HEIGHT=16 SRC="previous.xbm"></A><A HREF="node13.htm#Node13"><IMG WIDTH=16 HEIGHT=16 SRC="up.xbm"></A><A HREF="node13.htm#Node15"><IMG WIDTH=16 HEIGHT=16 SRC="next.xbm"></A><BR>
<b>Up: </b><A HREF="node13.htm#Node13"> Debugging</a>
<b>Next: </b><A HREF="node13.htm#Node15"> Error handlers</a>
<b>Previous: </b><A HREF="node13.htm#Node13"> Debugging</a>
<P>
<HR><H3><A NAME="Node15">Error handlers</a></H3>
<A HREF="node13.htm#Node14"><IMG WIDTH=16 HEIGHT=16 SRC="previous.xbm"></A><A HREF="node13.htm#Node13"><IMG WIDTH=16 HEIGHT=16 SRC="up.xbm"></A><A HREF="node13.htm#Node16"><IMG WIDTH=16 HEIGHT=16 SRC="next.xbm"></A><BR>
<b>Up: </b><A HREF="node13.htm#Node13"> Debugging</a>
<b>Next: </b><A HREF="node13.htm#Node16"> Starting processes manually</a>
<b>Previous: </b><A HREF="node13.htm#Node14"> The printf Approach</a>
<P>
<P>
The MPI Standard specifies a mechanism for installing one's own error handler, and
specifies the behavior of two predefined ones,
MPI_ERRORS_RETURN and MPI_ERRORS_ARE_FATAL.
<P>
<P>
<HR>
<A HREF="node13.htm#Node14"><IMG WIDTH=16 HEIGHT=16 SRC="previous.xbm"></A><A HREF="node13.htm#Node13"><IMG WIDTH=16 HEIGHT=16 SRC="up.xbm"></A><A HREF="node13.htm#Node16"><IMG WIDTH=16 HEIGHT=16 SRC="next.xbm"></A><BR>
<b>Up: </b><A HREF="node13.htm#Node13"> Debugging</a>
<b>Next: </b><A HREF="node13.htm#Node16"> Starting processes manually</a>
<b>Previous: </b><A HREF="node13.htm#Node14"> The printf Approach</a>
<P>
<HR><H3><A NAME="Node16">Starting processes manually</a></H3>
<A HREF="node13.htm#Node15"><IMG WIDTH=16 HEIGHT=16 SRC="previous.xbm"></A><A HREF="node13.htm#Node13"><IMG WIDTH=16 HEIGHT=16 SRC="up.xbm"></A><A HREF="node13.htm#Node17"><IMG WIDTH=16 HEIGHT=16 SRC="next.xbm"></A><BR>
<b>Up: </b><A HREF="node13.htm#Node13"> Debugging</a>
<b>Next: </b><A HREF="node13.htm#Node17"> Attaching a debugger to a running program</a>
<b>Previous: </b><A HREF="node13.htm#Node15"> Error handlers</a>
<P>
You can start each process in a parallel job by hand by setting the appropriate environment
variables. Each process needs the following variables:
<ol>
1. MPICH_JOBID=some short unique string to identify the job
<BR>
2. MPICH_NPROC=total number of processes in the job
<BR>
3. MPICH_IPROC=rank of the current process
<BR>
4. MPICH_ROOT=host:port where the root process will live and listen
</ol>
If you set these by hand then you can run each process in a debugger.
<P>
<P><IMG WIDTH=5 HEIGHT=11 SRC="img34.xbm"><P>
<P>
<HR>
<A HREF="node13.htm#Node15"><IMG WIDTH=16 HEIGHT=16 SRC="previous.xbm"></A><A HREF="node13.htm#Node13"><IMG WIDTH=16 HEIGHT=16 SRC="up.xbm"></A><A HREF="node13.htm#Node17"><IMG WIDTH=16 HEIGHT=16 SRC="next.xbm"></A><BR>
<b>Up: </b><A HREF="node13.htm#Node13"> Debugging</a>
<b>Next: </b><A HREF="node13.htm#Node17"> Attaching a debugger to a running program</a>
<b>Previous: </b><A HREF="node13.htm#Node15"> Error handlers</a>
<P>
<HR><H3><A NAME="Node17">Attaching a debugger to a running program</a></H3>
<A HREF="node13.htm#Node16"><IMG WIDTH=16 HEIGHT=16 SRC="previous.xbm"></A><A HREF="node13.htm#Node13"><IMG WIDTH=16 HEIGHT=16 SRC="up.xbm"></A><A HREF="node18.htm#Node18"><IMG WIDTH=16 HEIGHT=16 SRC="next.xbm"></A><BR>
<b>Up: </b><A HREF="node13.htm#Node13"> Debugging</a>
<b>Next: </b><A HREF="node18.htm#Node18"> Log and tracefile tools</a>
<b>Previous: </b><A HREF="node13.htm#Node16"> Starting processes manually</a>
<P>
You can often attach the MSDEV debugger to a running process locally. Visual C++.NET
has the ability to debug processes remotely. See the MSDEV help utility for details.
<P>
<P>
<HR>
<A HREF="node13.htm#Node16"><IMG WIDTH=16 HEIGHT=16 SRC="previous.xbm"></A><A HREF="node13.htm#Node13"><IMG WIDTH=16 HEIGHT=16 SRC="up.xbm"></A><A HREF="node18.htm#Node18"><IMG WIDTH=16 HEIGHT=16 SRC="next.xbm"></A><BR>
<b>Up: </b><A HREF="node13.htm#Node13"> Debugging</a>
<b>Next: </b><A HREF="node18.htm#Node18"> Log and tracefile tools</a>
<b>Previous: </b><A HREF="node13.htm#Node16"> Starting processes manually</a>
<P>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -