Commit 33302a9b authored by Backofen, Rainer's avatar Backofen, Rainer
Browse files

Added Feature: Configure Zoltan with initfile

parent 5d49651f
......@@ -24,6 +24,7 @@
#include "parallel/ZoltanPartitioner.h"
#include "Traverse.h"
#include "ElInfo.h"
#include "Initfile.h"
using namespace std;
......@@ -34,7 +35,23 @@ namespace AMDiS { namespace Parallel {
: MeshPartitioner(name, comm),
zoltan(*comm),
elWeights(nullptr)
{}
{
/* Read configuration for Zoltan
* format in initfile:
* <tag><NameOfZoltanParameter>:<ValueOfParameter>
* e.g.
* zoltan parameter->LB_METHOD: GRAPH
*/
std::string tag="zoltan parameter->";
std::string tagInitial="zoltan parameter->";
Parameters::get("zoltan->parameter tag", tag);
Parameters::get("zoltan->parameter initial tag", tagInitial);
Parameters::getParameterMap(tag,paramMap,2);
Parameters::getParameterMap(tagInitial,paramMapInitial,2);
}
bool ZoltanPartitioner::partition(map<int, double> &weights,
......@@ -53,7 +70,7 @@ namespace AMDiS { namespace Parallel {
zoltan.Set_Num_Obj_Fn(ZoltanFunctions::box_getNumObj, this);
zoltan.Set_Obj_List_Fn(ZoltanFunctions::box_getObjectList, this);
zoltan.Set_Num_Geom_Fn(ZoltanFunctions::box_getNumGeom, this);
zoltan.Set_Geom_Multi_Fn(ZoltanFunctions::box_getGeomMulti, this);
//zoltan.Set_Geom_Multi_Fn(ZoltanFunctions::box_getGeomMulti, this);
zoltan.Set_Num_Edges_Multi_Fn(ZoltanFunctions::box_getNumEdgeMulti, this);
zoltan.Set_Edge_List_Multi_Fn(ZoltanFunctions::box_getEdgeListMulti, this);
}
......@@ -76,15 +93,51 @@ namespace AMDiS { namespace Parallel {
int *export_procs;
int *export_to_part;
/*
* Set default configuration for Zoltan
*/
if (mode == INITIAL) {
zoltan.Set_Param("LB_APPROACH", "PARTITION");
zoltan.Set_Param("LB_METHOD", "GRAPH");
zoltan.Set_Param("REDUCE_DIMENSIONS", "1");
zoltan.Set_Param("DEGENERATE_RATIO", "1.1");
zoltan.Set_Param("RCB_RECTILINEAR_BLOCKS", "1");
zoltan.Set_Param("AVERAGE_CUTS", "1");
zoltan.Set_Param("RCB_RECOMPUTE_BOX", "1");
if (boxPartitioning)
zoltan.Set_Param("LB_METHOD", "GRAPH");
} else {
zoltan.Set_Param("LB_APPROACH", "REPARTITION");
zoltan.Set_Param("LB_METHOD", "GRAPH");
zoltan.Set_Param("LB_APPROACH", "REPARTITION");
zoltan.Set_Param("LB_METHOD", "GRAPH");
zoltan.Set_Param("REFTREE_INITPATH", "CONNECTED");
zoltan.Set_Param("REDUCE_DIMENSIONS", "1");
zoltan.Set_Param("DEGENERATE_RATIO", "1.1");
zoltan.Set_Param("RCB_RECTILINEAR_BLOCKS", "1");
zoltan.Set_Param("AVERAGE_CUTS", "1");
zoltan.Set_Param("RCB_RECOMPUTE_BOX", "1");
}
/*
* Overwrite default config of zoltan with Values
* defined in init-file.
*/
if (mode == INITIAL) {
std::map<string,string>::const_iterator itr;
for(itr=paramMapInitial.begin(); itr!= paramMapInitial.end(); ++itr)
if( zoltan.Set_Param((*itr).first, (*itr).second) != ZOLTAN_OK){
ERROR_EXIT("Wrong parameter for Zoltan in Initfile (paramInitialMap): %s : %s \n", (*itr).first.c_str(), (*itr).second.c_str());
}
} else {
std::map<string,string>::const_iterator itr;
for(itr=paramMap.begin(); itr!= paramMap.end(); ++itr)
if( zoltan.Set_Param((*itr).first, (*itr).second) != ZOLTAN_OK){
ERROR_EXIT("Wrong parameter for Zoltan in Initfile (paramMap): %s : %s \n", (*itr).first.c_str(), (*itr).second.c_str());
}
}
zoltan.Set_Param("OBJ_WEIGHT_DIM", "1");
#if (DEBUG != 0)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment