| 1 |
//@HEADER |
| 2 |
//************************************************************************ |
| 3 |
// |
| 4 |
// Isorropia: Partitioning and Load Balancing Package |
| 5 |
// Copyright (2006) Sandia Corporation |
| 6 |
// |
| 7 |
//Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive |
| 8 |
//license for use of this work by or on behalf of the U.S. Government. |
| 9 |
// |
| 10 |
// Redistribution and use in source and binary forms, with or without |
| 11 |
// modification, are permitted provided that the following conditions are |
| 12 |
// met: |
| 13 |
// |
| 14 |
// 1. Redistributions of source code must retain the above copyright |
| 15 |
// notice, this list of conditions and the following disclaimer. |
| 16 |
// |
| 17 |
// 2. Redistributions in binary form must reproduce the above copyright |
| 18 |
// notice, this list of conditions and the following disclaimer in the |
| 19 |
// documentation and/or other materials provided with the distribution. |
| 20 |
// |
| 21 |
// 3. Neither the name of the Corporation nor the names of the |
| 22 |
// contributors may be used to endorse or promote products derived from |
| 23 |
// this software without specific prior written permission. |
| 24 |
// |
| 25 |
// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY |
| 26 |
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 27 |
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 28 |
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE |
| 29 |
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 30 |
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 31 |
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 32 |
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
| 33 |
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
| 34 |
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 35 |
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 36 |
// |
| 37 |
//************************************************************************ |
| 38 |
//@HEADER |
| 39 |
|
| 40 |
#ifndef _Isorropia_Epetra_hpp_ |
| 41 |
#define _Isorropia_Epetra_hpp_ |
| 42 |
|
| 43 |
#include <Isorropia_ConfigDefs.hpp> |
| 44 |
#include <Teuchos_RCP.hpp> |
| 45 |
#include <Teuchos_ParameterList.hpp> |
| 46 |
|
| 47 |
#ifdef HAVE_EPETRA |
| 48 |
class Epetra_Comm; |
| 49 |
class Epetra_Map; |
| 50 |
class Epetra_BlockMap; |
| 51 |
class Epetra_Import; |
| 52 |
class Epetra_Vector; |
| 53 |
class Epetra_MultiVector; |
| 54 |
class Epetra_RowMatrix; |
| 55 |
class Epetra_CrsGraph; |
| 56 |
class Epetra_CrsMatrix; |
| 57 |
class Epetra_LinearProblem; |
| 58 |
#endif |
| 59 |
|
| 60 |
namespace Isorropia { |
| 61 |
|
| 62 |
namespace Epetra { |
| 63 |
|
| 64 |
class Partitioner; |
| 65 |
class CostDescriber; |
| 66 |
|
| 67 |
#ifdef HAVE_EPETRA |
| 68 |
|
| 69 |
/** createBalancedCopy() creates a copy with a more balanced map. |
| 70 |
The caller should free the copy after use. |
| 71 |
*/ |
| 72 |
Epetra_MultiVector * |
| 73 |
createBalancedCopy(const Epetra_MultiVector& input_vector); |
| 74 |
|
| 75 |
/** createBalancedCopy() creates a copy with a more balanced map. |
| 76 |
The caller should free the copy after use. |
| 77 |
*/ |
| 78 |
Epetra_MultiVector * |
| 79 |
createBalancedCopy(const Epetra_MultiVector& input_vector, |
| 80 |
const Teuchos::ParameterList& paramlist); |
| 81 |
|
| 82 |
/** createBalancedCopy() creates a copy with a more balanced map. |
| 83 |
The caller should free the copy after use. |
| 84 |
*/ |
| 85 |
Epetra_CrsGraph * |
| 86 |
createBalancedCopy(const Epetra_CrsGraph& input_graph); |
| 87 |
|
| 88 |
/** createBalancedCopy() creates a copy with a more balanced map. |
| 89 |
The caller should free the copy after use. |
| 90 |
*/ |
| 91 |
Epetra_CrsGraph * |
| 92 |
createBalancedCopy(const Epetra_CrsGraph& input_graph, |
| 93 |
const Teuchos::ParameterList& paramlist); |
| 94 |
|
| 95 |
/** createBalancedCopy() creates a copy with a more balanced map. |
| 96 |
The caller should free the copy after use. |
| 97 |
*/ |
| 98 |
Epetra_CrsMatrix * |
| 99 |
createBalancedCopy(const Epetra_CrsMatrix& input_matrix); |
| 100 |
|
| 101 |
/** createBalancedCopy() creates a copy with a more balanced map. |
| 102 |
The caller should free the copy after use. |
| 103 |
*/ |
| 104 |
Epetra_CrsMatrix * |
| 105 |
createBalancedCopy(const Epetra_CrsMatrix& input_matrix, |
| 106 |
const Teuchos::ParameterList& paramlist); |
| 107 |
|
| 108 |
/** createBalancedCopy() creates a copy with a more balanced map. |
| 109 |
The caller should free the copy after use. |
| 110 |
*/ |
| 111 |
|
| 112 |
Epetra_LinearProblem * |
| 113 |
createBalancedCopy(const Epetra_LinearProblem & input_problem); |
| 114 |
|
| 115 |
/** createBalancedCopy() creates a copy with a more balanced map. |
| 116 |
The caller should free the copy after use. |
| 117 |
*/ |
| 118 |
|
| 119 |
Epetra_LinearProblem * |
| 120 |
createBalancedCopy(const Epetra_LinearProblem & input_problem, |
| 121 |
const Teuchos::ParameterList& paramlist); |
| 122 |
|
| 123 |
/** create_target_map() is an internal function used by Isorropia. |
| 124 |
|
| 125 |
Given a Partitioner object, create a target map representing the |
| 126 |
new partitioning. |
| 127 |
This function calls partitioner.compute_partitioning() if it has not |
| 128 |
already been called. |
| 129 |
*/ |
| 130 |
// Teuchos::RCP<Epetra_Map> |
| 131 |
// create_target_map(const Epetra_Comm& comm, Partitioner& partitioner); |
| 132 |
|
| 133 |
/** create_balanced_copy(), which is part of the Isorropia API, is used to |
| 134 |
create and return a balanced copy of an input Epetra_CrsMatrix. |
| 135 |
|
| 136 |
Isorropia will use Zoltan to perform partitioning if it has been |
| 137 |
configured with Zoltan support. If Zoltan is not available, it will |
| 138 |
perform its own simple row partitioning. |
| 139 |
|
| 140 |
Zoltan will perform hypergraph partitioning using its own PHG method. |
| 141 |
It will assign unit weight to each row (vertex), and unit weight to each |
| 142 |
column (hyperedge). It will attempt to balance row weights while |
| 143 |
minimizing cuts in the hyperedges. |
| 144 |
|
| 145 |
The non-Zoltan rebalancing is 1-D, row-wise, and attempts to make the number |
| 146 |
of nonzeros equal in each partition. I.e., it is equivalent to specifying |
| 147 |
a weighted rebalance where the weights are the number of nonzeros in |
| 148 |
each row. |
| 149 |
|
| 150 |
*/ |
| 151 |
__deprecated Teuchos::RCP<Epetra_CrsMatrix> |
| 152 |
create_balanced_copy(const Epetra_CrsMatrix& input_matrix); |
| 153 |
|
| 154 |
/** create_balanced_copy(), which is part of the Isorropia API, is used to |
| 155 |
create and return a balanced copy of an input Epetra_CrsMatrix. |
| 156 |
|
| 157 |
Isorropia will use Zoltan to perform partitioning if it has been |
| 158 |
configured with Zoltan support. If Zoltan is not available, it will |
| 159 |
perform its own simple row partitioning. |
| 160 |
|
| 161 |
The balancing algorithm (Zoltan or non-Zoltan) will use the row |
| 162 |
weights provided for the matrix rows. |
| 163 |
|
| 164 |
Zoltan will perform hypergraph partitioning using its own PHG method. |
| 165 |
It will assign a unit weight to each column (hyperedge). It will attempt |
| 166 |
to balance row weights while minimizing cuts in the hyperedges. |
| 167 |
|
| 168 |
The non-Zoltan rebalancing is a quick 1-D, row-wise balancing. |
| 169 |
*/ |
| 170 |
__deprecated Teuchos::RCP<Epetra_CrsMatrix> |
| 171 |
create_balanced_copy(const Epetra_CrsMatrix& input_matrix, |
| 172 |
const Epetra_Vector &row_weights); |
| 173 |
|
| 174 |
/** create_balanced_copy(), which is part of the Isorropia API, is used to |
| 175 |
create and return a balanced copy of an input Epetra_CrsMatrix. |
| 176 |
|
| 177 |
Isorropia can use Zoltan to perform partitioning if it has been |
| 178 |
configured with Zoltan support. If Zoltan is not available, it will |
| 179 |
perform its own simple row partitioning. |
| 180 |
|
| 181 |
In addition, if the parameter "PARTITIONING_METHOD" is set to "SIMPLE_LINEAR", |
| 182 |
Isorropia will perform its own simple row partitioning, even if Zoltan is |
| 183 |
available. This method balances the rows across processes after assigning |
| 184 |
each row a weight equal to the number of non zeros it has. |
| 185 |
|
| 186 |
If Zoltan is called to do the partitioning, any parameters set in a |
| 187 |
"Zoltan" sublist of the paramlist are provided to Zoltan. |
| 188 |
|
| 189 |
Refer to the Zoltan users guide for specific parameters that Zoltan |
| 190 |
recognizes. A couple of important ones are "LB_METHOD" (valid values |
| 191 |
include "GRAPH", "HYPERGRAPH"), "DEBUG_LEVEL" (valid values are |
| 192 |
0 to 10, default is 1), etc. |
| 193 |
|
| 194 |
If no Zoltan parameters are provided, Zoltan will perform hypergraph |
| 195 |
partitioning using its own PHG method. It will assign unit weight to |
| 196 |
each row (vertex), and unit weight to each column (hyperedge). It will |
| 197 |
attempt to minimize cuts in the hyperedges. |
| 198 |
*/ |
| 199 |
__deprecated Teuchos::RCP<Epetra_CrsMatrix> |
| 200 |
create_balanced_copy(const Epetra_CrsMatrix& input_matrix, |
| 201 |
const Teuchos::ParameterList& paramlist); |
| 202 |
|
| 203 |
|
| 204 |
|
| 205 |
/** create_balanced_copy(), which is part of the Isorropia API, is used to |
| 206 |
create and return a balanced copy of an input Epetra_CrsMatrix. |
| 207 |
|
| 208 |
Isorropia can use Zoltan to perform partitioning if it has been |
| 209 |
configured with Zoltan support. If Zoltan is not available, it will |
| 210 |
perform its own simple row partitioning. |
| 211 |
|
| 212 |
In addition, if the parameter "PARTITIONING_METHOD" is set to "SIMPLE_LINEAR", |
| 213 |
Isorropia will perform its own simple row partitioning, even if Zoltan is |
| 214 |
available. This method balances the rows across processes after assigning |
| 215 |
each row a weight equal to the number of non zeros it has. It ignores the |
| 216 |
costs object. |
| 217 |
|
| 218 |
If Zoltan is called to do the partitioning, any parameters set in a |
| 219 |
"Zoltan" sublist of the paramlist are provided to Zoltan. The weights |
| 220 |
provided in the CostDescriber object will be supplied to Zoltan. |
| 221 |
|
| 222 |
Refer to the Zoltan users guide for specific parameters that Zoltan |
| 223 |
recognizes. A couple of important ones are "LB_METHOD" (valid values |
| 224 |
include "GRAPH", "HYPERGRAPH"), "DEBUG_LEVEL" (valid values are |
| 225 |
0 to 10, default is 1), etc. |
| 226 |
|
| 227 |
If no Zoltan parameters are provided, Zoltan will perform hypergraph |
| 228 |
partitioning using its own PHG method. |
| 229 |
|
| 230 |
If an empty CostDescriber is supplied, we will assign unit weight to each |
| 231 |
row (vertex), and unit weight to each column (hyperedge), in the case of |
| 232 |
hypergraph partitioning. We will assign unit weight to each row (vertex) |
| 233 |
and each non zero (edge) in the case of graph partitioning. |
| 234 |
*/ |
| 235 |
__deprecated Teuchos::RCP<Epetra_CrsMatrix> |
| 236 |
create_balanced_copy(const Epetra_CrsMatrix& input_matrix, |
| 237 |
CostDescriber &costs, |
| 238 |
const Teuchos::ParameterList& paramlist); |
| 239 |
|
| 240 |
/** create_balanced_copy(), which is part of the Isorropia API, is used to |
| 241 |
create and return a balanced copy of an input Epetra_CrsMatrix. |
| 242 |
|
| 243 |
|
| 244 |
Isorropia will use Zoltan to perform partitioning if it has been |
| 245 |
configured with Zoltan support. If Zoltan is not available, it will |
| 246 |
perform its own simple row partitioning. |
| 247 |
|
| 248 |
Zoltan will perform hypergraph partitioning using its own PHG method. |
| 249 |
It will assign unit weight to each row (vertex), and unit weight to each |
| 250 |
column (hyperedge). It will attempt to minimize cuts in the hyperedges. |
| 251 |
|
| 252 |
The non-Zoltan rebalancing is 1-D, row-wise, and attempts to make the number |
| 253 |
of nonzeros equal in each partition. I.e., it is equivalent to specifying |
| 254 |
a weighted rebalance where the weights are the number of nonzeros in |
| 255 |
each row. |
| 256 |
|
| 257 |
*/ |
| 258 |
__deprecated Teuchos::RCP<Epetra_RowMatrix> |
| 259 |
create_balanced_copy(const Epetra_RowMatrix& input_matrix); |
| 260 |
|
| 261 |
/** create_balanced_copy(), which is part of the Isorropia API, is used to |
| 262 |
create and return a balanced copy of an input Epetra_CrsMatrix. |
| 263 |
|
| 264 |
Isorropia will use Zoltan to perform partitioning if it has been |
| 265 |
configured with Zoltan support. If Zoltan is not available, it will |
| 266 |
perform its own simple row partitioning. |
| 267 |
|
| 268 |
The balancing algorithm (Zoltan or non-Zoltan) will use the row |
| 269 |
weights provided for the matrix rows. |
| 270 |
|
| 271 |
Zoltan will perform hypergraph partitioning using its own PHG method. |
| 272 |
It will assign a unit weight to each column (hyperedge). It will attempt |
| 273 |
to balance row weights while minimizing cuts in the hyperedges. |
| 274 |
|
| 275 |
The non-Zoltan rebalancing is a quick 1-D, row-wise balancing. |
| 276 |
*/ |
| 277 |
__deprecated Teuchos::RCP<Epetra_RowMatrix> |
| 278 |
create_balanced_copy(const Epetra_RowMatrix& input_matrix, |
| 279 |
const Epetra_Vector &row_weights); |
| 280 |
|
| 281 |
/** create_balanced_copy(), which is part of the Isorropia API, is used to |
| 282 |
create and return a balanced copy of an input Epetra_CrsMatrix. |
| 283 |
|
| 284 |
|
| 285 |
Isorropia can use Zoltan to perform partitioning if it has been |
| 286 |
configured with Zoltan support. If Zoltan is not available, it will |
| 287 |
perform its own simple row partitioning. |
| 288 |
|
| 289 |
In addition, if the parameter "PARTITIONING_METHOD" is set to "SIMPLE_LINEAR", |
| 290 |
Isorropia will perform its own simple row partitioning, even if Zoltan is |
| 291 |
available. This method balances the rows across processes after assigning |
| 292 |
each row a weight equal to the number of non zeros it has. |
| 293 |
|
| 294 |
If Zoltan is called to do the partitioning, any parameters set in a |
| 295 |
"Zoltan" sublist of the paramlist are provided to Zoltan. |
| 296 |
|
| 297 |
Refer to the Zoltan users guide for specific parameters that Zoltan |
| 298 |
recognizes. A couple of important ones are "LB_METHOD" (valid values |
| 299 |
include "GRAPH", "HYPERGRAPH"), "DEBUG_LEVEL" (valid values are |
| 300 |
0 to 10, default is 1), etc. |
| 301 |
|
| 302 |
If no Zoltan parameters are provided, Zoltan will perform hypergraph |
| 303 |
partitioning using its own PHG method. It will assign unit weight to |
| 304 |
each row (vertex), and unit weight to each column (hyperedge). It will |
| 305 |
attempt to minimize cuts in the hyperedges. |
| 306 |
*/ |
| 307 |
__deprecated Teuchos::RCP<Epetra_RowMatrix> |
| 308 |
create_balanced_copy(const Epetra_RowMatrix& input_matrix, |
| 309 |
const Teuchos::ParameterList& paramlist); |
| 310 |
|
| 311 |
/** create_balanced_copy(), which is part of the Isorropia API, is used to |
| 312 |
create and return a balanced copy of an input Epetra_CrsMatrix. |
| 313 |
|
| 314 |
|
| 315 |
Isorropia can use Zoltan to perform partitioning if it has been |
| 316 |
configured with Zoltan support. If Zoltan is not available, it will |
| 317 |
perform its own simple row partitioning. |
| 318 |
|
| 319 |
In addition, if the parameter "PARTITIONING_METHOD" is set to "SIMPLE_LINEAR", |
| 320 |
Isorropia will perform its own simple row partitioning, even if Zoltan is |
| 321 |
available. This method balances the rows across processes after assigning |
| 322 |
each row a weight equal to the number of non zeros it has. The costs |
| 323 |
object is ignored in this case. |
| 324 |
|
| 325 |
If Zoltan is called to do the partitioning, any parameters set in a |
| 326 |
"Zoltan" sublist of the paramlist are provided to Zoltan. The weights |
| 327 |
provided in the CostDescriber object will be supplied to Zoltan. |
| 328 |
|
| 329 |
Refer to the Zoltan users guide for specific parameters that Zoltan |
| 330 |
recognizes. A couple of important ones are "LB_METHOD" (valid values |
| 331 |
include "GRAPH", "HYPERGRAPH"), "DEBUG_LEVEL" (valid values are |
| 332 |
0 to 10, default is 1), etc. |
| 333 |
|
| 334 |
If no Zoltan parameters are provided, Zoltan will perform hypergraph |
| 335 |
partitioning using its own PHG method. |
| 336 |
|
| 337 |
If an empty CostDescriber is supplied, we will assign unit weight to each |
| 338 |
row (vertex), and unit weight to each column (hyperedge), in the case of |
| 339 |
hypergraph partitioning. We will assign unit weight to each row (vertex) |
| 340 |
and each non zero (edge) in the case of graph partitioning. |
| 341 |
*/ |
| 342 |
__deprecated Teuchos::RCP<Epetra_RowMatrix> |
| 343 |
create_balanced_copy(const Epetra_RowMatrix& input_matrix, |
| 344 |
CostDescriber &costs, |
| 345 |
const Teuchos::ParameterList& paramlist); |
| 346 |
|
| 347 |
/** create_balanced_copy(), which is part of the Isorropia API, is used to |
| 348 |
create and return a balanced copy of an input Epetra_CrsMatrix. |
| 349 |
|
| 350 |
|
| 351 |
Isorropia will use Zoltan to perform partitioning if it has been |
| 352 |
configured with Zoltan support. If Zoltan is not available, it will |
| 353 |
perform its own simple row partitioning. |
| 354 |
|
| 355 |
Zoltan will perform hypergraph partitioning using its own PHG method. |
| 356 |
It will assign unit weight to each row (vertex), and unit weight to each |
| 357 |
column (hyperedge). It will attempt to minimize cuts in the hyperedges. |
| 358 |
|
| 359 |
The non-Zoltan rebalancing is 1-D, row-wise, and attempts to make the number |
| 360 |
of nonzeros equal in each partition. I.e., it is equivalent to specifying |
| 361 |
a weighted rebalance where the weights are the number of nonzeros in |
| 362 |
each row. |
| 363 |
|
| 364 |
*/ |
| 365 |
__deprecated Teuchos::RCP<Epetra_CrsGraph> |
| 366 |
create_balanced_copy(const Epetra_CrsGraph& input_graph); |
| 367 |
|
| 368 |
/** create_balanced_copy(), which is part of the Isorropia API, is used to |
| 369 |
create and return a balanced copy of an input Epetra_CrsMatrix. |
| 370 |
|
| 371 |
|
| 372 |
Isorropia will use Zoltan to perform partitioning if it has been |
| 373 |
configured with Zoltan support. If Zoltan is not available, it will |
| 374 |
perform its own simple row partitioning. |
| 375 |
|
| 376 |
The balancing algorithm (Zoltan or non-Zoltan) will use the row |
| 377 |
weights provided for the matrix rows. |
| 378 |
|
| 379 |
Zoltan will perform hypergraph partitioning using its own PHG method. |
| 380 |
It will assign a unit weight to each column (hyperedge). It will attempt |
| 381 |
to balance row weights while minimizing cuts in the hyperedges. |
| 382 |
|
| 383 |
The non-Zoltan rebalancing is a quick 1-D, row-wise balancing. |
| 384 |
*/ |
| 385 |
__deprecated Teuchos::RCP<Epetra_CrsGraph> |
| 386 |
create_balanced_copy(const Epetra_CrsGraph& input_matrix, |
| 387 |
const Epetra_Vector &row_weights); |
| 388 |
|
| 389 |
/** create_balanced_copy(), which is part of the Isorropia API, is used to |
| 390 |
create and return a balanced copy of an input Epetra_CrsMatrix. |
| 391 |
|
| 392 |
Isorropia can use Zoltan to perform partitioning if it has been |
| 393 |
configured with Zoltan support. If Zoltan is not available, it will |
| 394 |
perform its own simple row partitioning. |
| 395 |
|
| 396 |
In addition, if the parameter "PARTITIONING_METHOD" is set to "SIMPLE_LINEAR", |
| 397 |
Isorropia will perform its own simple row partitioning, even if Zoltan is |
| 398 |
available. This method balances the rows across processes after assigning |
| 399 |
each row a weight equal to the number of non zeros it has. |
| 400 |
|
| 401 |
If Zoltan is called to do the partitioning, any parameters set in a |
| 402 |
"Zoltan" sublist of the paramlist are provided to Zoltan. |
| 403 |
|
| 404 |
Refer to the Zoltan users guide for specific parameters that Zoltan |
| 405 |
recognizes. A couple of important ones are "LB_METHOD" (valid values |
| 406 |
include "GRAPH", "HYPERGRAPH"), "DEBUG_LEVEL" (valid values are |
| 407 |
0 to 10, default is 1), etc. |
| 408 |
|
| 409 |
If no Zoltan parameters are provided, Zoltan will perform hypergraph |
| 410 |
partitioning using its own PHG method. It will assign unit weight to |
| 411 |
each row (vertex), and unit weight to each column (hyperedge). It will |
| 412 |
attempt to minimize cuts in the hyperedges. |
| 413 |
*/ |
| 414 |
__deprecated Teuchos::RCP<Epetra_CrsGraph> |
| 415 |
create_balanced_copy(const Epetra_CrsGraph& input_graph, |
| 416 |
const Teuchos::ParameterList& paramlist); |
| 417 |
|
| 418 |
/** create_balanced_copy(), which is part of the Isorropia API, is used to |
| 419 |
create and return a balanced copy of an input Epetra_CrsMatrix. |
| 420 |
|
| 421 |
|
| 422 |
Isorropia can use Zoltan to perform partitioning if it has been |
| 423 |
configured with Zoltan support. If Zoltan is not available, it will |
| 424 |
perform its own simple row partitioning. |
| 425 |
|
| 426 |
In addition, if the parameter "PARTITIONING_METHOD" is set to "SIMPLE_LINEAR", |
| 427 |
Isorropia will perform its own simple row partitioning, even if Zoltan is |
| 428 |
available. This method balances the rows across processes after assigning |
| 429 |
each row a weight equal to the number of non zeros it has. |
| 430 |
|
| 431 |
If Zoltan is called to do the partitioning, any parameters set in a |
| 432 |
"Zoltan" sublist of the paramlist are provided to Zoltan. The weights |
| 433 |
provided in the CostDescriber object will be supplied to Zoltan. |
| 434 |
|
| 435 |
Refer to the Zoltan users guide for specific parameters that Zoltan |
| 436 |
recognizes. A couple of important ones are "LB_METHOD" (valid values |
| 437 |
include "GRAPH", "HYPERGRAPH"), "DEBUG_LEVEL" (valid values are |
| 438 |
0 to 10, default is 1), etc. |
| 439 |
|
| 440 |
If no Zoltan parameters are provided, Zoltan will perform hypergraph |
| 441 |
partitioning using its own PHG method. |
| 442 |
|
| 443 |
If an empty CostDescriber is supplied, we will assign unit weight to each |
| 444 |
row (vertex), and unit weight to each column (hyperedge), in the case of |
| 445 |
hypergraph partitioning. We will assign unit weight to each row (vertex) |
| 446 |
and each non zero (edge) in the case of graph partitioning. |
| 447 |
*/ |
| 448 |
__deprecated Teuchos::RCP<Epetra_CrsGraph> |
| 449 |
create_balanced_copy(const Epetra_CrsGraph& input_graph, |
| 450 |
CostDescriber &costs, |
| 451 |
const Teuchos::ParameterList& paramlist); |
| 452 |
|
| 453 |
/** create_balanced_copy(), which is part of the Isorropia API, is used to |
| 454 |
create and return a balanced copy of an input Epetra_CrsMatrix. |
| 455 |
|
| 456 |
|
| 457 |
Isorropia will use Zoltan to perform partitioning if it has been |
| 458 |
configured with Zoltan support. If Zoltan is not available, it will |
| 459 |
perform its own simple row partitioning. |
| 460 |
|
| 461 |
Zoltan will perform hypergraph partitioning using its own PHG method. |
| 462 |
It will assign unit weight to each row (vertex), and unit weight to each |
| 463 |
column (hyperedge). It will attempt to minimize cuts in the hyperedges. |
| 464 |
|
| 465 |
The non-Zoltan rebalancing is 1-D, row-wise, and attempts to make the number |
| 466 |
of nonzeros equal in each partition. I.e., it is equivalent to specifying |
| 467 |
a weighted rebalance where the weights are the number of nonzeros in |
| 468 |
each row. |
| 469 |
|
| 470 |
*/ |
| 471 |
|
| 472 |
__deprecated Teuchos::RCP<Epetra_LinearProblem> |
| 473 |
create_balanced_copy(const Epetra_LinearProblem & input_problem); |
| 474 |
|
| 475 |
/** create_balanced_copy(), which is part of the Isorropia API, is used to |
| 476 |
create and return a balanced copy of an input Epetra_CrsMatrix. |
| 477 |
|
| 478 |
Isorropia will use Zoltan to perform partitioning if it has been |
| 479 |
configured with Zoltan support. If Zoltan is not available, it will |
| 480 |
perform its own simple row partitioning. |
| 481 |
|
| 482 |
The balancing algorithm (Zoltan or non-Zoltan) will use the row |
| 483 |
weights provided for the matrix rows. |
| 484 |
|
| 485 |
Zoltan will perform hypergraph partitioning using its own PHG method. |
| 486 |
It will assign a unit weight to each column (hyperedge). It will attempt |
| 487 |
to balance row weights while minimizing cuts in the hyperedges. |
| 488 |
|
| 489 |
The non-Zoltan rebalancing is a quick 1-D, row-wise balancing. |
| 490 |
*/ |
| 491 |
__deprecated Teuchos::RCP<Epetra_LinearProblem> |
| 492 |
create_balanced_copy(const Epetra_LinearProblem& input_matrix, |
| 493 |
const Epetra_Vector &row_weights); |
| 494 |
|
| 495 |
/** create_balanced_copy(), which is part of the Isorropia API, is used to |
| 496 |
create and return a balanced copy of an input Epetra_CrsMatrix. |
| 497 |
|
| 498 |
Isorropia can use Zoltan to perform partitioning if it has been |
| 499 |
configured with Zoltan support. If Zoltan is not available, it will |
| 500 |
perform its own simple row partitioning. |
| 501 |
|
| 502 |
In addition, if the parameter "PARTITIONING_METHOD" is set to "SIMPLE_LINEAR", |
| 503 |
Isorropia will perform its own simple row partitioning, even if Zoltan is |
| 504 |
available. This method balances the rows across processes after assigning |
| 505 |
each row a weight equal to the number of non zeros it has. |
| 506 |
|
| 507 |
If Zoltan is called to do the partitioning, any parameters set in a |
| 508 |
"Zoltan" sublist of the paramlist are provided to Zoltan. |
| 509 |
|
| 510 |
Refer to the Zoltan users guide for specific parameters that Zoltan |
| 511 |
recognizes. A couple of important ones are "LB_METHOD" (valid values |
| 512 |
include "GRAPH", "HYPERGRAPH"), "DEBUG_LEVEL" (valid values are |
| 513 |
0 to 10, default is 1), etc. |
| 514 |
|
| 515 |
If no Zoltan parameters are provided, Zoltan will perform hypergraph |
| 516 |
partitioning using its own PHG method. It will assign unit weight to |
| 517 |
each row (vertex), and unit weight to each column (hyperedge). It will |
| 518 |
attempt to minimize cuts in the hyperedges. |
| 519 |
*/ |
| 520 |
|
| 521 |
__deprecated Teuchos::RCP<Epetra_LinearProblem> |
| 522 |
create_balanced_copy(const Epetra_LinearProblem& input_problem, |
| 523 |
const Teuchos::ParameterList& paramlist); |
| 524 |
|
| 525 |
/** create_balanced_copy(), which is part of the Isorropia API, is used to |
| 526 |
create and return a balanced copy of an input Epetra_CrsMatrix. |
| 527 |
|
| 528 |
Isorropia can use Zoltan to perform partitioning if it has been |
| 529 |
configured with Zoltan support. If Zoltan is not available, it will |
| 530 |
perform its own simple row partitioning. |
| 531 |
|
| 532 |
In addition, if the parameter "PARTITIONING_METHOD" is set to "SIMPLE_LINEAR", |
| 533 |
Isorropia will perform its own simple row partitioning, even if Zoltan is |
| 534 |
available. This method balances the rows across processes after assigning |
| 535 |
each row a weight equal to the number of non zeros it has. This costs |
| 536 |
object is ignored in this case. |
| 537 |
|
| 538 |
If Zoltan is called to do the partitioning, any parameters set in a |
| 539 |
"Zoltan" sublist of the paramlist are provided to Zoltan. The weights |
| 540 |
provided in the CostDescriber object will be supplied to Zoltan. |
| 541 |
|
| 542 |
Refer to the Zoltan users guide for specific parameters that Zoltan |
| 543 |
recognizes. A couple of important ones are "LB_METHOD" (valid values |
| 544 |
include "GRAPH", "HYPERGRAPH"), "DEBUG_LEVEL" (valid values are |
| 545 |
0 to 10, default is 1), etc. |
| 546 |
|
| 547 |
If no Zoltan parameters are provided, Zoltan will perform hypergraph |
| 548 |
partitioning using its own PHG method. |
| 549 |
|
| 550 |
If an empty CostDescriber is supplied, we will assign unit weight to each |
| 551 |
row (vertex), and unit weight to each column (hyperedge), in the case of |
| 552 |
hypergraph partitioning. We will assign unit weight to each row (vertex) |
| 553 |
and each non zero (edge) in the case of graph partitioning. |
| 554 |
*/ |
| 555 |
__deprecated Teuchos::RCP<Epetra_LinearProblem> |
| 556 |
create_balanced_copy(const Epetra_LinearProblem& input_problem, |
| 557 |
CostDescriber &costs, |
| 558 |
const Teuchos::ParameterList& paramlist); |
| 559 |
|
| 560 |
__deprecated Teuchos::RCP<Epetra_MultiVector> |
| 561 |
create_balanced_copy(const Epetra_MultiVector &coords, |
| 562 |
const Teuchos::ParameterList& paramlist); |
| 563 |
|
| 564 |
__deprecated Teuchos::RCP<Epetra_MultiVector> |
| 565 |
create_balanced_copy(const Epetra_MultiVector &coords, |
| 566 |
const Epetra_MultiVector &weights, |
| 567 |
const Teuchos::ParameterList& paramlist); |
| 568 |
|
| 569 |
|
| 570 |
__deprecated Teuchos::RCP<Epetra_MultiVector> |
| 571 |
create_balanced_copy(const Epetra_MultiVector &coords); |
| 572 |
|
| 573 |
__deprecated Teuchos::RCP<Epetra_MultiVector> |
| 574 |
create_balanced_copy(const Epetra_MultiVector &coords, |
| 575 |
const Epetra_MultiVector &weights); |
| 576 |
|
| 577 |
/** redistribute_rows() is an internal Isorropia function, not part |
| 578 |
of the API. |
| 579 |
|
| 580 |
Return a new Epetra_CrsMatrix object constructed with target_rowmap, |
| 581 |
and with the contents of input_matrix imported into it. |
| 582 |
|
| 583 |
The caller is responsible for deleting the returned object. |
| 584 |
|
| 585 |
param input_matrix Source/input object. |
| 586 |
|
| 587 |
param target_rowmap Target rowmap, required to be compatible with |
| 588 |
input_matrix.RowMap() in terms of number-of-elements, etc. |
| 589 |
|
| 590 |
param importer Optional argument. If importer is supplied, it will be |
| 591 |
used to perform the import operation. Otherwise, a temporary importer |
| 592 |
will be created and used. |
| 593 |
*/ |
| 594 |
Teuchos::RCP<Epetra_CrsMatrix> |
| 595 |
redistribute_rows(const Epetra_CrsMatrix& input_matrix, |
| 596 |
const Epetra_Map& target_rowmap, |
| 597 |
Epetra_Import* importer=0); |
| 598 |
|
| 599 |
/** redistribute_rows() is an internal Isorropia function, not part |
| 600 |
of the API. |
| 601 |
|
| 602 |
Return a new Epetra_CrsMatrix object constructed with target_rowmap, |
| 603 |
and with the contents of input_matrix imported into it. |
| 604 |
|
| 605 |
The caller is responsible for deleting the returned object. |
| 606 |
|
| 607 |
param input_matrix Source/input object. |
| 608 |
|
| 609 |
param target_rowmap Target rowmap, required to be compatible with |
| 610 |
input_matrix.RowMatrixRowMap() in terms of number-of-elements, etc. |
| 611 |
|
| 612 |
param importer Optional argument. If importer is supplied, it will be |
| 613 |
used to perform the import operation. Otherwise, a temporary importer |
| 614 |
will be created and used. |
| 615 |
*/ |
| 616 |
Teuchos::RCP<Epetra_CrsMatrix> |
| 617 |
redistribute_rows(const Epetra_RowMatrix& input_matrix, |
| 618 |
const Epetra_Map& target_rowmap, |
| 619 |
Epetra_Import* importer=0); |
| 620 |
|
| 621 |
/** Return a new Epetra_CrsGraph object constructed with target_rowmap, |
| 622 |
and with the contents of input_graph imported into it. |
| 623 |
|
| 624 |
param input_graph Source/input object. |
| 625 |
|
| 626 |
param target_rowmap Target rowmap, required to be compatible with |
| 627 |
input_graph.RowMap() in terms of number-of-elements, etc. |
| 628 |
|
| 629 |
param importer Optional argument. If importer is supplied, it will be |
| 630 |
used to perform the import operation. Otherwise, a temporary importer |
| 631 |
will be created and used. |
| 632 |
*/ |
| 633 |
Teuchos::RCP<Epetra_CrsGraph> |
| 634 |
redistribute_rows(const Epetra_CrsGraph& input_graph, |
| 635 |
const Epetra_Map& target_rowmap, |
| 636 |
Epetra_Import* importer=0); |
| 637 |
|
| 638 |
/** Return a new Epetra_MultiVector object constructed with target_map, |
| 639 |
and with the contents of 'input' imported into it. |
| 640 |
|
| 641 |
param input Source/input object. |
| 642 |
|
| 643 |
param target_map Target map, required to be compatible with |
| 644 |
input.Map() in terms of number-of-elements, etc. |
| 645 |
|
| 646 |
param importer Optional argument. If importer is supplied, it will be |
| 647 |
used to perform the import operation. Otherwise, a temporary importer |
| 648 |
will be created and used. |
| 649 |
*/ |
| 650 |
Teuchos::RCP<Epetra_MultiVector> |
| 651 |
redistribute(const Epetra_MultiVector& input, |
| 652 |
const Epetra_BlockMap& target_map, |
| 653 |
Epetra_Import* importer=0); |
| 654 |
|
| 655 |
/** Return a new Epetra_Vector object constructed with target_map, |
| 656 |
and with the contents of 'input' imported into it. |
| 657 |
|
| 658 |
param input Source/input object. |
| 659 |
|
| 660 |
param target_map Target map, required to be compatible with |
| 661 |
input.RowMap() in terms of number-of-elements, etc. |
| 662 |
|
| 663 |
param importer Optional argument. If importer is supplied, it will be |
| 664 |
used to perform the import operation. Otherwise, a temporary importer |
| 665 |
will be created and used. |
| 666 |
*/ |
| 667 |
Teuchos::RCP<Epetra_Vector> |
| 668 |
redistribute(const Epetra_Vector& input, |
| 669 |
const Epetra_Map& target_map, |
| 670 |
Epetra_Import* importer=0); |
| 671 |
|
| 672 |
#ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 673 |
|
| 674 |
/** Return a vector containing weights that are equal to the number of |
| 675 |
nonzeros per row in the input_matrix. The returned vector will have |
| 676 |
the same size and distribution as input_matrix's row-map. |
| 677 |
*/ |
| 678 |
Epetra_MultiVector* create_row_weights_nnz(const Epetra_RowMatrix& input_matrix); |
| 679 |
|
| 680 |
/** Return a vector containing weights that are equal to the number of |
| 681 |
nonzeros per row in the input_graph. The returned vector will have |
| 682 |
the same size and distribution as input_graph's row-map. |
| 683 |
*/ |
| 684 |
Epetra_MultiVector* create_row_weights_nnz(const Epetra_CrsGraph& input_graph); |
| 685 |
|
| 686 |
Epetra_MultiVector* create_unit_weights(const Epetra_MultiVector& input_coords); |
| 687 |
|
| 688 |
|
| 689 |
/** Calculate a new partitioning, and fill output containers with new |
| 690 |
elements for the local partition, as well as export and import lists. |
| 691 |
This is a simple linear partitioning that does not use Zoltan. |
| 692 |
|
| 693 |
\param[in] input_map Input map describing the existing or 'old' partitioning. |
| 694 |
|
| 695 |
\param[in] weights Input vector giving a weight for each element in input_map. |
| 696 |
weights.Map() is required to be the same size and layout as input_map. |
| 697 |
|
| 698 |
\param[out] newPartitions contains the new partition for each element, |
| 699 |
in input_map local ID order. Partition numbers go from |
| 700 |
0 to numProcs - 1 |
| 701 |
|
| 702 |
\param[out] exports the number of exports, that is, the number of |
| 703 |
elements in newPartitions that are not equal to my |
| 704 |
process rank |
| 705 |
|
| 706 |
\param[out] imports the list of global IDs of the elements I will |
| 707 |
import under the new partitioning |
| 708 |
|
| 709 |
\return Error-code, 0 if successful. This probably should be a void |
| 710 |
function, since a serious error will result in an exception-throw |
| 711 |
rather than an integer-code error-return. |
| 712 |
*/ |
| 713 |
int |
| 714 |
repartition(const Epetra_BlockMap& input_map, |
| 715 |
const Epetra_MultiVector& weights, |
| 716 |
std::vector<int>& myNewElements, |
| 717 |
int& exportsSize, |
| 718 |
std::vector<int>& imports); |
| 719 |
|
| 720 |
/** gather_all_proc_global_offsets() is an internal Isorropia function, not |
| 721 |
part of the API. |
| 722 |
|
| 723 |
Given an Epetra_BlockMap object, fill a vector of length numprocs+1 |
| 724 |
with each processor's starting offset into the Epetra_BlockMap's global |
| 725 |
set of elements (the last position will contain num-global-elements). |
| 726 |
Gather the vector of offsets onto all processors. |
| 727 |
*/ |
| 728 |
void gather_all_proc_global_offsets(const Epetra_BlockMap& blkmap, |
| 729 |
std::vector<int>& all_proc_offsets); |
| 730 |
|
| 731 |
|
| 732 |
/** compute_imbalance() is an internal Isorropia function, not |
| 733 |
part of the API. |
| 734 |
|
| 735 |
This function is used by Isorropia to compute the global imbalance |
| 736 |
of an initial partitioning and a new partitioning, to ensure the |
| 737 |
new computed partitioning is better. |
| 738 |
*/ |
| 739 |
|
| 740 |
double compute_imbalance(int nprocs, std::vector<int> &offsets, |
| 741 |
double *wgts, double target); |
| 742 |
|
| 743 |
#endif //DOXYGEN_SHOULD_SKIP_THIS |
| 744 |
#endif //HAVE_EPETRA |
| 745 |
|
| 746 |
}//namespace Epetra |
| 747 |
}//namespace Isorropia |
| 748 |
|
| 749 |
#endif |
| 750 |
|
| 751 |
|
| 752 |
#if defined(Isorropia_SHOW_DEPRECATED_WARNINGS) |
| 753 |
#ifdef __GNUC__ |
| 754 |
#warning "The Isorropia package is deprecated" |
| 755 |
#endif |
| 756 |
#endif |
| 757 |
|