Load-balancing files#

If you are running a large simulation with multiple nodes, you may want to use a load balancing file to distribute the computing load among multiple cores. This can be especially helpful if the nodes vary considerably in size and, therefore, processing time. If no load balancing file is submitted, the Eradication.exe allocates simulation nodes to cores according to a checkerboard pattern.

For each simulation, the load balancing file contains information about the relative level of processing time required for each geographical node. The Eradication.exe can then allocate nodes to processors in such a way that the total processing required is evenly distributed across all processors.

To use a load balancing file, you must set the configuration parameter Load_Balance_Filename to the path to the load balancing file, relative to the input file directory. Load-balancing files can be JSON (JavaScript Object Notation) files, which are preferred, or binary files.

JSON file#

A JSON load-balancing file contains the Load_Balance_Scheme_Nodes_On_Core_Matrix parameter, assigned an array of arrays, each of which represents a core and lists the NodeID of each node to be processed on that core. If any node contained in the demographics file is not listed in the load-balancing file, it will be processed on the first core.

For example, the load-balancing file shown below distributes the processing for 100 nodes across 4 cores, assigning more nodes to particular cores when those nodes require less processing time.

{
    "Load_Balance_Scheme_Nodes_On_Core_Matrix": [
        [1, 2, 3, 4, 5, 11, 12, 13, 14, 15, 21, 22, 23, 24, 25, 31, 32, 33, 34, 35, 45],
        [6, 7, 8, 9, 10, 16, 17, 18, 19, 20, 26, 27, 28, 29, 30, 36, 37, 38, 39, 40, 46, 47, 48, 49, 50, 56, 57, 58, 59, 60, 67, 68, 69, 70],
        [61, 62, 63, 64, 65, 66, 71, 72, 73, 74, 75, 76, 77, 81, 82, 83, 84, 85, 86, 87, 91, 92, 93, 94, 95, 96, 97],
        [41, 42, 43, 44, 51, 52, 53, 54, 55, 78, 79, 80, 88, 89, 90, 98, 99, 100]
    ]
}

Binary file#

A binary load-balancing file starts with an initial unsigned 4-byte integer that indicates the number of nodes. Following that value is a series of 4-byte unsigned integers representing the NodeID values. The number of values will be equal to the previously read number of nodes. Following that, another series of 4-byte floating point values, with each value representing the relative processing time required for each geographic node. Again, the number of values will be equal to the previously read number of nodes. The series of values are set up such that the \(i^{th}\) entry in the series is equal to the cumulative proportion of the processing load for all the previous nodes 0 through \(i\).

The cumulative nature of each node’s value does not mean each node is assigned that amount for its processing load. Rather, it is a way to make the internal calculations more efficient. For example, if you had ten nodes and each node was assigned 10% of the load, the values assigned from node0 to node9 would be the following: 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9 and 1.0.

The following diagram shows the format for the binary load-balancing file data:

_images/loadbalancingBFF.jpg