Our solution to parameter setting is to have a single interface routine Zoltan_Set_Param. This function calls a set of more domain-specific parameter setting routines, each of which is responsible for a domain-specific set of parameters. Assuming there are no errors, the parameter name and new value are placed in a linked list of new parameters which is maintained by the Zoltan structure. When a partitioning method is invoked on a Zoltan structure, it scans through this linked list using the Zoltan_Assign_Param_Vals function, resetting parameter values that are appropriate to the method.
In addition to the method-specific parameters, Zoltan also has a set of so-called key parameters. These are normally stored in the Zoltan structure and may be accessed by any part of the Zoltan code (including all the methods). A list of the key parameters currently used in Zoltan can be found in the User's Guide.
The routines that control parameter setting are listed below. Note that these routines have been written to be as independent of Zoltan as possible. Only a few minor changes would be required to use these routines as a separate library.
Zoltan_Set_Param: User interface function that calls a set of method-specific routines.See also: Adding new parameters in Zoltan.
Zoltan_Set_Param_Vec: Same as Zoltan_Set_Param, but for vector parameters.
Zoltan_Check_Param: Routine to check if parameter name and value are OK.
Zoltan_Bind_Param: Routine to associate a parameter name with a variable.
Zoltan_Bind_Param_Vec: Same as Zoltan_Bind_Param, but for vector parameters.
Zoltan_Assign_Param_Vals: Scans list of parameter names & values, setting relevant parameters accordingly.
Zoltan_Free_Params: Frees a parameter list.
The Zoltan_Set_Param function is the user interface for parameter setting. Its principle purpose is to call a sequence of more domain-specific routines for setting domain-specific parameters (e.g., Zoltan_RCB_Set_Param). If you are adding algorithms to Zoltan, you must write one of these domain-specific parameter routines and modify Zoltan_Set_Param to call it. Zoltan_RCB_Set_Param can serve as a template for this task. The arguments to this routine are two strings param_name and new_val. The domain-specific routines return an integer value with the following meaning.
0 - The parameter name was found, and the value passed all error checks.If one of the domain-specific parameter routines returns with a 0, Zoltan_Set_Param adds the parameter and the value (both strings) to a linked list of such pairs that is pointed to by the Params field of the zz structure.
1 - The parameter name was not found among the parameters known by the domain-specific routine.
2 - The parameter name was found, but the value failed the error checking.
3 - Same as 0, but do not add parameter and value to linked list.
Other - More serious error; value is an error code.
Arguments: | |
zz | The Zoltan structure whose parameter value is being modified. |
param_name | A string containing the name of the parameter being modified. It is automatically converted to all upper-case letters. |
new_val | The new value desired for the parameter, expressed as a string. |
Returned Value: | |
int | Error code. |
This routine works the same way as Zoltan_Set_Param, but is used for vector parameters. A vector parameter is a parameter that in addition to a name also has a set of indices, usually starting at 0. Each entry (component) may have a different value. This routine sets a single entry (component) of a vector parameter. If you want all entries (components) of a vector parameter to have the same value, set the parameter using Zoltan_Set_Param as if it were a scalar parameter.
Arguments: | |
param_name | A capitalized string containing the name of the parameter being modified. |
new_val | The new value desired for the parameter, expressed as a string. |
params | The data structure (defined in params/params_const.h) describing the domain-specific parameters to be matched against. The data structure is an array of items, each of which consists of four fields. The first field is a string that is a capitalized name of a parameter. The second field is an address that is unused in Zoltan_Check_Param, but is used in Zoltan_Assign_Param_Vals. The third field is another capitalized string that indicates the type of the parameter from the first field. Currently supported types are "INT", "INTEGER", "FLOAT", "REAL", "DOUBLE", "LONG", "STRING" and "CHAR". It is easy to add additional types by simple modifications to Zoltan_Check_Param and Zoltan_Assign_Param_Vals. The fourth field is an integer that gives the dimension (length) of the parameter, if it is a vector parameter. Scalar parameters have dimension 0. The array is terminated by an item consisting of four NULL fields. See Zoltan_RCB_Set_Param for an example of how to set up this data structure. |
result | Structure of information returned by Zoltan_Check_Param (defined in params/params_const.h). If param_name matches any of the parameter names from the first field of the params data structure, Zoltan_Check_Param attempts to decode the value in new_val. The type of the value is determined by the third field in the params data structure. If the value decodes properly, it is returned in result. |
matched_index | If param_name matches, then matched_index returns the index into the params array that corresponds to the matched parameter name. The matched_index and result values allow the developer to check that values being assigned to parameters are valid. |
Returned Value: | |
int | 0 - param_name found in params data structure and new_val
decodes OK.
1 - param_name not found in params data structure. 2 - param_name found in params data structure but new_val doesn't decode properly. |
Arguments: | |
params | The data structure describing the domain-specific parameters to be matched against. The data structure is an array of items, each of which consists of four fields. The first field is a string that is a capitalized name of a parameter. The second field is an address that is unused in Zoltan_Check_Param, but is used in Zoltan_Assign_Param_Vals. The third field is another capitalized string that indicates the type of the parameter from the first field. Currently supported types are "INT", "INTEGER", "FLOAT", "REAL", "DOUBLE", "LONG", "STRING" and "CHAR". It is easy to add additional types by simple modifications to Zoltan_Check_Param and Zoltan_Assign_Param_Vals. The fourth field is an integer that gives the dimension (length) of the parameter, if it is a vector parameter. Scalar parameters have dimension 0. The array is terminated by an item consisting of four NULL fields. |
name | A capitalized string containing the name of the parameter being modified. |
var | A pointer to the variable you wish to associate with the parameter name name. The pointer should be type cast to a void pointer. The user is responsible for ensuring that the pointer really points to a variable of appropriate type. A NULL pointer may be used to "unbind" a variable such that it will not be assigned a value upon future calls to Zoltan_Assign_Param_Vals. |
Returned Value: | |
int | Error code. |
Same as Zoltan_Bind_Param, but for vector parameters. The additional parameter dim gives the dimension or length of the vector parameter.
Arguments: | |
change_list | The linked list of parameter names and values which is constructed by Zoltan_Set_Param and is a field of an Zoltan_Struct data structure (defined in params/param_const.h). |
params | The data structure (defined in params/params_const.h) describing the domain-specific parameters to be matched against. The data structure is an array of items, each of which consists of three fields. The first field is a string which is a capitalized name of a parameter. The second field is an address of the parameter which should be altered. The third field is another capitalized string which indicates the type of the parameter being altered. Currently supported types are "INT", "INTEGER", "FLOAT", "REAL", "DOUBLE", "LONG", "STRING" and "CHAR". It is easy to add additional types by simple modifications to Zoltan_Check_Param and Zoltan_Assign_Param_Vals. The array is terminated by an item consisting of three NULL fields. |
debug_level | Zoltan debug level. (Normally this is zz->Debug_Level.) |
my_proc | Processor number. (Normally this is zz->Proc.) |
debug_proc | Processor number for debugging. (Normally this is zz->Debug_Proc.) |
Returned Value: | |
int | Error code. |
Arguments: | |
param_list | A pointer to a list (array) of parameters to be freed. PARAM_LIST is defined in params/param_const.h. |