File: dev_add_lb.html

package info (click to toggle)
trilinos 12.10.1-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 471,528 kB
  • ctags: 314,491
  • sloc: cpp: 2,747,334; ansic: 420,675; fortran: 158,691; xml: 30,440; python: 25,109; f90: 24,661; sh: 14,133; makefile: 5,739; perl: 4,248; csh: 3,791; lex: 1,060; lisp: 810; yacc: 456; awk: 364; sed: 3
file content (259 lines) | stat: -rw-r--r-- 10,316 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
<!-------- @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
-------> 

<HTML>
<HEAD>
   <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
   <META NAME="GENERATOR" CONTENT="Mozilla/4.04 [en] (X11; U; SunOS 5.6 sun4m) [Netscape]">
   <META NAME="sandia.approved" CONTENT="SAND99-1376">
   <META NAME="author" CONTENT="karen devine, kddevin@sandia.gov">

   <TITLE> Zoltan Developer's Guide:  Adding Load-Balancing Functions</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">

<div ALIGN=right><b><i><a href="dev.html">Zoltan Developer's Guide</a>&nbsp; |&nbsp; <a href="dev_add_struct.html">Next</a>&nbsp; |&nbsp; <a href="dev_add_interface.html">Previous</a></i></b></div>


<H2>
<A NAME="new_implementation"></A>Load-Balancing Function Implementation</H2>
The new load-balancing algorithm should be implemented as an <B>ZOLTAN_LB_FN</B>.
The type definition for an <B>ZOLTAN_LB_FN</B> is in <I>lb/lb_const.h</I> and
is described below. When the new algorithm is selected,
the <I>LB_Fn</I> field of the <B>Zoltan_Struct</B> is set to point to the <B>ZOLTAN_LB_FN</B>
function for the new algorithm. This pointer is then used in invoking load
balancing in <B><A HREF="../ug_html/ug_interface_lb.html#Zoltan_LB_Partition">Zoltan_LB_Partition</A></B>.
<BR>&nbsp;

<P>
<hr>
<HR>typedef int <B>ZOLTAN_LB_FN</B>
(struct&nbsp;<B><A HREF="dev_lb_structs.html#Zoltan_Struct">Zoltan_Struct</A></B>&nbsp;*<I>zz</I>,
float&nbsp;*<I>part_sizes</I>,
int&nbsp;*<I>num_import</I>,
<B><A HREF="dev_lb_types.html">ZOLTAN_ID_PTR</A></B>&nbsp;*<I>import_global_ids</I>,
<B><A HREF="dev_lb_types.html">ZOLTAN_ID_PTR</A></B>&nbsp;*<I>import_local_ids</I>,
int&nbsp;**<I>import_procs</I>,
int&nbsp;**<I>import_to_parts</I>,
int&nbsp;*<I>num_export</I>,
<B><A HREF="dev_lb_types.html">ZOLTAN_ID_PTR</A></B>&nbsp;*<I>export_global_ids</I>,
<B><A HREF="dev_lb_types.html">ZOLTAN_ID_PTR</A></B>&nbsp;*<I>export_local_ids</I>,
int&nbsp;**<I>export_procs</I>,&nbsp;
int&nbsp;**<I>export_to_parts</I>);&nbsp;
<HR>
<BR>The <B>ZOLTAN_LB_FN</B> function type describes the arguments passed to a
load-balancing function. The input to the function is a <B><A HREF="dev_lb_structs.html#Zoltan_Struct">Zoltan_Struct</A></B>
containing pointers to application-registered functions to be used in the
load-balancing algorithm. The remaining arguments are output parameters
listing the objects to be imported or exported to the processor in the
new decomposition. The arrays for global and local IDs and source processors
must be allocated by the load-balancing function. The load-balancing function
may return either the import arrays, the export arrays, or both. If no
import data is returned, *<I>num_import </I>must be set to a negative number,
and similarly with *<I>num_export.</I>
Full support of the <a href="../ug_html/ug_alg.html#RETURN_LISTS">RETURN_LISTS</a>
parameter is not required. 
If <a href="../ug_html/ug_alg.html#RETURN_LISTS">RETURN_LISTS</a>
is not set to NONE,
the new algorithm may return either import or export lists; the Zoltan
interface will then build the lists requested by
<a href="../ug_html/ug_alg.html#RETURN_LISTS">RETURN_LISTS</a>.

<BR>&nbsp;
<TABLE WIDTH="100%" >
<TR VALIGN=TOP>
<TD VALIGN=TOP WIDTH="20%"><B>Arguments:</B></TD>

<TD WIDTH="80%"></TD>
</TR>

<TR VALIGN=TOP>
<TD VALIGN=TOP><I>&nbsp;&nbsp;&nbsp; zz</I></TD>

<TD>A pointer to the <B><A HREF="dev_lb_structs.html#Zoltan_Struct">Zoltan_Struct</A></B>
to be used in the load-balancing algorithm.</TD>
</TR>

<TR VALIGN=TOP>
<TD VALIGN=TOP><I>&nbsp;&nbsp;&nbsp; part_sizes</I></TD>

<TD>Input:  an array of part sizes for each weight component.
Entry 
<i>part_sizes[i*obj_weight_dim+j]</i>
contains the user-requested 
part size for part <i>i</i> with respect to object weight <i>j</i> for
<i>i</i>=0,1,...,number of parts-1, and 
<i>j</i>=0,1,...,<i>obj_weight_dim</i>-1.
If the application sets parameter 
<i><a href="../ug_html/ug_param.html#OBJ_WEIGHT_DIM">OBJ_WEIGHT_DIM</a></i>,
<i>obj_weight_dim</i> is the set value of 
<i><a href="../ug_html/ug_param.html#OBJ_WEIGHT_DIM">OBJ_WEIGHT_DIM</a></i>;
otherwise, <i>obj_weight_dim</i> is one.
</TD>
</TR>

