Add spsa_reporting_type and spsa_distribution_type (#170)
Reporting Method (BATCHED vs BULK) for SPSA Tests Send everything at once, vs every time a pair finishes Distribution Method (SINGLE vs MULTIPLE) for SPSA Tests Give 1 parameter set; Give as many sets as we can
This commit is contained in:
1 parent
d1b354d0fd
commit
a17b5f853d
7 files changed
+95
-44
No files matched your search
@@ -203,6 +203,10 @@ def extract_spas_params(request):
|
||||
spsa['pairs_per' ] = int(request.POST['spsa_pairs_per'])
|
||||
spsa['A' ] = spsa['A_ratio'] * spsa['iterations']
|
||||
|
||||
# Tuning Methodologies
|
||||
spsa['reporting_type' ] = request.POST['spsa_reporting_type']
|
||||
spsa['distribution_type'] = request.POST['spsa_distribution_type']
|
||||
|
||||
# Each individual tuning parameter
|
||||
spsa['parameters'] = {}
|
||||
for line in request.POST['spsa_inputs'].split('\n'):
|
||||
|
||||
@@ -37,9 +37,12 @@
|
||||
# Our response includes three critical values:
|
||||
#
|
||||
# 1. cutechess-count The # of Sockets on the worker for SPRT/FIXED tests
|
||||
# The # of max possible concurrent games for SPRT tests
|
||||
# The # of max possible concurrent pairs for SPSA tests
|
||||
# Unless the distribution type is SINGLE
|
||||
#
|
||||
# 2. concurrency-per The # of concurrent games to run per Cutechess copy.
|
||||
# Function of the machine, and each engine's options
|
||||
#
|
||||
# 3. games-per-cutechess # of total games to run per Cutechess copy
|
||||
# This is the 2 x workload_size x concurrency-per
|
||||
|
||||
@@ -223,16 +226,24 @@ def workload_to_dictionary(test, result, machine):
|
||||
'private' : OPENBENCH_CONFIG['engines'][test.base_engine]['private'],
|
||||
}
|
||||
|
||||
workload['distribution'] = game_distribution(test, machine)
|
||||
workload['spsa'] = spsa_to_dictionary(test, workload['distribution']['cutechess-count'])
|
||||
workload['distribution'] = game_distribution(test, machine)
|
||||
workload['spsa'] = spsa_to_dictionary(test, workload)
|
||||
workload['reporting_type'] = test.spsa['reporting_type']
|
||||
|
||||
return workload
|
||||
|
||||
def spsa_to_dictionary(test, permutations):
|
||||
def spsa_to_dictionary(test, workload):
|
||||
|
||||
if test.test_mode != 'SPSA':
|
||||
return None
|
||||
|
||||
# Only use one set of parameters if distribution is SINGLE.
|
||||
# Duplicate the params, even though they are the same, across all
|
||||
# Sockets on the machine, in the event of a singular SPSA distribution
|
||||
is_single = test.spsa['distribution_type'] == 'SINGLE'
|
||||
permutations = 1 if is_single else workload['distribution']['cutechess-count']
|
||||
duplicates = 1 if not is_single else workload['distribution']['cutechess-count']
|
||||
|
||||
# C & R are scaled over the course of the iterations
|
||||
iteration = 1 + (test.games / (test.spsa['pairs_per'] * 2))
|
||||
c_compression = iteration ** test.spsa['Gamma']
|
||||
@@ -274,9 +285,11 @@ def spsa_to_dictionary(test, permutations):
|
||||
base = int(base)
|
||||
|
||||
# Append each permutation
|
||||
spsa[name]['dev' ].append(dev)
|
||||
spsa[name]['base'].append(base)
|
||||
spsa[name]['flip'].append(flip)
|
||||
for g in range(duplicates):
|
||||
spsa[name]['dev' ].append(dev)
|
||||
spsa[name]['base'].append(base)
|
||||
spsa[name]['flip'].append(flip)
|
||||
|
||||
|
||||
return spsa
|
||||
|
||||
@@ -307,10 +320,11 @@ def game_distribution(test, machine):
|
||||
# Number of params being evaluated at a single time
|
||||
spsa_count = (worker_threads // max(dev_threads, base_threads)) // 2
|
||||
|
||||
is_spsa = test.test_mode == 'SPSA'
|
||||
# SPSA is treated specially, if we are distributing many parameter sets at once
|
||||
is_multiple_spsa = test.test_mode == 'SPSA' and test.spsa['distribution_type'] == 'MULTIPLE'
|
||||
|
||||
return {
|
||||
'cutechess-count' : spsa_count if is_spsa else worker_sockets,
|
||||
'concurrency-per' : 2 if is_spsa else concurrency,
|
||||
'games-per-cutechess' : 2 * test.workload_size * (1 if is_spsa else concurrency),
|
||||
'cutechess-count' : spsa_count if is_multiple_spsa else worker_sockets,
|
||||
'concurrency-per' : 2 if is_multiple_spsa else concurrency,
|
||||
'games-per-cutechess' : 2 * test.workload_size * (1 if is_multiple_spsa else concurrency),
|
||||
}
|
||||
@@ -111,45 +111,47 @@ def verify_tune_creation(errors, request):
|
||||
|
||||
verifications = [
|
||||
|
||||
# Verify the SPSA raw inputs and methods
|
||||
(verify_spsa_inputs , 'spsa_inputs'),
|
||||
(verify_spsa_reporting_type , 'spsa_reporting_type', 'Reporting Method'),
|
||||
(verify_spsa_distribution_type, 'spsa_distribution_type', 'Distribution Method'),
|
||||
|
||||
# Verify everything about the Engine
|
||||
(verify_configuration , 'dev_engine', 'Engine', 'engines'),
|
||||
(verify_github_repo , 'dev_repo'),
|
||||
(verify_network , 'dev_network', 'Network', 'dev_engine'),
|
||||
(verify_options , 'dev_options', 'Threads', 'Options'),
|
||||
(verify_options , 'dev_options', 'Hash', 'Options'),
|
||||
(verify_time_control , 'dev_time_control', 'Time Control'),
|
||||
(verify_configuration , 'dev_engine', 'Engine', 'engines'),
|
||||
(verify_github_repo , 'dev_repo'),
|
||||
(verify_network , 'dev_network', 'Network', 'dev_engine'),
|
||||
(verify_options , 'dev_options', 'Threads', 'Options'),
|
||||
(verify_options , 'dev_options', 'Hash', 'Options'),
|
||||
(verify_time_control , 'dev_time_control', 'Time Control'),
|
||||
|
||||
# Verify everything about the Test Settings
|
||||
(verify_configuration , 'book_name', 'Book', 'books'),
|
||||
(verify_configuration , 'book_name', 'Book', 'books'),
|
||||
|
||||
# Verify everything about the General Settings
|
||||
(verify_integer , 'priority', 'Priority'),
|
||||
(verify_greater_than , 'throughput', 'Throughput', 0),
|
||||
(verify_syzygy_field , 'syzygy_wdl', 'Syzygy WDL'),
|
||||
(verify_integer , 'priority', 'Priority'),
|
||||
(verify_greater_than , 'throughput', 'Throughput', 0),
|
||||
(verify_syzygy_field , 'syzygy_wdl', 'Syzygy WDL'),
|
||||
|
||||
# Verify everything about the Workload Settings
|
||||
(verify_integer_or_none, 'worker_limit', 'Worker Limit'),
|
||||
(verify_integer_or_none, 'thread_limit', 'Thread Limit'),
|
||||
(verify_integer_or_none , 'worker_limit', 'Worker Limit'),
|
||||
(verify_integer_or_none , 'thread_limit', 'Thread Limit'),
|
||||
|
||||
# Verify everything about the Adjudicaton Settings
|
||||
(verify_syzygy_field , 'syzygy_adj', 'Syzygy Adjudication'),
|
||||
(verify_win_adj , 'win_adj'),
|
||||
(verify_draw_adj , 'draw_adj'),
|
||||
(verify_syzygy_field , 'syzygy_adj', 'Syzygy Adjudication'),
|
||||
(verify_win_adj , 'win_adj'),
|
||||
(verify_draw_adj , 'draw_adj'),
|
||||
|
||||
# Verify everything about the SPSA Settings
|
||||
(verify_float , 'spsa_alpha', 'SPSA A-Ratio'),
|
||||
(verify_float , 'spsa_alpha', 'SPSA Alpha'),
|
||||
(verify_float , 'spsa_gamma', 'SPSA Gamma'),
|
||||
(verify_integer , 'spsa_iterations', 'SPSA Iterations'),
|
||||
(verify_integer , 'spsa_pairs_per', 'SPSA Pairs-Per'),
|
||||
(verify_greater_than , 'spsa_alpha', 'SPSA A-Ratio', 0.00),
|
||||
(verify_greater_than , 'spsa_alpha', 'SPSA Alpha', 0.00),
|
||||
(verify_greater_than , 'spsa_gamma', 'SPSA Gamma', 0.00),
|
||||
(verify_greater_than , 'spsa_iterations', 'SPSA Iterations', 0),
|
||||
(verify_greater_than , 'spsa_pairs_per', 'SPSA Pairs-Per', 0),
|
||||
|
||||
# Verify the SPSA raw inputs for each parameter
|
||||
(verify_spsa_inputs , 'spsa_inputs'),
|
||||
(verify_float , 'spsa_alpha', 'SPSA A-Ratio'),
|
||||
(verify_float , 'spsa_alpha', 'SPSA Alpha'),
|
||||
(verify_float , 'spsa_gamma', 'SPSA Gamma'),
|
||||
(verify_integer , 'spsa_iterations', 'SPSA Iterations'),
|
||||
(verify_integer , 'spsa_pairs_per', 'SPSA Pairs-Per'),
|
||||
(verify_greater_than , 'spsa_alpha', 'SPSA A-Ratio', 0.00),
|
||||
(verify_greater_than , 'spsa_alpha', 'SPSA Alpha', 0.00),
|
||||
(verify_greater_than , 'spsa_gamma', 'SPSA Gamma', 0.00),
|
||||
(verify_greater_than , 'spsa_iterations', 'SPSA Iterations', 0),
|
||||
(verify_greater_than , 'spsa_pairs_per', 'SPSA Pairs-Per', 0),
|
||||
]
|
||||
|
||||
for verification in verifications:
|
||||
@@ -268,6 +270,16 @@ def verify_spsa_inputs(errors, request, field):
|
||||
traceback.print_exc()
|
||||
errors.append('Malformed SPSA Input')
|
||||
|
||||
def verify_spsa_reporting_type(errors, request, field, field_name):
|
||||
candidates = ['BULK', 'BATCHED']
|
||||
try: assert request.POST[field] in candidates
|
||||
except: errors.append('%s must be in %s' % (field_name, ', '.join(candidates)))
|
||||
|
||||
def verify_spsa_distribution_type(errors, request, field, field_name):
|
||||
candidates = ['SINGLE', 'MULTIPLE']
|
||||
try: assert request.POST[field] in candidates
|
||||
except: errors.append('%s must be in %s' % (field_name, ', '.join(candidates)))
|
||||
|
||||
|
||||
def collect_github_info(errors, request, field):
|
||||
|
||||
|
||||
Reference in new issue
Block a user