Zoltan Developer's Guide | Next | Previous

## Load-Balancing Function Implementation

The new load-balancing algorithm should be implemented as an ZOLTAN_LB_FN. The type definition for an ZOLTAN_LB_FN is in lb/lb_const.h and is described below. When the new algorithm is selected, the LB_Fn field of the Zoltan_Struct is set to point to the ZOLTAN_LB_FN function for the new algorithm. This pointer is then used in invoking load balancing in Zoltan_LB_Partition.

typedef int ZOLTAN_LB_FN (struct Zoltan_Struct *zz, float *part_sizes, int *num_import, ZOLTAN_ID_PTR *import_global_ids, ZOLTAN_ID_PTR *import_local_ids, int **import_procs, int **import_to_parts, int *num_export, ZOLTAN_ID_PTR *export_global_ids, ZOLTAN_ID_PTR *export_local_ids, int **export_procs, int **export_to_parts);

The ZOLTAN_LB_FN function type describes the arguments passed to a load-balancing function. The input to the function is a Zoltan_Struct 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, *num_import must be set to a negative number, and similarly with *num_export. Full support of the RETURN_LISTS parameter is not required. If RETURN_LISTS 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 RETURN_LISTS.

Arguments: |
zz | A pointer to the Zoltan_Struct to be used in the load-balancing algorithm.
part_sizes | Input: an array of part sizes for each weight component. Entry part_sizes[i*obj_weight_dim+j] contains the user-requested part size for part i with respect to object weight j for i=0,1,...,number of parts-1, and j=0,1,...,obj_weight_dim-1. If the application sets parameter OBJ_WEIGHT_DIM, obj_weight_dim is the set value of OBJ_WEIGHT_DIM; otherwise, obj_weight_dim is one.
num_import | 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.
import_global_ids | Upon return, an array of num_import 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 Zoltan_Special_Malloc.
import_local_ids | Upon return, an array of num_import 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 Zoltan_Special_Malloc.
import_procs | Upon return, an array of size num_import 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 Zoltan_Special_Malloc.
import_to_parts | Upon return, an array of size num_import containing the part IDs of parts to which objects will be imported in the NEW decomposition. If this array is non-null, it must be allocated by Zoltan_Special_Malloc.
num_export | 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.
export_global_ids | Upon return, an array of num_export 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 Zoltan_Special_Malloc.
export_local_ids | Upon return, an array of num_export 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 Zoltan_Special_Malloc.
export_procs | Upon return, an array of size num_export containing the processor IDs of processors owning (in the old decomposition) the objects to be exported for the new decomposition. If this array is non-null, it must be allocated by Zoltan_Special_Malloc.
export_to_parts | Upon return, an array of size num_export containing the part IDs of parts to which the objects will be exported for the new decomposition. If this array is non-null, it must be allocated by Zoltan_Special_Malloc.
Returned Value: |
int | Error code.

[Table of Contents | Next: Data Structures | Previous: Load-Balancing Interface Routines | Privacy and Security]