You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							278 lines
						
					
					
						
							10 KiB
						
					
					
				
			
		
		
	
	
							278 lines
						
					
					
						
							10 KiB
						
					
					
				| <!-------- @HEADER
 | |
|  !
 | |
|  ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 | |
|  !
 | |
|  !  Zoltan Toolkit for Load-balancing, Partitioning, Ordering and Coloring
 | |
|  !                  Copyright 2012 Sandia Corporation
 | |
|  !
 | |
|  ! Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
 | |
|  ! the U.S. Government retains certain rights in this software.
 | |
|  !
 | |
|  ! Redistribution and use in source and binary forms, with or without
 | |
|  ! modification, are permitted provided that the following conditions are
 | |
|  ! met:
 | |
|  !
 | |
|  ! 1. Redistributions of source code must retain the above copyright
 | |
|  ! notice, this list of conditions and the following disclaimer.
 | |
|  !
 | |
|  ! 2. Redistributions in binary form must reproduce the above copyright
 | |
|  ! notice, this list of conditions and the following disclaimer in the
 | |
|  ! documentation and/or other materials provided with the distribution.
 | |
|  !
 | |
|  ! 3. Neither the name of the Corporation nor the names of the
 | |
|  ! contributors may be used to endorse or promote products derived from
 | |
|  ! this software without specific prior written permission.
 | |
|  !
 | |
|  ! THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
 | |
|  ! EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 | |
|  ! IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 | |
|  ! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
 | |
|  ! CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 | |
|  ! EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 | |
|  ! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 | |
|  ! PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
 | |
|  ! LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 | |
|  ! NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 | |
|  ! SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | |
|  !
 | |
|  ! Questions? Contact Karen Devine	kddevin@sandia.gov
 | |
|  !                    Erik Boman	egboman@sandia.gov
 | |
|  !
 | |
|  ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 | |
|  !
 | |
|  ! @HEADER
 | |
| -------> 
 | |
| 
 | |
| <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
 | |
| <html>
 | |
| <head>
 | |
|    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
 | |
|    <meta name="GENERATOR" content="Mozilla/4.7 [en] (X11; U; SunOS 5.7 sun4u) [Netscape]">
 | |
|    <meta name="sandia.approved" content="SAND99-1376">
 | |
|    <meta name="author" content="karen devine, kddevin@sandia.gov">
 | |
|    <title> Zoltan Developer's Guide:  Debugging Services</title>
 | |
| </head>
 | |
| <body bgcolor="#FFFFFF">
 | |
| 
 | |
| <div ALIGN=right><b><i><a href="dev.html">Zoltan Developer's Guide</a>  |  <a href="dev_add.html">Next</a>  |  <a href="dev_services_zoltantimer.html">Previous</a></i></b></div>
 | |
| 
 | |
| <!------------------------------------------------------------------------->
 | |
| <h2>
 | |
| <a NAME="Debugging"></a>Debugging Services</h2>
 | |
| Execution of code for debugging can be controlled by algorithm specific
 | |
| parameters or by the Zoltan key parameter <a href="../ug_html/ug_param.html#Debug Levels in Zoltan">DEBUG_LEVEL</a>.
 | |
| The value of the <i>Debug_Level</i> field of the <b><a href="dev_lb_structs.html#Zoltan_Struct">Zoltan_Struct</a></b>
 | |
| structure can be tested to determine whether the user desires debugging
 | |
| information.  Several constants (<b>ZOLTAN_DEBUG_*</b>) are defined in
 | |
| <i>zz/zz_const.h</i>; the <i>Debug_Level</i> field should be compared to
 | |
| these values so that future changes to the debugging levels can be made
 | |
| easily.  An <a href="#Debug Example">example</a> is included below.
 | |
| <p>Several macros for common debugging operations are provided.  The
 | |
| macros can be used to generate function trace information, such as when
 | |
| control enters or exits a function or reaches a certain point in the execution
 | |
| of a function.
 | |
| <blockquote><a href="#ZOLTAN_TRACE_ENTER">ZOLTAN_TRACE_ENTER</a>
 | |
| <br><a href="#ZOLTAN_TRACE_EXIT">ZOLTAN_TRACE_EXIT</a>
 | |
| <br><a href="#ZOLTAN_TRACE_DETAIL">ZOLTAN_TRACE_DETAIL</a></blockquote>
 | |
| These macros produce output depending upon the value of the <a href="../ug_html/ug_param.html#Debug Levels in Zoltan">DEBUG_LEVEL</a>
 | |
| parameter set in Zoltan by a call to <b><a href="../ug_html/ug_interface_init.html#Zoltan_Set_Param">Zoltan_Set_Param</a></b>.  
 | |
| The macros are defined in <i>zz/zz_const.h.</i>
 | |
| <p><a href="#Debug Example">Examples</a> of the use of these macros can
 | |
| be found <a href="#Debug Example">below</a> and in <i>lb/lb_balance.c</i> 
 | |
| and <i>rcb/rcb.c.</i>
 | |
