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:
Andrew Grant committed 2021-06-28 17:37:18 -04:00
1 parent b331506434
commit 0da47c267c
8 files changed
+212 -130

No files matched your search

+12 -3
View File
@@ -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
View File
@@ -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)
+41 -19
View File
@@ -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
View File
@@ -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)
+8
View File
@@ -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))