Massive Server/Client changes, listed below:
1. Reduce the time between workloads by dropping the number of games, as well as requesting them more often. 2. Add a Client version to do compatibility checks with the Server. 3. Add a Fleet Mode, to enable Noobpwnftw's workers to act as desired. Add this to the command line, as well the ability to pass the Syzygy WDL path from the command line to avoid modifying the Client. 4. Delete Syzygy DTZ components, as they are not needed. Replace with a working WDL check. Each test can decide for Syzygy Adjudication and Syzygy WDL (Gameplay) to be REQUIRED, OPTIONAL, or DISABLED. 5. Change the name of the binaries to be cutechess-ob, to avoid naming conflicts with those who have installed the Cutechess GUI and placed it onto the system path. 6. Implement Fixed Games test modes, defaulting to 20,000 games per test. Simplify some of the SPRT options by using the [A, B] format explicity. 7. Reduce the activity update rate to 5 minutes per machine, down from 15 minutes. 8. Have throughputs defined for each test mode (STC, LTC, SMPSTC, SMPLTC)
This commit is contained in:
1 parent
b331506434
commit
0da47c267c
8 files changed
+212
-130
No files matched your search
+41
-37
@@ -46,13 +46,14 @@ from itertools import combinations_with_replacement
|
||||
# #
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||
|
||||
TIMEOUT_HTTP = 30 # Timeout in seconds for HTTP requests
|
||||
TIMEOUT_ERROR = 10 # Timeout in seconds when any errors are thrown
|
||||
TIMEOUT_WORKLOAD = 60 # Timeout in seconds between workload requests
|
||||
TIMEOUT_HTTP = 30 # Timeout in seconds for HTTP requests
|
||||
TIMEOUT_ERROR = 10 # Timeout in seconds when any errors are thrown
|
||||
TIMEOUT_WORKLOAD = 30 # Timeout in seconds between workload requests
|
||||
CLIENT_VERSION = '1' # Client version to send to the Server
|
||||
|
||||
SYZYGY_WDL_PATH = None # Pathway to WDL Syzygy Tables
|
||||
SYZYGY_DTZ_PATH = None # Pathway to DTZ Syzygy Tables
|
||||
BASE_GAMES_PER_CORE = 32 # Typical games played per-thread
|
||||
SYZYGY_WDL_PATH = None # Pathway to WDL Syzygy Tables
|
||||
BASE_GAMES_PER_CORE = 16 # Typical games played per-thread
|
||||
FLEET_MODE = False # Exit when there are no workloads
|
||||
|
||||
CUSTOM_SETTINGS = {
|
||||
'Ethereal' : [], 'Laser' : [],
|
||||
@@ -75,8 +76,9 @@ ERRORS = {
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||
# #
|
||||
# Setting up the Client. Build the OpenBench file structure, check for #
|
||||
# Syzygy Tables for both WDL and DTZ, download a static Cutechess binary, #
|
||||
# and determine what engines we are able to compile by asking the server. #
|
||||
# Syzygy Tables for both WDL (Adjudication, and Gameplay). Download a #
|
||||
# static Cutechess binary, and determine what engines we are able to #
|
||||
# compile by asking the server for compiler and CPU Flag requirements #
|
||||
# #
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||
|
||||
@@ -122,7 +124,7 @@ def init_client(arguments):
|
||||
if not os.path.isdir(folder):
|
||||
os.mkdir(folder)
|
||||
|
||||
# Verify all WDL/DTZ tables are present when told they are
|
||||
# Verify all WDL tables are present when told they are
|
||||
validate_syzygy_exists()
|
||||
|
||||
def cleanup_client():
|
||||
@@ -146,7 +148,7 @@ def cleanup_client():
|
||||
|
||||
def validate_syzygy_exists():
|
||||
|
||||
global SYZYGY_WDL_PATH, SYZYGY_DTZ_PATH
|
||||
global SYZYGY_WDL_PATH
|
||||
|
||||
print ('\nScanning for Syzygy Configuration...')
|
||||
|
||||
@@ -157,27 +159,17 @@ def validate_syzygy_exists():
|
||||
if SYZYGY_WDL_PATH:
|
||||
wdlpath = os.path.join(SYZYGY_WDL_PATH, filename + '.rtbw')
|
||||
|
||||
if SYZYGY_DTZ_PATH:
|
||||
dtzpath = os.path.join(SYZYGY_DTZ_PATH, filename + '.rtbz')
|
||||
|
||||
# Reset the configuration if the file is missing
|
||||
|
||||
if SYZYGY_WDL_PATH and not os.path.isfile(wdlpath):
|
||||
SYZYGY_WDL_PATH = None
|
||||
|
||||
if SYZYGY_DTZ_PATH and not os.path.isfile(dtzpath):
|
||||
SYZYGY_DTZ_PATH = None
|
||||
|
||||
# Report final results, which may conflict with the original configuration
|
||||
|
||||
if SYZYGY_WDL_PATH:
|
||||
print('Verified Syzygy WDL (%s)' % (SYZYGY_WDL_PATH))
|
||||
else: print('Syzygy WDL Not Found')
|
||||
|
||||
if SYZYGY_DTZ_PATH:
|
||||
print('Verified Syzygy DTZ (%s)' % (SYZYGY_DTZ_PATH))
|
||||
else: print('Syzygy DTZ Not Found')
|
||||
|
||||
def tablebase_names(K=6):
|
||||
|
||||
letters = ['', 'Q', 'R', 'B', 'N', 'P']
|
||||
@@ -209,7 +201,8 @@ def try_until_success(mesg):
|
||||
while True:
|
||||
try: return funct(*args)
|
||||
except Exception:
|
||||
print('[Error]', mesg); time.sleep(TIMEOUT_ERROR)
|
||||
print('[Error]', mesg);
|
||||
if not FLEET_MODE: time.sleep(TIMEOUT_ERROR)
|
||||
if DEBUG: traceback.print_exc()
|
||||
return __try_until_success
|
||||
return _try_until_success
|
||||
@@ -326,7 +319,7 @@ def server_download_cutechess(arguments):
|
||||
|
||||
print('\nFetching Cutechess Binary...')
|
||||
|
||||
if IS_WINDOWS and not locate_utility('cutechess.exe', False, False):
|
||||
if IS_WINDOWS and not locate_utility('cutechess-ob.exe', False, False):
|
||||
|
||||
# Fetch the source location if we are missing the binary
|
||||
source = requests.get(
|
||||
@@ -334,13 +327,13 @@ def server_download_cutechess(arguments):
|
||||
timeout=TIMEOUT_HTTP).content.decode('utf-8')
|
||||
|
||||
# Windows workers simply need a static compile (64-bit)
|
||||
download_file(url_join(source, 'cutechess-windows.exe'), 'cutechess.exe')
|
||||
download_file(url_join(source, 'cutechess-windows.exe'), 'cutechess-ob.exe')
|
||||
|
||||
# Verify that we can execute Cutechess
|
||||
if not locate_utility('cutechess.exe', False):
|
||||
if not locate_utility('cutechess-ob.exe', False):
|
||||
raise Exception
|
||||
|
||||
if IS_LINUX and not locate_utility('./cutechess', False, False):
|
||||
if IS_LINUX and not locate_utility('./cutechess-ob', False, False):
|
||||
|
||||
# Fetch the source location if we are missing the binary
|
||||
source = requests.get(
|
||||
@@ -348,11 +341,11 @@ def server_download_cutechess(arguments):
|
||||
timeout=TIMEOUT_HTTP).content.decode('utf-8')
|
||||
|
||||
# Linux workers need a static compile (64-bit) with execute permissions
|
||||
download_file(url_join(source, 'cutechess-linux'), 'cutechess')
|
||||
os.system('chmod 777 cutechess')
|
||||
download_file(url_join(source, 'cutechess-linux'), 'cutechess-ob')
|
||||
os.system('chmod 777 cutechess-ob')
|
||||
|
||||
# Verify that we can execute Cutechess
|
||||
if not locate_utility('./cutechess', False):
|
||||
if not locate_utility('./cutechess-ob', False):
|
||||
raise Exception
|
||||
|
||||
@try_until_success(mesg=ERRORS['configure'])
|
||||
@@ -426,13 +419,13 @@ def server_request_workload(arguments):
|
||||
print('[NOTE] This machine is currently unregistered')
|
||||
|
||||
supported = ' '.join(COMPILERS.keys() - ['cpuflags'])
|
||||
has_syzygy = bool(SYZYGY_DTZ_PATH) and bool(SYZYGY_WDL_PATH)
|
||||
|
||||
payload = {
|
||||
'username' : arguments.username, 'threads' : arguments.threads,
|
||||
'password' : arguments.password, 'osname' : OSNAME,
|
||||
'machineid' : machine_id, 'syzygy_dtz' : has_syzygy,
|
||||
'machineid' : machine_id, 'syzygy_wdl' : bool(SYZYGY_WDL_PATH),
|
||||
'supported' : supported, 'cpuflags' : COMPILERS['cpuflags'],
|
||||
'version' : CLIENT_VERSION
|
||||
}
|
||||
|
||||
target = url_join(arguments.server, 'clientGetWorkload')
|
||||
@@ -530,7 +523,7 @@ def check_workload_response(arguments, response):
|
||||
# No workloads available to our machine
|
||||
if raw_text == 'None':
|
||||
print('[Note] Server Has No Work')
|
||||
time.sleep(TIMEOUT_WORKLOAD)
|
||||
if not FLEET_MODE: time.sleep(TIMEOUT_WORKLOAD)
|
||||
return False
|
||||
|
||||
# Bad login, kill the worker since all requests will fail
|
||||
@@ -544,6 +537,11 @@ def check_workload_response(arguments, response):
|
||||
os.remove('machine.txt')
|
||||
return False
|
||||
|
||||
# We must match the server's version number
|
||||
if raw_text == 'Bad Client Version':
|
||||
print('[ERROR] Client Version Outdated')
|
||||
sys.exit()
|
||||
|
||||
# Final check that we may parse the workload JSON
|
||||
data = response.json()
|
||||
with open('machine.txt', 'w') as fout:
|
||||
@@ -727,7 +725,7 @@ def build_cutechess_command(arguments, workload, dev_name, base_name, nps):
|
||||
dev_threads = int(re.search('(?<=Threads=)\d*', dev_options ).group())
|
||||
base_threads = int(re.search('(?<=Threads=)\d*', base_options).group())
|
||||
|
||||
if SYZYGY_WDL_PATH:
|
||||
if SYZYGY_WDL_PATH and workload['test']['syzygy_wdl'] != 'DISABLED':
|
||||
path = SYZYGY_WDL_PATH.replace('\\', '\\\\')
|
||||
dev_options += ' SyzygyPath=%s' % (path)
|
||||
base_options += ' SyzygyPath=%s' % (path)
|
||||
@@ -745,8 +743,8 @@ def build_cutechess_command(arguments, workload, dev_name, base_name, nps):
|
||||
flags += '-openings file=Books/%s format=%s order=random plies=16 '
|
||||
flags += '-pgnout PGNs/%s_vs_%s '
|
||||
|
||||
if SYZYGY_DTZ_PATH and workload['test']['allow_dtz']:
|
||||
flags += '-tb %s' % (SYZYGY_DTZ_PATH.replace('\\', '\\\\'))
|
||||
if SYZYGY_WDL_PATH and workload['test']['syzygy_adj'] != 'DISABLED':
|
||||
flags += '-tb %s' % (SYZYGY_WDL_PATH.replace('\\', '\\\\'))
|
||||
|
||||
throughput = int(workload['test']['throughput'])
|
||||
concurrency = int(arguments.threads) // max(dev_threads, base_threads)
|
||||
@@ -766,8 +764,8 @@ def build_cutechess_command(arguments, workload, dev_name, base_name, nps):
|
||||
)
|
||||
|
||||
if IS_LINUX:
|
||||
return concurrency, './cutechess ' + flags % (args)
|
||||
return concurrency, 'cutechess.exe ' + flags % (args)
|
||||
return concurrency, './cutechess-ob ' + flags % (args)
|
||||
return concurrency, 'cutechess-ob.exe ' + flags % (args)
|
||||
|
||||
def run_and_parse_cutechess(arguments, workload, concurrency, command):
|
||||
|
||||
@@ -805,7 +803,7 @@ def run_and_parse_cutechess(arguments, workload, concurrency, command):
|
||||
|
||||
# Only report scores after every 'concurrency' games
|
||||
score = list(map(int, score_reason.split()[0:5:2]))
|
||||
if ((sum(score) - sum(sent)) % concurrency != 0): continue
|
||||
if ((sum(score) - sum(sent)) % 8 != 0): continue
|
||||
|
||||
# Report to the server but allow failed reports to delay
|
||||
wld = [score[ii] - sent[ii] for ii in range(3)]
|
||||
@@ -835,8 +833,13 @@ if __name__ == '__main__':
|
||||
p.add_argument('-P', '--password', help='Password' , required=True)
|
||||
p.add_argument('-S', '--server' , help='Webserver', required=True)
|
||||
p.add_argument('-T', '--threads' , help='Threads' , required=True)
|
||||
p.add_argument('--syzygy', help='Syzygy WDL', required=False)
|
||||
p.add_argument('-fleet' , help='Fleet Mode', action='store_true')
|
||||
arguments = p.parse_args()
|
||||
|
||||
if arguments.syzygy is not None: SYZYGY_WDL_PATH = arguments.syzygy
|
||||
if arguments.fleet is not None: FLEET_MODE = True
|
||||
|
||||
check_for_utilities()
|
||||
init_client(arguments)
|
||||
server_download_cutechess(arguments)
|
||||
@@ -848,4 +851,5 @@ if __name__ == '__main__':
|
||||
response = server_request_workload(arguments)
|
||||
workload = check_workload_response(arguments, response)
|
||||
if workload: complete_workload(arguments, workload)
|
||||
elif FLEET_MODE: break
|
||||
except Exception: traceback.print_exc()
|
||||
+12
-3
@@ -22,6 +22,10 @@ USE_CROSS_APPROVAL = False
|
||||
|
||||
OPENBENCH_CONFIG = {
|
||||
|
||||
# Server Client version control
|
||||
'client_version' : '1',
|
||||
|
||||
# Generic Error Messages useful to those setting up their own instance
|
||||
'error' : {
|
||||
'disabled' : 'Account has not been enabled. Contact andrew@grantnet.us',
|
||||
'fakeuser' : 'This is not a real OpenBench User. Create an OpenBench account',
|
||||
@@ -31,11 +35,16 @@ OPENBENCH_CONFIG = {
|
||||
'framework' : 'http://github.com/AndyGrant/OpenBench/',
|
||||
'corefiles' : 'http://github.com/AndyGrant/OpenBench/raw/master/CoreFiles/',
|
||||
|
||||
# SPRT Elo bounds and type I/II errors
|
||||
'sprt' : { 'elolower' : 0.00, 'eloupper' : 5.00, 'alpha' : 0.05, 'beta' : 0.05 },
|
||||
# Test Configuration. For both SPRT and Fixed Games Tests
|
||||
|
||||
'tests' : {
|
||||
'bounds' : '[0.00, 5.00]', # SPRT Elo Bounds
|
||||
'confidence' : '[0.05, 0.05]', # SPRT Type I/II Confidence
|
||||
'max_games' : '20000', # Default for Fixed Games
|
||||
'throughput' : { 'stc' : 1000, 'ltc' : 500, 'smpstc' : 250, 'smpltc' : 125 },
|
||||
},
|
||||
|
||||
# Book confgiruation. When addding a book, follow the provided template.
|
||||
# Book Configuration. When addding a book, follow the provided template.
|
||||
# The SHA is defined by hashlib.sha256(book).hexdigest(). Client.py has
|
||||
# code to generate and verify sha256 values, as an example.
|
||||
|
||||
|
||||
+8
-3
@@ -78,6 +78,7 @@ class Test(Model):
|
||||
|
||||
author = CharField(max_length=64)
|
||||
engine = CharField(max_length=64)
|
||||
test_mode = CharField(max_length=16, default='SPRT')
|
||||
|
||||
dev = ForeignKey('Engine', PROTECT, related_name='dev')
|
||||
base = ForeignKey('Engine', PROTECT, related_name='base')
|
||||
@@ -94,18 +95,22 @@ class Test(Model):
|
||||
|
||||
priority = IntegerField(default=0)
|
||||
throughput = IntegerField(default=0)
|
||||
allow_dtz = BooleanField(default=True)
|
||||
force_wdl = BooleanField(default=False)
|
||||
|
||||
syzygy_adj = CharField(max_length=16, default='OPTIONAL')
|
||||
syzygy_wdl = CharField(max_length=16, default='OPTIONAL')
|
||||
|
||||
# Only for SPRT Tests
|
||||
elolower = FloatField(default=0.0)
|
||||
eloupper = FloatField(default=0.0)
|
||||
alpha = FloatField(default=0.0)
|
||||
beta = FloatField(default=0.0)
|
||||
|
||||
lowerllr = FloatField(default=0.0)
|
||||
currentllr = FloatField(default=0.0)
|
||||
upperllr = FloatField(default=0.0)
|
||||
|
||||
# Only for Fixed-Games Tests
|
||||
max_games = IntegerField(default=0)
|
||||
|
||||
games = IntegerField(default=0)
|
||||
wins = IntegerField(default=0)
|
||||
draws = IntegerField(default=0)
|
||||
|
||||
@@ -64,16 +64,29 @@ def gitDiffLink(test):
|
||||
|
||||
def shortStatBlock(test):
|
||||
|
||||
currentllr = twoDigitPrecision(test.currentllr)
|
||||
lowerllr = twoDigitPrecision(test.lowerllr)
|
||||
upperllr = twoDigitPrecision(test.upperllr)
|
||||
elolower = twoDigitPrecision(test.elolower)
|
||||
eloupper = twoDigitPrecision(test.eloupper)
|
||||
if test.test_mode == "SPRT":
|
||||
|
||||
llrbounds = '({}, {}) '.format(lowerllr, upperllr)
|
||||
currentllr = twoDigitPrecision(test.currentllr)
|
||||
lowerllr = twoDigitPrecision(test.lowerllr)
|
||||
upperllr = twoDigitPrecision(test.upperllr)
|
||||
elolower = twoDigitPrecision(test.elolower)
|
||||
eloupper = twoDigitPrecision(test.eloupper)
|
||||
|
||||
return 'LLR: {0} {1}[{2}, {3}]\n'.format(currentllr, llrbounds, elolower, eloupper) \
|
||||
+ 'Games: {0} W: {1} L: {2} D: {3}'.format(test.games, test.wins, test.losses, test.draws)
|
||||
llrbounds = '({}, {}) '.format(lowerllr, upperllr)
|
||||
|
||||
return 'LLR: {0} {1}[{2}, {3}]\n'.format(currentllr, llrbounds, elolower, eloupper) \
|
||||
+ 'Games: {0} W: {1} L: {2} D: {3}'.format(test.games, test.wins, test.losses, test.draws)
|
||||
|
||||
if test.test_mode == "GAMES":
|
||||
|
||||
lower, elo, upper = OpenBench.stats.ELO(test.wins, test.losses, test.draws)
|
||||
error = max(upper - elo, elo - lower)
|
||||
|
||||
elo = twoDigitPrecision(elo)
|
||||
error = twoDigitPrecision(error)
|
||||
|
||||
return 'Elo: {0} +- {1} (95%) [N={2}]\n'.format(elo, error, test.max_games) \
|
||||
+ 'Games: {0} W: {1} L: {2} D: {3}'.format(test.games, test.wins, test.losses, test.draws)
|
||||
|
||||
def longStatBlock(test):
|
||||
|
||||
@@ -84,18 +97,27 @@ def longStatBlock(test):
|
||||
lower, elo, upper = OpenBench.stats.ELO(test.wins, test.losses, test.draws)
|
||||
error = max(upper - elo, elo - lower)
|
||||
|
||||
elo = twoDigitPrecision(elo)
|
||||
error = twoDigitPrecision(error)
|
||||
lowerllr = twoDigitPrecision(test.lowerllr)
|
||||
currentllr = twoDigitPrecision(test.currentllr)
|
||||
upperllr = twoDigitPrecision(test.upperllr)
|
||||
elolower = twoDigitPrecision(test.elolower)
|
||||
eloupper = twoDigitPrecision(test.eloupper)
|
||||
elo = twoDigitPrecision(elo)
|
||||
error = twoDigitPrecision(error)
|
||||
|
||||
return 'ELO | {0} +- {1} (95%)\n'.format(elo, error) \
|
||||
+ 'SPRT | {0}s Threads={1} Hash={2}MB\n'.format(test.timecontrol, threads, hash) \
|
||||
+ 'LLR | {0} ({1}, {2}) [{3}, {4}]\n'.format(currentllr, lowerllr, upperllr, elolower, eloupper) \
|
||||
+ 'Games | N: {0} W: {1} L: {2} D: {3}'.format(test.games, test.wins, test.losses, test.draws) \
|
||||
if test.test_mode == 'SPRT':
|
||||
|
||||
lowerllr = twoDigitPrecision(test.lowerllr)
|
||||
currentllr = twoDigitPrecision(test.currentllr)
|
||||
upperllr = twoDigitPrecision(test.upperllr)
|
||||
elolower = twoDigitPrecision(test.elolower)
|
||||
eloupper = twoDigitPrecision(test.eloupper)
|
||||
|
||||
return 'ELO | {0} +- {1} (95%)\n'.format(elo, error) \
|
||||
+ 'SPRT | {0}s Threads={1} Hash={2}MB\n'.format(test.timecontrol, threads, hash) \
|
||||
+ 'LLR | {0} ({1}, {2}) [{3}, {4}]\n'.format(currentllr, lowerllr, upperllr, elolower, eloupper) \
|
||||
+ 'GAMES | N: {0} W: {1} L: {2} D: {3}'.format(test.games, test.wins, test.losses, test.draws)
|
||||
|
||||
if test.test_mode == 'GAMES':
|
||||
|
||||
return 'ELO | {0} +- {1} (95%)\n'.format(elo, error) \
|
||||
+ 'LLR | {0}s Threads={1} Hash={2}MB\n'.format(test.timecontrol, threads, hash) \
|
||||
+ 'GAMES | N: {0} W: {1} L: {2} D: {3}'.format(test.games, test.wins, test.losses, test.draws)
|
||||
|
||||
def testResultColour(test):
|
||||
|
||||
|
||||
+43
-38
@@ -81,7 +81,7 @@ def getCompletedTests():
|
||||
return completed.order_by('-updated')
|
||||
|
||||
|
||||
def getRecentMachines(minutes=15):
|
||||
def getRecentMachines(minutes=5):
|
||||
target = datetime.datetime.utcnow()
|
||||
target = target.replace(tzinfo=django.utils.timezone.utc)
|
||||
target = target - datetime.timedelta(minutes=minutes)
|
||||
@@ -191,14 +191,6 @@ def verifyNewTest(request):
|
||||
try: int(request.POST[field])
|
||||
except: errors.append('{0} is not an Integer'.format(fieldName))
|
||||
|
||||
def verifyFloating(field, fieldName):
|
||||
try: float(request.POST[field])
|
||||
except: errors.append('{0} is not a Floating Point'.format(fieldName))
|
||||
|
||||
def verifyLessThan(field, fieldName, value, valueName):
|
||||
if not float(request.POST[field]) < value:
|
||||
errors.append('{0} is not less than {1}'.format(fieldName, valueName))
|
||||
|
||||
def verifyGreaterThan(field, fieldName, value, valueName):
|
||||
if not float(request.POST[field]) > value:
|
||||
errors.append('{0} is not greater than {1}'.format(fieldName, valueName))
|
||||
@@ -220,14 +212,6 @@ def verifyNewTest(request):
|
||||
verifications = [
|
||||
(verifyInteger, 'priority', 'Priority'),
|
||||
(verifyInteger, 'throughput', 'Throughput'),
|
||||
(verifyFloating, 'elolower', 'Elo Lower'),
|
||||
(verifyFloating, 'eloupper', 'Elo Upper'),
|
||||
(verifyFloating, 'alpha', 'Alpha'),
|
||||
(verifyFloating, 'beta', 'Beta'),
|
||||
(verifyLessThan, 'alpha', 'Alpha', 1.00, '1'),
|
||||
(verifyLessThan, 'beta', 'Beta', 1.00, '1'),
|
||||
(verifyGreaterThan, 'alpha', 'Alpha', 0.00, '0'),
|
||||
(verifyGreaterThan, 'beta', 'beta', 0.00, '0'),
|
||||
(verifyGreaterThan, 'throughput', 'Throughput', 0, '0'),
|
||||
(verifyOptions, 'devoptions', 'Threads', 'Dev Options'),
|
||||
(verifyOptions, 'devoptions', 'Hash', 'Dev Options'),
|
||||
@@ -246,7 +230,7 @@ def verifyNewTest(request):
|
||||
|
||||
def createNewTest(request):
|
||||
|
||||
errors = verifyNewTest(request)
|
||||
errors = []; verifyNewTest(request)
|
||||
if errors != []: return None, errors
|
||||
|
||||
devinfo = getBranch(request, errors, 'dev')
|
||||
@@ -256,6 +240,7 @@ def createNewTest(request):
|
||||
test = Test()
|
||||
test.author = request.user.username
|
||||
test.engine = request.POST['enginename']
|
||||
test.test_mode = request.POST['test_mode']
|
||||
test.source = request.POST['source']
|
||||
test.devoptions = request.POST['devoptions'].rstrip(' ')
|
||||
test.baseoptions = request.POST['baseoptions'].rstrip(' ')
|
||||
@@ -265,14 +250,20 @@ def createNewTest(request):
|
||||
test.timecontrol = parseTimeControl(request.POST['timecontrol'])
|
||||
test.priority = int(request.POST['priority'])
|
||||
test.throughput = int(request.POST['throughput'])
|
||||
test.allow_dtz = request.POST['allow_dtz'] == 'True'
|
||||
test.force_wdl = request.POST['force_wdl'] == 'True'
|
||||
test.elolower = float(request.POST['elolower'])
|
||||
test.eloupper = float(request.POST['eloupper'])
|
||||
test.alpha = float(request.POST['alpha'])
|
||||
test.beta = float(request.POST['beta'])
|
||||
test.lowerllr = math.log(test.beta / (1.0 - test.alpha))
|
||||
test.upperllr = math.log((1.0 - test.beta) / test.alpha)
|
||||
test.syzygy_adj = request.POST['syzygy_adj']
|
||||
test.syzygy_wdl = request.POST['syzygy_wdl']
|
||||
|
||||
if request.POST['test_mode'] == 'SPRT':
|
||||
test.elolower = float(request.POST['bounds'].split(',')[0].lstrip('['))
|
||||
test.eloupper = float(request.POST['bounds'].split(',')[1].rstrip(']'))
|
||||
test.alpha = float(request.POST['confidence'].split(',')[1].rstrip(']'))
|
||||
test.beta = float(request.POST['confidence'].split(',')[0].lstrip('['))
|
||||
test.lowerllr = math.log(test.beta / (1.0 - test.alpha))
|
||||
test.upperllr = math.log((1.0 - test.beta) / test.alpha)
|
||||
|
||||
if request.POST['test_mode'] == 'GAMES':
|
||||
test.max_games = int(request.POST['max_games'])
|
||||
|
||||
test.dev = getEngine(*devinfo)
|
||||
test.base = getEngine(*baseinfo)
|
||||
test.save()
|
||||
@@ -342,9 +333,10 @@ def getWorkload(user, request):
|
||||
if flag not in cpuflags:
|
||||
tests = tests.exclude(engine=engine)
|
||||
|
||||
# Remove Syzygy tests if the Machine has no TBs
|
||||
if not request.POST['syzygy_dtz']:
|
||||
tests = tests.exclude(force_wdl=True)
|
||||
# Remove Syzygy tests if the Machine has no Syzygy Tablebases
|
||||
if request.POST['syzygy_wdl'] == 'False':
|
||||
tests = tests.exclude(syzygy_adj='REQUIRED')
|
||||
tests = tests.exclude(syzygy_wdl='REQUIRED')
|
||||
|
||||
# If we don't get a Test back, there was an error
|
||||
test = selectWorkload(tests, machine)
|
||||
@@ -398,8 +390,8 @@ def workloadDictionary(test, result, machine):
|
||||
'engine' : test.engine,
|
||||
'timecontrol' : test.timecontrol,
|
||||
'throughput' : test.throughput,
|
||||
'allow_dtz' : test.allow_dtz,
|
||||
'force_wdl' : test.force_wdl,
|
||||
'syzygy_adj' : test.syzygy_adj,
|
||||
'syzygy_wdl' : test.syzygy_wdl,
|
||||
|
||||
'nps' : OPENBENCH_CONFIG['engines'][test.engine]['nps'],
|
||||
'build' : OPENBENCH_CONFIG['engines'][test.engine]['build'],
|
||||
@@ -442,17 +434,30 @@ def updateTest(request, user):
|
||||
if test.finished or test.deleted:
|
||||
return 'Stop'
|
||||
|
||||
# Compute a new LLR for the updated results
|
||||
# Tally up the updated WLD stats
|
||||
swins = test.wins + wins
|
||||
slosses = test.losses + losses
|
||||
sdraws = test.draws + draws
|
||||
WLD = (swins, slosses, sdraws)
|
||||
sprt = OpenBench.stats.SPRT(*WLD, test.elolower, test.eloupper)
|
||||
sgames = swins + slosses + sdraws
|
||||
|
||||
# Check for an H0 or H1 being accepted
|
||||
passed = sprt > test.upperllr
|
||||
failed = sprt < test.lowerllr
|
||||
finished = passed or failed
|
||||
if test.test_mode == 'SPRT':
|
||||
|
||||
# Compute a new LLR for the updated results
|
||||
WLD = (swins, slosses, sdraws)
|
||||
sprt = OpenBench.stats.SPRT(*WLD, test.elolower, test.eloupper)
|
||||
|
||||
# Check for H0 or H1 being accepted
|
||||
passed = sprt > test.upperllr
|
||||
failed = sprt < test.lowerllr
|
||||
finished = passed or failed
|
||||
|
||||
if test.test_mode == 'GAMES':
|
||||
|
||||
# Finish test once we've played the proper amount of games
|
||||
passed = sgames >= test.max_games and swins >= slosses
|
||||
failed = sgames >= test.max_games and swins < slosses
|
||||
finished = passed or failed
|
||||
sprt = 0.0 # Hack to "update" the currentllr
|
||||
|
||||
# Update total games played by the Player
|
||||
Profile.objects.filter(user=user).update(games=F('games') + games)
|
||||
|
||||
@@ -605,6 +605,14 @@ def clientGetWorkload(request):
|
||||
try: user = authenticate(request, True)
|
||||
except UnableToAuthenticate: return HttpResponse('Bad Credentials')
|
||||
|
||||
# Make sure the Client passed its version number
|
||||
if 'version' not in request.POST:
|
||||
return HttpResponse('Bad Client Version')
|
||||
|
||||
# Make sure the Client & Server version numbers match
|
||||
if request.POST['version'] != OpenBench.config.OPENBENCH_CONFIG['client_version']:
|
||||
return HttpResponse('Bad Client Version')
|
||||
|
||||
# getWorkload() will verify the integrity of the request
|
||||
return HttpResponse(OpenBench.utils.getWorkload(user, request))
|
||||
|
||||
|
||||
@@ -19,6 +19,13 @@
|
||||
{% endfor %}
|
||||
};
|
||||
|
||||
var Throughputs = {
|
||||
"stc" : "{{config.tests.throughput.stc }}",
|
||||
"ltc" : "{{config.tests.throughput.ltc }}",
|
||||
"smpstc" : "{{config.tests.throughput.smpstc}}",
|
||||
"smpltc" : "{{config.tests.throughput.smpltc}}",
|
||||
};
|
||||
|
||||
var Networks = [
|
||||
{% for network in networks %}
|
||||
{
|
||||
@@ -48,6 +55,7 @@
|
||||
document.getElementById("devoptions").value = "Threads=" + threads + " Hash=" + hash;
|
||||
document.getElementById("baseoptions").value = "Threads=" + threads + " Hash=" + hash;
|
||||
document.getElementById("timecontrol").value = timecontrol;
|
||||
document.getElementById("throughput").value = Throughputs[mode];
|
||||
|
||||
return; // Don't change the Network setup unless asked
|
||||
}
|
||||
@@ -90,8 +98,27 @@
|
||||
}
|
||||
}
|
||||
|
||||
function test_type() {
|
||||
|
||||
var selection = document.getElementById("test_mode");
|
||||
var mode = selection.options[selection.selectedIndex].value;
|
||||
|
||||
if (mode == "SPRT") {
|
||||
document.getElementById("test_bounds").value = "{{config.tests.bounds}}";
|
||||
document.getElementById("test_confidence").value = "{{config.tests.confidence}}";
|
||||
document.getElementById("test_max_games").value = "N/A";
|
||||
}
|
||||
|
||||
if (mode == "GAMES") {
|
||||
document.getElementById("test_bounds").value = "N/A";
|
||||
document.getElementById("test_confidence").value = "N/A";
|
||||
document.getElementById("test_max_games").value = "{{config.tests.max_games}}";
|
||||
}
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function () { configure('stc'); }, false);
|
||||
document.addEventListener('DOMContentLoaded', function () { configure(null); }, false);
|
||||
document.addEventListener('DOMContentLoaded', function () { test_type(); }, false);
|
||||
|
||||
{% endblock %}
|
||||
|
||||
@@ -102,7 +129,7 @@
|
||||
<div class="settings-column">
|
||||
|
||||
<h3> Engine </h3>
|
||||
<label> Name </label> <select onClick="configure(null)" id="enginename" name="enginename">
|
||||
<label> Engine </label> <select onClick="configure(null)" id="enginename" name="enginename">
|
||||
{% for engine in config.engines %}
|
||||
{% if engine == profile.engine %}
|
||||
<option onClick="configure(null)" selected value="{{engine}}">{{engine}}</option>
|
||||
@@ -115,16 +142,16 @@
|
||||
<label> Source </label> <input value="{{profile.repo}}" name="source"><br>
|
||||
|
||||
<h3> Dev Settings </h3>
|
||||
<label> Bench </label> <input name="devbench"><br>
|
||||
<label> Branch </label> <input name="devbranch" autofocus><br>
|
||||
<label> Options </label> <input id="devoptions" name="devoptions"><br>
|
||||
<label> Network </label> <select id="devnetwork" name="devnetwork"></select><br>
|
||||
<label> Dev Bench </label> <input name="devbench"><br>
|
||||
<label> Dev Branch </label> <input name="devbranch" autofocus><br>
|
||||
<label> Dev Options </label> <input id="devoptions" name="devoptions"><br>
|
||||
<label> Dev Network </label> <select id="devnetwork" name="devnetwork"></select><br>
|
||||
|
||||
<h3> Base Settings </h3>
|
||||
<label> Bench </label> <input name="basebench"><br>
|
||||
<label> Branch </label> <input value="master" name="basebranch"><br>
|
||||
<label> Options </label> <input id="baseoptions" name="baseoptions"><br>
|
||||
<label> Network </label> <select id="basenetwork" name="basenetwork"></select><br>
|
||||
<label> Base Bench </label> <input name="basebench"><br>
|
||||
<label> Base Branch </label> <input value="master" name="basebranch"><br>
|
||||
<label> Base Options </label> <input id="baseoptions" name="baseoptions"><br>
|
||||
<label> Base Network </label> <select id="basenetwork" name="basenetwork"></select><br>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -142,24 +169,29 @@
|
||||
</select><br>
|
||||
<label> Time </label> <input id="timecontrol" name="timecontrol"><br>
|
||||
|
||||
<h3> SPRT Settings </h3>
|
||||
<label> Lower </label> <input value="{{config.sprt.elolower}}" name="elolower"><br>
|
||||
<label> Upper </label> <input value="{{config.sprt.eloupper}}" name="eloupper"><br>
|
||||
<label> Alpha </label> <input value="{{config.sprt.alpha}}" name="alpha"><br>
|
||||
<label> Beta </label> <input value="{{config.sprt.beta}}" name="beta"><br>
|
||||
|
||||
<h3> Test Settings </h3>
|
||||
<label> Priority </label> <input value="0" name="priority"><br>
|
||||
<label> Throughput </label> <input value="1000" name="throughput"><br>
|
||||
<label> Test Mode </label> <select onchange='test_type()' id="test_mode" name="test_mode">
|
||||
<option selected value="SPRT"> SPRT </option>
|
||||
<option value="GAMES"> Fixed Games </option>
|
||||
</select><br>
|
||||
<label> Bounds </label> <input id="test_bounds" name="bounds"><br>
|
||||
<label> Confidence </label> <input id="test_confidence" name="confidence"><br>
|
||||
<label> Max Games </label> <input id="test_max_games" name="max_games"><br>
|
||||
|
||||
<label> Syzygy DTZ </label> <select name="allow_dtz">
|
||||
<option selected value="True"> Allowed </option>
|
||||
<option value="False"> Disabled </option>
|
||||
<h3> General Settings </h3>
|
||||
<label> Priority </label> <input value="0" name="priority"><br>
|
||||
<label> Throughput </label> <input id="throughput", name="throughput"><br>
|
||||
|
||||
<label> Syzygy ADJ </label> <select name="syzygy_adj">
|
||||
<option value="OPTIONAL"> Optional </option>
|
||||
<option value="REQUIRED"> Required </option>
|
||||
<option value="DISABLED"> Disabled </option>
|
||||
</select><br>
|
||||
|
||||
<label> Syzygy WDL </label> <select name="force_wdl">
|
||||
<option value="True"> Required </option>
|
||||
<option selected value="False"> Allowed </option>
|
||||
<label> Syzygy WDL </label> <select name="syzygy_wdl">
|
||||
<option value="OPTIONAL"> Optional </option>
|
||||
<option value="REQUIRED"> Required </option>
|
||||
<option value="DISABLED"> Disabled </option>
|
||||
</select><br>
|
||||
|
||||
</div>
|
||||
@@ -176,4 +208,3 @@
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
@@ -35,11 +35,9 @@
|
||||
{% endif %}
|
||||
<tr><th>Source Repo</th><td><a href="{{test.source}}">{{test.source}}</a></td></tr>
|
||||
<tr><th>Opening Book</th><td><a href="{{config.framework}}/raw/master/Books/">{{test.bookname}}</a></td></tr>
|
||||
<tr><th>Time Control</th><td>{{test.timecontrol}}s</td></tr>
|
||||
<tr><th>Elo Bounds</th><td>[{{test.elolower}}, {{test.eloupper}}]</td></tr>
|
||||
<tr><th>SPRT Bounds</th><td>({{test.lowerllr|twoDigitPrecision}}, {{test.upperllr|twoDigitPrecision}})</td></tr>
|
||||
<tr><th>Allow DTZ</th><td>{{test.allow_dtz}}</td></tr>
|
||||
<tr><th>Force WDL</th><td>{{test.force_wdl}}</td></tr>
|
||||
|
||||
<tr><th>Syzygy ADJ</th><td>{{test.syzygy_adj}}</td></tr>
|
||||
<tr><th>Syzygy WDL</th><td>{{test.syzygy_wdl}}</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
@@ -84,7 +82,7 @@
|
||||
<a class="anchorbutton deadbutton">Delete</a>
|
||||
{% endif %}
|
||||
|
||||
<!-- ELO, SPRT, LLR, Games -->
|
||||
<!-- Elo, (SPRT/LRR if SPRT, otherwise CONF), Games -->
|
||||
<pre>{{test|longStatBlock|linebreaksbr}}</pre>
|
||||
|
||||
<!-- Forum to modify the Priority or Throughput -->
|
||||
|
||||
Reference in new issue
Block a user