| <p>
 | |
| 
 | |
| <!------------------------------------------------------------------------->
 | |
| <hr>
 | |
| <a NAME="ZOLTAN_TRACE_ENTER"></a>
 | |
| <hr>
 | |
| <b>ZOLTAN_TRACE_ENTER</b>(struct <b><a href="dev_lb_structs.html#Zoltan_Struct">Zoltan_Struct</a></b>
 | |
| *<i>zz</i>, char *<i>function_name</i>);
 | |
| <br>
 | |
| <hr>
 | |
| <b>ZOLTAN_TRACE_ENTER</b> prints to <i>stdout</i> a message stating that
 | |
| a given processor is entering a function.  The call to the macro should
 | |
| be included at the beginning of major functions for which debugging information
 | |
| is desired.  Output includes the processor number and the function
 | |
| name passed as an argument to the macro.  The amount of output produced
 | |
| is controlled by the value of the <a href="../ug_html/ug_param.html#Debug Levels in Zoltan">DEBUG_LEVEL</a>
 | |
| parameter set in Zoltan by a call to <b><a href="../ug_html/ug_interface_init.html#Zoltan_Set_Param">Zoltan_Set_Param</a></b>.
 | |
| <br> 
 | |
| <table WIDTH="100%" NOSAVE >
 | |
| <tr VALIGN=TOP>
 | |
| <td VALIGN=TOP WIDTH="20%"><b>Arguments:</b></td>
 | |
| 
 | |
| <td WIDTH="80%"></td>
 | |
| </tr>
 | |
| 
 | |
| <tr>
 | |
| <td VALIGN=TOP>    <i>zz</i></td>
 | |
| 
 | |
| <td>Pointer to a Zoltan structure.
 | |
| </td>
 | |
| </tr>
 | |
| 
 | |
| <tr VALIGN=TOP NOSAVE>
 | |
| <td NOSAVE>    <i>function_name</i></td>
 | |
| 
 | |
| <td>Character string containing the function's name.</td>
 | |
| </tr>
 | |
| 
 | |
| <tr>
 | |
| <td><b>Output:</b></td>
 | |
| 
 | |
| <td></td>
 | |
| </tr>
 | |
| 
 | |
| <tr>
 | |
| <td VALIGN=TOP> </td>
 | |
| 
 | |
