Add balance_engine_throughputs as a configuration option
Load balances tests with relation to each engine. If set to true, the effective throughput during work allocation will be scaled linearly with the number of tests which share the same dev engine. Namely, it can be used in a large framework to ensure equal allocation of resources across various engines. This comit will be followed by one which allows the user to specify an engine to the client, via --engine MyEngine, to force their worker to selfishly select their engine. We will account for cases where the selfish-engine is not a top-prio workload, and not play the low prio one. We will account for the other workers, by ignoring this worker's contribution to overall worker distrubtion. This ensures that it is a strict net gain to attach your own machines to a framework
This commit is contained in:
1 parent
7b826b22ef
commit
9d464e5b7d
3 files changed
+45
-6
No files matched your search
@@ -6,6 +6,7 @@
|
||||
"use_cross_approval" : false,
|
||||
"require_login_to_view" : false,
|
||||
"require_manual_registration" : false,
|
||||
"balance_engine_throughputs" : false,
|
||||
|
||||
"books" : [
|
||||
"2moves_v1.epd",
|
||||
|
||||
@@ -31,6 +31,8 @@ def create_openbench_config():
|
||||
|
||||
with open(os.path.join(PROJECT_PATH, 'Config', 'config.json')) as fin:
|
||||
config_dict = json.load(fin)
|
||||
verify_general_config(config_dict)
|
||||
|
||||
|
||||
config_dict['books'] = {
|
||||
book : load_book_config(book) for book in config_dict['books']
|
||||
@@ -78,6 +80,17 @@ def load_engine_config(engine_name):
|
||||
return conf
|
||||
|
||||
|
||||
def verify_general_config(conf):
|
||||
|
||||
assert type(conf.get("client_version" ) == int)
|
||||
assert type(conf.get("client_repo_url" ) == str)
|
||||
assert type(conf.get("client_repo_ref" ) == str)
|
||||
|
||||
assert type(conf.get("use_cross_approval" ) == bool)
|
||||
assert type(conf.get("require_login_to_view" ) == bool)
|
||||
assert type(conf.get("require_manual_registration") == bool)
|
||||
assert type(conf.get("balance_engine_throughputs" ) == bool)
|
||||
|
||||
def verify_engine_basics(conf):
|
||||
|
||||
assert type(conf.get('private')) == bool
|
||||
|
||||
@@ -58,11 +58,11 @@ def select_workload(machine):
|
||||
return {}
|
||||
|
||||
# Find the tests most deserving of resources currently
|
||||
ratios = [distribution[x.id]['threads'] / x.throughput for x in tests]
|
||||
lowest_indices = [i for i, r in enumerate(ratios) if r == min(ratios)]
|
||||
test_ratios = effective_allocation(tests, distribution)
|
||||
lowest_indices = [i for i, r in enumerate(test_ratios) if r == min(test_ratios)]
|
||||
|
||||
# Machine is out of date; or there is an unassigned test
|
||||
if machine.workload not in distribution or min(ratios) == 0:
|
||||
if machine.workload not in distribution or min(test_ratios) == 0:
|
||||
return tests[random.choice(lowest_indices)]
|
||||
|
||||
# Determine the "fair" ratio given the total threads and total throughput of tests
|
||||
@@ -70,8 +70,8 @@ def select_workload(machine):
|
||||
total_throughput = sum([x.throughput for x in tests])
|
||||
fair_ratio = total_threads / total_throughput
|
||||
|
||||
# Repeat the same test if the distribution is fair, and has the previous test
|
||||
if min(ratios) / fair_ratio > 0.75:
|
||||
# Repeat the same test if the distribution, is fair, and has the previous test
|
||||
if min(test_ratios) / fair_ratio > 0.75:
|
||||
if (test := Test.objects.get(id=machine.workload)) in tests:
|
||||
return test
|
||||
|
||||
@@ -90,7 +90,7 @@ def worker_distribution(machine):
|
||||
}
|
||||
|
||||
# Don't count ourselves; and don't include non-active tests
|
||||
for x in OpenBench.utils.getRecentMachines():
|
||||
for x in OpenBench.utils.getRecentMachines(1200):
|
||||
if machine != x and x.workload in distribution:
|
||||
distribution[x.workload]['workers'] += 1
|
||||
distribution[x.workload]['threads'] += x.info['concurrency']
|
||||
@@ -319,3 +319,28 @@ def game_distribution(test, machine):
|
||||
'concurrency-per' : 2 if is_multiple_spsa else max_concurrency,
|
||||
'games-per-cutechess' : 2 * test.workload_size * (1 if is_multiple_spsa else max_concurrency),
|
||||
}
|
||||
|
||||
def effective_allocation(tests, distribution):
|
||||
|
||||
# We track the "ratio" of threads relative to the effective-throughput (ETP) of a test.
|
||||
# This is used to determine which tests have more or less resources, relative to each
|
||||
# other, when taking into account the ETP.
|
||||
#
|
||||
# The ETP is just the throughput of a test by default. The 'balance_engine_throughputs'
|
||||
# option in the main configuration file will scale the throughput of each test in relation
|
||||
# to the number of tests that exist for the same engine.
|
||||
#
|
||||
# For example: Suppose there are four tests, each with Throughput=1000. Three of the tests
|
||||
# are for Ethereal, and one is for Laser. When computing resources, the Throughput of the
|
||||
# Ethereal tests will be scaled down by a factor of 3.
|
||||
|
||||
# Count of total tests, and total throughput, for each engine
|
||||
engines = set([x.dev_engine for x in tests])
|
||||
test_count = { engine : sum(x.dev_engine == engine for x in tests) for engine in engines }
|
||||
|
||||
# Ignore the test_count entirely when not doing engine balancing
|
||||
if not OPENBENCH_CONFIG['balance_engine_throughputs']:
|
||||
test_count = { engine : 1 for engine in engines }
|
||||
|
||||
# Threads working on the test, per unit of effective-throughput
|
||||
return [distribution[x.id]['threads'] / (x.throughput / test_count[x.dev_engine]) for x in tests]
|
||||
Reference in new issue
Block a user