federer
Version:
Experiments in asynchronous federated learning and decentralized learning
33 lines • 1.36 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.checkClientDelayOptions = void 0;
const assert = require("assert");
/**
* Function that parses {@link CoordinatorClientDelayOptions}, checks for
* invalid.
*/
function checkClientDelayOptions(options, numberClients) {
if (options !== undefined)
switch (options.type) {
case "none":
return;
case "delay-groups":
checkDelayGroupsOptions(options, numberClients);
return;
}
}
exports.checkClientDelayOptions = checkClientDelayOptions;
function checkDelayGroupsOptions(options, numberClients) {
assert(options.groups.length >= 1);
let sumSplits = 0;
for (const { fraction, delay } of options.groups) {
assert(fraction > 0);
assert(fraction <= 1);
assert(fraction >= 1 / numberClients, `The delay group with a delay of ${delay} ms was assigned to a ${fraction} fraction of all nodes, ` +
`but the minimum value for the fraction of clients with a given delay is 1 / numberClients = ${1 / numberClients}. The reason for this is that groups with a fraction lower than that would not include any clients.`);
assert(delay >= 0);
sumSplits += fraction;
}
assert.strictEqual(sumSplits, 1);
}
//# sourceMappingURL=delays.js.map