| <td>ZOLTAN (Processor #) Entering <i>function_name</i></td>
 | |
| </tr>
 | |
| </table>
 | |
| 
 | |
| <p>
 | |
| 
 | |
| <!------------------------------------------------------------------------->
 | |
| <hr>
 | |
| <a NAME="ZOLTAN_TRACE_EXIT"></a>
 | |
| <hr>
 | |
| <b>ZOLTAN_TRACE_EXIT</b>(struct <b><a href="dev_lb_structs.html#Zoltan_Struct">Zoltan_Struct</a></b>
 | |
| *<i>zz</i>, char *<i>function_name</i>);
 | |
| <br>
 | |
| <hr>
 | |
| <b>ZOLTAN_TRACE_EXIT</b> prints to <i>stdout</i> a message stating that
 | |
| a given processor is exiting a function.  The call to the macro should
 | |
| be included at the end of major functions (and before return statements)
 | |
| for which debugging information is desired.  Output includes the processor
 | |
| number and the function name passed as an argument to the macro. 
 | |
| The amount of output produced is controlled by the value of the <a href="../ug_html/ug_param.html#Debug Levels in Zoltan">DEBUG_LEVEL</a>
 | |
| parameter set in Zoltan by a call to <b><a href="../ug_html/ug_interface_init.html#Zoltan_Set_Param">Zoltan_Set_Param</a></b>.
 | |
| <br> 
 | |
| <table WIDTH="100%" NOSAVE >
 | |
| <tr VALIGN=TOP>
 | |
| <td VALIGN=TOP WIDTH="20%"><b>Arguments:</b></td>
 | |
| 
 | |
| <td WIDTH="80%"></td>
 | |
| </tr>
 | |
| 
 | |
| <tr>
 | |
| <td VALIGN=TOP><i>    zz</i></td>
 | |
| 
 | |
| <td>Pointer to a Zoltan structure.
 | |
| </td>
 | |
| </tr>
 | |
| 
 | |
| <tr VALIGN=TOP NOSAVE>
 | |
| <td NOSAVE><i>    function_name</i></td>
 | |
| 
 | |
| <td>Character string containing the function's name.</td>
 | |
| </tr>
 | |
| 
 | |
| <tr>
 | |
| <td><b>Output:</b></td>
 | |
| 
 | |
| <td></td>
 | |
| </tr>
 | |
| 
 | |
| <tr>
 | |
| <td VALIGN=TOP> </td>
 | |
| 
 | |
| <td>ZOLTAN (Processor #) Leaving <i>function_name</i></td>
 | |
| </tr>
 | |
| </table>
 | |
| 
 | |
| <p>
 | |
| 
 | |
| <!------------------------------------------------------------------------->
 | |
| <hr>
 | |
| <a NAME="ZOLTAN_TRACE_DETAIL"></a>
 | |
| <hr WIDTH="100%">
 | |
| <b>ZOLTAN_TRACE_DETAIL</b>(struct
 | |
| <b><a href="dev_lb_structs.html#Zoltan_Struct">Zoltan_Struct</a></b>
 | |
| *<i>zz</i>, char *<i>function_name</i>, char *<i>message</i>);
 | |
| <br>
 | |
| <hr>
 | |
| <b>ZOLTAN_TRACE_DETAIL</b> prints to <i>stdout</i> a message specified
 | |
| by the developer.   It can be used to indicate how far execution
 | |
| has progressed through a routine.  It can also be used to print values
 | |
| of variables.  See the example below.  Output includes the processor
 | |
| number, the function name passed as an argument to the macro, and a user-defined
 | |
| message passed to the macro.  The amount of output produced is controlled
 | |
| by the value of the <a href="../ug_html/ug_param.html#Debug Levels in Zoltan">DEBUG_LEVEL</a>
 | |
| parameter set in Zoltan by a call to <b><a href="../ug_html/ug_interface_init.html#Zoltan_Set_Param">Zoltan_Set_Param</a></b>.
 | |
| <br> 
 | |
| <table WIDTH="100%" NOSAVE >
 | |
| <tr VALIGN=TOP>
 | |
| <td VALIGN=TOP WIDTH="20%"><b>Arguments:</b></td>
 | |
| 
 | |
| <td WIDTH="80%"></td>
 | |
| </tr>
 | |
| 
 | |
| <tr>
 | |
| <td VALIGN=TOP>    <i>zz</i></td>
 | |
| 
 | |
| <td>Pointer to a Zoltan structure.
 | |
| </td>
 | |
| </tr>
 | |
| 
 | |
| <tr VALIGN=TOP NOSAVE>
 | |
| <td NOSAVE>    <i>function_name</i></td>
 | |
| 
 | |
| <td>Character string containing the function's name.</td>
 | |
| </tr>
 | |
| 
 | |
| <tr VALIGN=TOP NOSAVE>
 | |
| <td NOSAVE>    <i>message</i></td>
 | |
| 
 | |
| <td>Character string containing a message defined by the developer.</td>
 | |
| </tr>
 | |
| 
 | |
| <tr>
 | |
| <td><b>Output:</b></td>
 | |
| 
 | |
| <td></td>
 | |
| </tr>
 | |
| 
 | |
| <tr>
 | |
| <td VALIGN=TOP> </td>
 | |
| 
 | |
| <td>ZOLTAN (Processor #)  <i>function_name: message</i></td>
 | |
| </tr>
 | |
| </table>
 | |
| 
 | |
| <br> 
 | |
| <br> 
 | |
| 
 | |
| <!------------------------------------------------------------------------->
 | |
| <p>
 | |
| <hr><a NAME="Debug Example"></a>
 | |
| <br><b>Example:</b>
 | |
| <br>An example using the debugging macros in shown below.
 | |
| <tt>
 | |
| <ul>#include "zoltan.h"
 | |
| <br>void example(struct <b><a href="dev_lb_structs.html#Zoltan_Struct">Zoltan_Struct</a></b>
 | |
| *zz)
 | |
| <br>{
 | |
| <br>char *yo = "example";
 | |
| <br>char tmp[80];
 | |
| <br>int a, b;
 | |
| <br> 
 | |
| <ul><a href="#ZOLTAN_TRACE_ENTER">ZOLTAN_TRACE_ENTER</a>(zz, yo);
 | |
| <br>a = function_one(zz);
 | |
| <br><a href="#ZOLTAN_TRACE_DETAIL">ZOLTAN_TRACE_DETAIL</a>(zz, yo, "After function_one");
 | |
| <br>b = function_two(zz);
 | |
| <br>sprintf(tmp, "b = %d a = %d", b, a);
 | |
| <br><a href="#ZOLTAN_TRACE_DETAIL">ZOLTAN_TRACE_DETAIL</a>(zz, yo, tmp);
 | |
| <br>if (zz->Debug_Level >= ZOLTAN_DEBUG_ALL)
 | |
| <br>  printf("Total = %d\n", a+b);
 | |
| <br><a href="#ZOLTAN_TRACE_EXIT">ZOLTAN_TRACE_EXIT</a>(zz, yo);</ul>
 | |
| }</ul>
 | |
| </tt>
 | |
| 
 | |
| <hr WIDTH="100%">
 | |
| <br>[<a href="dev.html">Table of Contents</a>  |  <a href="dev_add.html">Next: 
 | |
| Adding New Load-Balancing Algorithms</a> |  <a href="dev_services_zoltantimer.html">Previous: 
 | |
| ZOLTAN_TIMER</a>  |  <a href="https://www.sandia.gov/general/privacy-security/index.html">Privacy and Security</a>]
 | |
| </body>
 | |
| </html>
 | |
| 
 |