<TR VALIGN=TOP>
<TD VALIGN=TOP><I>&nbsp;&nbsp;&nbsp; num_import</I></TD>

<TD>Upon return, the number of objects to be imported to the processor
for the new decomposition. A negative number indicates that no import data
has been computed and the import arrays should be ignored.</TD>
</TR>

<TR VALIGN=TOP>
<TD VALIGN=TOP><I>&nbsp;&nbsp;&nbsp; import_global_ids</I></TD>

<TD>Upon return, an array of <I>num_import</I> global IDs
of objects to be imported to the processor for the new decomposition.
If this array is non-null, it must be allocated by 
<b><a href="dev_add_memory.html#Zoltan_Special_Malloc">Zoltan_Special_Malloc</a></b>.
</td>
</TR>

<TR VALIGN=TOP>
<TD VALIGN=TOP>&nbsp;&nbsp;&nbsp; <I>import_local_ids</I></TD>

<TD>Upon return, an array of <I>num_import</I> local IDs
of objects to be imported to the processor for the new decomposition.
If this array is non-null, it must be allocated by 
<b><a href="dev_add_memory.html#Zoltan_Special_Malloc">Zoltan_Special_Malloc</a></b>.
</td>
</TR>

<TR VALIGN=TOP>
<TD VALIGN=TOP>&nbsp;&nbsp;&nbsp; <I>import_procs</I></TD>

<TD>Upon return, an array of size <I>num_import</I> containing the processor
IDs of processors owning (in the old decomposition) the objects to be imported
for the new decomposition.
If this array is non-null, it must be allocated by 
<b><a href="dev_add_memory.html#Zoltan_Special_Malloc">Zoltan_Special_Malloc</a></b>.
</td>
</TR>

<TR VALIGN=TOP>
<TD VALIGN=TOP>&nbsp;&nbsp;&nbsp; <I>import_to_parts</I></TD>

<TD>Upon return, an array of size <I>num_import</I> containing the part
IDs of parts to which objects will be imported
 <i>in the NEW decomposition</i>.
If this array is non-null, it must be allocated by 
<b><a href="dev_add_memory.html#Zoltan_Special_Malloc">Zoltan_Special_Malloc</a></b>.
</td>
</TR>
<TR VALIGN=TOP>
<TD>&nbsp;&nbsp;&nbsp; <I>num_export</I></TD>

<TD>Upon return, the number of objects to be exported from the processor
for the new decomposition. A negative number indicates that no export data
has been computed and the export arrays should be ignored.</TD>
</TR>

<TR VALIGN=TOP>
<TD>&nbsp;&nbsp;&nbsp; <I>export_global_ids</I></TD>

<TD>Upon return, an array of <I>num_export</I> global IDs
of objects to be exported from the processor for the new decomposition.
If this array is non-null, it must be allocated by 
<b><a href="dev_add_memory.html#Zoltan_Special_Malloc">Zoltan_Special_Malloc</a></b>.
</td>
</TR>

<TR VALIGN=TOP>
<TD>&nbsp;&nbsp;&nbsp; <I>export_local_ids</I></TD>

<TD>Upon return, an array of <I>num_export</I> local IDs
of objects to be exported from the processor for the new decomposition.
If this array is non-null, it must be allocated by 
<b><a href="dev_add_memory.html#Zoltan_Special_Malloc">Zoltan_Special_Malloc</a></b>.
</TD>
</TR>

<TR VALIGN=TOP>
<TD>&nbsp;&nbsp;&nbsp; <I>export_procs</I></TD>

<TD>Upon return, an array of size <I>num_export</I> containing the
processor IDs of processors owning (in the old decomposition) the objects
to be exported for the new decomposition.&nbsp;
If this array is non-null, it must be allocated by 
<b><a href="dev_add_memory.html#Zoltan_Special_Malloc">Zoltan_Special_Malloc</a></b>.
</td>
</TR>
<TR VALIGN=TOP>
<TD>&nbsp;&nbsp;&nbsp; <I>export_to_parts</I></TD>

<TD>Upon return, an array of size <I>num_export</I> containing the
part IDs of parts to which the objects will be 
exported for the new decomposition.&nbsp;
If this array is non-null, it must be allocated by 
<b><a href="dev_add_memory.html#Zoltan_Special_Malloc">Zoltan_Special_Malloc</a></b>.
</td>
</TR>

<TR VALIGN=TOP>
<TD></TD>

<TD></TD>
</TR>

<TR VALIGN=TOP>
<TD><B>Returned Value:</B></TD>

<TD></TD>
</TR>

<TR VALIGN=TOP>
<TD VALIGN=TOP>&nbsp;&nbsp;&nbsp; int</TD>

<TD><A HREF="../ug_html/ug_interface.html#Error Codes">Error code</A>.</TD>
</TR>
</TABLE>

<HR WIDTH="100%">
<BR>[<A HREF="dev.html">Table of Contents</A>&nbsp; |&nbsp; <A HREF="dev_add_struct.html">Next:&nbsp;
Data Structures</A>&nbsp; |&nbsp; <A HREF="dev_add_interface.html">Previous:&nbsp;
Load-Balancing Interface Routines</A>&nbsp; |&nbsp; <a href="http://www.sandia.gov/general/privacy-security/index.html">Privacy and Security</a>]
</BODY>
</HTML>