Adding new parameters
All parameters in Zoltan should be set and accessed through the parameter
setting routines. To add a new parameter to an existing method, you
need to do the following:
-
In the source code for the desired method, search for the place where
the static array of parameters is defined. It will look something like:
static
PARAM_VARS Method_params[] = { ... }. Add a line with the name
of the new parameter, a pointer to the variable you want to associate (usually
NULL), and its type.
-
In the method source code, bind the parameter to a local variable through
Zoltan_Bind_Param.
Make sure you do this before Zoltan_Assign_Param_Vals
is
invoked.
-
Update the parameter function for the method in question. This routine
is typically called Zoltan_Method_Set_Param. This
routine checks if a given string is a valid parameter for that method.
It may also verify the values.
When you add a new method to Zoltan, you also need to:
-
Write a parameter function for your method that checks whether a given
string and value is a valid parameter pair for your method. See Zoltan_RCB_Set_Param
in rcb/rcb.c for an example.
-
Let your method access the parameters via Zoltan_Bind_Param
and
Zoltan_Assign_Param_Vals.
-
Change the parameter function array in params/set_params.c to include
your parameter function. Simply add a new entry to the static array that
looks like: static ZOLTAN_SET_PARAM_FN * Param_func[] = {...}.
-
Make sure your method uses the key
parameters in Zoltan correctly.
One useful convention is to put your method routine and your corresponding
parameter function in the same source file. This way you can define the
parameters in a static array. This convention eliminates the risk
of bugs caused by duplicate declarations (that are, incorrectly, not identical).
[Table of Contents | Next:
Part Remapping | Previous:
Memory Management | Privacy and Security]