From aa3e43b12522cd2f8ce4eed88aea4f3fa54c46cd Mon Sep 17 00:00:00 2001 From: andrew Date: Mon, 20 Feb 2023 21:20:09 -0500 Subject: [PATCH 01/51] Pass adjudication settings from the server. Allow defaults --- Client/Client.py | 9 +++-- OpenBench/config.py | 68 +++++++++++++++++++++++++++----- OpenBench/models.py | 3 ++ OpenBench/utils.py | 37 +++++++++++------ Templates/OpenBench/newTest.html | 41 ++++++++++--------- Templates/OpenBench/test.html | 6 ++- 6 files changed, 121 insertions(+), 43 deletions(-) diff --git a/Client/Client.py b/Client/Client.py index df666fa..037108d 100644 --- a/Client/Client.py +++ b/Client/Client.py @@ -48,7 +48,7 @@ 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 = 30 # Timeout in seconds between workload requests -CLIENT_VERSION = '4' # Client version to send to the Server +CLIENT_VERSION = '5' # Client version to send to the Server SYZYGY_WDL_PATH = None # Pathway to WDL Syzygy Tables BASE_GAMES_PER_CORE = 32 # Typical games played per-thread @@ -783,10 +783,13 @@ def build_cutechess_command(arguments, workload, dev_name, base_name, nps): dev_options = ' option.'.join([''] + dev_options.split()) base_options = ' option.'.join([''] + base_options.split()) + win_adj = ['', '-resign ' + workload['test']['win_adj' ]][workload['test']['win_adj' ] != 'None'] + draw_adj = ['', '-draw ' + workload['test']['draw_adj']][workload['test']['draw_adj'] != 'None'] + book_name = workload['test']['book']['name'] variant = ['standard', 'fischerandom']['FRC' in book_name.upper()] - flags = '-repeat -recover -resign %s -draw %s ' + flags = '-repeat -recover %s %s ' flags += '-srand %d -variant %s -concurrency %d -games %d ' flags += '-engine dir=Engines/ cmd=./%s proto=uci %s%s name=%s ' flags += '-engine dir=Engines/ cmd=./%s proto=uci %s%s name=%s ' @@ -805,7 +808,7 @@ def build_cutechess_command(arguments, workload, dev_name, base_name, nps): time_control = scale_time_control(workload, nps) args = ( - 'movecount=3 score=400', 'movenumber=40 movecount=8 score=10', + win_adj, draw_adj, int(time.time()), variant, concurrency, games, dev_name, time_control, dev_options, dev_name.rstrip('.exe'), base_name, time_control, base_options, base_name.rstrip('.exe'), diff --git a/OpenBench/config.py b/OpenBench/config.py index 0ee7a09..ae80a36 100644 --- a/OpenBench/config.py +++ b/OpenBench/config.py @@ -23,7 +23,7 @@ USE_CROSS_APPROVAL = False OPENBENCH_CONFIG = { # Server Client version control - 'client_version' : '4', + 'client_version' : '5', # Generic Error Messages useful to those setting up their own instance 'error' : { @@ -106,6 +106,9 @@ OPENBENCH_CONFIG = { 'bounds' : '[0.00, 3.00]', 'source' : 'https://github.com/AndyGrant/Ethereal', + 'win_adj' : 'movecount=3 score=400', + 'draw_adj' : 'movenumber=40 movecount=8 score=10', + 'build' : { 'path' : 'src', 'compilers' : ['clang', 'gcc'], @@ -113,14 +116,10 @@ OPENBENCH_CONFIG = { }, 'testmodes' : [ - { 'id' : 'STC', 'th' : 1, 'hash' : 8, 'tc' : '10.0+0.1' }, - { 'id' : 'LTC', 'th' : 1, 'hash' : 64, 'tc' : '60.0+0.6' }, - { 'id' : 'SMP STC', 'th' : 8, 'hash' : 64, 'tc' : '5.0+0.05' }, - { 'id' : 'SMP LTC', 'th' : 8, 'hash' : 256, 'tc' : '20.0+0.2' }, - { 'id' : 'STC Simplification', 'th' : 1, 'hash' : 8, 'tc' : '10.0+0.1', 'bounds' : '[-3.00, 1.00]' }, - { 'id' : 'LTC Simplification', 'th' : 1, 'hash' : 64, 'tc' : '60.0+0.6', 'bounds' : '[-3.00, 1.00]' }, - { 'id' : 'STC Regression', 'th' : 1, 'hash' : 8, 'tc' : '10.0+0.1', 'book' : '8moves_v3.epd', 'games' : 40000 }, - { 'id' : 'LTC Regression', 'th' : 1, 'hash' : 64, 'tc' : '60.0+0.6', 'book' : '8moves_v3.epd', 'games' : 40000 }, + { 'id' : 'STC', 'th' : 1, 'hash' : 8, 'tc' : '10.0+0.1' }, + { 'id' : 'LTC', 'th' : 1, 'hash' : 64, 'tc' : '60.0+0.6' }, + { 'id' : 'SMP STC', 'th' : 8, 'hash' : 64, 'tc' : '5.0+0.05' }, + { 'id' : 'SMP LTC', 'th' : 8, 'hash' : 256, 'tc' : '20.0+0.2' }, ], }, @@ -132,6 +131,9 @@ OPENBENCH_CONFIG = { 'bounds' : '[0.00, 5.00]', 'source' : 'https://github.com/jeffreyan11/uci-chess-engine', + 'win_adj' : 'movecount=3 score=400', + 'draw_adj' : 'movenumber=40 movecount=8 score=10', + 'build' : { 'path' : 'src', 'compilers' : ['g++'], @@ -154,6 +156,9 @@ OPENBENCH_CONFIG = { 'bounds' : '[-1.00, 4.00]', 'source' : 'https://github.com/TerjeKir/weiss', + 'win_adj' : 'movecount=3 score=400', + 'draw_adj' : 'movenumber=40 movecount=8 score=10', + 'build' : { 'path' : 'src', 'compilers' : ['gcc'], @@ -176,6 +181,9 @@ OPENBENCH_CONFIG = { 'bounds' : '[0.00, 5.00]', 'source' : 'https://github.com/lucasart/Demolito', + 'win_adj' : 'movecount=3 score=400', + 'draw_adj' : 'movenumber=40 movecount=8 score=10', + 'build' : { 'path' : 'src', 'compilers' : ['clang', 'gcc'], @@ -198,6 +206,9 @@ OPENBENCH_CONFIG = { 'bounds' : '[0.00, 5.00]', 'source' : 'https://github.com/Matthies/RubiChess', + 'win_adj' : 'movecount=3 score=400', + 'draw_adj' : 'movenumber=40 movecount=8 score=10', + 'build' : { 'path' : 'src', 'compilers' : ['g++'], @@ -220,6 +231,9 @@ OPENBENCH_CONFIG = { 'bounds' : '[0.00, 5.00]', 'source' : 'https://github.com/fabianvdW/FabChess', + 'win_adj' : 'movecount=3 score=400', + 'draw_adj' : 'movenumber=40 movecount=8 score=10', + 'build' : { 'path' : '', 'compilers' : ['cargo>=1.41.0'], @@ -242,6 +256,9 @@ OPENBENCH_CONFIG = { 'bounds' : '[0.00, 3.00]', 'source' : 'https://github.com/vshcherbyna/igel', + 'win_adj' : 'movecount=3 score=400', + 'draw_adj' : 'movenumber=40 movecount=8 score=10', + 'build' : { 'path' : 'src', 'compilers' : ['g++'], @@ -264,6 +281,9 @@ OPENBENCH_CONFIG = { 'bounds' : '[0.00, 5.00]', 'source' : 'https://github.com/rosenthj/Winter', + 'win_adj' : 'movecount=3 score=400', + 'draw_adj' : 'movenumber=40 movecount=8 score=10', + 'build' : { 'path' : '', 'compilers' : ['clang++', 'g++'], @@ -286,6 +306,9 @@ OPENBENCH_CONFIG = { 'bounds' : '[0.00, 5.00]', 'source' : 'https://github.com/KierenP/Halogen', + 'win_adj' : 'movecount=3 score=400', + 'draw_adj' : 'movenumber=40 movecount=8 score=10', + 'build' : { 'path' : 'src', 'compilers' : ['g++'], @@ -308,6 +331,9 @@ OPENBENCH_CONFIG = { 'bounds' : '[0.00, 5.00]', 'source' : 'https://github.com/mhouppin/stash-bot', + 'win_adj' : 'movecount=3 score=400', + 'draw_adj' : 'movenumber=40 movecount=8 score=10', + 'build' : { 'path' : 'src', 'compilers' : ['gcc', 'clang'], @@ -330,6 +356,9 @@ OPENBENCH_CONFIG = { 'bounds' : '[0.00, 5.00]', 'source' : 'https://github.com/connormcmonigle/seer-nnue', + 'win_adj' : 'movecount=3 score=400', + 'draw_adj' : 'movenumber=40 movecount=8 score=10', + 'build' : { 'path' : 'build', 'compilers' : ['g++>=9.0.0'], @@ -352,6 +381,9 @@ OPENBENCH_CONFIG = { 'bounds' : '[0.00, 2.50]', 'source' : 'https://github.com/Luecx/Koivisto', + 'win_adj' : 'movecount=3 score=400', + 'draw_adj' : 'movenumber=40 movecount=8 score=10', + 'build' : { 'path' : 'src_files', 'compilers' : ['g++'], @@ -374,6 +406,9 @@ OPENBENCH_CONFIG = { 'bounds' : '[0.00, 5.00]', 'source' : 'https://github.com/justNo4b/Drofa', + 'win_adj' : 'movecount=3 score=400', + 'draw_adj' : 'movenumber=40 movecount=8 score=10', + 'build' : { 'path' : '', 'compilers' : ['g++'], @@ -396,6 +431,9 @@ OPENBENCH_CONFIG = { 'bounds' : '[0.00, 5.00]', 'source' : 'https://github.com/Aryan1508/Bit-Genie', + 'win_adj' : 'movecount=3 score=400', + 'draw_adj' : 'movenumber=40 movecount=8 score=10', + 'build' : { 'path' : 'src', 'compilers' : ['g++'], @@ -418,6 +456,9 @@ OPENBENCH_CONFIG = { 'bounds' : '[0.00, 3.00]', 'source' : 'https://github.com/jhonnold/berserk', + 'win_adj' : 'movecount=3 score=400', + 'draw_adj' : 'movenumber=40 movecount=8 score=10', + 'build' : { 'path' : 'src', 'compilers' : ['gcc'], @@ -440,6 +481,9 @@ OPENBENCH_CONFIG = { 'bounds' : '[0.00, 5.00]', 'source' : 'https://github.com/amanjpro/zahak', + 'win_adj' : 'movecount=3 score=400', + 'draw_adj' : 'movenumber=40 movecount=8 score=10', + 'build' : { 'path' : '', 'compilers' : ['go'], @@ -462,6 +506,9 @@ OPENBENCH_CONFIG = { 'bounds' : '[0.00, 5.00]', 'source' : 'https://github.com/dsekercioglu/blackmarlin', + 'win_adj' : 'movecount=3 score=400', + 'draw_adj' : 'movenumber=40 movecount=8 score=10', + 'build' : { 'path' : '', 'compilers': ['cargo>=1.57.0'], @@ -484,6 +531,9 @@ OPENBENCH_CONFIG = { 'bounds' : '[0.00, 5.00]', 'source' : 'https://github.com/kz04px/4ku', + 'win_adj' : 'movecount=3 score=400', + 'draw_adj' : 'movenumber=40 movecount=8 score=10', + 'build' : { 'path' : '', 'compilers' : ['g++'], diff --git a/OpenBench/models.py b/OpenBench/models.py index ef32e14..fb419ac 100644 --- a/OpenBench/models.py +++ b/OpenBench/models.py @@ -103,6 +103,9 @@ class Test(Model): syzygy_adj = CharField(max_length=16, default='OPTIONAL') syzygy_wdl = CharField(max_length=16, default='OPTIONAL') + win_adj = CharField(max_length=64, default='movecount=3 score=400') + draw_adj = CharField(max_length=64, default='movenumber=40 movecount=8 score=10') + # Only for SPRT Tests elolower = FloatField(default=0.0) eloupper = FloatField(default=0.0) diff --git a/OpenBench/utils.py b/OpenBench/utils.py index befec4a..face156 100644 --- a/OpenBench/utils.py +++ b/OpenBench/utils.py @@ -203,25 +203,35 @@ def verifyNewTest(request): def verifyInteger(field, fieldName): try: int(request.POST[field]) - except: errors.append('{0} is not an Integer'.format(fieldName)) + except: errors.append('"{0}" is not an Integer'.format(fieldName)) def verifyGreaterThan(field, fieldName, value, valueName): if not float(request.POST[field]) > value: - errors.append('{0} is not greater than {1}'.format(fieldName, valueName)) + errors.append('"{0}" is not greater than {1}'.format(fieldName, valueName)) def verifyOptions(field, option, fieldName): if extractOption(request.POST[field], option) == None: - errors.append('{0} was not found as an option for {1}'.format(option, fieldName)) + errors.append('"{0}" was not found as an option for {1}'.format(option, fieldName)) elif int(extractOption(request.POST[field], option)) < 1: - errors.append('{0} needs to be at least 1 for {1}'.format(option, fieldName)) + errors.append('"{0}" needs to be at least 1 for {1}'.format(option, fieldName)) def verifyConfiguration(field, fieldName, parent): if request.POST[field] not in OpenBench.config.OPENBENCH_CONFIG[parent].keys(): - errors.append('{0} was not found in the configuration'.format(fieldName)) + errors.append('"{0}" was not found in the configuration'.format(fieldName)) def verifyTimeControl(field, fieldName): try: parseTimeControl(request.POST[field]) - except: errors.append('{0} is not a parsable {1}'.format(request.POST[field], fieldName)) + except: errors.append('"{0}" is not a parsable {1}'.format(request.POST[field], fieldName)) + + def verifyWinAdjudication(field): + if (content := request.POST[field]) == 'None': return + try: assert re.match('movecount=[0-9]+ score=[0-9]+', content) + except: errors.append('"{0}" is not a parsable Win Adjudication Seting'.format(content)) + + def verifyDrawAdjudication(field): + if (content := request.POST[field]) == 'None': return + try: assert re.match('movenumber=[0-9]+ movecount=[0-9]+ score=[0-9]+', content) + except: errors.append('"{0}" is not a parsable Draw Adjudication Seting'.format(content)) verifications = [ (verifyInteger, 'priority', 'Priority'), @@ -234,6 +244,8 @@ def verifyNewTest(request): (verifyConfiguration, 'enginename', 'Engine', 'engines'), (verifyConfiguration, 'bookname', 'Book', 'books'), (verifyTimeControl, 'timecontrol', 'Time Control'), + (verifyWinAdjudication, 'win_adj'), + (verifyDrawAdjudication, 'draw_adj'), ] for verification in verifications: @@ -244,7 +256,7 @@ def verifyNewTest(request): def createNewTest(request): - errors = []; verifyNewTest(request) + errors = verifyNewTest(request) if errors != []: return None, errors devinfo = getBranch(request, errors, 'dev') @@ -264,8 +276,10 @@ def createNewTest(request): test.timecontrol = parseTimeControl(request.POST['timecontrol']) test.priority = int(request.POST['priority']) test.throughput = int(request.POST['throughput']) - test.syzygy_adj = request.POST['syzygy_adj'] test.syzygy_wdl = request.POST['syzygy_wdl'] + test.syzygy_adj = request.POST['syzygy_adj'] + test.win_adj = request.POST['win_adj'] + test.draw_adj = request.POST['draw_adj'] if request.POST['test_mode'] == 'SPRT': test.elolower = float(request.POST['bounds'].split(',')[0].lstrip('[')) @@ -430,14 +444,15 @@ def workload_to_dictionary(test, result, machine): 'test' : { - 'throughput' : 1000, # HACK: Updated Client's no longer need this value - 'id' : test.id, 'engine' : test.engine, 'timecontrol' : test.timecontrol, - 'syzygy_adj' : test.syzygy_adj, 'syzygy_wdl' : test.syzygy_wdl, + 'syzygy_adj' : test.syzygy_adj, + 'win_adj' : test.win_adj, + 'draw_adj' : test.draw_adj, + 'nps' : OPENBENCH_CONFIG['engines'][test.engine]['nps'], 'build' : OPENBENCH_CONFIG['engines'][test.engine]['build'], 'book' : OPENBENCH_CONFIG['books'][test.bookname], diff --git a/Templates/OpenBench/newTest.html b/Templates/OpenBench/newTest.html index 6fb083c..dc79e67 100644 --- a/Templates/OpenBench/newTest.html +++ b/Templates/OpenBench/newTest.html @@ -4,21 +4,23 @@ var Configurations = { {% for name, data in config.engines.items %} - '{{name}}' : { - 'base' : "{{data.base}}", - 'book' : "{{data.book}}", - 'bounds' : "{{data.bounds}}", + "{{name}}" : { + "base" : "{{data.base}}", + "book" : "{{data.book}}", + "bounds" : "{{data.bounds}}", + "win_adj" : "{{data.win_adj}}", + "draw_adj" : "{{data.draw_adj}}", }, {% endfor %} }; var TestModes = { {% for name, data in config.engines.items %} - '{{name}}' : [ + "{{name}}" : [ {% for mode in data.testmodes %} { {% for key, value in mode.items %} - '{{key}}' : '{{value}}', + "{{key}}" : "{{value}}", {% endfor %} }, {% endfor %} @@ -162,14 +164,12 @@ baseopt.selected = (hasdefault == false); basenet.add(baseopt); } - var base_branch = document.getElementById("basebranch"); - base_branch.value = Configurations[engine]["base"]; - - var book_selection = document.getElementById("bookname"); - book_selection.value = Configurations[engine]["book"]; + document.getElementById("basebranch").value = Configurations[engine]["base"]; + document.getElementById("bookname" ).value = Configurations[engine]["book"]; + document.getElementById("win_adj" ).value = Configurations[engine]["win_adj"]; + document.getElementById("draw_adj" ).value = Configurations[engine]["draw_adj"]; } - document.addEventListener( 'DOMContentLoaded', function () { set_test_type(); @@ -231,18 +231,23 @@

-
-
+

Adjudication Settings

+ +
+ +
+
+
diff --git a/Templates/OpenBench/test.html b/Templates/OpenBench/test.html index 391fe89..7bf1395 100644 --- a/Templates/OpenBench/test.html +++ b/Templates/OpenBench/test.html @@ -35,9 +35,11 @@ {% endif %} Source Repo{{test.source}} Opening Book{{test.bookname}} - - Syzygy ADJ{{test.syzygy_adj}} Syzygy WDL{{test.syzygy_wdl}} + Syzygy ADJ.{{test.syzygy_adj}} + Win ADJ.{{test.win_adj}} + Draw ADJ.{{test.draw_adj}} + From 4e4da633d6243f835c92338cd515c97f3d16c9da Mon Sep 17 00:00:00 2001 From: andrew Date: Wed, 22 Feb 2023 06:15:31 -0500 Subject: [PATCH 02/51] Allow blocking of public access to OpenBench --- OpenBench/config.py | 2 ++ OpenBench/views.py | 13 ++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/OpenBench/config.py b/OpenBench/config.py index ae80a36..c0234b3 100644 --- a/OpenBench/config.py +++ b/OpenBench/config.py @@ -20,6 +20,8 @@ USE_CROSS_APPROVAL = False +REQUIRE_LOGIN_TO_VIEW = False + OPENBENCH_CONFIG = { # Server Client version control diff --git a/OpenBench/views.py b/OpenBench/views.py index c558b24..b807541 100644 --- a/OpenBench/views.py +++ b/OpenBench/views.py @@ -47,11 +47,18 @@ from htmlmin.decorators import not_minified_response class UnableToAuthenticate(Exception): pass -def render(request, template, content={}): +def render(request, template, content={}, always_allow=False): data = content.copy() data.update({'config' : OpenBench.config.OPENBENCH_CONFIG}) + if OpenBench.config.REQUIRE_LOGIN_TO_VIEW: + + if not request.user.is_authenticated and not always_allow: + return django.http.HttpResponseRedirect('/login/') + + return django.shortcuts.render(request, 'OpenBench/{0}'.format(template), data) + if request.user.is_authenticated: profile = Profile.objects.filter(user=request.user) @@ -123,7 +130,7 @@ def register(request): # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # if request.method == 'GET': - return render(request, 'register.html') + return render(request, 'register.html', always_allow=True) if request.POST['password1'] != request.POST['password2']: return index(request, error='Passwords Do Not Match') @@ -156,7 +163,7 @@ def login(request): # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # if request.method == 'GET': - return render(request, 'login.html') + return render(request, 'login.html', always_allow=True) try: user = authenticate(request) From 7324bb1dc1f0534615b9583eaf1d0e88beff5be1 Mon Sep 17 00:00:00 2001 From: andrew Date: Sat, 4 Mar 2023 22:54:10 -0500 Subject: [PATCH 03/51] Add private boolean to each engine config --- OpenBench/config.py | 199 ++++++++++++++++++++++++-------------------- 1 file changed, 108 insertions(+), 91 deletions(-) diff --git a/OpenBench/config.py b/OpenBench/config.py index c0234b3..fb88594 100644 --- a/OpenBench/config.py +++ b/OpenBench/config.py @@ -38,7 +38,6 @@ OPENBENCH_CONFIG = { 'corefiles' : 'https://raw.githubusercontent.com/AndyGrant/OpenBench/master/CoreFiles', # Test Configuration. For both SPRT and Fixed Games Tests - 'tests' : { 'max_games' : '20000', # Default for Fixed Games 'confidence' : '[0.05, 0.05]', # SPRT Type I/II Confidence @@ -102,11 +101,12 @@ OPENBENCH_CONFIG = { 'Ethereal' : { - 'nps' : 1050000, - 'base' : 'master', - 'book' : 'Pohl.epd', - 'bounds' : '[0.00, 3.00]', - 'source' : 'https://github.com/AndyGrant/Ethereal', + 'nps' : 1050000, + 'base' : 'master', + 'book' : 'Pohl.epd', + 'bounds' : '[0.00, 3.00]', + 'source' : 'https://github.com/AndyGrant/Ethereal', + 'private' : False, 'win_adj' : 'movecount=3 score=400', 'draw_adj' : 'movenumber=40 movecount=8 score=10', @@ -127,11 +127,12 @@ OPENBENCH_CONFIG = { 'Laser' : { - 'nps' : 935000, - 'base' : 'master', - 'book' : 'Pohl.epd', - 'bounds' : '[0.00, 5.00]', - 'source' : 'https://github.com/jeffreyan11/uci-chess-engine', + 'nps' : 935000, + 'base' : 'master', + 'book' : 'Pohl.epd', + 'bounds' : '[0.00, 5.00]', + 'source' : 'https://github.com/jeffreyan11/uci-chess-engine', + 'private' : False, 'win_adj' : 'movecount=3 score=400', 'draw_adj' : 'movenumber=40 movecount=8 score=10', @@ -152,11 +153,12 @@ OPENBENCH_CONFIG = { 'Weiss' : { - 'nps' : 1700000, - 'base' : 'master', - 'book' : 'Pohl.epd', - 'bounds' : '[-1.00, 4.00]', - 'source' : 'https://github.com/TerjeKir/weiss', + 'nps' : 1700000, + 'base' : 'master', + 'book' : 'Pohl.epd', + 'bounds' : '[-1.00, 4.00]', + 'source' : 'https://github.com/TerjeKir/weiss', + 'private' : False, 'win_adj' : 'movecount=3 score=400', 'draw_adj' : 'movenumber=40 movecount=8 score=10', @@ -177,11 +179,12 @@ OPENBENCH_CONFIG = { 'Demolito' : { - 'nps' : 1300000, - 'base' : 'master', - 'book' : 'Pohl.epd', - 'bounds' : '[0.00, 5.00]', - 'source' : 'https://github.com/lucasart/Demolito', + 'nps' : 1300000, + 'base' : 'master', + 'book' : 'Pohl.epd', + 'bounds' : '[0.00, 5.00]', + 'source' : 'https://github.com/lucasart/Demolito', + 'private' : False, 'win_adj' : 'movecount=3 score=400', 'draw_adj' : 'movenumber=40 movecount=8 score=10', @@ -202,11 +205,12 @@ OPENBENCH_CONFIG = { 'RubiChess' : { - 'nps' : 925000, - 'base' : 'master', - 'book' : 'Pohl.epd', - 'bounds' : '[0.00, 5.00]', - 'source' : 'https://github.com/Matthies/RubiChess', + 'nps' : 925000, + 'base' : 'master', + 'book' : 'Pohl.epd', + 'bounds' : '[0.00, 5.00]', + 'source' : 'https://github.com/Matthies/RubiChess', + 'private' : False, 'win_adj' : 'movecount=3 score=400', 'draw_adj' : 'movenumber=40 movecount=8 score=10', @@ -227,11 +231,12 @@ OPENBENCH_CONFIG = { 'FabChess' : { - 'nps' : 1000000, - 'base' : 'master', - 'book' : 'Pohl.epd', - 'bounds' : '[0.00, 5.00]', - 'source' : 'https://github.com/fabianvdW/FabChess', + 'nps' : 1000000, + 'base' : 'master', + 'book' : 'Pohl.epd', + 'bounds' : '[0.00, 5.00]', + 'source' : 'https://github.com/fabianvdW/FabChess', + 'private' : False, 'win_adj' : 'movecount=3 score=400', 'draw_adj' : 'movenumber=40 movecount=8 score=10', @@ -252,11 +257,12 @@ OPENBENCH_CONFIG = { 'Igel' : { - 'nps' : 450000, - 'base' : 'master', - 'book' : 'Pohl.epd', - 'bounds' : '[0.00, 3.00]', - 'source' : 'https://github.com/vshcherbyna/igel', + 'nps' : 450000, + 'base' : 'master', + 'book' : 'Pohl.epd', + 'bounds' : '[0.00, 3.00]', + 'source' : 'https://github.com/vshcherbyna/igel', + 'private' : False, 'win_adj' : 'movecount=3 score=400', 'draw_adj' : 'movenumber=40 movecount=8 score=10', @@ -277,11 +283,12 @@ OPENBENCH_CONFIG = { 'Winter' : { - 'nps' : 625000, - 'base' : 'master', - 'book' : 'Pohl.epd', - 'bounds' : '[0.00, 5.00]', - 'source' : 'https://github.com/rosenthj/Winter', + 'nps' : 625000, + 'base' : 'master', + 'book' : 'Pohl.epd', + 'bounds' : '[0.00, 5.00]', + 'source' : 'https://github.com/rosenthj/Winter', + 'private' : False, 'win_adj' : 'movecount=3 score=400', 'draw_adj' : 'movenumber=40 movecount=8 score=10', @@ -302,11 +309,12 @@ OPENBENCH_CONFIG = { 'Halogen' : { - 'nps' : 1800000, - 'base' : 'master', - 'book' : 'Pohl.epd', - 'bounds' : '[0.00, 5.00]', - 'source' : 'https://github.com/KierenP/Halogen', + 'nps' : 1800000, + 'base' : 'master', + 'book' : 'Pohl.epd', + 'bounds' : '[0.00, 5.00]', + 'source' : 'https://github.com/KierenP/Halogen', + 'private' : False, 'win_adj' : 'movecount=3 score=400', 'draw_adj' : 'movenumber=40 movecount=8 score=10', @@ -327,11 +335,12 @@ OPENBENCH_CONFIG = { 'Stash' : { - 'nps' : 1625000, - 'base' : 'master', - 'book' : '4moves_noob.epd', - 'bounds' : '[0.00, 5.00]', - 'source' : 'https://github.com/mhouppin/stash-bot', + 'nps' : 1625000, + 'base' : 'master', + 'book' : '4moves_noob.epd', + 'bounds' : '[0.00, 5.00]', + 'source' : 'https://github.com/mhouppin/stash-bot', + 'private' : False, 'win_adj' : 'movecount=3 score=400', 'draw_adj' : 'movenumber=40 movecount=8 score=10', @@ -352,11 +361,12 @@ OPENBENCH_CONFIG = { 'Seer' : { - 'nps' : 875000, - 'base' : 'main', - 'book' : 'Pohl.epd', - 'bounds' : '[0.00, 5.00]', - 'source' : 'https://github.com/connormcmonigle/seer-nnue', + 'nps' : 875000, + 'base' : 'main', + 'book' : 'Pohl.epd', + 'bounds' : '[0.00, 5.00]', + 'source' : 'https://github.com/connormcmonigle/seer-nnue', + 'private' : False, 'win_adj' : 'movecount=3 score=400', 'draw_adj' : 'movenumber=40 movecount=8 score=10', @@ -377,11 +387,12 @@ OPENBENCH_CONFIG = { 'Koivisto' : { - 'nps' : 1200000, - 'base' : 'master', - 'book' : 'Pohl.epd', - 'bounds' : '[0.00, 2.50]', - 'source' : 'https://github.com/Luecx/Koivisto', + 'nps' : 1200000, + 'base' : 'master', + 'book' : 'Pohl.epd', + 'bounds' : '[0.00, 2.50]', + 'source' : 'https://github.com/Luecx/Koivisto', + 'private' : False, 'win_adj' : 'movecount=3 score=400', 'draw_adj' : 'movenumber=40 movecount=8 score=10', @@ -402,11 +413,12 @@ OPENBENCH_CONFIG = { 'Drofa' : { - 'nps' : 1250000, - 'base' : 'master', - 'book' : '4moves_noob.epd', - 'bounds' : '[0.00, 5.00]', - 'source' : 'https://github.com/justNo4b/Drofa', + 'nps' : 1250000, + 'base' : 'master', + 'book' : '4moves_noob.epd', + 'bounds' : '[0.00, 5.00]', + 'source' : 'https://github.com/justNo4b/Drofa', + 'private' : False, 'win_adj' : 'movecount=3 score=400', 'draw_adj' : 'movenumber=40 movecount=8 score=10', @@ -427,11 +439,12 @@ OPENBENCH_CONFIG = { 'Bit-Genie' : { - 'nps' : 1975000, - 'base' : 'master', - 'book' : 'Pohl.epd', - 'bounds' : '[0.00, 5.00]', - 'source' : 'https://github.com/Aryan1508/Bit-Genie', + 'nps' : 1975000, + 'base' : 'master', + 'book' : 'Pohl.epd', + 'bounds' : '[0.00, 5.00]', + 'source' : 'https://github.com/Aryan1508/Bit-Genie', + 'private' : False, 'win_adj' : 'movecount=3 score=400', 'draw_adj' : 'movenumber=40 movecount=8 score=10', @@ -452,11 +465,12 @@ OPENBENCH_CONFIG = { 'Berserk' : { - 'nps' : 1325000, - 'base' : 'main', - 'book' : 'Pohl.epd', - 'bounds' : '[0.00, 3.00]', - 'source' : 'https://github.com/jhonnold/berserk', + 'nps' : 1325000, + 'base' : 'main', + 'book' : 'Pohl.epd', + 'bounds' : '[0.00, 3.00]', + 'source' : 'https://github.com/jhonnold/berserk', + 'private' : False, 'win_adj' : 'movecount=3 score=400', 'draw_adj' : 'movenumber=40 movecount=8 score=10', @@ -477,11 +491,12 @@ OPENBENCH_CONFIG = { 'Zahak' : { - 'nps' : 850000, - 'base' : 'master', - 'book' : 'Pohl.epd', - 'bounds' : '[0.00, 5.00]', - 'source' : 'https://github.com/amanjpro/zahak', + 'nps' : 850000, + 'base' : 'master', + 'book' : 'Pohl.epd', + 'bounds' : '[0.00, 5.00]', + 'source' : 'https://github.com/amanjpro/zahak', + 'private' : False, 'win_adj' : 'movecount=3 score=400', 'draw_adj' : 'movenumber=40 movecount=8 score=10', @@ -502,11 +517,12 @@ OPENBENCH_CONFIG = { 'BlackMarlin' : { - 'nps' : 1075000, - 'base' : 'main', - 'book' : 'Pohl.epd', - 'bounds' : '[0.00, 5.00]', - 'source' : 'https://github.com/dsekercioglu/blackmarlin', + 'nps' : 1075000, + 'base' : 'main', + 'book' : 'Pohl.epd', + 'bounds' : '[0.00, 5.00]', + 'source' : 'https://github.com/dsekercioglu/blackmarlin', + 'private' : False, 'win_adj' : 'movecount=3 score=400', 'draw_adj' : 'movenumber=40 movecount=8 score=10', @@ -527,11 +543,12 @@ OPENBENCH_CONFIG = { '4ku' : { - 'nps' : 1225000, - 'base' : 'master', - 'book' : 'Pohl.pgn', - 'bounds' : '[0.00, 5.00]', - 'source' : 'https://github.com/kz04px/4ku', + 'nps' : 1225000, + 'base' : 'master', + 'book' : 'Pohl.pgn', + 'bounds' : '[0.00, 5.00]', + 'source' : 'https://github.com/kz04px/4ku', + 'private' : False, 'win_adj' : 'movecount=3 score=400', 'draw_adj' : 'movenumber=40 movecount=8 score=10', From c02e0782b69a53d7ffc67e0448a584dde143b004 Mon Sep 17 00:00:00 2001 From: andrew Date: Tue, 7 Mar 2023 23:12:23 -0500 Subject: [PATCH 04/51] Add Support for Private source engines Private source engines must be located on Github. All test branches must come from the same repo as stated in the config. Repo must have an openbench.yml file that produces artifacts for the workers. Basic name scheme: windows-avx2-pext, linux-avx512-pext, ... Desired artifacts can be set in the engine config under ['build']['artifacts'] Server must have a private key, housed in credentials.enginename. Client must have a private key, housed in credentials.enginename. enginename is lowercase and with spaces removed. Private engines cannot build their NNUE files directly into them. They must therefore support being run from the CMD line, with additional options. Namely: ./engine "setoption name EvalFile value path/to/file" "bench" "quit". --- Client/Client.py | 206 ++++++++++++++++++++++--------- OpenBench/config.py | 38 +++--- OpenBench/templatetags/mytags.py | 10 +- OpenBench/utils.py | 153 ++++++++++++++++++----- OpenBench/views.py | 1 + 5 files changed, 296 insertions(+), 112 deletions(-) diff --git a/Client/Client.py b/Client/Client.py index 037108d..9e220ea 100644 --- a/Client/Client.py +++ b/Client/Client.py @@ -48,7 +48,7 @@ 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 = 30 # Timeout in seconds between workload requests -CLIENT_VERSION = '5' # Client version to send to the Server +CLIENT_VERSION = '6' # Client version to send to the Server SYZYGY_WDL_PATH = None # Pathway to WDL Syzygy Tables BASE_GAMES_PER_CORE = 32 # Typical games played per-thread @@ -86,6 +86,7 @@ IS_WINDOWS = platform.system() == 'Windows' IS_LINUX = platform.system() != 'Windows' COMPILERS = {} # Compiler for each Engine, + CPU Flags +CPUINFO = '' # Result of ``echo | gcc -march=native -E -dM -`` OSNAME = '%s %s' % (platform.system(), platform.release()) DEBUG = True @@ -207,9 +208,9 @@ def try_until_success(mesg): return __try_until_success return _try_until_success -def download_file(source, outname, post_data=None): +def download_file(source, outname, post_data=None, headers=None): - arguments = { 'stream' : True, 'timeout' : TIMEOUT_ERROR } + arguments = { 'stream' : True, 'timeout' : TIMEOUT_ERROR, 'headers' : headers } function = [requests.get, requests.post][post_data != None] if post_data: arguments['data'] = post_data @@ -260,11 +261,15 @@ def parse_bench_output(stream): bench = int(re.search(r'[0-9]+', bench).group()) if bench else None return (nps, bench) -def run_bench(engine, outqueue): +def run_bench(engine, outqueue, private_net=None): try: + # We may need to set an EvalFile via the UCI Options + if not private_net: cmd = ['./' + engine, 'bench'] + else: cmd = ['./' + engine, 'setoption name EvalFile value %s' % (private_net), 'bench', 'quit'] + # Launch the engine and parse output for statistics - process = Popen(['./' + engine, 'bench'], stdout=PIPE, stderr=PIPE) + process = Popen(cmd, stdout=PIPE, stderr=PIPE) stdout, stderr = process.communicate() outqueue.put(parse_bench_output(stdout)) except Exception: outqueue.put((0, 0)) @@ -389,8 +394,6 @@ def server_download_cutechess(arguments): @try_until_success(mesg=ERRORS['configure']) def server_configure_worker(arguments): - print ('\nScanning for Compilers...') - # Fetch { Engine -> Compilers } from the server target = url_join(arguments.server, 'clientGetBuildInfo') data = requests.get(target, timeout=TIMEOUT_HTTP).json() @@ -410,8 +413,15 @@ def server_configure_worker(arguments): stdout = process.communicate()[0].decode('utf-8') return re.search(r'[0-9]+\.[0-9]+\.[0-9]+', stdout).group() + print ('\nScanning for Compilers...') + # For each engine, attempt to find a valid compiler for engine, build_info in data.items(): + + # Private engines don't need to be compiled + if build_info['private']: + continue + for compiler in build_info['compilers']: # Compilers may require a specific version @@ -425,33 +435,47 @@ def server_configure_worker(arguments): # Compiler version was sufficient if tuple(map(int, match.split('.'))) >= version: - print('%14s | %s (%s)' % (engine, compiler, match)) + print('%-20s | %-8s (%s)' % (engine, compiler, match)) COMPILERS[engine] = compiler break # Report missing engines in case the User is not expecting it - for engine in filter(lambda x: x not in COMPILERS, data): + for engine in filter(lambda x: x not in COMPILERS and not data[x]['private'], data): compiler = data[engine]['compilers'] - print('%14s | Missing %s' % (engine, compiler)) + print('%-20s | Missing %s' % (engine, compiler)) + + print ('\nScanning for Private Tokens...') + + # For each engine, attempt to find a valid compiler + for engine, build_info in data.items(): + + # Public engines don't need access tokens + if not build_info['private']: + continue + + # Private engines expect a credentials.engine file for the main repo + has_token = os.path.exists('credentials.%s' % (engine.replace(' ', '').lower())) + print('%-20s | %s' % (engine, ['Missing', 'Found'][has_token])) + if has_token: COMPILERS[engine] = True print('\nScanning for CPU Flags...') # Use GCC -march=native to find CPU info - stdout, stderr = Popen( + CPUINFO = str(Popen( 'echo | gcc -march=native -E -dM -', stdout=PIPE, shell=True - ).communicate() + ).communicate()[0]) # Check for each requested flag using the gcc dump desired = [info['cpuflags'] for engine, info in data.items()] flags = set(sum(desired, [])) # Trick to flatten the list - actual = set(f for f in flags if '__%s__ 1' % (f) in str(stdout)) - - # Report and save to global configuration - print(' Found |', ' '.join(list(actual))) - print(' Missing |', ' '.join(list(flags - actual))) + actual = set(f for f in flags if '%s 1' % (f) in CPUINFO) COMPILERS['cpuflags'] = ' '.join(list(actual)) + # Print out the results of our search + for flag in sorted(flags): + print ('%-20s | %s' % (flag, ['Missing', 'Found'][flag in actual])) + @try_until_success(mesg=ERRORS['request']) def server_request_workload(arguments): @@ -478,6 +502,20 @@ def server_request_workload(arguments): target = url_join(arguments.server, 'clientGetWorkload') return requests.post(target, data=payload, timeout=TIMEOUT_HTTP) +def server_report_missing_artifact(arguments, workload, branch, artifact_name, artifact_json): + + payload = { + 'username' : arguments.username, + 'password' : arguments.password, + 'testid' : workload['test']['id'], + 'machineid' : workload['machine']['id'], + 'error' : 'Artifact %s missing' % (artifact_name), + 'logs' : json.dumps(artifact_json, indent=2), + } + + target = url_join(arguments.server, 'clientSubmitError') + requests.post(target, data=payload, timeout=TIMEOUT_HTTP) + def server_report_build_fail(arguments, workload, branch, compiler_output): payload = { @@ -602,17 +640,17 @@ def check_workload_response(arguments, response): def complete_workload(arguments, workload): - dev_network = download_network_weights(arguments, workload, 'dev') + dev_network = download_network_weights(arguments, workload, 'dev' ) base_network = download_network_weights(arguments, workload, 'base') - dev_name = download_engine(arguments, workload, 'dev', dev_network) + dev_name = download_engine(arguments, workload, 'dev' , dev_network ) base_name = download_engine(arguments, workload, 'base', base_network) if dev_name == None or base_name == None: return - dev_bench, dev_nps = run_benchmarks(arguments, workload, 'dev', dev_name) - base_bench, base_nps = run_benchmarks(arguments, workload, 'base', base_name) + dev_bench, dev_nps = run_benchmarks(arguments, workload, 'dev' , dev_name , dev_network ) + base_bench, base_nps = run_benchmarks(arguments, workload, 'base', base_name, base_network) - dev_status = verify_benchmarks(arguments, workload, 'dev', dev_bench) + dev_status = verify_benchmarks(arguments, workload, 'dev' , dev_bench ) base_status = verify_benchmarks(arguments, workload, 'base', base_bench) if not dev_status or not base_status: return @@ -695,37 +733,71 @@ def download_engine(arguments, workload, branch, network): commit_sha = workload['test'][branch]['sha'] source = workload['test'][branch]['source'] build_path = workload['test']['build']['path'] + private = workload['engine']['private'] - if arguments.proxy: source = 'https://ghproxy.com/' + source - - pattern = '\nEngine: [%s] %s\nCommit: %s' - print(pattern % (engine, branch_name, commit_sha.upper())) - - # Naming as Engine-SHA256[:8]-NETSHA256[:8] + # Naming as Engine-CommitSha[:8]-NetworkSha[:8] final_name = '%s-%s' % (engine, commit_sha.upper()[:8]) - if network: final_name += '-%s' % (network[-8:]) + if network and not private: final_name += '-%s' % (network[-8:]) # Check to see if we already have the final binary final_path = os.path.join('Engines', final_name) if os.path.isfile(final_path): return final_name if os.path.isfile(final_path + '.exe'): return final_name + '.exe' - # Download and unzip the source from Github - download_file(source, '%s.zip' % (engine)) - unzip_delete_file('%s.zip' % (engine), 'tmp/') + if private: - # Parse out paths to find the makefile location - tokens = source.split('/') - unzip_name = '%s-%s' % (tokens[-3], tokens[-1].rstrip('.zip')) - src_path = os.path.join('tmp', unzip_name, *build_path.split('/')) + # Get the candidate artifacts that we can pick from + print ('\nFetching Artifacts for %s' % branch_name) + with open('credentials.%s' % (engine.replace(' ', '').lower())) as fin: + auth_headers = { 'Authorization' : 'token %s' % fin.readlines()[0].rstrip() } + artifacts = requests.get(url=source, headers=auth_headers).json()['artifacts'] - # Build the engine and drop it into src_path - print('\nBuilding [%s]' % (final_path)) - output_name = os.path.join(src_path, engine) - command = make_command(arguments, engine, src_path, network) - process = Popen(command, cwd=src_path, stdout=PIPE, stderr=STDOUT) - compiler_output = process.communicate()[0].decode('utf-8') - print (compiler_output) + # Construct the artifact string for the desired binary + old_ryzen = '__znver1' in str(CPUINFO) or '__znver2' in str(CPUINFO) + os_string = ['windows', 'linux' ][IS_LINUX] + avx_string = ['avx2' , 'avx512']['__AVX512VNNI__ 1' in str(CPUINFO)] + bit_string = ['popcnt' , 'pext' ]['__BMI2__ 1' in str(CPUINFO) and not old_ryzen] + desired = '%s-%s-%s' % (os_string, avx_string, bit_string) + + # Search for our artifact in the list provided + artifact_id = None + for artifact in artifacts: + if artifact['name'] == '%s-%s' % (commit_sha, desired): + artifact_id = artifact['id'] + + # Artifact was missing, workload cannot be completed + if artifact_id == None: + server_report_missing_artifact(arguments, workload, branch, desired, artifacts) + return None + + # Download the binary that matches our desired artifact + print ('Downloading [%s] %s' % (branch_name, desired)) + base = source.split('/runs/')[0] + url = url_join(base, 'artifacts', str(artifact_id), 'zip').rstrip('/') + download_file(url, 'artifact.zip', None, auth_headers) + + # Unzip the binary, and determine where to move the binary + unzip_delete_file('artifact.zip', 'tmp/') + output_name = os.path.join('tmp', engine) + + if not private: + + # Download and unzip the source from Github + download_file(source, '%s.zip' % (engine)) + unzip_delete_file('%s.zip' % (engine), 'tmp/') + + # Parse out paths to find the makefile location + tokens = source.split('/') + unzip_name = '%s-%s' % (tokens[-3], tokens[-1].rstrip('.zip')) + src_path = os.path.join('tmp', unzip_name, *build_path.split('/')) + + # Build the engine and drop it into src_path + print('\nBuilding [%s]' % (final_path)) + output_name = os.path.join(src_path, engine) + command = make_command(arguments, engine, src_path, network) + process = Popen(command, cwd=src_path, stdout=PIPE, stderr=STDOUT) + cxx_output = process.communicate()[0].decode('utf-8') + print (cxx_output) # Move the file to the final location ( Linux ) if os.path.isfile(output_name): @@ -739,21 +811,23 @@ def download_engine(arguments, workload, branch, network): shutil.rmtree('tmp') return final_name + '.exe' - # Notify the server if the build failed - server_report_build_fail(arguments, workload, branch, compiler_output) - return None + # Manual builds should have exited by now + if not private: + server_report_build_fail(arguments, workload, branch, cxx_output) + return None -def run_benchmarks(arguments, workload, branch, engine): +def run_benchmarks(arguments, workload, branch, engine, network): - cores = int(arguments.threads) - queue = multiprocessing.Queue() - name = workload['test'][branch]['name'] + cores = int(arguments.threads) + queue = multiprocessing.Queue() + name = workload['test'][branch]['name'] + private = workload['engine']['private'] print('\nRunning %dx Benchmarks for %s' % (cores, name)) for ii in range(cores): - args = (os.path.join('Engines', engine), queue,) - proc = multiprocessing.Process(target=run_bench, args=args) - proc.start() + args = [os.path.join('Engines', engine), queue] + if private and network: args.append(network) + multiprocessing.Process(target=run_bench, args=args).start() nps, bench = list(zip(*[queue.get() for ii in range(cores)])) if len(set(bench)) > 1: return (0, 0) # Flag an error @@ -767,7 +841,7 @@ def verify_benchmarks(arguments, workload, branch, bench): server_report_bad_bench(arguments, workload, branch, bench) return bench == int(workload['test'][branch]['bench']) -def build_cutechess_command(arguments, workload, dev_name, base_name, nps): +def build_cutechess_command(arguments, workload, dev_cmd, base_cmd, nps): dev_options = workload['test']['dev' ]['options'] base_options = workload['test']['base']['options'] @@ -775,11 +849,29 @@ 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()) + dev_name = dev_cmd.rstrip('.exe') # Used to name the PGN file and Headers + base_name = base_cmd.rstrip('.exe') # Used to name the PGN file and Headers + + # Possibly add SyzygyPath to dev and base options 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) + # Add EvalFile to the options for Private engines using Networks + if workload['engine']['private']: + + dev_network = workload['test']['dev' ]['network'] + if dev_network and dev_network != 'None': + dev_options += ' EvalFile=%s' % (os.path.join('../Networks', dev_network)) + dev_name += '-%s' % (dev_network) + + base_network = workload['test']['base']['network'] + if base_network and base_network != 'None': + base_options += ' EvalFile=%s' % (os.path.join('../Networks', base_network)) + base_name += '-%s' % (base_network) + + # Join all of the options into a single string dev_options = ' option.'.join([''] + dev_options.split()) base_options = ' option.'.join([''] + base_options.split()) @@ -810,10 +902,10 @@ def build_cutechess_command(arguments, workload, dev_name, base_name, nps): args = ( win_adj, draw_adj, int(time.time()), variant, concurrency, games, - dev_name, time_control, dev_options, dev_name.rstrip('.exe'), - base_name, time_control, base_options, base_name.rstrip('.exe'), + dev_cmd, time_control, dev_options, dev_name, + base_cmd, time_control, base_options, base_name, book_name, book_name.split('.')[-1], - dev_name.rstrip('.exe'), base_name.rstrip('.exe') + dev_name, base_name, ) if IS_LINUX: diff --git a/OpenBench/config.py b/OpenBench/config.py index fb88594..6c2af11 100644 --- a/OpenBench/config.py +++ b/OpenBench/config.py @@ -25,7 +25,7 @@ REQUIRE_LOGIN_TO_VIEW = False OPENBENCH_CONFIG = { # Server Client version control - 'client_version' : '5', + 'client_version' : '6', # Generic Error Messages useful to those setting up their own instance 'error' : { @@ -114,7 +114,7 @@ OPENBENCH_CONFIG = { 'build' : { 'path' : 'src', 'compilers' : ['clang', 'gcc'], - 'cpuflags' : ['AVX2', 'AVX', 'FMA', 'POPCNT', 'SSE2', 'SSE'], + 'cpuflags' : ['__AVX2__', '__FMA__', '__POPCNT__'], }, 'testmodes' : [ @@ -140,7 +140,7 @@ OPENBENCH_CONFIG = { 'build' : { 'path' : 'src', 'compilers' : ['g++'], - 'cpuflags' : ['POPCNT'], + 'cpuflags' : ['__POPCNT__'], }, 'testmodes' : [ @@ -166,7 +166,7 @@ OPENBENCH_CONFIG = { 'build' : { 'path' : 'src', 'compilers' : ['gcc'], - 'cpuflags' : ['POPCNT'], + 'cpuflags' : ['__POPCNT__'], }, 'testmodes' : [ @@ -192,7 +192,7 @@ OPENBENCH_CONFIG = { 'build' : { 'path' : 'src', 'compilers' : ['clang', 'gcc'], - 'cpuflags' : ['POPCNT'], + 'cpuflags' : ['__POPCNT__'], }, 'testmodes' : [ @@ -218,7 +218,7 @@ OPENBENCH_CONFIG = { 'build' : { 'path' : 'src', 'compilers' : ['g++'], - 'cpuflags' : ['POPCNT'], + 'cpuflags' : ['__POPCNT__'], }, 'testmodes' : [ @@ -244,7 +244,7 @@ OPENBENCH_CONFIG = { 'build' : { 'path' : '', 'compilers' : ['cargo>=1.41.0'], - 'cpuflags' : ['POPCNT'], + 'cpuflags' : ['__POPCNT__'], }, 'testmodes' : [ @@ -270,7 +270,7 @@ OPENBENCH_CONFIG = { 'build' : { 'path' : 'src', 'compilers' : ['g++'], - 'cpuflags' : ['POPCNT'], + 'cpuflags' : ['__POPCNT__'], }, 'testmodes' : [ @@ -296,7 +296,7 @@ OPENBENCH_CONFIG = { 'build' : { 'path' : '', 'compilers' : ['clang++', 'g++'], - 'cpuflags' : ['POPCNT'], + 'cpuflags' : ['__POPCNT__'], }, 'testmodes' : [ @@ -322,7 +322,7 @@ OPENBENCH_CONFIG = { 'build' : { 'path' : 'src', 'compilers' : ['g++'], - 'cpuflags' : ['POPCNT'], + 'cpuflags' : ['__POPCNT__'], }, 'testmodes' : [ @@ -348,7 +348,7 @@ OPENBENCH_CONFIG = { 'build' : { 'path' : 'src', 'compilers' : ['gcc', 'clang'], - 'cpuflags' : ['POPCNT'], + 'cpuflags' : ['__POPCNT__'], }, 'testmodes' : [ @@ -374,7 +374,7 @@ OPENBENCH_CONFIG = { 'build' : { 'path' : 'build', 'compilers' : ['g++>=9.0.0'], - 'cpuflags' : ['AVX2', 'AVX', 'FMA', 'POPCNT', 'SSE2', 'SSE'], + 'cpuflags' : ['__AVX2__', '__FMA__', '__POPCNT__'], }, 'testmodes' : [ @@ -400,7 +400,7 @@ OPENBENCH_CONFIG = { 'build' : { 'path' : 'src_files', 'compilers' : ['g++'], - 'cpuflags' : ['AVX2', 'AVX', 'FMA', 'POPCNT', 'SSE2', 'SSE'], + 'cpuflags' : ['__AVX2__', '__FMA__', '__POPCNT__'], }, 'testmodes' : [ @@ -426,7 +426,7 @@ OPENBENCH_CONFIG = { 'build' : { 'path' : '', 'compilers' : ['g++'], - 'cpuflags' : ['POPCNT'], + 'cpuflags' : ['__POPCNT__'], }, 'testmodes' : [ @@ -452,7 +452,7 @@ OPENBENCH_CONFIG = { 'build' : { 'path' : 'src', 'compilers' : ['g++'], - 'cpuflags' : ['POPCNT'], + 'cpuflags' : ['__POPCNT__'], }, 'testmodes' : [ @@ -478,7 +478,7 @@ OPENBENCH_CONFIG = { 'build' : { 'path' : 'src', 'compilers' : ['gcc'], - 'cpuflags' : ['AVX2', 'AVX', 'FMA', 'POPCNT', 'SSE2', 'SSE'], + 'cpuflags' : ['__AVX2__', '__FMA__', '__POPCNT__'], }, 'testmodes' : [ @@ -504,7 +504,7 @@ OPENBENCH_CONFIG = { 'build' : { 'path' : '', 'compilers' : ['go'], - 'cpuflags' : ['AVX', 'POPCNT'], + 'cpuflags' : ['__AVX__', '__POPCNT__'], }, 'testmodes' : [ @@ -530,7 +530,7 @@ OPENBENCH_CONFIG = { 'build' : { 'path' : '', 'compilers': ['cargo>=1.57.0'], - 'cpuflags' : ['AVX2', 'AVX', 'FMA', 'POPCNT', 'SSE2', 'SSE'], + 'cpuflags' : ['__AVX2__', '__FMA__', '__POPCNT__'], }, 'testmodes' : [ @@ -556,7 +556,7 @@ OPENBENCH_CONFIG = { 'build' : { 'path' : '', 'compilers' : ['g++'], - 'cpuflags' : ['POPCNT'], + 'cpuflags' : ['__POPCNT__'], }, 'testmodes' : [ diff --git a/OpenBench/templatetags/mytags.py b/OpenBench/templatetags/mytags.py index cf059c5..e668d60 100644 --- a/OpenBench/templatetags/mytags.py +++ b/OpenBench/templatetags/mytags.py @@ -19,7 +19,7 @@ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # import re, django -import OpenBench.utils, OpenBench.stats, OpenBench.models +import OpenBench.config, OpenBench.utils, OpenBench.stats, OpenBench.models def oneDigitPrecision(value): @@ -51,14 +51,20 @@ def gitDiffLink(test): base = test['base']['source'] devsha = test['dev']['sha'] basesha = test['base']['sha'] + engine = test['engine'] else: dev = test.dev.source base = test.base.source devsha = test.dev.sha basesha = test.base.sha + engine = test.engine + + if OpenBench.config.OPENBENCH_CONFIG['engines'][engine]['private']: + repo = OpenBench.config.OPENBENCH_CONFIG['engines'][engine]['source'] + else: + repo = OpenBench.utils.pathjoin(*dev.split('/')[:-2]) - repo = OpenBench.utils.pathjoin(*dev.split('/')[:-2]) return OpenBench.utils.pathjoin(repo, 'compare', '{0}...{1}'.format(basesha[:8], devsha[:8])) diff --git a/OpenBench/utils.py b/OpenBench/utils.py index face156..cfb3b05 100644 --- a/OpenBench/utils.py +++ b/OpenBench/utils.py @@ -148,55 +148,136 @@ def getEngine(source, name, sha, bench): if engine.first() != None: return engine.first() return Engine.objects.create(name=name, source=source, sha=sha, bench=bench) -def getBranch(request, errors, name): - branch = request.POST['{0}branch'.format(name)] +def read_git_credentials(request): + + engine = request.POST['enginename'].replace(' ', '').lower() + fname = 'credentials.%s' % (engine) + + if os.path.exists(fname): + with open(fname) as fin: + return { 'Authorization' : 'token %s' % fin.readlines()[0].rstrip() } + +def requests_illegal_fork(request): + + # Strip trailing '/'s for sanity + engine = OPENBENCH_CONFIG['engines'][request.POST['enginename']] + eng_src = engine['source'].rstrip('/') + tar_src = request.POST['source'].rstrip('/') + + # Illegal if sources do not match for Private engines + return engine['private'] and eng_src != tar_src + +def determine_bench(request, field, message): + + # Use the provided bench if possible + try: return int(request.POST['{0}bench'.format(field)]) + except: pass + + # Fallback to try to parse the Bench from the commit + try: + benches = re.findall('(?:BENCH|NODES)[ :=]+([0-9,]+)', message, re.IGNORECASE) + return int(benches[-1].replace(',', '')) + except: return None + +def collect_github_info(request, errors, field): + + # Get branch name, whether it is a commit SHA, and the API path for it + branch = request.POST['{0}branch'.format(field)] bysha = bool(re.search('[0-9a-fA-F]{40}', branch)) url = 'commits' if bysha else 'branches' - repo = request.POST['source'] - target = repo.replace('github.com', 'api.github.com/repos') - target = pathjoin(target, url, branch).rstrip('/') + # All API requests will share this common path. Some engines are private. + base = request.POST['source'].replace('github.com', 'api.github.com/repos') + private = OPENBENCH_CONFIG['engines'][request.POST['enginename']]['private'] + headers = {} - # Avoid leaking our credentials to other sites - if not target.startswith('https://api.github.com/'): + ## Step 1: Verify the target of the API requests + ## [A] We will not attempt to reach any sit other than api.github.com + ## [B] Private engines may only use their main repo for sources of tests + ## [C] Determine which, if any, credentials we want to pass along + + # Private engines must have a token stored in credentials.enginename + if private and not (headers := read_git_credentials(request)): + errors.append('Server does not have access tokens for this engine') + return (None, None, None, None) + + # Do not allow private engines to use forked repos ( We don't have a token! ) + if requests_illegal_fork(request): + errors.append('Forked Repositories are not allowed for Private engines') + return (None, None, None, None) + + # Avoid leaking our credentials to other websites + if not base.startswith('https://api.github.com/'): errors.append('OpenBench may only reach Github\'s API') return (None, None, None, None) - # Check for a (User, Token) credentials file - if os.path.exists('credentials'): - with open('credentials') as fin: - user, token = fin.readlines()[0].rstrip().split() - auth = requests.auth.HTTPBasicAuth(user, token) - else: auth = None + ## Step 2: Connect to the Github API for the given Branch or Commit SHA. + ## [A] We will attempt to parse the most recent commit message for a + ## bench, unless one was supplied. + ## [B] We will translate any branch name into a commit SHA for later use, + ## so we may compare branches and generate diff URLs + ## [C] If the engine is public, we will construct the URL to download the + ## source code from Github into a .zip file. + ## [D] If the engine is private, we will carry onto Step 3. try: # Fetch data from the Github API - data = requests.get(target, auth=auth).json() + path = 'commits' if bysha else 'branches' + url = pathjoin(base, path, branch).rstrip('/') + data = requests.get(url, headers=headers).json() data = data if bysha else data['commit'] except: # Unable to connect for whatever reason - lookup = 'Commit Sha' if bysha else 'Branch' - errors.append('{0} {1} could not be found'.format(lookup, branch)) + path = 'Commit Sha' if bysha else 'Branch' + errors.append('{0} {1} could not be found'.format(path, branch)) return (None, None, None, None) - treeurl = data['commit']['tree']['sha'] + '.zip' - source = pathjoin(repo, 'archive', treeurl).rstrip('/') - - try: # Use the provided Bench if there is one - bench = int(request.POST['{0}bench'.format(name)]) - return (source, branch, data['sha'], bench) - except: pass - - try: # Fallback to try to parse the Bench from the commit - message = data['commit']['message'] - benches = re.findall('(?:BENCH|NODES)[ :=]+([0-9,]+)', message, re.IGNORECASE) - bench = int(benches[-1].replace(',', '')) - return (source, branch, data['sha'], bench) - - except: # Neither method found a viable Bench - errors.append('Unable to parse a Bench for {0}'.format(branch)) + # Extract the bench from the web form, or from the commit message + if not (bench := determine_bench(request, field, data['commit']['message'])): + errors.append('Unable to parse a Bench for %s' % (branch)) return (None, None, None, None) + # Public Engines: Construct the .zip download and return everything + if not OPENBENCH_CONFIG['engines'][request.POST['enginename']]['private']: + treeurl = data['commit']['tree']['sha'] + '.zip' + source = pathjoin(request.POST['source'], 'archive', treeurl).rstrip('/') + return (source, branch, data['sha'], bench) + + ## Step 3: Construct the URL for the API request to list all Artifacts + ## [A] OpenBench artifacts are always run via a file named openbench.yml + ## [B] These should contain combinations for windows/linux, avx2/avx512, popcnt/pext + ## [C] If those artifacts do not exist, we cannot create the test. + + try: # Fetch the run id for the openbench workflow for this comment + url = pathjoin(base, 'actions', 'workflows', 'openbench.yml', 'runs').rstrip('/') + url += '?head_sha=%s' % (data['sha']) + run_id = requests.get(url=url, headers=headers).json()['workflow_runs'][0]['id'] + + except: # Unable to determine this for whatever reason + errors.append('Failed to idenftify the run_id associated with the OpenBench workflow') + return (None, None, None, None) + + try: # Fetch the artifact list for the run_id we determined above + url = pathjoin(base, 'actions', 'runs', str(run_id), 'artifacts').rstrip('/') + artifacts = requests.get(url=url, headers=headers).json()['artifacts'] + + except: # Unable to fetch the list of artifacts for whatever reason + errors.append('Failed to get the Artifact List for run_id = %d' % (run_id)) + return (None, None, None, None) + + # Verify that all of the artifacts exist and are not expired + available = [ f['name'] for f in artifacts if f['expired'] == False ] + required = OPENBENCH_CONFIG['engines'][request.POST['enginename']]['build']['artifacts'] + + # Flag any and all missing artifacts + for name in required: + if '%s-%s' % (data['sha'], name) not in available: + errors.append('Missing Artifact (%s)' % (name)) + + # Return the API endpoint for artifacts, along with the usual rest + return (url, branch, data['sha'], bench) + + def verifyNewTest(request): errors = [] @@ -259,8 +340,8 @@ def createNewTest(request): errors = verifyNewTest(request) if errors != []: return None, errors - devinfo = getBranch(request, errors, 'dev') - baseinfo = getBranch(request, errors, 'base') + devinfo = collect_github_info(request, errors, 'dev') + baseinfo = collect_github_info(request, errors, 'base') if errors != []: return None, errors test = Test() @@ -442,6 +523,10 @@ def workload_to_dictionary(test, result, machine): 'result' : { 'id' : result.id }, + 'engine' : { + 'private' : OPENBENCH_CONFIG['engines'][test.engine]['private'] + }, + 'test' : { 'id' : test.id, diff --git a/OpenBench/views.py b/OpenBench/views.py index b807541..a893532 100644 --- a/OpenBench/views.py +++ b/OpenBench/views.py @@ -639,6 +639,7 @@ def clientGetBuildInfo(request): data = {} for engine, config in OpenBench.config.OPENBENCH_CONFIG['engines'].items(): data[engine] = config['build'] + data[engine]['private'] = config['private'] return HttpResponse(json.dumps(data)) @csrf_exempt From f22883647dc9091edd5bb9554dea61749261b9dd Mon Sep 17 00:00:00 2001 From: andrew Date: Wed, 8 Mar 2023 04:16:44 -0500 Subject: [PATCH 05/51] Finalize hiding public information in settings --- Client/cleanup.sh | 3 ++- OpenBench/config.py | 10 +++++++--- OpenBench/static/style.css | 7 +++++-- OpenBench/views.py | 14 +++++++------- 4 files changed, 21 insertions(+), 13 deletions(-) diff --git a/Client/cleanup.sh b/Client/cleanup.sh index 741ea66..ef9dedd 100755 --- a/Client/cleanup.sh +++ b/Client/cleanup.sh @@ -7,4 +7,5 @@ rm -rf Books/ rm -rf PGNs/ rm -rf tmp/ rm -rf *.dll -rm -rf cutechess* \ No newline at end of file +rm -rf cutechess* +rm -rf machine.txt \ No newline at end of file diff --git a/OpenBench/config.py b/OpenBench/config.py index 6c2af11..5c5da6b 100644 --- a/OpenBench/config.py +++ b/OpenBench/config.py @@ -20,7 +20,9 @@ USE_CROSS_APPROVAL = False -REQUIRE_LOGIN_TO_VIEW = False +REQUIRE_LOGIN_TO_VIEW = True + +REQUIRE_MANUAL_REGISTRATION = True OPENBENCH_CONFIG = { @@ -29,8 +31,10 @@ OPENBENCH_CONFIG = { # 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', + 'disabled' : 'Account has not been enabled. Contact andrew@grantnet.us', + 'fakeuser' : 'This is not a real OpenBench User. Create an OpenBench account', + 'requires_login' : 'All pages require a user login to access', + 'manual_registration' : 'Registration can only be done via an Administrator', }, # Link to the repo on the sidebar, as well as the core files diff --git a/OpenBench/static/style.css b/OpenBench/static/style.css index ff3a21e..610b195 100644 --- a/OpenBench/static/style.css +++ b/OpenBench/static/style.css @@ -271,10 +271,13 @@ a:link, a:visited, a:hover, a:active { background-color: #00AF00; } -#error { +#error pre { background-color: #EE7676; - padding: 8px; + padding: 6px; + margin: 0px; text-align: center; + font-family: "Courier Prime"; + font-size: 18px; } #content form h3 { diff --git a/OpenBench/views.py b/OpenBench/views.py index a893532..3e0446f 100644 --- a/OpenBench/views.py +++ b/OpenBench/views.py @@ -53,11 +53,8 @@ def render(request, template, content={}, always_allow=False): data.update({'config' : OpenBench.config.OPENBENCH_CONFIG}) if OpenBench.config.REQUIRE_LOGIN_TO_VIEW: - if not request.user.is_authenticated and not always_allow: - return django.http.HttpResponseRedirect('/login/') - - return django.shortcuts.render(request, 'OpenBench/{0}'.format(template), data) + return login(request, OpenBench.config.OPENBENCH_CONFIG['error']['requires_login']) if request.user.is_authenticated: @@ -130,7 +127,9 @@ def register(request): # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # if request.method == 'GET': - return render(request, 'register.html', always_allow=True) + if not OpenBench.config.REQUIRE_MANUAL_REGISTRATION: + return render(request, 'register.html', always_allow=True) + return login(request, OpenBench.config.OPENBENCH_CONFIG['error']['manual_registration']) if request.POST['password1'] != request.POST['password2']: return index(request, error='Passwords Do Not Match') @@ -151,7 +150,7 @@ def register(request): return django.http.HttpResponseRedirect('/index/') -def login(request): +def login(request, error=''): # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # @@ -163,7 +162,8 @@ def login(request): # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # if request.method == 'GET': - return render(request, 'login.html', always_allow=True) + data = { 'error' : error } + return render(request, 'login.html', data, always_allow=True) try: user = authenticate(request) From 36fab373e07a281cac9f536a02b7c1a434626b2f Mon Sep 17 00:00:00 2001 From: Andrew Grant Date: Fri, 10 Mar 2023 17:09:29 +0000 Subject: [PATCH 06/51] Always display approved users --- Templates/OpenBench/users.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Templates/OpenBench/users.html b/Templates/OpenBench/users.html index 9cbd4b8..9bbe5a3 100644 --- a/Templates/OpenBench/users.html +++ b/Templates/OpenBench/users.html @@ -23,7 +23,7 @@ {% for profile in profiles %} {% if profile.enabled %} - {% if profile.games or profile.tests %} + {% if profile.games or profile.tests or profile.approver %} {{profile.user.username|capfirst}} {{profile.games|insertCommas}} From 7143b15899f353dbd96acde891548290e602e853 Mon Sep 17 00:00:00 2001 From: andrew Date: Fri, 10 Mar 2023 12:31:58 -0500 Subject: [PATCH 07/51] Fix missing conversation for private downloads --- Client/Client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Client/Client.py b/Client/Client.py index 9e220ea..4e00df9 100644 --- a/Client/Client.py +++ b/Client/Client.py @@ -778,7 +778,7 @@ def download_engine(arguments, workload, branch, network): # Unzip the binary, and determine where to move the binary unzip_delete_file('artifact.zip', 'tmp/') - output_name = os.path.join('tmp', engine) + output_name = os.path.join('tmp', engine.replace(' ', '').lower()) if not private: From 6592360ac358d2ef2f5c7788010db4d8da44fc9c Mon Sep 17 00:00:00 2001 From: andrew Date: Fri, 10 Mar 2023 13:53:39 -0500 Subject: [PATCH 08/51] Add execute permissions to artifacts --- Client/Client.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Client/Client.py b/Client/Client.py index 4e00df9..d3b6a6a 100644 --- a/Client/Client.py +++ b/Client/Client.py @@ -780,6 +780,10 @@ def download_engine(arguments, workload, branch, network): unzip_delete_file('artifact.zip', 'tmp/') output_name = os.path.join('tmp', engine.replace(' ', '').lower()) + # Binaries don't have execute permissions by default + if IS_LINUX: + os.system('chmod 777 %s\n' % (output_name)) + if not private: # Download and unzip the source from Github From b18cbce31f366f303a7a054279649eaecba67af3 Mon Sep 17 00:00:00 2001 From: andrew Date: Thu, 16 Mar 2023 16:50:57 -0400 Subject: [PATCH 09/51] Resolve infinite recursion on illegal logins --- OpenBench/views.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/OpenBench/views.py b/OpenBench/views.py index 3e0446f..f497b59 100644 --- a/OpenBench/views.py +++ b/OpenBench/views.py @@ -161,7 +161,7 @@ def login(request, error=''): # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # - if request.method == 'GET': + if request.method == 'GET' or error: data = { 'error' : error } return render(request, 'login.html', data, always_allow=True) @@ -171,7 +171,8 @@ def login(request, error=''): return django.http.HttpResponseRedirect('/index/') except UnableToAuthenticate: - return index(request, error='Unable to Authenticate User') + data = { 'error' : 'Unable to authenticate username and password' } + return render(request, 'login.html', data, always_allow=True) def logout(request): From 0a6d365174dff8eb43b4d492a981d568d9b09467 Mon Sep 17 00:00:00 2001 From: andrew Date: Sun, 2 Apr 2023 18:05:38 -0400 Subject: [PATCH 10/51] Spawn multiple cutechess copies if requested --- Client/Client.py | 93 +++++++++++++++++++++++++++------------------ OpenBench/config.py | 2 +- OpenBench/utils.py | 18 ++++----- 3 files changed, 65 insertions(+), 48 deletions(-) diff --git a/Client/Client.py b/Client/Client.py index d3b6a6a..296db4e 100644 --- a/Client/Client.py +++ b/Client/Client.py @@ -48,24 +48,12 @@ 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 = 30 # Timeout in seconds between workload requests -CLIENT_VERSION = '6' # Client version to send to the Server +CLIENT_VERSION = '7' # Client version to send to the Server SYZYGY_WDL_PATH = None # Pathway to WDL Syzygy Tables BASE_GAMES_PER_CORE = 32 # Typical games played per-thread FLEET_MODE = False # Exit when there are no workloads -CUSTOM_SETTINGS = { - 'Ethereal' : [], 'Laser' : [], - 'Weiss' : [], 'Demolito' : [], - 'Rubichess' : [], 'FabChess' : [], - 'Igel' : [], 'Winter' : [], - 'Halogen' : [], 'Stash' : [], - 'Seer' : [], 'Koivisto' : [], - 'Drofa' : [], 'Bit-Genie' : [], - 'Berserk' : [], 'Zahak' : [], - 'BlackMarlin' : [], -}; - ERRORS = { 'cutechess' : 'Unable to fetch Cutechess location and download it!', 'configure' : 'Unable to fetch and determine acceptable workloads!', @@ -231,9 +219,6 @@ def make_command(arguments, engine, src_path, network_path): command = 'make %s=%s EXE=%s -j%s' % ( ['CC', 'CXX']['++' in COMPILERS[engine]], COMPILERS[engine], engine, arguments.threads) - if engine in CUSTOM_SETTINGS: - command += ' '.join(CUSTOM_SETTINGS[engine]) - if network_path != None: path = os.path.relpath(os.path.abspath(network_path), src_path) command += ' EVALFILE=%s' % (path.replace('\\', '/')) @@ -493,10 +478,10 @@ def server_request_workload(arguments): payload = { 'username' : arguments.username, 'threads' : arguments.threads, - 'password' : arguments.password, 'osname' : OSNAME, - 'machineid' : machine_id, 'syzygy_wdl' : bool(SYZYGY_WDL_PATH), - 'supported' : supported, 'cpuflags' : COMPILERS['cpuflags'], - 'version' : CLIENT_VERSION + 'password' : arguments.password, 'ncutechess' : arguments.ncutechess, + 'machineid' : machine_id, 'osname' : OSNAME, + 'supported' : supported, 'syzygy_wdl' : bool(SYZYGY_WDL_PATH), + 'version' : CLIENT_VERSION, 'cpuflags' : COMPILERS['cpuflags'], } target = url_join(arguments.server, 'clientGetWorkload') @@ -605,7 +590,7 @@ def check_workload_response(arguments, response): # No workloads available to our machine if raw_text == 'None': - print('[Note] Server Has No Work') + print('[NOTE] Server Has No Work') if not FLEET_MODE: time.sleep(TIMEOUT_WORKLOAD) return False @@ -616,7 +601,7 @@ def check_workload_response(arguments, response): # Bad machine, mostly meaningless but note it if raw_text == 'Bad Machine': - print('[Note] Replacing Invalid Machine Id') + print('[NOTE] Replacing Invalid Machine Id') os.remove('machine.txt') return False @@ -649,6 +634,7 @@ def complete_workload(arguments, workload): dev_bench, dev_nps = run_benchmarks(arguments, workload, 'dev' , dev_name , dev_network ) base_bench, base_nps = run_benchmarks(arguments, workload, 'base', base_name, base_network) + average_nps = (dev_nps + base_nps) // 2 dev_status = verify_benchmarks(arguments, workload, 'dev' , dev_bench ) base_status = verify_benchmarks(arguments, workload, 'base', base_bench) @@ -657,11 +643,29 @@ def complete_workload(arguments, workload): server_report_nps(arguments, workload, dev_nps, base_nps) download_opening_book(arguments, workload) - avg_nps = (dev_nps + base_nps) // 2 - concurrency, update_interval, command = build_cutechess_command( - arguments, workload, dev_name, base_name, avg_nps) + # Construct each individual Cutechess argument, which differs by PGN output + cutechess_args = [ + build_cutechess_command(arguments, workload, dev_name, base_name, average_nps, ii) + for ii in range(int(arguments.ncutechess)) + ] - run_and_parse_cutechess(arguments, workload, concurrency, update_interval, command) + # Create a process for the each copy of run_and_parse_cutechess() + processes = [ + multiprocessing.Process( + target=run_and_parse_cutechess, + args=(arguments, workload, *cutechess_args[ii], ii)) + for ii in range(int(arguments.ncutechess)) + ] + + try: + # Launch and wait for each cutechess copy + for process in processes: process.start() + for process in processes: process.join() + + except KeyboardInterrupt: + # Kill everything and pass the error back up + for process in processes: process.kill() + raise KeyboardInterrupt def download_opening_book(arguments, workload): @@ -845,7 +849,7 @@ def verify_benchmarks(arguments, workload, branch, bench): server_report_bad_bench(arguments, workload, branch, bench) return bench == int(workload['test'][branch]['bench']) -def build_cutechess_command(arguments, workload, dev_cmd, base_cmd, nps): +def build_cutechess_command(arguments, workload, dev_cmd, base_cmd, nps, cutechess_idx): dev_options = workload['test']['dev' ]['options'] base_options = workload['test']['base']['options'] @@ -890,12 +894,13 @@ def build_cutechess_command(arguments, workload, dev_cmd, base_cmd, nps): flags += '-engine dir=Engines/ cmd=./%s proto=uci %s%s name=%s ' flags += '-engine dir=Engines/ cmd=./%s proto=uci %s%s name=%s ' flags += '-openings file=Books/%s format=%s order=random plies=16 ' - flags += '-pgnout PGNs/%s_vs_%s ' + flags += '-pgnout PGNs/%s_vs_%s.%d ' if SYZYGY_WDL_PATH and workload['test']['syzygy_adj'] != 'DISABLED': flags += '-tb %s' % (SYZYGY_WDL_PATH.replace('\\', '\\\\')) - concurrency = int(arguments.threads) // max(dev_threads, base_threads) + concurrency = int(arguments.threads) / int(arguments.ncutechess) + concurrency = concurrency // max(dev_threads, base_threads) update_interval = 8 if max(dev_threads, base_threads) == 1 else 1 games = int(concurrency * BASE_GAMES_PER_CORE) @@ -905,20 +910,20 @@ def build_cutechess_command(arguments, workload, dev_cmd, base_cmd, nps): args = ( win_adj, draw_adj, - int(time.time()), variant, concurrency, games, + int(time.time() + cutechess_idx), variant, concurrency, games, dev_cmd, time_control, dev_options, dev_name, base_cmd, time_control, base_options, base_name, book_name, book_name.split('.')[-1], - dev_name, base_name, + dev_name, base_name, cutechess_idx, ) if IS_LINUX: return concurrency, update_interval, './cutechess-ob ' + flags % (args) return concurrency, update_interval, 'cutechess-ob.exe ' + flags % (args) -def run_and_parse_cutechess(arguments, workload, concurrency, update_interval, command): +def run_and_parse_cutechess(arguments, workload, concurrency, update_interval, command, cutechess_idx): - print('\nLaunching Cutechess...\n%s\n' % (command)) + print('\n[#%d] Launching Cutechess...\n%s\n' % (cutechess_idx, command)) cutechess = Popen(command.split(), stdout=PIPE) crashes = timelosses = 0 @@ -929,7 +934,7 @@ def run_and_parse_cutechess(arguments, workload, concurrency, update_interval, c # Read each line of output until the pipe closes line = cutechess.stdout.readline().strip().decode('ascii') - if line != '': print(line) + if line != '': print('[#%d] %s' % (cutechess_idx, line)) else: cutechess.wait(); return # Real updates contain a colon @@ -984,15 +989,27 @@ if __name__ == '__main__': help_pass = 'Password. May also be passed as OPENBENCH_PASSWORD environment variable' p = argparse.ArgumentParser() - p.add_argument('-U', '--username', help=help_user , required=req_user) - p.add_argument('-P', '--password', help=help_pass , required=req_pass) - p.add_argument('-S', '--server' , help='Webserver', required=True) - p.add_argument('-T', '--threads' , help='Threads' , required=True) + + # Required arguments + p.add_argument('-U', '--username' , help=help_user , required=req_user) + p.add_argument('-P', '--password' , help=help_pass , required=req_pass) + p.add_argument('-S', '--server' , help='Webserver Address' , required=True) + p.add_argument('-T', '--threads' , help='Total Threads' , required=True) + p.add_argument('-N', '--ncutechess' , help='Cutechess Copies' , required=True) + + # Optional arguments p.add_argument('--syzygy', help='Syzygy WDL' , required=False) p.add_argument('--fleet' , help='Fleet Mode' , action='store_true') p.add_argument('--proxy' , help='Github Proxy', action='store_true') + arguments = p.parse_args() + # Make sure the thread distibution between Cutechess copies is correct + assert (int(arguments.threads) >= 1) + assert (int(arguments.ncutechess) >= 1) + assert (int(arguments.threads) >= int(arguments.ncutechess)) + assert (int(arguments.threads) % int(arguments.ncutechess) == 0) + if arguments.username is None: arguments.username = os.environ['OPENBENCH_USERNAME'] diff --git a/OpenBench/config.py b/OpenBench/config.py index 5c5da6b..36b2456 100644 --- a/OpenBench/config.py +++ b/OpenBench/config.py @@ -27,7 +27,7 @@ REQUIRE_MANUAL_REGISTRATION = True OPENBENCH_CONFIG = { # Server Client version control - 'client_version' : '6', + 'client_version' : '7', # Generic Error Messages useful to those setting up their own instance 'error' : { diff --git a/OpenBench/utils.py b/OpenBench/utils.py index cfb3b05..7fe45dd 100644 --- a/OpenBench/utils.py +++ b/OpenBench/utils.py @@ -466,25 +466,25 @@ def get_valid_workloads(machine, request): tests = tests.exclude(syzygy_wdl='REQUIRED') # Skip tests that would waste available Threads or exceed them - options = [x for x in tests if test_maps_onto_thread_count(machine, x)] + ncutechess = int(request.POST['ncutechess']) + options = [x for x in tests if test_maps_onto_thread_count(machine, x, ncutechess)] # Finally refine for tests of the highest priority if not options: return [] highest_prio = max(options, key=lambda x: x.priority).priority return [test for test in options if test.priority == highest_prio] -def test_maps_onto_thread_count(machine, test): - - # Only assign a workload to a machine if the machine actually has - # enough Threads for the test. Furthermore, ensure that there are - # no left over threads when assigned. An exception is made for the - # case where thread counts differ -- a bad idea to run in general +def test_maps_onto_thread_count(machine, test, ncutechess): dev_threads = int(extractOption(test.devoptions, 'Threads')) base_threads = int(extractOption(test.baseoptions, 'Threads')) - if max(dev_threads, base_threads) > machine.threads: return False - return dev_threads != base_threads or machine.threads % dev_threads == 0 + # Each individual cutechess copy must have access to sufficient Threads + if max(dev_threads, base_threads) > (machine.threads / ncutechess): + return False + + # Intentional Thread Imbalance, or evenly distributed Threads + return dev_threads != base_threads or (machine.threads / ncutechess) % dev_threads == 0 def select_workload(machine, tests, variance=0.25): From 7d820d85d93d59027a75756507ca0cb1ef323731 Mon Sep 17 00:00:00 2001 From: andrew Date: Mon, 3 Apr 2023 19:21:14 -0400 Subject: [PATCH 11/51] Let the server loop until artifacts exist --- OpenBench/apps.py | 36 +++++++++++ OpenBench/models.py | 1 + OpenBench/utils.py | 112 +++++++++++++++++---------------- OpenBench/views.py | 29 +++++---- OpenSite/settings.py | 2 +- Templates/OpenBench/index.html | 9 +++ 6 files changed, 120 insertions(+), 69 deletions(-) diff --git a/OpenBench/apps.py b/OpenBench/apps.py index c9b5743..2a000fb 100644 --- a/OpenBench/apps.py +++ b/OpenBench/apps.py @@ -19,6 +19,42 @@ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # import django.apps +import threading, time + +class ArtifactWatcher(threading.Thread): + + def run(self): + + # Delay imports due to the app not having been loaded yet + import OpenBench.utils + + while True: + + time.sleep(30) + + for test in OpenBench.utils.get_awaiting_tests(): + + dev_has_all = test.dev.source.endswith('artifacts') + base_has_all = test.base.source.endswith('artifacts') + headers = OpenBench.utils.read_git_credentials(test.engine) + + if headers and not dev_has_all: + test.dev.source, dev_has_all = OpenBench.utils.fetch_artifact_url( + test.dev.source, test.engine, headers, test.dev.sha) + test.dev.save() + + if headers and not base_has_all: + test.base.source, base_has_all = OpenBench.utils.fetch_artifact_url( + test.base.source, test.engine, headers, test.base.sha) + test.base.save() + + if dev_has_all and base_has_all: + test.awaiting = False + test.save() class OpenbenchConfig(django.apps.AppConfig): + name = 'OpenBench' + + def ready(self): + self.watcher = ArtifactWatcher().start() diff --git a/OpenBench/models.py b/OpenBench/models.py index fb419ac..92b4303 100644 --- a/OpenBench/models.py +++ b/OpenBench/models.py @@ -129,6 +129,7 @@ class Test(Model): finished = BooleanField(default=False) deleted = BooleanField(default=False) approved = BooleanField(default=False) + awaiting = BooleanField(default=False) creation = DateTimeField(auto_now_add=True) updated = DateTimeField(auto_now=True) diff --git a/OpenBench/utils.py b/OpenBench/utils.py index 7fe45dd..1a0dd08 100644 --- a/OpenBench/utils.py +++ b/OpenBench/utils.py @@ -77,22 +77,29 @@ def parseTimeControl(time_control): raise Exception('Unable to parse Time Control (%s)' % (time_control)) -def getPendingTests(): - pending = OpenBench.models.Test.objects.filter(approved=False) - pending = pending.exclude(finished=True) - pending = pending.exclude(deleted=True) - return pending.order_by('-creation') +def get_pending_tests(): + t = OpenBench.models.Test.objects.filter(approved=False) + t = t.exclude(finished=True) + t = t.exclude(deleted=True) + return t.order_by('-creation') -def getActiveTests(): - active = OpenBench.models.Test.objects.filter(approved=True) - active = active.exclude(finished=True) - active = active.exclude(deleted=True) - return active.order_by('-priority', '-currentllr') +def get_active_tests(): + t = OpenBench.models.Test.objects.filter(approved=True) + t = t.exclude(awaiting=True) + t = t.exclude(finished=True) + t = t.exclude(deleted=True) + return t.order_by('-priority', '-currentllr') -def getCompletedTests(): - completed = OpenBench.models.Test.objects.filter(finished=True) - completed = completed.exclude(deleted=True) - return completed.order_by('-updated') +def get_completed_tests(): + t = OpenBench.models.Test.objects.filter(finished=True) + t = t.exclude(deleted=True) + return t.order_by('-updated') + +def get_awaiting_tests(): + t = OpenBench.models.Test.objects.filter(awaiting=True) + t = t.exclude(finished=True) + t = t.exclude(deleted=True) + return t.order_by('-creation') def getRecentMachines(minutes=5): @@ -149,11 +156,8 @@ def getEngine(source, name, sha, bench): return Engine.objects.create(name=name, source=source, sha=sha, bench=bench) -def read_git_credentials(request): - - engine = request.POST['enginename'].replace(' ', '').lower() - fname = 'credentials.%s' % (engine) - +def read_git_credentials(engine): + fname = 'credentials.%s' % (engine.replace(' ', '').lower()) if os.path.exists(fname): with open(fname) as fin: return { 'Authorization' : 'token %s' % fin.readlines()[0].rstrip() } @@ -198,19 +202,19 @@ def collect_github_info(request, errors, field): ## [C] Determine which, if any, credentials we want to pass along # Private engines must have a token stored in credentials.enginename - if private and not (headers := read_git_credentials(request)): + if private and not (headers := read_git_credentials(request.POST['enginename'])): errors.append('Server does not have access tokens for this engine') - return (None, None, None, None) + return (None, None) # Do not allow private engines to use forked repos ( We don't have a token! ) if requests_illegal_fork(request): errors.append('Forked Repositories are not allowed for Private engines') - return (None, None, None, None) + return (None, None) # Avoid leaking our credentials to other websites if not base.startswith('https://api.github.com/'): errors.append('OpenBench may only reach Github\'s API') - return (None, None, None, None) + return (None, None) ## Step 2: Connect to the Github API for the given Branch or Commit SHA. ## [A] We will attempt to parse the most recent commit message for a @@ -230,53 +234,51 @@ def collect_github_info(request, errors, field): except: # Unable to connect for whatever reason path = 'Commit Sha' if bysha else 'Branch' errors.append('{0} {1} could not be found'.format(path, branch)) - return (None, None, None, None) + return (None, None) # Extract the bench from the web form, or from the commit message if not (bench := determine_bench(request, field, data['commit']['message'])): errors.append('Unable to parse a Bench for %s' % (branch)) - return (None, None, None, None) + return (None, None) # Public Engines: Construct the .zip download and return everything if not OPENBENCH_CONFIG['engines'][request.POST['enginename']]['private']: treeurl = data['commit']['tree']['sha'] + '.zip' source = pathjoin(request.POST['source'], 'archive', treeurl).rstrip('/') - return (source, branch, data['sha'], bench) + return (source, branch, data['sha'], bench), True ## Step 3: Construct the URL for the API request to list all Artifacts ## [A] OpenBench artifacts are always run via a file named openbench.yml ## [B] These should contain combinations for windows/linux, avx2/avx512, popcnt/pext - ## [C] If those artifacts do not exist, we cannot create the test. + ## [C] If those artifacts are not found, we flag the test as awaiting, and try later. - try: # Fetch the run id for the openbench workflow for this comment + engine = request.POST['enginename'] + url, has_all = fetch_artifact_url(base, engine, headers, data['sha']) + return (url, branch, data['sha'], bench), has_all + +def fetch_artifact_url(base, engine, headers, sha): + + try: + # Fetch the run id for the openbench workflow for this comment url = pathjoin(base, 'actions', 'workflows', 'openbench.yml', 'runs').rstrip('/') - url += '?head_sha=%s' % (data['sha']) + url += '?head_sha=%s' % (sha) run_id = requests.get(url=url, headers=headers).json()['workflow_runs'][0]['id'] - except: # Unable to determine this for whatever reason - errors.append('Failed to idenftify the run_id associated with the OpenBench workflow') - return (None, None, None, None) - - try: # Fetch the artifact list for the run_id we determined above + # Construct the final URL that will be used to look at artifacts url = pathjoin(base, 'actions', 'runs', str(run_id), 'artifacts').rstrip('/') artifacts = requests.get(url=url, headers=headers).json()['artifacts'] - except: # Unable to fetch the list of artifacts for whatever reason - errors.append('Failed to get the Artifact List for run_id = %d' % (run_id)) - return (None, None, None, None) + # Verify that all of the artifacts exist and are not expired + available = [ f['name'] for f in artifacts if f['expired'] == False ] + required = OPENBENCH_CONFIG['engines'][engine]['build']['artifacts'] + has_all = all(['%s-%s' % (sha, name) in available for name in required]) - # Verify that all of the artifacts exist and are not expired - available = [ f['name'] for f in artifacts if f['expired'] == False ] - required = OPENBENCH_CONFIG['engines'][request.POST['enginename']]['build']['artifacts'] - - # Flag any and all missing artifacts - for name in required: - if '%s-%s' % (data['sha'], name) not in available: - errors.append('Missing Artifact (%s)' % (name)) - - # Return the API endpoint for artifacts, along with the usual rest - return (url, branch, data['sha'], bench) + # Return the URL iff we found them; otherwise base + return (url if has_all else base, has_all) + except Exception as error: + # If anything goes wrong, retry later with the same base URL + return (base, False) def verifyNewTest(request): @@ -340,8 +342,8 @@ def createNewTest(request): errors = verifyNewTest(request) if errors != []: return None, errors - devinfo = collect_github_info(request, errors, 'dev') - baseinfo = collect_github_info(request, errors, 'base') + devinfo, dev_has_all = collect_github_info(request, errors, 'dev') + baseinfo, base_has_all = collect_github_info(request, errors, 'base') if errors != []: return None, errors test = Test() @@ -379,8 +381,9 @@ def createNewTest(request): if request.POST['basenetwork']: test.basenetname = Network.objects.get(sha256=request.POST['basenetwork']).name - test.dev = getEngine(*devinfo) - test.base = getEngine(*baseinfo) + test.dev = getEngine(*devinfo) + test.base = getEngine(*baseinfo) + test.awaiting = not (dev_has_all and base_has_all) test.save() profile = Profile.objects.get(user=request.user) @@ -445,9 +448,8 @@ def getWorkload(user, request): def get_valid_workloads(machine, request): - # Skip finished tests - tests = Test.objects.filter(finished=False) - tests = tests.filter(deleted=False).filter(approved=True) + # Skip anything that is not running + tests = get_active_tests() # Skip engines that the Machine cannot build for engine in OPENBENCH_CONFIG['engines'].keys(): diff --git a/OpenBench/views.py b/OpenBench/views.py index f497b59..4cf13a2 100644 --- a/OpenBench/views.py +++ b/OpenBench/views.py @@ -238,16 +238,18 @@ def index(request, page=1, error=''): # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # - pending = OpenBench.utils.getPendingTests() - active = OpenBench.utils.getActiveTests() - completed = OpenBench.utils.getCompletedTests() + pending = OpenBench.utils.get_pending_tests() + active = OpenBench.utils.get_active_tests() + completed = OpenBench.utils.get_completed_tests() + awaiting = OpenBench.utils.get_awaiting_tests() start, end, paging = OpenBench.utils.getPaging(completed, page, 'index') data = { - 'error' : error, 'pending' : pending, - 'active' : active, 'completed' : completed[start:end], - 'paging' : paging, 'status' : OpenBench.utils.getMachineStatus(), + 'pending' : pending, 'active' : active, + 'completed' : completed[start:end], 'awaiting' : awaiting, + 'paging' : paging, 'status' : OpenBench.utils.getMachineStatus(), + 'error' : error, } return render(request, 'index.html', data) @@ -261,7 +263,7 @@ def greens(request, page=1): # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # - completed = OpenBench.utils.getCompletedTests().filter(passed=True) + completed = OpenBench.utils.get_completed_tests().filter(passed=True) start, end, paging = OpenBench.utils.getPaging(completed, page, 'greens') data = {'completed' : completed[start:end], 'paging' : paging} @@ -323,17 +325,18 @@ def user(request, username, page=1): # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # - pending = OpenBench.utils.getPendingTests().filter(author=username) - active = OpenBench.utils.getActiveTests().filter(author=username) - completed = OpenBench.utils.getCompletedTests().filter(author=username) + pending = OpenBench.utils.get_pending_tests().filter(author=username) + active = OpenBench.utils.get_active_tests().filter(author=username) + completed = OpenBench.utils.get_completed_tests().filter(author=username) + awaiting = OpenBench.utils.get_awaiting_tests().filter(author=username) url = 'user/{0}'.format(username) start, end, paging = OpenBench.utils.getPaging(completed, page, url) data = { - 'pending' : pending, 'active' : active, - 'completed' : completed[start:end], 'paging' : paging, - 'status' : OpenBench.utils.getMachineStatus(username), + 'pending' : pending, 'active' : active, + 'completed' : completed[start:end], 'awaiting' : awaiting, + 'paging' : paging, 'status' : OpenBench.utils.getMachineStatus(username), } return render(request, 'index.html', data) diff --git a/OpenSite/settings.py b/OpenSite/settings.py index 115c7fe..851299c 100644 --- a/OpenSite/settings.py +++ b/OpenSite/settings.py @@ -42,8 +42,8 @@ INSTALLED_APPS = [ 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', - 'OpenBench', 'OpenBench.templatetags', + 'OpenBench.apps.OpenbenchConfig', ] MIDDLEWARE = [ diff --git a/Templates/OpenBench/index.html b/Templates/OpenBench/index.html index 83070b2..cd5d644 100644 --- a/Templates/OpenBench/index.html +++ b/Templates/OpenBench/index.html @@ -16,6 +16,15 @@ {% endif %} + + {% if awaiting %} + Awaiting Artifacts + {% for test in awaiting %} + {% include "OpenBench/Blocks/testsummary.html" %} + {% endfor %} + + {% endif %} + {% if active %} Active {{status}} From 19cfa5391d2899fa9926c13410cac225b673d28c Mon Sep 17 00:00:00 2001 From: andrew Date: Mon, 3 Apr 2023 20:59:43 -0400 Subject: [PATCH 12/51] Use a overwritten runserver command as the solution instead --- OpenBench/apps.py | 38 +--------------- OpenBench/management/__init__.py | 0 OpenBench/management/commands/__init__.py | 0 OpenBench/management/commands/runserver.py | 51 ++++++++++++++++++++++ OpenSite/settings.py | 4 +- 5 files changed, 54 insertions(+), 39 deletions(-) create mode 100644 OpenBench/management/__init__.py create mode 100644 OpenBench/management/commands/__init__.py create mode 100644 OpenBench/management/commands/runserver.py diff --git a/OpenBench/apps.py b/OpenBench/apps.py index 2a000fb..48ea39e 100644 --- a/OpenBench/apps.py +++ b/OpenBench/apps.py @@ -19,42 +19,6 @@ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # import django.apps -import threading, time - -class ArtifactWatcher(threading.Thread): - - def run(self): - - # Delay imports due to the app not having been loaded yet - import OpenBench.utils - - while True: - - time.sleep(30) - - for test in OpenBench.utils.get_awaiting_tests(): - - dev_has_all = test.dev.source.endswith('artifacts') - base_has_all = test.base.source.endswith('artifacts') - headers = OpenBench.utils.read_git_credentials(test.engine) - - if headers and not dev_has_all: - test.dev.source, dev_has_all = OpenBench.utils.fetch_artifact_url( - test.dev.source, test.engine, headers, test.dev.sha) - test.dev.save() - - if headers and not base_has_all: - test.base.source, base_has_all = OpenBench.utils.fetch_artifact_url( - test.base.source, test.engine, headers, test.base.sha) - test.base.save() - - if dev_has_all and base_has_all: - test.awaiting = False - test.save() - -class OpenbenchConfig(django.apps.AppConfig): +class OpenBench(django.apps.AppConfig): name = 'OpenBench' - - def ready(self): - self.watcher = ArtifactWatcher().start() diff --git a/OpenBench/management/__init__.py b/OpenBench/management/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/OpenBench/management/commands/__init__.py b/OpenBench/management/commands/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/OpenBench/management/commands/runserver.py b/OpenBench/management/commands/runserver.py new file mode 100644 index 0000000..977342d --- /dev/null +++ b/OpenBench/management/commands/runserver.py @@ -0,0 +1,51 @@ +import django.apps +import threading, time +import OpenBench.utils + +from django.core.management.commands.runserver import BaseRunserverCommand + +class ArtifactWatcher(threading.Thread): + + def update_test(self, test): + + dev_has_all = test.dev.source.endswith('artifacts') + base_has_all = test.base.source.endswith('artifacts') + headers = OpenBench.utils.read_git_credentials(test.engine) + + if headers and not dev_has_all: + test.dev.source, dev_has_all = OpenBench.utils.fetch_artifact_url( + test.dev.source, test.engine, headers, test.dev.sha) + test.dev.save() + + if headers and not base_has_all: + test.base.source, base_has_all = OpenBench.utils.fetch_artifact_url( + test.base.source, test.engine, headers, test.base.sha) + test.base.save() + + if dev_has_all and base_has_all: + test.awaiting = False + test.save() + + def run(self): + + while True: + + for test in OpenBench.utils.get_awaiting_tests(): + self.update_test(test) + + time.sleep(10) + +class Command(BaseRunserverCommand): + + help = "Test" + + def inner_run(self, *args, **options): + self.pre_start() + super().inner_run(*args, **options) + self.pre_quit() + + def pre_start(self): + self.watcher = ArtifactWatcher().start() + + def pre_quit(self): + self.watcher.kill() \ No newline at end of file diff --git a/OpenSite/settings.py b/OpenSite/settings.py index 851299c..7e362f7 100644 --- a/OpenSite/settings.py +++ b/OpenSite/settings.py @@ -36,14 +36,14 @@ MEDIA_URL = '/Media/' MEDIA_ROOT = os.path.join(BASE_DIR, 'Media') INSTALLED_APPS = [ + 'OpenBench', + 'OpenBench.templatetags', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', - 'OpenBench.templatetags', - 'OpenBench.apps.OpenbenchConfig', ] MIDDLEWARE = [ From 3dd786deb90ba4ad2bd0545b1a498c8fee07a324 Mon Sep 17 00:00:00 2001 From: andrew Date: Tue, 4 Apr 2023 04:26:42 -0400 Subject: [PATCH 13/51] Make sure static files are loaded --- OpenBench/management/commands/runserver.py | 7 +------ OpenSite/urls.py | 3 +++ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/OpenBench/management/commands/runserver.py b/OpenBench/management/commands/runserver.py index 977342d..7cb43f3 100644 --- a/OpenBench/management/commands/runserver.py +++ b/OpenBench/management/commands/runserver.py @@ -27,18 +27,13 @@ class ArtifactWatcher(threading.Thread): test.save() def run(self): - while True: - for test in OpenBench.utils.get_awaiting_tests(): self.update_test(test) - time.sleep(10) class Command(BaseRunserverCommand): - help = "Test" - def inner_run(self, *args, **options): self.pre_start() super().inner_run(*args, **options) @@ -48,4 +43,4 @@ class Command(BaseRunserverCommand): self.watcher = ArtifactWatcher().start() def pre_quit(self): - self.watcher.kill() \ No newline at end of file + self.watcher.kill() diff --git a/OpenSite/urls.py b/OpenSite/urls.py index 1ca45e2..7b8961c 100644 --- a/OpenSite/urls.py +++ b/OpenSite/urls.py @@ -1,5 +1,6 @@ from django.contrib import admin from django.urls import path, include +from django.contrib.staticfiles.urls import staticfiles_urlpatterns import OpenBench.urls @@ -7,3 +8,5 @@ urlpatterns = [ path(r'admin/', admin.site.urls), path(r'', include(OpenBench.urls.urlpatterns)), ] + +urlpatterns += staticfiles_urlpatterns() \ No newline at end of file From e229b26f9daa030b4c8999a5fca32575514bf9cb Mon Sep 17 00:00:00 2001 From: andrew Date: Tue, 4 Apr 2023 21:12:16 -0400 Subject: [PATCH 14/51] Move all configurations with books and engines to .json files --- .gitignore | 8 +- Books/books.json | 43 ++++ Engines/4ku.json | 45 ++++ Engines/Berserk.json | 47 ++++ Engines/Bit-Genie.json | 45 ++++ Engines/BlackMarlin.json | 47 ++++ Engines/Demolito.json | 46 ++++ Engines/Drofa.json | 45 ++++ Engines/Ethereal.json | 44 ++++ Engines/FabChess.json | 45 ++++ Engines/Halogen.json | 45 ++++ Engines/Igel.json | 45 ++++ Engines/Koivisto.json | 47 ++++ Engines/Laser.json | 45 ++++ Engines/RubiChess.json | 45 ++++ Engines/Seer.json | 47 ++++ Engines/Stash.json | 46 ++++ Engines/Weiss.json | 45 ++++ Engines/Winter.json | 46 ++++ Engines/Zahak.json | 46 ++++ OpenBench/config.py | 544 ++------------------------------------- cleanup.sh | 12 - 22 files changed, 888 insertions(+), 540 deletions(-) create mode 100644 Books/books.json create mode 100644 Engines/4ku.json create mode 100644 Engines/Berserk.json create mode 100644 Engines/Bit-Genie.json create mode 100644 Engines/BlackMarlin.json create mode 100644 Engines/Demolito.json create mode 100644 Engines/Drofa.json create mode 100644 Engines/Ethereal.json create mode 100644 Engines/FabChess.json create mode 100644 Engines/Halogen.json create mode 100644 Engines/Igel.json create mode 100644 Engines/Koivisto.json create mode 100644 Engines/Laser.json create mode 100644 Engines/RubiChess.json create mode 100644 Engines/Seer.json create mode 100644 Engines/Stash.json create mode 100644 Engines/Weiss.json create mode 100644 Engines/Winter.json create mode 100644 Engines/Zahak.json delete mode 100755 cleanup.sh diff --git a/.gitignore b/.gitignore index 75fb2a5..09f477f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,13 @@ *.pyc Client/* -!Client/cleanup.sh OpenBench/migrations/* + credentials +credentials.* +db.sqlite3 Scripts/Binaries/* Scripts/Networks/* -Scripts/Repositories/* \ No newline at end of file +Scripts/Repositories/* + +Media/* \ No newline at end of file diff --git a/Books/books.json b/Books/books.json new file mode 100644 index 0000000..2aa0b49 --- /dev/null +++ b/Books/books.json @@ -0,0 +1,43 @@ +{ + "2moves_v1.epd" : { + "name" : "2moves_v1.epd", + "sha" : "7bec98239836f219dc41944a768c0506abed950aaec48da69a0782643e90f237", + "source" : "https://raw.githubusercontent.com/AndyGrant/OpenBench/master/Books/2moves_v1.epd.zip" + }, + + "8moves_v3.epd" : { + "name" : "8moves_v3.epd", + "sha" : "1f055af431656f09ee6a09d2448e0b876125f78bb7b404fca2031c403a1541e5", + "source" : "https://raw.githubusercontent.com/AndyGrant/OpenBench/master/Books/8moves_v3.epd.zip" + }, + + "3moves_FRC.epd" : { + "name" : "3moves_FRC.epd", + "sha" : "6bf81e1ada6a3306bbc8356f7bca1e2984a2828d658799992d5443b7179c934d", + "source" : "https://raw.githubusercontent.com/AndyGrant/OpenBench/master/Books/3moves_FRC.epd.zip" + }, + + "4moves_noob.epd" : { + "name" : "4moves_noob.epd", + "sha" : "4be746a91e3f8af0c9344b1e72d611e9fcfe486843867a55760970a4896f284d", + "source" : "https://raw.githubusercontent.com/AndyGrant/OpenBench/master/Books/4moves_noob.epd.zip" + }, + + "Pohl.epd" : { + "name" : "Pohl.epd", + "sha" : "b3e64e0dab84cf451a9ac7ef031f5a2bbcf16c7e21be95298fb03cbf021f5466", + "source" : "https://raw.githubusercontent.com/AndyGrant/OpenBench/master/Books/Pohl.epd.zip" + }, + + "Pohl.pgn" : { + "name" : "Pohl.pgn", + "sha" : "aaa7559c5d94e592fe5cca3586cb099d8fc5f13428d4ce84afc4b97811241c7e", + "source" : "https://raw.githubusercontent.com/AndyGrant/OpenBench/master/Books/Pohl.pgn.zip" + }, + + "DFRC.epd" : { + "name" : "DFRC.epd", + "sha" : "648c447ef40614a44d13b78911e81470d8ddb0d3b2711c1b180e990871f5db4f", + "source" : "https://raw.githubusercontent.com/AndyGrant/OpenBench/master/Books/DFRC.epd.zip" + } +} \ No newline at end of file diff --git a/Engines/4ku.json b/Engines/4ku.json new file mode 100644 index 0000000..5fdb5c7 --- /dev/null +++ b/Engines/4ku.json @@ -0,0 +1,45 @@ +{ + "nps": 1225000, + "base": "master", + "book": "Pohl.pgn", + "bounds": "[0.00, 5.00]", + "source": "https://github.com/kz04px/4ku", + "private": false, + "win_adj": "movecount=3 score=400", + "draw_adj": "movenumber=40 movecount=8 score=10", + "build": { + "path": "", + "compilers": [ + "g++" + ], + "cpuflags": [ + "__POPCNT__" + ] + }, + "testmodes": [ + { + "id": "STC", + "th": 1, + "hash": 64, + "tc": "8.0+0.08" + }, + { + "id": "LTC", + "th": 1, + "hash": 64, + "tc": "40.0+0.4" + }, + { + "id": "SMP STC", + "th": 8, + "hash": 64, + "tc": "5.0+0.05" + }, + { + "id": "SMP LTC", + "th": 8, + "hash": 256, + "tc": "20.0+0.2" + } + ] +} \ No newline at end of file diff --git a/Engines/Berserk.json b/Engines/Berserk.json new file mode 100644 index 0000000..feb7263 --- /dev/null +++ b/Engines/Berserk.json @@ -0,0 +1,47 @@ +{ + "nps": 1325000, + "base": "main", + "book": "Pohl.epd", + "bounds": "[0.00, 3.00]", + "source": "https://github.com/jhonnold/berserk", + "private": false, + "win_adj": "movecount=3 score=400", + "draw_adj": "movenumber=40 movecount=8 score=10", + "build": { + "path": "src", + "compilers": [ + "gcc" + ], + "cpuflags": [ + "__AVX2__", + "__FMA__", + "__POPCNT__" + ] + }, + "testmodes": [ + { + "id": "STC", + "th": 1, + "hash": 8, + "tc": "10.0+0.1" + }, + { + "id": "LTC", + "th": 1, + "hash": 64, + "tc": "60.0+0.6" + }, + { + "id": "SMP STC", + "th": 8, + "hash": 64, + "tc": "5.0+0.05" + }, + { + "id": "SMP LTC", + "th": 8, + "hash": 256, + "tc": "20.0+0.2" + } + ] +} \ No newline at end of file diff --git a/Engines/Bit-Genie.json b/Engines/Bit-Genie.json new file mode 100644 index 0000000..138b795 --- /dev/null +++ b/Engines/Bit-Genie.json @@ -0,0 +1,45 @@ +{ + "nps": 1975000, + "base": "master", + "book": "Pohl.epd", + "bounds": "[0.00, 5.00]", + "source": "https://github.com/Aryan1508/Bit-Genie", + "private": false, + "win_adj": "movecount=3 score=400", + "draw_adj": "movenumber=40 movecount=8 score=10", + "build": { + "path": "src", + "compilers": [ + "g++" + ], + "cpuflags": [ + "__POPCNT__" + ] + }, + "testmodes": [ + { + "id": "STC", + "th": 1, + "hash": 8, + "tc": "8.0+0.08" + }, + { + "id": "LTC", + "th": 1, + "hash": 64, + "tc": "40.0+0.4" + }, + { + "id": "SMP STC", + "th": 8, + "hash": 64, + "tc": "5.0+0.05" + }, + { + "id": "SMP LTC", + "th": 8, + "hash": 256, + "tc": "20.0+0.2" + } + ] +} \ No newline at end of file diff --git a/Engines/BlackMarlin.json b/Engines/BlackMarlin.json new file mode 100644 index 0000000..beebb9c --- /dev/null +++ b/Engines/BlackMarlin.json @@ -0,0 +1,47 @@ +{ + "nps": 1075000, + "base": "main", + "book": "Pohl.epd", + "bounds": "[0.00, 5.00]", + "source": "https://github.com/dsekercioglu/blackmarlin", + "private": false, + "win_adj": "movecount=3 score=400", + "draw_adj": "movenumber=40 movecount=8 score=10", + "build": { + "path": "", + "compilers": [ + "cargo>=1.57.0" + ], + "cpuflags": [ + "__AVX2__", + "__FMA__", + "__POPCNT__" + ] + }, + "testmodes": [ + { + "id": "STC", + "th": 1, + "hash": 8, + "tc": "8.0+0.08" + }, + { + "id": "LTC", + "th": 1, + "hash": 64, + "tc": "40.0+0.4" + }, + { + "id": "SMP STC", + "th": 8, + "hash": 64, + "tc": "5.0+0.05" + }, + { + "id": "SMP LTC", + "th": 8, + "hash": 256, + "tc": "20.0+0.2" + } + ] +} \ No newline at end of file diff --git a/Engines/Demolito.json b/Engines/Demolito.json new file mode 100644 index 0000000..9e0db66 --- /dev/null +++ b/Engines/Demolito.json @@ -0,0 +1,46 @@ +{ + "nps": 1300000, + "base": "master", + "book": "Pohl.epd", + "bounds": "[0.00, 5.00]", + "source": "https://github.com/lucasart/Demolito", + "private": false, + "win_adj": "movecount=3 score=400", + "draw_adj": "movenumber=40 movecount=8 score=10", + "build": { + "path": "src", + "compilers": [ + "clang", + "gcc" + ], + "cpuflags": [ + "__POPCNT__" + ] + }, + "testmodes": [ + { + "id": "STC", + "th": 1, + "hash": 8, + "tc": "8.0+0.08" + }, + { + "id": "LTC", + "th": 1, + "hash": 32, + "tc": "32.0+0.32" + }, + { + "id": "SMP STC", + "th": 8, + "hash": 32, + "tc": "4.0+0.04" + }, + { + "id": "SMP LTC", + "th": 8, + "hash": 128, + "tc": "16.0+0.16" + } + ] +} \ No newline at end of file diff --git a/Engines/Drofa.json b/Engines/Drofa.json new file mode 100644 index 0000000..26d165c --- /dev/null +++ b/Engines/Drofa.json @@ -0,0 +1,45 @@ +{ + "nps": 1250000, + "base": "master", + "book": "4moves_noob.epd", + "bounds": "[0.00, 5.00]", + "source": "https://github.com/justNo4b/Drofa", + "private": false, + "win_adj": "movecount=3 score=400", + "draw_adj": "movenumber=40 movecount=8 score=10", + "build": { + "path": "", + "compilers": [ + "g++" + ], + "cpuflags": [ + "__POPCNT__" + ] + }, + "testmodes": [ + { + "id": "STC", + "th": 1, + "hash": 8, + "tc": "8.0+0.08" + }, + { + "id": "LTC", + "th": 1, + "hash": 64, + "tc": "40.0+0.4" + }, + { + "id": "SMP STC", + "th": 8, + "hash": 64, + "tc": "5.0+0.05" + }, + { + "id": "SMP LTC", + "th": 8, + "hash": 256, + "tc": "20.0+0.2" + } + ] +} \ No newline at end of file diff --git a/Engines/Ethereal.json b/Engines/Ethereal.json new file mode 100644 index 0000000..9b10d14 --- /dev/null +++ b/Engines/Ethereal.json @@ -0,0 +1,44 @@ +{ + "private" : false, + "nps" : 1050000, + "base" : "master", + "source" : "https://github.com/AndyGrant/Ethereal", + + "bounds" : "[0.00, 3.00]", + "book" : "Pohl.epd", + "win_adj" : "movecount=3 score=400", + "draw_adj" : "movenumber=40 movecount=8 score=10", + + "build": { + "path" : "src", + "compilers" : ["clang", "gcc"], + "cpuflags" : ["__AVX2__", "__FMA__", "__POPCNT__"] + }, + + "testmodes": [ + { + "id": "STC", + "th": 1, + "hash": 8, + "tc": "10.0+0.1" + }, + { + "id": "LTC", + "th": 1, + "hash": 64, + "tc": "60.0+0.6" + }, + { + "id": "SMP STC", + "th": 8, + "hash": 64, + "tc": "5.0+0.05" + }, + { + "id": "SMP LTC", + "th": 8, + "hash": 256, + "tc": "20.0+0.2" + } + ] +} \ No newline at end of file diff --git a/Engines/FabChess.json b/Engines/FabChess.json new file mode 100644 index 0000000..9a4bfa2 --- /dev/null +++ b/Engines/FabChess.json @@ -0,0 +1,45 @@ +{ + "nps": 1000000, + "base": "master", + "book": "Pohl.epd", + "bounds": "[0.00, 5.00]", + "source": "https://github.com/fabianvdW/FabChess", + "private": false, + "win_adj": "movecount=3 score=400", + "draw_adj": "movenumber=40 movecount=8 score=10", + "build": { + "path": "", + "compilers": [ + "cargo>=1.41.0" + ], + "cpuflags": [ + "__POPCNT__" + ] + }, + "testmodes": [ + { + "id": "STC", + "th": 1, + "hash": 8, + "tc": "8.0+0.08" + }, + { + "id": "LTC", + "th": 1, + "hash": 64, + "tc": "40.0+0.4" + }, + { + "id": "SMP STC", + "th": 8, + "hash": 64, + "tc": "5.0+0.05" + }, + { + "id": "SMP LTC", + "th": 8, + "hash": 256, + "tc": "20.0+0.2" + } + ] +} \ No newline at end of file diff --git a/Engines/Halogen.json b/Engines/Halogen.json new file mode 100644 index 0000000..86defcb --- /dev/null +++ b/Engines/Halogen.json @@ -0,0 +1,45 @@ +{ + "nps": 1800000, + "base": "master", + "book": "Pohl.epd", + "bounds": "[0.00, 5.00]", + "source": "https://github.com/KierenP/Halogen", + "private": false, + "win_adj": "movecount=3 score=400", + "draw_adj": "movenumber=40 movecount=8 score=10", + "build": { + "path": "src", + "compilers": [ + "g++" + ], + "cpuflags": [ + "__POPCNT__" + ] + }, + "testmodes": [ + { + "id": "STC", + "th": 1, + "hash": 8, + "tc": "8.0+0.08" + }, + { + "id": "LTC", + "th": 1, + "hash": 64, + "tc": "40.0+0.4" + }, + { + "id": "SMP STC", + "th": 8, + "hash": 64, + "tc": "5.0+0.05" + }, + { + "id": "SMP LTC", + "th": 8, + "hash": 256, + "tc": "20.0+0.2" + } + ] +} \ No newline at end of file diff --git a/Engines/Igel.json b/Engines/Igel.json new file mode 100644 index 0000000..027d090 --- /dev/null +++ b/Engines/Igel.json @@ -0,0 +1,45 @@ +{ + "nps": 450000, + "base": "master", + "book": "Pohl.epd", + "bounds": "[0.00, 3.00]", + "source": "https://github.com/vshcherbyna/igel", + "private": false, + "win_adj": "movecount=3 score=400", + "draw_adj": "movenumber=40 movecount=8 score=10", + "build": { + "path": "src", + "compilers": [ + "g++" + ], + "cpuflags": [ + "__POPCNT__" + ] + }, + "testmodes": [ + { + "id": "STC", + "th": 1, + "hash": 8, + "tc": "10.0+0.1" + }, + { + "id": "LTC", + "th": 1, + "hash": 64, + "tc": "60.0+0.6" + }, + { + "id": "SMP STC", + "th": 8, + "hash": 64, + "tc": "5.0+0.05" + }, + { + "id": "SMP LTC", + "th": 8, + "hash": 256, + "tc": "20.0+0.2" + } + ] +} \ No newline at end of file diff --git a/Engines/Koivisto.json b/Engines/Koivisto.json new file mode 100644 index 0000000..a7f8149 --- /dev/null +++ b/Engines/Koivisto.json @@ -0,0 +1,47 @@ +{ + "nps": 1200000, + "base": "master", + "book": "Pohl.epd", + "bounds": "[0.00, 2.50]", + "source": "https://github.com/Luecx/Koivisto", + "private": false, + "win_adj": "movecount=3 score=400", + "draw_adj": "movenumber=40 movecount=8 score=10", + "build": { + "path": "src_files", + "compilers": [ + "g++" + ], + "cpuflags": [ + "__AVX2__", + "__FMA__", + "__POPCNT__" + ] + }, + "testmodes": [ + { + "id": "STC", + "th": 1, + "hash": 8, + "tc": "8.0+0.08" + }, + { + "id": "LTC", + "th": 1, + "hash": 64, + "tc": "40.0+0.4" + }, + { + "id": "SMP STC", + "th": 8, + "hash": 64, + "tc": "5.0+0.05" + }, + { + "id": "SMP LTC", + "th": 8, + "hash": 256, + "tc": "20.0+0.2" + } + ] +} \ No newline at end of file diff --git a/Engines/Laser.json b/Engines/Laser.json new file mode 100644 index 0000000..a6c572a --- /dev/null +++ b/Engines/Laser.json @@ -0,0 +1,45 @@ +{ + "nps": 935000, + "base": "master", + "book": "Pohl.epd", + "bounds": "[0.00, 5.00]", + "source": "https://github.com/jeffreyan11/uci-chess-engine", + "private": false, + "win_adj": "movecount=3 score=400", + "draw_adj": "movenumber=40 movecount=8 score=10", + "build": { + "path": "src", + "compilers": [ + "g++" + ], + "cpuflags": [ + "__POPCNT__" + ] + }, + "testmodes": [ + { + "id": "STC", + "th": 1, + "hash": 8, + "tc": "8.0+0.08" + }, + { + "id": "LTC", + "th": 1, + "hash": 64, + "tc": "40.0+0.4" + }, + { + "id": "SMP STC", + "th": 8, + "hash": 64, + "tc": "5.0+0.05" + }, + { + "id": "SMP LTC", + "th": 8, + "hash": 256, + "tc": "20.0+0.2" + } + ] +} \ No newline at end of file diff --git a/Engines/RubiChess.json b/Engines/RubiChess.json new file mode 100644 index 0000000..ac2b8a4 --- /dev/null +++ b/Engines/RubiChess.json @@ -0,0 +1,45 @@ +{ + "nps": 925000, + "base": "master", + "book": "Pohl.epd", + "bounds": "[0.00, 5.00]", + "source": "https://github.com/Matthies/RubiChess", + "private": false, + "win_adj": "movecount=3 score=400", + "draw_adj": "movenumber=40 movecount=8 score=10", + "build": { + "path": "src", + "compilers": [ + "g++" + ], + "cpuflags": [ + "__POPCNT__" + ] + }, + "testmodes": [ + { + "id": "STC", + "th": 1, + "hash": 8, + "tc": "10.0+0.1" + }, + { + "id": "LTC", + "th": 1, + "hash": 64, + "tc": "60.0+0.6" + }, + { + "id": "SMP STC", + "th": 8, + "hash": 64, + "tc": "5.0+0.05" + }, + { + "id": "SMP LTC", + "th": 8, + "hash": 256, + "tc": "20.0+0.2" + } + ] +} \ No newline at end of file diff --git a/Engines/Seer.json b/Engines/Seer.json new file mode 100644 index 0000000..e58a439 --- /dev/null +++ b/Engines/Seer.json @@ -0,0 +1,47 @@ +{ + "nps": 875000, + "base": "main", + "book": "Pohl.epd", + "bounds": "[0.00, 5.00]", + "source": "https://github.com/connormcmonigle/seer-nnue", + "private": false, + "win_adj": "movecount=3 score=400", + "draw_adj": "movenumber=40 movecount=8 score=10", + "build": { + "path": "build", + "compilers": [ + "g++>=9.0.0" + ], + "cpuflags": [ + "__AVX2__", + "__FMA__", + "__POPCNT__" + ] + }, + "testmodes": [ + { + "id": "STC", + "th": 1, + "hash": 32, + "tc": "8.0+0.08" + }, + { + "id": "LTC", + "th": 1, + "hash": 64, + "tc": "40.0+0.4" + }, + { + "id": "SMP STC", + "th": 8, + "hash": 64, + "tc": "5.0+0.05" + }, + { + "id": "SMP LTC", + "th": 8, + "hash": 256, + "tc": "20.0+0.2" + } + ] +} \ No newline at end of file diff --git a/Engines/Stash.json b/Engines/Stash.json new file mode 100644 index 0000000..6b99bfa --- /dev/null +++ b/Engines/Stash.json @@ -0,0 +1,46 @@ +{ + "nps": 1625000, + "base": "master", + "book": "4moves_noob.epd", + "bounds": "[0.00, 5.00]", + "source": "https://github.com/mhouppin/stash-bot", + "private": false, + "win_adj": "movecount=3 score=400", + "draw_adj": "movenumber=40 movecount=8 score=10", + "build": { + "path": "src", + "compilers": [ + "gcc", + "clang" + ], + "cpuflags": [ + "__POPCNT__" + ] + }, + "testmodes": [ + { + "id": "STC", + "th": 1, + "hash": 16, + "tc": "8.0+0.08" + }, + { + "id": "LTC", + "th": 1, + "hash": 64, + "tc": "40.0+0.4" + }, + { + "id": "SMP STC", + "th": 8, + "hash": 64, + "tc": "5.0+0.05" + }, + { + "id": "SMP LTC", + "th": 8, + "hash": 256, + "tc": "20.0+0.2" + } + ] +} \ No newline at end of file diff --git a/Engines/Weiss.json b/Engines/Weiss.json new file mode 100644 index 0000000..0a6b25f --- /dev/null +++ b/Engines/Weiss.json @@ -0,0 +1,45 @@ +{ + "nps": 1700000, + "base": "master", + "book": "Pohl.epd", + "bounds": "[-1.00, 4.00]", + "source": "https://github.com/TerjeKir/weiss", + "private": false, + "win_adj": "movecount=3 score=400", + "draw_adj": "movenumber=40 movecount=8 score=10", + "build": { + "path": "src", + "compilers": [ + "gcc" + ], + "cpuflags": [ + "__POPCNT__" + ] + }, + "testmodes": [ + { + "id": "STC", + "th": 1, + "hash": 32, + "tc": "8.0+0.08" + }, + { + "id": "LTC", + "th": 1, + "hash": 128, + "tc": "40.0+0.4" + }, + { + "id": "SMP STC", + "th": 8, + "hash": 128, + "tc": "5.0+0.05" + }, + { + "id": "SMP LTC", + "th": 8, + "hash": 512, + "tc": "20.0+0.2" + } + ] +} \ No newline at end of file diff --git a/Engines/Winter.json b/Engines/Winter.json new file mode 100644 index 0000000..6ab12c5 --- /dev/null +++ b/Engines/Winter.json @@ -0,0 +1,46 @@ +{ + "nps": 625000, + "base": "master", + "book": "Pohl.epd", + "bounds": "[0.00, 5.00]", + "source": "https://github.com/rosenthj/Winter", + "private": false, + "win_adj": "movecount=3 score=400", + "draw_adj": "movenumber=40 movecount=8 score=10", + "build": { + "path": "", + "compilers": [ + "clang++", + "g++" + ], + "cpuflags": [ + "__POPCNT__" + ] + }, + "testmodes": [ + { + "id": "STC", + "th": 1, + "hash": 8, + "tc": "8.0+0.08" + }, + { + "id": "LTC", + "th": 1, + "hash": 64, + "tc": "40.0+0.4" + }, + { + "id": "SMP STC", + "th": 8, + "hash": 64, + "tc": "5.0+0.05" + }, + { + "id": "SMP LTC", + "th": 8, + "hash": 256, + "tc": "20.0+0.2" + } + ] +} \ No newline at end of file diff --git a/Engines/Zahak.json b/Engines/Zahak.json new file mode 100644 index 0000000..a1780ea --- /dev/null +++ b/Engines/Zahak.json @@ -0,0 +1,46 @@ +{ + "nps": 850000, + "base": "master", + "book": "Pohl.epd", + "bounds": "[0.00, 5.00]", + "source": "https://github.com/amanjpro/zahak", + "private": false, + "win_adj": "movecount=3 score=400", + "draw_adj": "movenumber=40 movecount=8 score=10", + "build": { + "path": "", + "compilers": [ + "go" + ], + "cpuflags": [ + "__AVX__", + "__POPCNT__" + ] + }, + "testmodes": [ + { + "id": "STC", + "th": 1, + "hash": 8, + "tc": "8.0+0.08" + }, + { + "id": "LTC", + "th": 1, + "hash": 64, + "tc": "40.0+0.4" + }, + { + "id": "SMP STC", + "th": 8, + "hash": 64, + "tc": "5.0+0.05" + }, + { + "id": "SMP LTC", + "th": 8, + "hash": 256, + "tc": "20.0+0.2" + } + ] +} \ No newline at end of file diff --git a/OpenBench/config.py b/OpenBench/config.py index 36b2456..1c5cd8a 100644 --- a/OpenBench/config.py +++ b/OpenBench/config.py @@ -18,11 +18,22 @@ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # -USE_CROSS_APPROVAL = False +import json, os.path +from OpenSite.settings import PROJECT_PATH -REQUIRE_LOGIN_TO_VIEW = True +def load_json_config(*path): + with open(os.path.join(PROJECT_PATH, *path)) as fin: + return json.load(fin) -REQUIRE_MANUAL_REGISTRATION = True +def load_folder_of_configs(*path): + return { + fname.removesuffix('.json') : load_json_config(*path, fname) + for fname in os.listdir(os.path.join(PROJECT_PATH, *path)) if fname.endswith('.json') + } + +USE_CROSS_APPROVAL = False # Require a second user to approve patches +REQUIRE_LOGIN_TO_VIEW = True # Block all content but Login and Regiser by default +REQUIRE_MANUAL_REGISTRATION = True # Disable the public facing registration page OPENBENCH_CONFIG = { @@ -47,528 +58,9 @@ OPENBENCH_CONFIG = { 'confidence' : '[0.05, 0.05]', # SPRT Type I/II Confidence }, - # Book Configuration. When addding a book, follow the provided template. - # The SHA is defined by hashlib.sha256(book.read().encode('utf-8')).hexdigest(). - # Client.py has this exact code to generate and verify sha256 values, as an example. + # Take a look at Books/books.json + 'books' : load_json_config('Books', 'books.json'), - 'books' : { - - '2moves_v1.epd' : { - 'name' : '2moves_v1.epd', - 'sha' : '7bec98239836f219dc41944a768c0506abed950aaec48da69a0782643e90f237', - 'source' : 'https://raw.githubusercontent.com/AndyGrant/OpenBench/master/Books/2moves_v1.epd.zip', - }, - - '8moves_v3.epd' : { - 'name' : '8moves_v3.epd', - 'sha' : '1f055af431656f09ee6a09d2448e0b876125f78bb7b404fca2031c403a1541e5', - 'source' : 'https://raw.githubusercontent.com/AndyGrant/OpenBench/master/Books/8moves_v3.epd.zip', - }, - - '3moves_FRC.epd' : { - 'name' : '3moves_FRC.epd', - 'sha' : '6bf81e1ada6a3306bbc8356f7bca1e2984a2828d658799992d5443b7179c934d', - 'source' : 'https://raw.githubusercontent.com/AndyGrant/OpenBench/master/Books/3moves_FRC.epd.zip', - }, - - '4moves_noob.epd' : { - 'name' : '4moves_noob.epd', - 'sha' : '4be746a91e3f8af0c9344b1e72d611e9fcfe486843867a55760970a4896f284d', - 'source' : 'https://raw.githubusercontent.com/AndyGrant/OpenBench/master/Books/4moves_noob.epd.zip', - }, - - 'Pohl.epd' : { - 'name' : 'Pohl.epd', - 'sha' : 'b3e64e0dab84cf451a9ac7ef031f5a2bbcf16c7e21be95298fb03cbf021f5466', - 'source' : 'https://raw.githubusercontent.com/AndyGrant/OpenBench/master/Books/Pohl.epd.zip', - }, - - 'Pohl.pgn' : { - 'name' : 'Pohl.pgn', - 'sha' : 'aaa7559c5d94e592fe5cca3586cb099d8fc5f13428d4ce84afc4b97811241c7e', - 'source' : 'https://raw.githubusercontent.com/AndyGrant/OpenBench/master/Books/Pohl.pgn.zip', - }, - - 'DFRC.epd' : { - 'name' : 'DFRC.epd', - 'sha' : '648c447ef40614a44d13b78911e81470d8ddb0d3b2711c1b180e990871f5db4f', - 'source' : 'https://raw.githubusercontent.com/AndyGrant/OpenBench/master/Books/DFRC.epd.zip', - }, - }, - - - # Engine Configuration. All engines must have a name, a source repo, - # a set of paramaters for each standard test type, as well as a scaled - # NPS value, which is used to normalize speed across all workers. - - 'engines' : { - - 'Ethereal' : { - - 'nps' : 1050000, - 'base' : 'master', - 'book' : 'Pohl.epd', - 'bounds' : '[0.00, 3.00]', - 'source' : 'https://github.com/AndyGrant/Ethereal', - 'private' : False, - - 'win_adj' : 'movecount=3 score=400', - 'draw_adj' : 'movenumber=40 movecount=8 score=10', - - 'build' : { - 'path' : 'src', - 'compilers' : ['clang', 'gcc'], - 'cpuflags' : ['__AVX2__', '__FMA__', '__POPCNT__'], - }, - - 'testmodes' : [ - { 'id' : 'STC', 'th' : 1, 'hash' : 8, 'tc' : '10.0+0.1' }, - { 'id' : 'LTC', 'th' : 1, 'hash' : 64, 'tc' : '60.0+0.6' }, - { 'id' : 'SMP STC', 'th' : 8, 'hash' : 64, 'tc' : '5.0+0.05' }, - { 'id' : 'SMP LTC', 'th' : 8, 'hash' : 256, 'tc' : '20.0+0.2' }, - ], - }, - - 'Laser' : { - - 'nps' : 935000, - 'base' : 'master', - 'book' : 'Pohl.epd', - 'bounds' : '[0.00, 5.00]', - 'source' : 'https://github.com/jeffreyan11/uci-chess-engine', - 'private' : False, - - 'win_adj' : 'movecount=3 score=400', - 'draw_adj' : 'movenumber=40 movecount=8 score=10', - - 'build' : { - 'path' : 'src', - 'compilers' : ['g++'], - 'cpuflags' : ['__POPCNT__'], - }, - - 'testmodes' : [ - { 'id' : 'STC', 'th' : 1, 'hash' : 8, 'tc' : '8.0+0.08' }, - { 'id' : 'LTC', 'th' : 1, 'hash' : 64, 'tc' : '40.0+0.4' }, - { 'id' : 'SMP STC', 'th' : 8, 'hash' : 64, 'tc' : '5.0+0.05' }, - { 'id' : 'SMP LTC', 'th' : 8, 'hash' : 256, 'tc' : '20.0+0.2' }, - ], - }, - - 'Weiss' : { - - 'nps' : 1700000, - 'base' : 'master', - 'book' : 'Pohl.epd', - 'bounds' : '[-1.00, 4.00]', - 'source' : 'https://github.com/TerjeKir/weiss', - 'private' : False, - - 'win_adj' : 'movecount=3 score=400', - 'draw_adj' : 'movenumber=40 movecount=8 score=10', - - 'build' : { - 'path' : 'src', - 'compilers' : ['gcc'], - 'cpuflags' : ['__POPCNT__'], - }, - - 'testmodes' : [ - { 'id' : 'STC', 'th' : 1, 'hash' : 32, 'tc' : '8.0+0.08' }, - { 'id' : 'LTC', 'th' : 1, 'hash' : 128, 'tc' : '40.0+0.4' }, - { 'id' : 'SMP STC', 'th' : 8, 'hash' : 128, 'tc' : '5.0+0.05' }, - { 'id' : 'SMP LTC', 'th' : 8, 'hash' : 512, 'tc' : '20.0+0.2' }, - ], - }, - - 'Demolito' : { - - 'nps' : 1300000, - 'base' : 'master', - 'book' : 'Pohl.epd', - 'bounds' : '[0.00, 5.00]', - 'source' : 'https://github.com/lucasart/Demolito', - 'private' : False, - - 'win_adj' : 'movecount=3 score=400', - 'draw_adj' : 'movenumber=40 movecount=8 score=10', - - 'build' : { - 'path' : 'src', - 'compilers' : ['clang', 'gcc'], - 'cpuflags' : ['__POPCNT__'], - }, - - 'testmodes' : [ - { 'id' : 'STC', 'th' : 1, 'hash' : 8, 'tc' : '8.0+0.08' }, - { 'id' : 'LTC', 'th' : 1, 'hash' : 32, 'tc' : '32.0+0.32'}, - { 'id' : 'SMP STC', 'th' : 8, 'hash' : 32, 'tc' : '4.0+0.04' }, - { 'id' : 'SMP LTC', 'th' : 8, 'hash' : 128, 'tc' : '16.0+0.16'}, - ], - }, - - 'RubiChess' : { - - 'nps' : 925000, - 'base' : 'master', - 'book' : 'Pohl.epd', - 'bounds' : '[0.00, 5.00]', - 'source' : 'https://github.com/Matthies/RubiChess', - 'private' : False, - - 'win_adj' : 'movecount=3 score=400', - 'draw_adj' : 'movenumber=40 movecount=8 score=10', - - 'build' : { - 'path' : 'src', - 'compilers' : ['g++'], - 'cpuflags' : ['__POPCNT__'], - }, - - 'testmodes' : [ - { 'id' : 'STC', 'th' : 1, 'hash' : 8, 'tc' : '10.0+0.1' }, - { 'id' : 'LTC', 'th' : 1, 'hash' : 64, 'tc' : '60.0+0.6' }, - { 'id' : 'SMP STC', 'th' : 8, 'hash' : 64, 'tc' : '5.0+0.05' }, - { 'id' : 'SMP LTC', 'th' : 8, 'hash' : 256, 'tc' : '20.0+0.2' }, - ], - }, - - 'FabChess' : { - - 'nps' : 1000000, - 'base' : 'master', - 'book' : 'Pohl.epd', - 'bounds' : '[0.00, 5.00]', - 'source' : 'https://github.com/fabianvdW/FabChess', - 'private' : False, - - 'win_adj' : 'movecount=3 score=400', - 'draw_adj' : 'movenumber=40 movecount=8 score=10', - - 'build' : { - 'path' : '', - 'compilers' : ['cargo>=1.41.0'], - 'cpuflags' : ['__POPCNT__'], - }, - - 'testmodes' : [ - { 'id' : 'STC', 'th' : 1, 'hash' : 8, 'tc' : '8.0+0.08' }, - { 'id' : 'LTC', 'th' : 1, 'hash' : 64, 'tc' : '40.0+0.4' }, - { 'id' : 'SMP STC', 'th' : 8, 'hash' : 64, 'tc' : '5.0+0.05' }, - { 'id' : 'SMP LTC', 'th' : 8, 'hash' : 256, 'tc' : '20.0+0.2' }, - ], - }, - - 'Igel' : { - - 'nps' : 450000, - 'base' : 'master', - 'book' : 'Pohl.epd', - 'bounds' : '[0.00, 3.00]', - 'source' : 'https://github.com/vshcherbyna/igel', - 'private' : False, - - 'win_adj' : 'movecount=3 score=400', - 'draw_adj' : 'movenumber=40 movecount=8 score=10', - - 'build' : { - 'path' : 'src', - 'compilers' : ['g++'], - 'cpuflags' : ['__POPCNT__'], - }, - - 'testmodes' : [ - { 'id' : 'STC', 'th' : 1, 'hash' : 8, 'tc' : '10.0+0.1' }, - { 'id' : 'LTC', 'th' : 1, 'hash' : 64, 'tc' : '60.0+0.6' }, - { 'id' : 'SMP STC', 'th' : 8, 'hash' : 64, 'tc' : '5.0+0.05' }, - { 'id' : 'SMP LTC', 'th' : 8, 'hash' : 256, 'tc' : '20.0+0.2' }, - ], - }, - - 'Winter' : { - - 'nps' : 625000, - 'base' : 'master', - 'book' : 'Pohl.epd', - 'bounds' : '[0.00, 5.00]', - 'source' : 'https://github.com/rosenthj/Winter', - 'private' : False, - - 'win_adj' : 'movecount=3 score=400', - 'draw_adj' : 'movenumber=40 movecount=8 score=10', - - 'build' : { - 'path' : '', - 'compilers' : ['clang++', 'g++'], - 'cpuflags' : ['__POPCNT__'], - }, - - 'testmodes' : [ - { 'id' : 'STC', 'th' : 1, 'hash' : 8, 'tc' : '8.0+0.08' }, - { 'id' : 'LTC', 'th' : 1, 'hash' : 64, 'tc' : '40.0+0.4' }, - { 'id' : 'SMP STC', 'th' : 8, 'hash' : 64, 'tc' : '5.0+0.05' }, - { 'id' : 'SMP LTC', 'th' : 8, 'hash' : 256, 'tc' : '20.0+0.2' }, - ], - }, - - 'Halogen' : { - - 'nps' : 1800000, - 'base' : 'master', - 'book' : 'Pohl.epd', - 'bounds' : '[0.00, 5.00]', - 'source' : 'https://github.com/KierenP/Halogen', - 'private' : False, - - 'win_adj' : 'movecount=3 score=400', - 'draw_adj' : 'movenumber=40 movecount=8 score=10', - - 'build' : { - 'path' : 'src', - 'compilers' : ['g++'], - 'cpuflags' : ['__POPCNT__'], - }, - - 'testmodes' : [ - { 'id' : 'STC', 'th' : 1, 'hash' : 8, 'tc' : '8.0+0.08' }, - { 'id' : 'LTC', 'th' : 1, 'hash' : 64, 'tc' : '40.0+0.4' }, - { 'id' : 'SMP STC', 'th' : 8, 'hash' : 64, 'tc' : '5.0+0.05' }, - { 'id' : 'SMP LTC', 'th' : 8, 'hash' : 256, 'tc' : '20.0+0.2' }, - ], - }, - - 'Stash' : { - - 'nps' : 1625000, - 'base' : 'master', - 'book' : '4moves_noob.epd', - 'bounds' : '[0.00, 5.00]', - 'source' : 'https://github.com/mhouppin/stash-bot', - 'private' : False, - - 'win_adj' : 'movecount=3 score=400', - 'draw_adj' : 'movenumber=40 movecount=8 score=10', - - 'build' : { - 'path' : 'src', - 'compilers' : ['gcc', 'clang'], - 'cpuflags' : ['__POPCNT__'], - }, - - 'testmodes' : [ - { 'id' : 'STC', 'th' : 1, 'hash' : 16, 'tc' : '8.0+0.08' }, - { 'id' : 'LTC', 'th' : 1, 'hash' : 64, 'tc' : '40.0+0.4' }, - { 'id' : 'SMP STC', 'th' : 8, 'hash' : 64, 'tc' : '5.0+0.05' }, - { 'id' : 'SMP LTC', 'th' : 8, 'hash' : 256, 'tc' : '20.0+0.2' }, - ], - }, - - 'Seer' : { - - 'nps' : 875000, - 'base' : 'main', - 'book' : 'Pohl.epd', - 'bounds' : '[0.00, 5.00]', - 'source' : 'https://github.com/connormcmonigle/seer-nnue', - 'private' : False, - - 'win_adj' : 'movecount=3 score=400', - 'draw_adj' : 'movenumber=40 movecount=8 score=10', - - 'build' : { - 'path' : 'build', - 'compilers' : ['g++>=9.0.0'], - 'cpuflags' : ['__AVX2__', '__FMA__', '__POPCNT__'], - }, - - 'testmodes' : [ - { 'id' : 'STC', 'th' : 1, 'hash' : 32, 'tc' : '8.0+0.08' }, - { 'id' : 'LTC', 'th' : 1, 'hash' : 64, 'tc' : '40.0+0.4' }, - { 'id' : 'SMP STC', 'th' : 8, 'hash' : 64, 'tc' : '5.0+0.05' }, - { 'id' : 'SMP LTC', 'th' : 8, 'hash' : 256, 'tc' : '20.0+0.2' }, - ], - }, - - 'Koivisto' : { - - 'nps' : 1200000, - 'base' : 'master', - 'book' : 'Pohl.epd', - 'bounds' : '[0.00, 2.50]', - 'source' : 'https://github.com/Luecx/Koivisto', - 'private' : False, - - 'win_adj' : 'movecount=3 score=400', - 'draw_adj' : 'movenumber=40 movecount=8 score=10', - - 'build' : { - 'path' : 'src_files', - 'compilers' : ['g++'], - 'cpuflags' : ['__AVX2__', '__FMA__', '__POPCNT__'], - }, - - 'testmodes' : [ - { 'id' : 'STC', 'th' : 1, 'hash' : 8, 'tc' : '8.0+0.08' }, - { 'id' : 'LTC', 'th' : 1, 'hash' : 64, 'tc' : '40.0+0.4' }, - { 'id' : 'SMP STC', 'th' : 8, 'hash' : 64, 'tc' : '5.0+0.05' }, - { 'id' : 'SMP LTC', 'th' : 8, 'hash' : 256, 'tc' : '20.0+0.2' }, - ], - }, - - 'Drofa' : { - - 'nps' : 1250000, - 'base' : 'master', - 'book' : '4moves_noob.epd', - 'bounds' : '[0.00, 5.00]', - 'source' : 'https://github.com/justNo4b/Drofa', - 'private' : False, - - 'win_adj' : 'movecount=3 score=400', - 'draw_adj' : 'movenumber=40 movecount=8 score=10', - - 'build' : { - 'path' : '', - 'compilers' : ['g++'], - 'cpuflags' : ['__POPCNT__'], - }, - - 'testmodes' : [ - { 'id' : 'STC', 'th' : 1, 'hash' : 8, 'tc' : '8.0+0.08' }, - { 'id' : 'LTC', 'th' : 1, 'hash' : 64, 'tc' : '40.0+0.4' }, - { 'id' : 'SMP STC', 'th' : 8, 'hash' : 64, 'tc' : '5.0+0.05' }, - { 'id' : 'SMP LTC', 'th' : 8, 'hash' : 256, 'tc' : '20.0+0.2' }, - ], - }, - - 'Bit-Genie' : { - - 'nps' : 1975000, - 'base' : 'master', - 'book' : 'Pohl.epd', - 'bounds' : '[0.00, 5.00]', - 'source' : 'https://github.com/Aryan1508/Bit-Genie', - 'private' : False, - - 'win_adj' : 'movecount=3 score=400', - 'draw_adj' : 'movenumber=40 movecount=8 score=10', - - 'build' : { - 'path' : 'src', - 'compilers' : ['g++'], - 'cpuflags' : ['__POPCNT__'], - }, - - 'testmodes' : [ - { 'id' : 'STC', 'th' : 1, 'hash' : 8, 'tc' : '8.0+0.08' }, - { 'id' : 'LTC', 'th' : 1, 'hash' : 64, 'tc' : '40.0+0.4' }, - { 'id' : 'SMP STC', 'th' : 8, 'hash' : 64, 'tc' : '5.0+0.05' }, - { 'id' : 'SMP LTC', 'th' : 8, 'hash' : 256, 'tc' : '20.0+0.2' }, - ], - }, - - 'Berserk' : { - - 'nps' : 1325000, - 'base' : 'main', - 'book' : 'Pohl.epd', - 'bounds' : '[0.00, 3.00]', - 'source' : 'https://github.com/jhonnold/berserk', - 'private' : False, - - 'win_adj' : 'movecount=3 score=400', - 'draw_adj' : 'movenumber=40 movecount=8 score=10', - - 'build' : { - 'path' : 'src', - 'compilers' : ['gcc'], - 'cpuflags' : ['__AVX2__', '__FMA__', '__POPCNT__'], - }, - - 'testmodes' : [ - { 'id' : 'STC', 'th' : 1, 'hash' : 8, 'tc' : '10.0+0.1' }, - { 'id' : 'LTC', 'th' : 1, 'hash' : 64, 'tc' : '60.0+0.6' }, - { 'id' : 'SMP STC', 'th' : 8, 'hash' : 64, 'tc' : '5.0+0.05' }, - { 'id' : 'SMP LTC', 'th' : 8, 'hash' : 256, 'tc' : '20.0+0.2' }, - ], - }, - - 'Zahak' : { - - 'nps' : 850000, - 'base' : 'master', - 'book' : 'Pohl.epd', - 'bounds' : '[0.00, 5.00]', - 'source' : 'https://github.com/amanjpro/zahak', - 'private' : False, - - 'win_adj' : 'movecount=3 score=400', - 'draw_adj' : 'movenumber=40 movecount=8 score=10', - - 'build' : { - 'path' : '', - 'compilers' : ['go'], - 'cpuflags' : ['__AVX__', '__POPCNT__'], - }, - - 'testmodes' : [ - { 'id' : 'STC', 'th' : 1, 'hash' : 8, 'tc' : '8.0+0.08' }, - { 'id' : 'LTC', 'th' : 1, 'hash' : 64, 'tc' : '40.0+0.4' }, - { 'id' : 'SMP STC', 'th' : 8, 'hash' : 64, 'tc' : '5.0+0.05' }, - { 'id' : 'SMP LTC', 'th' : 8, 'hash' : 256, 'tc' : '20.0+0.2' }, - ], - }, - - 'BlackMarlin' : { - - 'nps' : 1075000, - 'base' : 'main', - 'book' : 'Pohl.epd', - 'bounds' : '[0.00, 5.00]', - 'source' : 'https://github.com/dsekercioglu/blackmarlin', - 'private' : False, - - 'win_adj' : 'movecount=3 score=400', - 'draw_adj' : 'movenumber=40 movecount=8 score=10', - - 'build' : { - 'path' : '', - 'compilers': ['cargo>=1.57.0'], - 'cpuflags' : ['__AVX2__', '__FMA__', '__POPCNT__'], - }, - - 'testmodes' : [ - { 'id' : 'STC', 'th' : 1, 'hash' : 8, 'tc' : '8.0+0.08' }, - { 'id' : 'LTC', 'th' : 1, 'hash' : 64, 'tc' : '40.0+0.4' }, - { 'id' : 'SMP STC', 'th' : 8, 'hash' : 64, 'tc' : '5.0+0.05' }, - { 'id' : 'SMP LTC', 'th' : 8, 'hash' : 256, 'tc' : '20.0+0.2' }, - ], - }, - - '4ku' : { - - 'nps' : 1225000, - 'base' : 'master', - 'book' : 'Pohl.pgn', - 'bounds' : '[0.00, 5.00]', - 'source' : 'https://github.com/kz04px/4ku', - 'private' : False, - - 'win_adj' : 'movecount=3 score=400', - 'draw_adj' : 'movenumber=40 movecount=8 score=10', - - 'build' : { - 'path' : '', - 'compilers' : ['g++'], - 'cpuflags' : ['__POPCNT__'], - }, - - 'testmodes' : [ - { 'id' : 'STC', 'th' : 1, 'hash' : 64, 'tc' : '8.0+0.08' }, - { 'id' : 'LTC', 'th' : 1, 'hash' : 64, 'tc' : '40.0+0.4' }, - { 'id' : 'SMP STC', 'th' : 8, 'hash' : 64, 'tc' : '5.0+0.05' }, - { 'id' : 'SMP LTC', 'th' : 8, 'hash' : 256, 'tc' : '20.0+0.2' }, - ], - }, - }, + # Take a look at json file in Engines/ + 'engines' : load_folder_of_configs('Engines'), } diff --git a/cleanup.sh b/cleanup.sh deleted file mode 100755 index 111b7f6..0000000 --- a/cleanup.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -rm -i db.sqlite3 -rm -r OpenBench/migrations/* -rm -r OpenBench/__pycache__/* -rm -r OpenSite/__pycache__/* - -python3 manage.py makemigrations -python3 manage.py migrate -python3 manage.py migrate --run-syncdb - -python3 manage.py createsuperuser \ No newline at end of file From c32dbef9dd7606c4f1c3b816beb902fd89d56918 Mon Sep 17 00:00:00 2001 From: andrew Date: Thu, 6 Apr 2023 01:12:02 -0400 Subject: [PATCH 15/51] Add report_rate and workload_size options to Tests --- Client/Client.py | 12 ++--- OpenBench/models.py | 4 ++ OpenBench/static/style.css | 17 ++++--- OpenBench/utils.py | 78 +++++++++++++++++++------------- OpenBench/views.py | 12 +++-- Templates/OpenBench/newTest.html | 11 ++++- Templates/OpenBench/test.html | 3 +- 7 files changed, 85 insertions(+), 52 deletions(-) diff --git a/Client/Client.py b/Client/Client.py index 296db4e..4c1a58b 100644 --- a/Client/Client.py +++ b/Client/Client.py @@ -51,7 +51,6 @@ TIMEOUT_WORKLOAD = 30 # Timeout in seconds between workload requests CLIENT_VERSION = '7' # Client version to send to the Server SYZYGY_WDL_PATH = None # Pathway to WDL Syzygy Tables -BASE_GAMES_PER_CORE = 32 # Typical games played per-thread FLEET_MODE = False # Exit when there are no workloads ERRORS = { @@ -901,9 +900,8 @@ def build_cutechess_command(arguments, workload, dev_cmd, base_cmd, nps, cuteche concurrency = int(arguments.threads) / int(arguments.ncutechess) concurrency = concurrency // max(dev_threads, base_threads) - update_interval = 8 if max(dev_threads, base_threads) == 1 else 1 - games = int(concurrency * BASE_GAMES_PER_CORE) + games = int(concurrency * workload['test']['workload_size']) games = max(8, concurrency * 2, games - (games % (2 * concurrency))) time_control = scale_time_control(workload, nps) @@ -918,10 +916,10 @@ def build_cutechess_command(arguments, workload, dev_cmd, base_cmd, nps, cuteche ) if IS_LINUX: - return concurrency, update_interval, './cutechess-ob ' + flags % (args) - return concurrency, update_interval, 'cutechess-ob.exe ' + flags % (args) + return concurrency, './cutechess-ob ' + flags % (args) + return concurrency, 'cutechess-ob.exe ' + flags % (args) -def run_and_parse_cutechess(arguments, workload, concurrency, update_interval, command, cutechess_idx): +def run_and_parse_cutechess(arguments, workload, concurrency, command, cutechess_idx): print('\n[#%d] Launching Cutechess...\n%s\n' % (cutechess_idx, command)) cutechess = Popen(command.split(), stdout=PIPE) @@ -958,7 +956,7 @@ def run_and_parse_cutechess(arguments, workload, concurrency, update_interval, c # Only report scores after every eight games score = list(map(int, score_reason.split()[0:5:2])) - if ((sum(score) - sum(sent)) % update_interval != 0): continue + if ((sum(score) - sum(sent)) % workload['test']['report_rate'] != 0): continue # Report to the server but allow failed reports to delay wld = [score[ii] - sent[ii] for ii in range(3)] diff --git a/OpenBench/models.py b/OpenBench/models.py index 92b4303..09a7cd9 100644 --- a/OpenBench/models.py +++ b/OpenBench/models.py @@ -106,6 +106,10 @@ class Test(Model): win_adj = CharField(max_length=64, default='movecount=3 score=400') draw_adj = CharField(max_length=64, default='movenumber=40 movecount=8 score=10') + # Client configuration + report_rate = IntegerField(default=8) + workload_size = IntegerField(default=32) + # Only for SPRT Tests elolower = FloatField(default=0.0) eloupper = FloatField(default=0.0) diff --git a/OpenBench/static/style.css b/OpenBench/static/style.css index 610b195..dbf43df 100644 --- a/OpenBench/static/style.css +++ b/OpenBench/static/style.css @@ -17,14 +17,14 @@ a:link, a:visited, a:hover, a:active { #sidebar ul { list-style-type: none; - padding: 0px 16px 0px 8px; - line-height: 1.75; + padding: 0px 0px 0px 8px; + line-height: 1.50; } #sidebar li a { color: #A2A2A2; padding: 0px 16px; - font-size: 1.0rem; + font-size: 16px; } #sidebar li:hover { @@ -35,7 +35,7 @@ a:link, a:visited, a:hover, a:active { #sidebar .header { color: #00AF00; padding: 0px 16px; - font-size: 1.0rem; + font-size: 16px; } #sidebar .header:hover { @@ -58,14 +58,19 @@ a:link, a:visited, a:hover, a:active { } #content input, #content select { + background-color: #BBBBBB; color: #000000; padding: 10px; margin: 1px 0px; - width: 320px; - box-sizing: border-box; + width: 340px; + + border: 2px solid black; + border-radius: 6px; + -moz-box-sizing: border-box; -webkit-box-sizing: border-box; + box-sizing: border-box; } #content button { diff --git a/OpenBench/utils.py b/OpenBench/utils.py index 1a0dd08..eaa6ab0 100644 --- a/OpenBench/utils.py +++ b/OpenBench/utils.py @@ -288,9 +288,9 @@ def verifyNewTest(request): try: int(request.POST[field]) except: errors.append('"{0}" is not an Integer'.format(fieldName)) - def verifyGreaterThan(field, fieldName, value, valueName): + def verifyGreaterThan(field, fieldName, value): if not float(request.POST[field]) > value: - errors.append('"{0}" is not greater than {1}'.format(fieldName, valueName)) + errors.append('"{0}" is not greater than {1}'.format(fieldName, value)) def verifyOptions(field, option, fieldName): if extractOption(request.POST[field], option) == None: @@ -317,9 +317,18 @@ def verifyNewTest(request): except: errors.append('"{0}" is not a parsable Draw Adjudication Seting'.format(content)) verifications = [ - (verifyInteger, 'priority', 'Priority'), - (verifyInteger, 'throughput', 'Throughput'), - (verifyGreaterThan, 'throughput', 'Throughput', 0, '0'), + + # Must have all of these values for test settings + (verifyInteger, 'priority', 'Priority' ), + (verifyInteger, 'throughput', 'Throughput' ), + (verifyInteger, 'report_rate', 'Report Rate' ), + (verifyInteger, 'workload_size', 'Workload Size'), + + # Can't allow non-natural values for any of these fields + (verifyGreaterThan, 'throughput', 'Throughput', 0), + (verifyGreaterThan, 'report_rate', 'Report Rate', 0), + (verifyGreaterThan, 'workload_size', 'Workload Size', 0), + (verifyOptions, 'devoptions', 'Threads', 'Dev Options'), (verifyOptions, 'devoptions', 'Hash', 'Dev Options'), (verifyOptions, 'baseoptions', 'Threads', 'Base Options'), @@ -346,23 +355,25 @@ def createNewTest(request): baseinfo, base_has_all = collect_github_info(request, errors, 'base') if errors != []: return None, errors - 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(' ') - test.devnetwork = request.POST['devnetwork'] - test.basenetwork = request.POST['basenetwork'] - test.bookname = request.POST['bookname'] - test.timecontrol = parseTimeControl(request.POST['timecontrol']) - test.priority = int(request.POST['priority']) - test.throughput = int(request.POST['throughput']) - test.syzygy_wdl = request.POST['syzygy_wdl'] - test.syzygy_adj = request.POST['syzygy_adj'] - test.win_adj = request.POST['win_adj'] - test.draw_adj = request.POST['draw_adj'] + 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(' ') + test.devnetwork = request.POST['devnetwork'] + test.basenetwork = request.POST['basenetwork'] + test.bookname = request.POST['bookname'] + test.timecontrol = parseTimeControl(request.POST['timecontrol']) + test.priority = int(request.POST['priority']) + test.throughput = int(request.POST['throughput']) + test.syzygy_wdl = request.POST['syzygy_wdl'] + test.syzygy_adj = request.POST['syzygy_adj'] + test.win_adj = request.POST['win_adj'] + test.draw_adj = request.POST['draw_adj'] + test.report_rate = int(request.POST['report_rate']) + test.workload_size = int(request.POST['workload_size']) if request.POST['test_mode'] == 'SPRT': test.elolower = float(request.POST['bounds'].split(',')[0].lstrip('[')) @@ -531,18 +542,21 @@ def workload_to_dictionary(test, result, machine): 'test' : { - 'id' : test.id, - 'engine' : test.engine, - 'timecontrol' : test.timecontrol, - 'syzygy_wdl' : test.syzygy_wdl, + 'id' : test.id, + 'engine' : test.engine, + 'timecontrol' : test.timecontrol, + 'syzygy_wdl' : test.syzygy_wdl, - 'syzygy_adj' : test.syzygy_adj, - 'win_adj' : test.win_adj, - 'draw_adj' : test.draw_adj, + 'syzygy_adj' : test.syzygy_adj, + 'win_adj' : test.win_adj, + 'draw_adj' : test.draw_adj, - 'nps' : OPENBENCH_CONFIG['engines'][test.engine]['nps'], - 'build' : OPENBENCH_CONFIG['engines'][test.engine]['build'], - 'book' : OPENBENCH_CONFIG['books'][test.bookname], + 'report_rate' : test.report_rate, + 'workload_size' : test.workload_size, + + 'nps' : OPENBENCH_CONFIG['engines'][test.engine]['nps'], + 'build' : OPENBENCH_CONFIG['engines'][test.engine]['build'], + 'book' : OPENBENCH_CONFIG['books'][test.bookname], 'dev' : { 'id' : test.dev.id, 'name' : test.dev.name, diff --git a/OpenBench/views.py b/OpenBench/views.py index 4cf13a2..f96d117 100644 --- a/OpenBench/views.py +++ b/OpenBench/views.py @@ -420,9 +420,9 @@ def test(request, id, action=None): return django.http.HttpResponseRedirect('/index/') if action not in ['APPROVE', 'RESTART', 'STOP', 'DELETE', 'MODIFY']: - test = Test.objects.get(id=id) + test = Test.objects.get(id=id) results = Result.objects.filter(test=test).order_by('machine_id') - data = {'test' : test, 'results': results} + data = {'test' : test, 'results': results} return render(request, 'test.html', data) if not request.user.is_authenticated: @@ -445,11 +445,13 @@ def test(request, id, action=None): if action == 'DELETE' : test.deleted = True; test.save() if action == 'MODIFY': - test.priority = int(request.POST['priority']) - test.throughput = max(1, int(request.POST['throughput'])) + test.priority = int(request.POST['priority']) + test.throughput = max(1, int(request.POST['throughput'])) + test.report_rate = max(1, int(request.POST['report_rate'])) + test.workload_size = max(1, int(request.POST['workload_size'])) test.save() - action += " P={0} TP={1}".format(test.priority, test.throughput) + action += " P=%d TP=%d RR=%d WS=%d" % (test.priority, test.throughput, test.report_rate, test.workload_size) LogEvent.objects.create(author=user.username, summary=action, log_file='', test_id=test.id) return django.http.HttpResponseRedirect('/index/') diff --git a/Templates/OpenBench/newTest.html b/Templates/OpenBench/newTest.html index dc79e67..41e1fba 100644 --- a/Templates/OpenBench/newTest.html +++ b/Templates/OpenBench/newTest.html @@ -40,7 +40,7 @@ ]; - function set_test_type(type) { + function set_test_type() { //// When the test mode is set or changed, run this. //// Sets the bounds, confidence intervals, and max games fields. @@ -73,6 +73,9 @@ var engine = selection.options[selection.selectedIndex].value; var mode = TestModes[engine][mode_idx]; + document.getElementById("report_rate").value = mode["report_rate"] || 8; + document.getElementById("workload_size").value = mode["workload_size"] || 32; + if (mode["th"] != null && mode["hash"] != null) { var threads = mode["th"]; var hash = mode["hash"]; document.getElementById("devoptions").value = "Threads=" + threads + " Hash=" + hash; @@ -168,6 +171,8 @@ document.getElementById("bookname" ).value = Configurations[engine]["book"]; document.getElementById("win_adj" ).value = Configurations[engine]["win_adj"]; document.getElementById("draw_adj" ).value = Configurations[engine]["draw_adj"]; + + set_test_mode(0); } document.addEventListener( @@ -206,6 +211,10 @@

+

Workload Settings

+
+ +
diff --git a/Templates/OpenBench/test.html b/Templates/OpenBench/test.html index 7bf1395..6d21369 100644 --- a/Templates/OpenBench/test.html +++ b/Templates/OpenBench/test.html @@ -39,7 +39,6 @@ Syzygy ADJ.{{test.syzygy_adj}} Win ADJ.{{test.win_adj}} Draw ADJ.{{test.draw_adj}} -
@@ -94,6 +93,8 @@

+
+
{% if profile.approver or profile.user.username == test.author %} From bdba7ab283c7bdc7e37c8fc521f7597d40f9838f Mon Sep 17 00:00:00 2001 From: andrew Date: Wed, 3 May 2023 17:30:09 -0400 Subject: [PATCH 16/51] Update config schema --- Engines/4ku.json | 79 ++++++++++--------- Engines/Berserk.json | 81 ++++++++++---------- Engines/Bit-Genie.json | 79 ++++++++++--------- Engines/BlackMarlin.json | 81 ++++++++++---------- Engines/Demolito.json | 80 +++++++++---------- Engines/Drofa.json | 79 ++++++++++--------- Engines/Ethereal.json | 50 ++++++------ Engines/FabChess.json | 79 ++++++++++--------- Engines/Halogen.json | 79 ++++++++++--------- Engines/Igel.json | 79 ++++++++++--------- Engines/Koivisto.json | 81 ++++++++++---------- Engines/Laser.json | 77 ++++++++++--------- Engines/RubiChess.json | 79 ++++++++++--------- Engines/Seer.json | 81 ++++++++++---------- Engines/Stash.json | 80 +++++++++---------- Engines/Weiss.json | 79 ++++++++++--------- Engines/Winter.json | 80 +++++++++---------- Engines/Zahak.json | 80 +++++++++---------- OpenBench/views.py | 2 +- Templates/OpenBench/base.html | 4 + Templates/OpenBench/newTest.html | 127 ++++++++++--------------------- 21 files changed, 768 insertions(+), 768 deletions(-) diff --git a/Engines/4ku.json b/Engines/4ku.json index 5fdb5c7..053e73d 100644 --- a/Engines/4ku.json +++ b/Engines/4ku.json @@ -1,45 +1,48 @@ { - "nps": 1225000, - "base": "master", - "book": "Pohl.pgn", - "bounds": "[0.00, 5.00]", - "source": "https://github.com/kz04px/4ku", - "private": false, - "win_adj": "movecount=3 score=400", - "draw_adj": "movenumber=40 movecount=8 score=10", - "build": { - "path": "", - "compilers": [ - "g++" - ], - "cpuflags": [ - "__POPCNT__" - ] + "private" : false, + "nps" : 1225000, + "base" : "master", + "source" : "https://github.com/kz04px/4ku", + + "bounds" : "[0.00, 5.00]", + "book" : "Pohl.pgn", + "win_adj" : "movecount=3 score=400", + "draw_adj" : "movenumber=40 movecount=8 score=10", + + "build" : { + "path" : "", + "compilers" : ["g++"], + "cpuflags" : ["__POPCNT__"] }, - "testmodes": [ - { - "id": "STC", - "th": 1, - "hash": 64, - "tc": "8.0+0.08" + + "testmodes" : { + + "STC" : { + "options" : "Threads=1 Hash=8", + "timecontrol" : "8.0+0.08", + "report_rate" : 16, + "workload_size" : 32 }, - { - "id": "LTC", - "th": 1, - "hash": 64, - "tc": "40.0+0.4" + + "LTC" : { + "options" : "Threads=1 Hash=64", + "timecontrol" : "40.0+0.4", + "report_rate" : 4, + "workload_size" : 8 }, - { - "id": "SMP STC", - "th": 8, - "hash": 64, - "tc": "5.0+0.05" + + "SMP STC" : { + "options" : "Threads=8 Hash=64", + "timecontrol" : "5.0+0.05", + "report_rate" : 1, + "workload_size" : 64 }, - { - "id": "SMP LTC", - "th": 8, - "hash": 256, - "tc": "20.0+0.2" + + "SMP LTC" : { + "options" : "Threads=8 Hash=256", + "timecontrol" : "20.0+0.2", + "report_rate" : 1, + "workload_size" : 16 } - ] + } } \ No newline at end of file diff --git a/Engines/Berserk.json b/Engines/Berserk.json index feb7263..b0775ec 100644 --- a/Engines/Berserk.json +++ b/Engines/Berserk.json @@ -1,47 +1,48 @@ { - "nps": 1325000, - "base": "main", - "book": "Pohl.epd", - "bounds": "[0.00, 3.00]", - "source": "https://github.com/jhonnold/berserk", - "private": false, - "win_adj": "movecount=3 score=400", - "draw_adj": "movenumber=40 movecount=8 score=10", - "build": { - "path": "src", - "compilers": [ - "gcc" - ], - "cpuflags": [ - "__AVX2__", - "__FMA__", - "__POPCNT__" - ] + "private" : false, + "nps" : 1325000, + "base" : "main", + "source" : "https://github.com/jhonnold/berserk", + + "bounds" : "[0.00, 3.00]", + "book" : "Pohl.epd", + "win_adj" : "movecount=3 score=400", + "draw_adj" : "movenumber=40 movecount=8 score=10", + + "build" : { + "path" : "src", + "compilers" : ["gcc"], + "cpuflags" : ["__AVX2__", "__FMA__", "__POPCNT__"] }, - "testmodes": [ - { - "id": "STC", - "th": 1, - "hash": 8, - "tc": "10.0+0.1" + + "testmodes" : { + + "STC" : { + "options" : "Threads=1 Hash=8", + "timecontrol" : "10.0+0.1", + "report_rate" : 16, + "workload_size" : 32 }, - { - "id": "LTC", - "th": 1, - "hash": 64, - "tc": "60.0+0.6" + + "LTC" : { + "options" : "Threads=1 Hash=64", + "timecontrol" : "60.0+0.6", + "report_rate" : 4, + "workload_size" : 8 }, - { - "id": "SMP STC", - "th": 8, - "hash": 64, - "tc": "5.0+0.05" + + "SMP STC" : { + "options" : "Threads=8 Hash=64", + "timecontrol" : "5.0+0.05", + "report_rate" : 1, + "workload_size" : 64 }, - { - "id": "SMP LTC", - "th": 8, - "hash": 256, - "tc": "20.0+0.2" + + "SMP LTC" : { + "options" : "Threads=8 Hash=256", + "timecontrol" : "20.0+0.2", + "report_rate" : 1, + "workload_size" : 16 } - ] + } } \ No newline at end of file diff --git a/Engines/Bit-Genie.json b/Engines/Bit-Genie.json index 138b795..ab85035 100644 --- a/Engines/Bit-Genie.json +++ b/Engines/Bit-Genie.json @@ -1,45 +1,48 @@ { - "nps": 1975000, - "base": "master", - "book": "Pohl.epd", - "bounds": "[0.00, 5.00]", - "source": "https://github.com/Aryan1508/Bit-Genie", - "private": false, - "win_adj": "movecount=3 score=400", - "draw_adj": "movenumber=40 movecount=8 score=10", - "build": { - "path": "src", - "compilers": [ - "g++" - ], - "cpuflags": [ - "__POPCNT__" - ] + "private" : false, + "nps" : 1975000, + "base" : "master", + "source" : "https://github.com/Aryan1508/Bit-Genie", + + "bounds" : "[0.00, 5.00]", + "book" : "Pohl.epd", + "win_adj" : "movecount=3 score=400", + "draw_adj" : "movenumber=40 movecount=8 score=10", + + "build" : { + "path" : "src", + "compilers" : ["g++"], + "cpuflags" : ["__POPCNT__"] }, - "testmodes": [ - { - "id": "STC", - "th": 1, - "hash": 8, - "tc": "8.0+0.08" + + "testmodes" : { + + "STC" : { + "options" : "Threads=1 Hash=8", + "timecontrol" : "8.0+0.08", + "report_rate" : 16, + "workload_size" : 32 }, - { - "id": "LTC", - "th": 1, - "hash": 64, - "tc": "40.0+0.4" + + "LTC" : { + "options" : "Threads=1 Hash=64", + "timecontrol" : "40.0+0.4", + "report_rate" : 4, + "workload_size" : 8 }, - { - "id": "SMP STC", - "th": 8, - "hash": 64, - "tc": "5.0+0.05" + + "SMP STC" : { + "options" : "Threads=8 Hash=64", + "timecontrol" : "5.0+0.05", + "report_rate" : 1, + "workload_size" : 64 }, - { - "id": "SMP LTC", - "th": 8, - "hash": 256, - "tc": "20.0+0.2" + + "SMP LTC" : { + "options" : "Threads=8 Hash=256", + "timecontrol" : "20.0+0.2", + "report_rate" : 1, + "workload_size" : 16 } - ] + } } \ No newline at end of file diff --git a/Engines/BlackMarlin.json b/Engines/BlackMarlin.json index beebb9c..81d607c 100644 --- a/Engines/BlackMarlin.json +++ b/Engines/BlackMarlin.json @@ -1,47 +1,48 @@ { - "nps": 1075000, - "base": "main", - "book": "Pohl.epd", - "bounds": "[0.00, 5.00]", - "source": "https://github.com/dsekercioglu/blackmarlin", - "private": false, - "win_adj": "movecount=3 score=400", - "draw_adj": "movenumber=40 movecount=8 score=10", - "build": { - "path": "", - "compilers": [ - "cargo>=1.57.0" - ], - "cpuflags": [ - "__AVX2__", - "__FMA__", - "__POPCNT__" - ] + "private" : false, + "nps" : 1075000, + "base" : "main", + "source" : "https://github.com/dsekercioglu/blackmarlin", + + "bounds" : "[0.00, 5.00]", + "book" : "Pohl.epd", + "win_adj" : "movecount=3 score=400", + "draw_adj" : "movenumber=40 movecount=8 score=10", + + "build" : { + "path" : "", + "compilers" : ["cargo>=1.57.0"], + "cpuflags" : [ "__AVX2__", "__FMA__", "__POPCNT__"] }, - "testmodes": [ - { - "id": "STC", - "th": 1, - "hash": 8, - "tc": "8.0+0.08" + + "testmodes" : { + + "STC" : { + "options" : "Threads=1 Hash=8", + "timecontrol" : "8.0+0.08", + "report_rate" : 16, + "workload_size" : 32 }, - { - "id": "LTC", - "th": 1, - "hash": 64, - "tc": "40.0+0.4" + + "LTC" : { + "options" : "Threads=1 Hash=64", + "timecontrol" : "40.0+0.4", + "report_rate" : 4, + "workload_size" : 8 }, - { - "id": "SMP STC", - "th": 8, - "hash": 64, - "tc": "5.0+0.05" + + "SMP STC" : { + "options" : "Threads=8 Hash=64", + "timecontrol" : "5.0+0.05", + "report_rate" : 1, + "workload_size" : 64 }, - { - "id": "SMP LTC", - "th": 8, - "hash": 256, - "tc": "20.0+0.2" + + "SMP LTC" : { + "options" : "Threads=8 Hash=256", + "timecontrol" : "20.0+0.2", + "report_rate" : 1, + "workload_size" : 16 } - ] + } } \ No newline at end of file diff --git a/Engines/Demolito.json b/Engines/Demolito.json index 9e0db66..342b7e3 100644 --- a/Engines/Demolito.json +++ b/Engines/Demolito.json @@ -1,46 +1,48 @@ { - "nps": 1300000, - "base": "master", - "book": "Pohl.epd", - "bounds": "[0.00, 5.00]", - "source": "https://github.com/lucasart/Demolito", - "private": false, - "win_adj": "movecount=3 score=400", - "draw_adj": "movenumber=40 movecount=8 score=10", - "build": { - "path": "src", - "compilers": [ - "clang", - "gcc" - ], - "cpuflags": [ - "__POPCNT__" - ] + "private" : false, + "nps" : 1300000, + "base" : "master", + "source" : "https://github.com/lucasart/Demolito", + + "bounds" : "[0.00, 5.00]", + "book" : "Pohl.epd", + "win_adj" : "movecount=3 score=400", + "draw_adj" : "movenumber=40 movecount=8 score=10", + + "build" : { + "path" : "src", + "compilers" : ["clang", "gcc"], + "cpuflags" : ["__POPCNT__"] }, - "testmodes": [ - { - "id": "STC", - "th": 1, - "hash": 8, - "tc": "8.0+0.08" + + "testmodes" : { + + "STC" : { + "options" : "Threads=1 Hash=8", + "timecontrol" : "8.0+0.08", + "report_rate" : 16, + "workload_size" : 32 }, - { - "id": "LTC", - "th": 1, - "hash": 32, - "tc": "32.0+0.32" + + "LTC" : { + "options" : "Threads=1 Hash=32", + "timecontrol" : "32.0+0.32", + "report_rate" : 4, + "workload_size" : 8 }, - { - "id": "SMP STC", - "th": 8, - "hash": 32, - "tc": "4.0+0.04" + + "SMP STC" : { + "options" : "Threads=8 Hash=32", + "timecontrol" : "4.0+0.04", + "report_rate" : 1, + "workload_size" : 64 }, - { - "id": "SMP LTC", - "th": 8, - "hash": 128, - "tc": "16.0+0.16" + + "SMP LTC" : { + "options" : "Threads=8 Hash=128", + "timecontrol" : "16.0+0.16", + "report_rate" : 1, + "workload_size" : 16 } - ] + } } \ No newline at end of file diff --git a/Engines/Drofa.json b/Engines/Drofa.json index 26d165c..18a5d4b 100644 --- a/Engines/Drofa.json +++ b/Engines/Drofa.json @@ -1,45 +1,48 @@ { - "nps": 1250000, - "base": "master", - "book": "4moves_noob.epd", - "bounds": "[0.00, 5.00]", - "source": "https://github.com/justNo4b/Drofa", - "private": false, - "win_adj": "movecount=3 score=400", - "draw_adj": "movenumber=40 movecount=8 score=10", - "build": { - "path": "", - "compilers": [ - "g++" - ], - "cpuflags": [ - "__POPCNT__" - ] + "private" : false, + "nps" : 1250000, + "base" : "master", + "source" : "https://github.com/justNo4b/Drofa", + + "bounds" : "[0.00, 5.00]", + "book" : "4moves_noob.epd", + "win_adj" : "movecount=3 score=400", + "draw_adj" : "movenumber=40 movecount=8 score=10", + + "build" : { + "path" : "", + "compilers" : ["g++"], + "cpuflags" : ["__POPCNT__"] }, - "testmodes": [ - { - "id": "STC", - "th": 1, - "hash": 8, - "tc": "8.0+0.08" + + "testmodes" : { + + "STC" : { + "options" : "Threads=1 Hash=8", + "timecontrol" : "8.0+0.08", + "report_rate" : 16, + "workload_size" : 32 }, - { - "id": "LTC", - "th": 1, - "hash": 64, - "tc": "40.0+0.4" + + "LTC" : { + "options" : "Threads=1 Hash=64", + "timecontrol" : "40.0+0.4", + "report_rate" : 4, + "workload_size" : 8 }, - { - "id": "SMP STC", - "th": 8, - "hash": 64, - "tc": "5.0+0.05" + + "SMP STC" : { + "options" : "Threads=8 Hash=64", + "timecontrol" : "5.0+0.05", + "report_rate" : 1, + "workload_size" : 64 }, - { - "id": "SMP LTC", - "th": 8, - "hash": 256, - "tc": "20.0+0.2" + + "SMP LTC" : { + "options" : "Threads=8 Hash=256", + "timecontrol" : "20.0+0.2", + "report_rate" : 1, + "workload_size" : 16 } - ] + } } \ No newline at end of file diff --git a/Engines/Ethereal.json b/Engines/Ethereal.json index 9b10d14..f835b4e 100644 --- a/Engines/Ethereal.json +++ b/Engines/Ethereal.json @@ -9,36 +9,40 @@ "win_adj" : "movecount=3 score=400", "draw_adj" : "movenumber=40 movecount=8 score=10", - "build": { + "build" : { "path" : "src", "compilers" : ["clang", "gcc"], "cpuflags" : ["__AVX2__", "__FMA__", "__POPCNT__"] }, - "testmodes": [ - { - "id": "STC", - "th": 1, - "hash": 8, - "tc": "10.0+0.1" + "testmodes" : { + + "STC" : { + "options" : "Threads=1 Hash=8", + "timecontrol" : "10.0+0.1", + "report_rate" : 16, + "workload_size" : 32 }, - { - "id": "LTC", - "th": 1, - "hash": 64, - "tc": "60.0+0.6" + + "LTC" : { + "options" : "Threads=1 Hash=64", + "timecontrol" : "60.0+0.6", + "report_rate" : 4, + "workload_size" : 8 }, - { - "id": "SMP STC", - "th": 8, - "hash": 64, - "tc": "5.0+0.05" + + "SMP STC" : { + "options" : "Threads=8 Hash=64", + "timecontrol" : "5.0+0.05", + "report_rate" : 1, + "workload_size" : 64 }, - { - "id": "SMP LTC", - "th": 8, - "hash": 256, - "tc": "20.0+0.2" + + "SMP LTC" : { + "options" : "Threads=8 Hash=256", + "timecontrol" : "20.0+0.2", + "report_rate" : 1, + "workload_size" : 16 } - ] + } } \ No newline at end of file diff --git a/Engines/FabChess.json b/Engines/FabChess.json index 9a4bfa2..9eebb24 100644 --- a/Engines/FabChess.json +++ b/Engines/FabChess.json @@ -1,45 +1,48 @@ { - "nps": 1000000, - "base": "master", - "book": "Pohl.epd", - "bounds": "[0.00, 5.00]", - "source": "https://github.com/fabianvdW/FabChess", - "private": false, - "win_adj": "movecount=3 score=400", - "draw_adj": "movenumber=40 movecount=8 score=10", - "build": { - "path": "", - "compilers": [ - "cargo>=1.41.0" - ], - "cpuflags": [ - "__POPCNT__" - ] + "private" : false, + "nps" : 1000000, + "base" : "master", + "source" : "https://github.com/fabianvdW/FabChess", + + "bounds" : "[0.00, 5.00]", + "book" : "Pohl.epd", + "win_adj" : "movecount=3 score=400", + "draw_adj" : "movenumber=40 movecount=8 score=10", + + "build" : { + "path" : "", + "compilers" : ["cargo>=1.41.0"], + "cpuflags" : ["__POPCNT__"] }, - "testmodes": [ - { - "id": "STC", - "th": 1, - "hash": 8, - "tc": "8.0+0.08" + + "testmodes" : { + + "STC" : { + "options" : "Threads=1 Hash=8", + "timecontrol" : "8.0+0.08", + "report_rate" : 16, + "workload_size" : 32 }, - { - "id": "LTC", - "th": 1, - "hash": 64, - "tc": "40.0+0.4" + + "LTC" : { + "options" : "Threads=1 Hash=64", + "timecontrol" : "40.0+0.4", + "report_rate" : 4, + "workload_size" : 8 }, - { - "id": "SMP STC", - "th": 8, - "hash": 64, - "tc": "5.0+0.05" + + "SMP STC" : { + "options" : "Threads=8 Hash=64", + "timecontrol" : "5.0+0.05", + "report_rate" : 1, + "workload_size" : 64 }, - { - "id": "SMP LTC", - "th": 8, - "hash": 256, - "tc": "20.0+0.2" + + "SMP LTC" : { + "options" : "Threads=8 Hash=256", + "timecontrol" : "20.0+0.2", + "report_rate" : 1, + "workload_size" : 16 } - ] + } } \ No newline at end of file diff --git a/Engines/Halogen.json b/Engines/Halogen.json index 86defcb..7d0c035 100644 --- a/Engines/Halogen.json +++ b/Engines/Halogen.json @@ -1,45 +1,48 @@ { - "nps": 1800000, - "base": "master", - "book": "Pohl.epd", - "bounds": "[0.00, 5.00]", - "source": "https://github.com/KierenP/Halogen", - "private": false, - "win_adj": "movecount=3 score=400", - "draw_adj": "movenumber=40 movecount=8 score=10", - "build": { - "path": "src", - "compilers": [ - "g++" - ], - "cpuflags": [ - "__POPCNT__" - ] + "private" : false, + "nps" : 1800000, + "base" : "master", + "source" : "https://github.com/KierenP/Halogen", + + "bounds" : "[0.00, 5.00]", + "book" : "Pohl.epd", + "win_adj" : "movecount=3 score=400", + "draw_adj" : "movenumber=40 movecount=8 score=10", + + "build" : { + "path" : "src", + "compilers" : ["g++"], + "cpuflags" : ["__POPCNT__"] }, - "testmodes": [ - { - "id": "STC", - "th": 1, - "hash": 8, - "tc": "8.0+0.08" + + "testmodes" : { + + "STC" : { + "options" : "Threads=1 Hash=8", + "timecontrol" : "8.0+0.08", + "report_rate" : 16, + "workload_size" : 32 }, - { - "id": "LTC", - "th": 1, - "hash": 64, - "tc": "40.0+0.4" + + "LTC" : { + "options" : "Threads=1 Hash=64", + "timecontrol" : "40.0+0.4", + "report_rate" : 4, + "workload_size" : 8 }, - { - "id": "SMP STC", - "th": 8, - "hash": 64, - "tc": "5.0+0.05" + + "SMP STC" : { + "options" : "Threads=8 Hash=64", + "timecontrol" : "5.0+0.05", + "report_rate" : 1, + "workload_size" : 64 }, - { - "id": "SMP LTC", - "th": 8, - "hash": 256, - "tc": "20.0+0.2" + + "SMP LTC" : { + "options" : "Threads=8 Hash=256", + "timecontrol" : "20.0+0.2", + "report_rate" : 1, + "workload_size" : 16 } - ] + } } \ No newline at end of file diff --git a/Engines/Igel.json b/Engines/Igel.json index 027d090..8a04a29 100644 --- a/Engines/Igel.json +++ b/Engines/Igel.json @@ -1,45 +1,48 @@ { - "nps": 450000, - "base": "master", - "book": "Pohl.epd", - "bounds": "[0.00, 3.00]", - "source": "https://github.com/vshcherbyna/igel", - "private": false, - "win_adj": "movecount=3 score=400", - "draw_adj": "movenumber=40 movecount=8 score=10", - "build": { - "path": "src", - "compilers": [ - "g++" - ], - "cpuflags": [ - "__POPCNT__" - ] + "private" : false, + "nps" : 450000, + "base" : "master", + "source" : "https://github.com/vshcherbyna/igel", + + "bounds" : "[0.00, 3.00]", + "book" : "Pohl.epd", + "win_adj" : "movecount=3 score=400", + "draw_adj" : "movenumber=40 movecount=8 score=10", + + "build" : { + "path" : "src", + "compilers" : ["g++"], + "cpuflags" : ["__POPCNT__"] }, - "testmodes": [ - { - "id": "STC", - "th": 1, - "hash": 8, - "tc": "10.0+0.1" + + "testmodes" : { + + "STC" : { + "options" : "Threads=1 Hash=8", + "timecontrol" : "10.0+0.1", + "report_rate" : 16, + "workload_size" : 32 }, - { - "id": "LTC", - "th": 1, - "hash": 64, - "tc": "60.0+0.6" + + "LTC" : { + "options" : "Threads=1 Hash=64", + "timecontrol" : "60.0+0.6", + "report_rate" : 4, + "workload_size" : 8 }, - { - "id": "SMP STC", - "th": 8, - "hash": 64, - "tc": "5.0+0.05" + + "SMP STC" : { + "options" : "Threads=8 Hash=64", + "timecontrol" : "5.0+0.05", + "report_rate" : 1, + "workload_size" : 64 }, - { - "id": "SMP LTC", - "th": 8, - "hash": 256, - "tc": "20.0+0.2" + + "SMP LTC" : { + "options" : "Threads=8 Hash=256", + "timecontrol" : "20.0+0.2", + "report_rate" : 1, + "workload_size" : 16 } - ] + } } \ No newline at end of file diff --git a/Engines/Koivisto.json b/Engines/Koivisto.json index a7f8149..52f1795 100644 --- a/Engines/Koivisto.json +++ b/Engines/Koivisto.json @@ -1,47 +1,48 @@ { - "nps": 1200000, - "base": "master", - "book": "Pohl.epd", - "bounds": "[0.00, 2.50]", - "source": "https://github.com/Luecx/Koivisto", - "private": false, - "win_adj": "movecount=3 score=400", - "draw_adj": "movenumber=40 movecount=8 score=10", - "build": { - "path": "src_files", - "compilers": [ - "g++" - ], - "cpuflags": [ - "__AVX2__", - "__FMA__", - "__POPCNT__" - ] + "private" : false, + "nps" : 1200000, + "base" : "master", + "source" : "https://github.com/Luecx/Koivisto", + + "bounds" : "[0.00, 2.50]", + "book" : "Pohl.epd", + "win_adj" : "movecount=3 score=400", + "draw_adj" : "movenumber=40 movecount=8 score=10", + + "build" : { + "path" : "src_files", + "compilers" : ["g++"], + "cpuflags" : ["__AVX2__", "__FMA__", "__POPCNT__"] }, - "testmodes": [ - { - "id": "STC", - "th": 1, - "hash": 8, - "tc": "8.0+0.08" + + "testmodes" : { + + "STC" : { + "options" : "Threads=1 Hash=8", + "timecontrol" : "8.0+0.08", + "report_rate" : 16, + "workload_size" : 32 }, - { - "id": "LTC", - "th": 1, - "hash": 64, - "tc": "40.0+0.4" + + "LTC" : { + "options" : "Threads=1 Hash=64", + "timecontrol" : "40.0+0.4", + "report_rate" : 4, + "workload_size" : 8 }, - { - "id": "SMP STC", - "th": 8, - "hash": 64, - "tc": "5.0+0.05" + + "SMP STC" : { + "options" : "Threads=8 Hash=64", + "timecontrol" : "5.0+0.05", + "report_rate" : 1, + "workload_size" : 64 }, - { - "id": "SMP LTC", - "th": 8, - "hash": 256, - "tc": "20.0+0.2" + + "SMP LTC" : { + "options" : "Threads=8 Hash=256", + "timecontrol" : "20.0+0.2", + "report_rate" : 1, + "workload_size" : 16 } - ] + } } \ No newline at end of file diff --git a/Engines/Laser.json b/Engines/Laser.json index a6c572a..5b9890e 100644 --- a/Engines/Laser.json +++ b/Engines/Laser.json @@ -1,45 +1,48 @@ { - "nps": 935000, - "base": "master", - "book": "Pohl.epd", - "bounds": "[0.00, 5.00]", - "source": "https://github.com/jeffreyan11/uci-chess-engine", - "private": false, - "win_adj": "movecount=3 score=400", - "draw_adj": "movenumber=40 movecount=8 score=10", + "private" : false, + "nps" : 935000, + "base" : "master", + "source" : "https://github.com/jeffreyan11/uci-chess-engine", + + "bounds" : "[0.00, 5.00]", + "book" : "Pohl.epd", + "win_adj" : "movecount=3 score=400", + "draw_adj" : "movenumber=40 movecount=8 score=10", + "build": { - "path": "src", - "compilers": [ - "g++" - ], - "cpuflags": [ - "__POPCNT__" - ] + "path" : "src", + "compilers" : ["g++"], + "cpuflags" : ["__POPCNT__"] }, - "testmodes": [ - { - "id": "STC", - "th": 1, - "hash": 8, - "tc": "8.0+0.08" + + "testmodes" : { + + "STC" : { + "options" : "Threads=1 Hash=8", + "timecontrol" : "8.0+0.08", + "report_rate" : 16, + "workload_size" : 32 }, - { - "id": "LTC", - "th": 1, - "hash": 64, - "tc": "40.0+0.4" + + "LTC" : { + "options" : "Threads=1 Hash=64", + "timecontrol" : "40.0+0.4", + "report_rate" : 4, + "workload_size" : 8 }, - { - "id": "SMP STC", - "th": 8, - "hash": 64, - "tc": "5.0+0.05" + + "SMP STC" : { + "options" : "Threads=8 Hash=64", + "timecontrol" : "5.0+0.05", + "report_rate" : 1, + "workload_size" : 64 }, - { - "id": "SMP LTC", - "th": 8, - "hash": 256, - "tc": "20.0+0.2" + + "SMP LTC" : { + "options" : "Threads=8 Hash=256", + "timecontrol" : "20.0+0.2", + "report_rate" : 1, + "workload_size" : 16 } - ] + } } \ No newline at end of file diff --git a/Engines/RubiChess.json b/Engines/RubiChess.json index ac2b8a4..fbd0533 100644 --- a/Engines/RubiChess.json +++ b/Engines/RubiChess.json @@ -1,45 +1,48 @@ { - "nps": 925000, - "base": "master", - "book": "Pohl.epd", - "bounds": "[0.00, 5.00]", - "source": "https://github.com/Matthies/RubiChess", - "private": false, - "win_adj": "movecount=3 score=400", - "draw_adj": "movenumber=40 movecount=8 score=10", - "build": { - "path": "src", - "compilers": [ - "g++" - ], - "cpuflags": [ - "__POPCNT__" - ] + "private" : false, + "nps" : 925000, + "base" : "master", + "source" : "https://github.com/Matthies/RubiChess", + + "bounds" : "[0.00, 5.00]", + "book" : "Pohl.epd", + "win_adj" : "movecount=3 score=400", + "draw_adj" : "movenumber=40 movecount=8 score=10", + + "build" : { + "path" : "src", + "compilers" : ["g++"], + "cpuflags" : ["__POPCNT__"] }, - "testmodes": [ - { - "id": "STC", - "th": 1, - "hash": 8, - "tc": "10.0+0.1" + + "testmodes" : { + + "STC" : { + "options" : "Threads=1 Hash=8", + "timecontrol" : "10.0+0.1", + "report_rate" : 16, + "workload_size" : 32 }, - { - "id": "LTC", - "th": 1, - "hash": 64, - "tc": "60.0+0.6" + + "LTC" : { + "options" : "Threads=1 Hash=64", + "timecontrol" : "60.0+0.6", + "report_rate" : 4, + "workload_size" : 8 }, - { - "id": "SMP STC", - "th": 8, - "hash": 64, - "tc": "5.0+0.05" + + "SMP STC" : { + "options" : "Threads=8 Hash=64", + "timecontrol" : "5.0+0.05", + "report_rate" : 1, + "workload_size" : 64 }, - { - "id": "SMP LTC", - "th": 8, - "hash": 256, - "tc": "20.0+0.2" + + "SMP LTC" : { + "options" : "Threads=8 Hash=256", + "timecontrol" : "20.0+0.2", + "report_rate" : 1, + "workload_size" : 16 } - ] + } } \ No newline at end of file diff --git a/Engines/Seer.json b/Engines/Seer.json index e58a439..f2aa02a 100644 --- a/Engines/Seer.json +++ b/Engines/Seer.json @@ -1,47 +1,48 @@ { - "nps": 875000, - "base": "main", - "book": "Pohl.epd", - "bounds": "[0.00, 5.00]", - "source": "https://github.com/connormcmonigle/seer-nnue", - "private": false, - "win_adj": "movecount=3 score=400", - "draw_adj": "movenumber=40 movecount=8 score=10", - "build": { - "path": "build", - "compilers": [ - "g++>=9.0.0" - ], - "cpuflags": [ - "__AVX2__", - "__FMA__", - "__POPCNT__" - ] + "private" : false, + "nps" : 875000, + "base" : "main", + "source" : "https://github.com/connormcmonigle/seer-nnue", + + "bounds" : "[0.00, 5.00]", + "book" : "Pohl.epd", + "win_adj" : "movecount=3 score=400", + "draw_adj" : "movenumber=40 movecount=8 score=10", + + "build" : { + "path" : "build", + "compilers" : ["g++>=9.0.0"], + "cpuflags" : ["__AVX2__", "__FMA__", "__POPCNT__"] }, - "testmodes": [ - { - "id": "STC", - "th": 1, - "hash": 32, - "tc": "8.0+0.08" + + "testmodes" : { + + "STC" : { + "options" : "Threads=1 Hash=32", + "timecontrol" : "8.0+0.08", + "report_rate" : 16, + "workload_size" : 32 }, - { - "id": "LTC", - "th": 1, - "hash": 64, - "tc": "40.0+0.4" + + "LTC" : { + "options" : "Threads=1 Hash=64", + "timecontrol" : "40.0+0.4", + "report_rate" : 4, + "workload_size" : 8 }, - { - "id": "SMP STC", - "th": 8, - "hash": 64, - "tc": "5.0+0.05" + + "SMP STC" : { + "options" : "Threads=8 Hash=64", + "timecontrol" : "5.0+0.05", + "report_rate" : 1, + "workload_size" : 64 }, - { - "id": "SMP LTC", - "th": 8, - "hash": 256, - "tc": "20.0+0.2" + + "SMP LTC" : { + "options" : "Threads=8 Hash=256", + "timecontrol" : "20.0+0.2", + "report_rate" : 1, + "workload_size" : 16 } - ] + } } \ No newline at end of file diff --git a/Engines/Stash.json b/Engines/Stash.json index 6b99bfa..b98417c 100644 --- a/Engines/Stash.json +++ b/Engines/Stash.json @@ -1,46 +1,48 @@ { - "nps": 1625000, - "base": "master", - "book": "4moves_noob.epd", - "bounds": "[0.00, 5.00]", - "source": "https://github.com/mhouppin/stash-bot", - "private": false, - "win_adj": "movecount=3 score=400", - "draw_adj": "movenumber=40 movecount=8 score=10", - "build": { - "path": "src", - "compilers": [ - "gcc", - "clang" - ], - "cpuflags": [ - "__POPCNT__" - ] + "private" : false, + "nps" : 1625000, + "base" : "master", + "source" : "https://github.com/mhouppin/stash-bot", + + "bounds" : "[0.00, 5.00]", + "book" : "4moves_noob.epd", + "win_adj" : "movecount=3 score=400", + "draw_adj" : "movenumber=40 movecount=8 score=10", + + "build" : { + "path" : "src", + "compilers" : ["gcc", "clang"], + "cpuflags" : ["__POPCNT__"] }, - "testmodes": [ - { - "id": "STC", - "th": 1, - "hash": 16, - "tc": "8.0+0.08" + + "testmodes" : { + + "STC" : { + "options" : "Threads=1 Hash=16", + "timecontrol" : "8.0+0.08", + "report_rate" : 16, + "workload_size" : 32 }, - { - "id": "LTC", - "th": 1, - "hash": 64, - "tc": "40.0+0.4" + + "LTC" : { + "options" : "Threads=1 Hash=64", + "timecontrol" : "40.0+0.4", + "report_rate" : 4, + "workload_size" : 8 }, - { - "id": "SMP STC", - "th": 8, - "hash": 64, - "tc": "5.0+0.05" + + "SMP STC" : { + "options" : "Threads=8 Hash=64", + "timecontrol" : "5.0+0.05", + "report_rate" : 1, + "workload_size" : 64 }, - { - "id": "SMP LTC", - "th": 8, - "hash": 256, - "tc": "20.0+0.2" + + "SMP LTC" : { + "options" : "Threads=8 Hash=256", + "timecontrol" : "20.0+0.2", + "report_rate" : 1, + "workload_size" : 16 } - ] + } } \ No newline at end of file diff --git a/Engines/Weiss.json b/Engines/Weiss.json index 0a6b25f..7e73254 100644 --- a/Engines/Weiss.json +++ b/Engines/Weiss.json @@ -1,45 +1,48 @@ { - "nps": 1700000, - "base": "master", - "book": "Pohl.epd", - "bounds": "[-1.00, 4.00]", - "source": "https://github.com/TerjeKir/weiss", - "private": false, - "win_adj": "movecount=3 score=400", - "draw_adj": "movenumber=40 movecount=8 score=10", - "build": { - "path": "src", - "compilers": [ - "gcc" - ], - "cpuflags": [ - "__POPCNT__" - ] + "private" : false, + "nps" : 1700000, + "base" : "master", + "source" : "https://github.com/TerjeKir/weiss", + + "bounds" : "[-1.00, 4.00]", + "book" : "Pohl.epd", + "win_adj" : "movecount=3 score=400", + "draw_adj" : "movenumber=40 movecount=8 score=10", + + "build" : { + "path" : "src", + "compilers" : ["gcc"], + "cpuflags" : ["__POPCNT__"] }, - "testmodes": [ - { - "id": "STC", - "th": 1, - "hash": 32, - "tc": "8.0+0.08" + + "testmodes" : { + + "STC" : { + "options" : "Threads=1 Hash=32", + "timecontrol" : "8.0+0.08", + "report_rate" : 16, + "workload_size" : 32 }, - { - "id": "LTC", - "th": 1, - "hash": 128, - "tc": "40.0+0.4" + + "LTC" : { + "options" : "Threads=1 Hash=128", + "timecontrol" : "40.0+0.4", + "report_rate" : 4, + "workload_size" : 8 }, - { - "id": "SMP STC", - "th": 8, - "hash": 128, - "tc": "5.0+0.05" + + "SMP STC" : { + "options" : "Threads=8 Hash=128", + "timecontrol" : "5.0+0.05", + "report_rate" : 1, + "workload_size" : 64 }, - { - "id": "SMP LTC", - "th": 8, - "hash": 512, - "tc": "20.0+0.2" + + "SMP LTC" : { + "options" : "Threads=8 Hash=512", + "timecontrol" : "20.0+0.2", + "report_rate" : 1, + "workload_size" : 16 } - ] + } } \ No newline at end of file diff --git a/Engines/Winter.json b/Engines/Winter.json index 6ab12c5..85e6094 100644 --- a/Engines/Winter.json +++ b/Engines/Winter.json @@ -1,46 +1,48 @@ { - "nps": 625000, - "base": "master", - "book": "Pohl.epd", - "bounds": "[0.00, 5.00]", - "source": "https://github.com/rosenthj/Winter", - "private": false, - "win_adj": "movecount=3 score=400", - "draw_adj": "movenumber=40 movecount=8 score=10", - "build": { - "path": "", - "compilers": [ - "clang++", - "g++" - ], - "cpuflags": [ - "__POPCNT__" - ] + "private" : false, + "nps" : 625000, + "base" : "master", + "source" : "https://github.com/rosenthj/Winter", + + "bounds" : "[0.00, 5.00]", + "book" : "Pohl.epd", + "win_adj" : "movecount=3 score=400", + "draw_adj" : "movenumber=40 movecount=8 score=10", + + "build" : { + "path" : "", + "compilers" : ["clang++", "g++"], + "cpuflags" : ["__POPCNT__"] }, - "testmodes": [ - { - "id": "STC", - "th": 1, - "hash": 8, - "tc": "8.0+0.08" + + "testmodes" : { + + "STC" : { + "options" : "Threads=1 Hash=8", + "timecontrol" : "8.0+0.08", + "report_rate" : 16, + "workload_size" : 32 }, - { - "id": "LTC", - "th": 1, - "hash": 64, - "tc": "40.0+0.4" + + "LTC" : { + "options" : "Threads=1 Hash=64", + "timecontrol" : "40.0+0.4", + "report_rate" : 4, + "workload_size" : 8 }, - { - "id": "SMP STC", - "th": 8, - "hash": 64, - "tc": "5.0+0.05" + + "SMP STC" : { + "options" : "Threads=8 Hash=64", + "timecontrol" : "5.0+0.05", + "report_rate" : 1, + "workload_size" : 64 }, - { - "id": "SMP LTC", - "th": 8, - "hash": 256, - "tc": "20.0+0.2" + + "SMP LTC" : { + "options" : "Threads=8 Hash=256", + "timecontrol" : "20.0+0.2", + "report_rate" : 1, + "workload_size" : 16 } - ] + } } \ No newline at end of file diff --git a/Engines/Zahak.json b/Engines/Zahak.json index a1780ea..4975c8a 100644 --- a/Engines/Zahak.json +++ b/Engines/Zahak.json @@ -1,46 +1,48 @@ { - "nps": 850000, - "base": "master", - "book": "Pohl.epd", - "bounds": "[0.00, 5.00]", - "source": "https://github.com/amanjpro/zahak", - "private": false, - "win_adj": "movecount=3 score=400", - "draw_adj": "movenumber=40 movecount=8 score=10", - "build": { - "path": "", - "compilers": [ - "go" - ], - "cpuflags": [ - "__AVX__", - "__POPCNT__" - ] + "private" : false, + "nps" : 850000, + "base" : "master", + "source" : "https://github.com/amanjpro/zahak", + + "bounds" : "[0.00, 5.00]", + "book" : "Pohl.epd", + "win_adj" : "movecount=3 score=400", + "draw_adj" : "movenumber=40 movecount=8 score=10", + + "build" : { + "path" : "", + "compilers" : ["go"], + "cpuflags" : ["__AVX__", "__POPCNT__"] }, - "testmodes": [ - { - "id": "STC", - "th": 1, - "hash": 8, - "tc": "8.0+0.08" + + "testmodes" : { + + "STC" : { + "options" : "Threads=1 Hash=8", + "timecontrol" : "8.0+0.08", + "report_rate" : 16, + "workload_size" : 32 }, - { - "id": "LTC", - "th": 1, - "hash": 64, - "tc": "40.0+0.4" + + "LTC" : { + "options" : "Threads=1 Hash=64", + "timecontrol" : "40.0+0.4", + "report_rate" : 4, + "workload_size" : 8 }, - { - "id": "SMP STC", - "th": 8, - "hash": 64, - "tc": "5.0+0.05" + + "SMP STC" : { + "options" : "Threads=8 Hash=64", + "timecontrol" : "5.0+0.05", + "report_rate" : 1, + "workload_size" : 64 }, - { - "id": "SMP LTC", - "th": 8, - "hash": 256, - "tc": "20.0+0.2" + + "SMP LTC" : { + "options" : "Threads=8 Hash=256", + "timecontrol" : "20.0+0.2", + "report_rate" : 1, + "workload_size" : 16 } - ] + } } \ No newline at end of file diff --git a/OpenBench/views.py b/OpenBench/views.py index f96d117..31e9aa1 100644 --- a/OpenBench/views.py +++ b/OpenBench/views.py @@ -479,7 +479,7 @@ def newTest(request): return django.http.HttpResponseRedirect('/index/') if request.method == 'GET': - data = { 'networks' : Network.objects.all() } + data = { 'networks' : list(Network.objects.all().values()) } return render(request, 'newTest.html', data) test, errors = OpenBench.utils.createNewTest(request) diff --git a/Templates/OpenBench/base.html b/Templates/OpenBench/base.html index fde75e6..8780367 100644 --- a/Templates/OpenBench/base.html +++ b/Templates/OpenBench/base.html @@ -13,6 +13,10 @@ OpenBench + + {% block json %} + {% endblock %} + + {% endblock %} {% block content %} @@ -164,76 +28,81 @@
-

Engine

+

Engines

+
- - {% for engine in config.engines %} {% endfor %}
-
- + +
+
+ + +
+
+

Dev Settings

+
- +
- +
- +
- + +
+
+

Base Settings

- +
- +
- +
- + +
+
+
- -

Workload Settings

-
- -
-
- -
-

Game Settings

+

Test Settings

- {% for name, data in config.books.items %} {% endfor %}
-
- -
- -

Test Settings

- +
- +
- +
-

General Settings

@@ -259,12 +127,21 @@
+
+ + + + +
+ +

Workload Settings

+
+ +
+
+

Adjudication Settings

diff --git a/Templates/OpenBench/test.html b/Templates/OpenBench/test.html index 2e9cf70..eeb4cf0 100644 --- a/Templates/OpenBench/test.html +++ b/Templates/OpenBench/test.html @@ -3,38 +3,41 @@ {% load mytags %} {% block style %} -{% load static %} {% endblock %} {% block scripts %} - function copy_statblock() { + {% endblock %} @@ -44,29 +47,33 @@ - + + + + - - - {% if test.devnetwork %} + {% if test.dev_network %} - - - {% endif %} - - - + + {% endif %} + + + + + - {% if test.basenetwork %} + + {% if test.base_network %} - - - {% endif %} - - + + {% endif %} + + + + From 9faa5c51aa2f3aae19a3b5dc0487f92902ce95d0 Mon Sep 17 00:00:00 2001 From: andrew Date: Tue, 6 Jun 2023 05:32:22 -0400 Subject: [PATCH 40/51] Bugfix cross-engine, and time control parsing --- Client/Client.py | 4 ++-- OpenBench/utils.py | 12 ++++++------ Templates/OpenBench/Blocks/testsummary.html | 5 +---- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/Client/Client.py b/Client/Client.py index 33f4ae7..5cf3517 100644 --- a/Client/Client.py +++ b/Client/Client.py @@ -896,7 +896,7 @@ def run_benchmarks(arguments, workload, branch, engine, network): if private and network: args.append(network) multiprocessing.Process(target=run_bench, args=args).start() - nps, bench = list(zip(*[queue.get() for ii in range(cores)])) + bench, nps = list(zip(*[queue.get() for ii in range(cores)])) if len(set(bench)) > 1: return (0, 0) # Flag an error print('Bench for %s is %d' % (name, bench[0])) @@ -916,7 +916,7 @@ def build_cutechess_command(arguments, workload, dev_cmd, base_cmd, nps, cuteche dev_threads = int(re.search('(?<=Threads=)\d*', dev_options ).group()) base_threads = int(re.search('(?<=Threads=)\d*', base_options).group()) - dev_network = workload['test']['base']['network'] # Could be empty strings + dev_network = workload['test']['dev' ]['network'] # Could be empty strings base_network = workload['test']['base']['network'] # Could be empty strings dev_time = scale_time_control(workload, nps, 'dev') diff --git a/OpenBench/utils.py b/OpenBench/utils.py index eb664b6..96c3536 100644 --- a/OpenBench/utils.py +++ b/OpenBench/utils.py @@ -46,7 +46,7 @@ def extract_option(options, option): match = re.search('(?<={0}=)[^ ]*'.format(option), options) if match: return match.group() -def parse_time_control(timecontrol): +def parse_time_control(time_control): # Display Nodes as N=, Depth as D=, MoveTime as MT= conversion = { @@ -57,13 +57,13 @@ def parse_time_control(timecontrol): # Searching for "nodes=", "depth=", and "movetime=" Time Controls pattern = '(?P((N)|(D)|(MT)|(nodes)|(depth)|(movetime)))=(?P(\d+))' - if results := re.search(pattern, timecontrol.upper()): + if results := re.search(pattern, time_control.upper()): mode, value = results.group('mode', 'value') return '%s=%s' % (conversion[mode], value) # Searching for "X/Y+Z" time controls pattern = '(?P(\d+/)?)(?P\d*(\.\d+)?)(?P\+(\d+\.)?\d+)?' - if results := re.search(pattern, timecontrol): + if results := re.search(pattern, time_control): moves, base, inc = results.group('moves', 'base', 'inc') # Strip the trailing and leading symbols @@ -74,7 +74,7 @@ def parse_time_control(timecontrol): if moves is None: return '%.1f+%.2f' % (float(base), float(inc)) return '%d/%.1f+%.2f' % (int(moves), float(base), float(inc)) - raise Exception('Unable to parse Time Control (%s)' % (timecontrol)) + raise Exception('Unable to parse Time Control (%s)' % (time_control)) def get_pending_tests(): @@ -422,14 +422,14 @@ def create_new_test(request): test.dev_engine = request.POST['dev_engine'] test.dev_options = request.POST['dev_options'] test.dev_network = request.POST['dev_network'] - test.dev_time_control = request.POST['dev_time_control'] + test.dev_time_control = parse_time_control(request.POST['dev_time_control']) test.base = getEngine(*baseinfo) test.base_repo = request.POST['base_repo'] test.base_engine = request.POST['base_engine'] test.base_options = request.POST['base_options'] test.base_network = request.POST['base_network'] - test.base_time_control = request.POST['base_time_control'] + test.base_time_control = parse_time_control(request.POST['base_time_control']) test.report_rate = int(request.POST['report_rate']) test.workload_size = int(request.POST['workload_size']) diff --git a/Templates/OpenBench/Blocks/testsummary.html b/Templates/OpenBench/Blocks/testsummary.html index d10048e..ee7dcc8 100644 --- a/Templates/OpenBench/Blocks/testsummary.html +++ b/Templates/OpenBench/Blocks/testsummary.html @@ -1,10 +1,7 @@ {% load mytags %} - +
Author{{test.author|capfirst}}
Creation{{test.creation|date:'U'}}
Engine{{test.engine}}
Dev Engine{{test.dev_engine}}
Dev Source{{test.dev_repo}}
Dev Sha{{test.dev.sha}}
Dev Branch{{test.dev.name|prettyName}}
Dev Bench{{test.dev.bench}}
Dev Options{{test.devoptions}}
Dev Sha{{test.dev.sha}}
Dev Network{{test.devnetname}}
Base Branch{{test.base.name|prettyName}}
Base Bench{{test.base.bench}}
Base Options{{test.baseoptions}}
{{test.dev_netname}}
Dev Options{{test.dev_options}}
Dev Time{{test.dev_time_control}}
Base Engine{{test.base_engine}}
Base Source{{test.base_repo}}
Base Sha{{test.base.sha}}
Base Bench{{test.base.bench}}
Base Network{{test.basenetname}}
Source Repo{{test.source}}
Opening Book{{test.bookname}}
{{test.base_netname}}
Base Options{{test.base_options}}
Base Time{{test.base_time_control}}
Opening Book{{test.book_name}}
Syzygy WDL{{test.syzygy_wdl}}
Syzygy ADJ.{{test.syzygy_adj}}
Win ADJ.{{test.win_adj}}
{{test.author|capfirst|slice:":6"}} - {{test.dev_engine}} - {% if test.dev_engine != test.base_engine %} * {% endif %} - {{test.dev_engine}} {{test|prettyDevName}} {% if test.error %} * {% endif %} From 5ae64025aa88e27e6abfaa3089334a63ea47cc0f Mon Sep 17 00:00:00 2001 From: rafid-dev Date: Fri, 9 Jun 2023 09:49:56 +0600 Subject: [PATCH 41/51] multiple repos --- OpenBench/models.py | 2 +- OpenBench/urls.py | 1 + OpenBench/views.py | 46 ++++++++++++++++ Templates/OpenBench/profile.html | 95 +++++++++++++++++++++++--------- 4 files changed, 118 insertions(+), 26 deletions(-) diff --git a/OpenBench/models.py b/OpenBench/models.py index f52ef68..75d0c15 100644 --- a/OpenBench/models.py +++ b/OpenBench/models.py @@ -38,7 +38,7 @@ class Profile(Model): user = ForeignKey(User, PROTECT, related_name='user') games = IntegerField(default=0) tests = IntegerField(default=0) - repo = CharField(max_length=256, blank=True) + repos = JSONField() engine = CharField(max_length=128, blank=True) enabled = BooleanField(default=False) approver = BooleanField(default=False) diff --git a/OpenBench/urls.py b/OpenBench/urls.py index 4cf6d5a..68ab564 100644 --- a/OpenBench/urls.py +++ b/OpenBench/urls.py @@ -27,6 +27,7 @@ urlpatterns = [ django.urls.path(r'login/', OpenBench.views.login), django.urls.path(r'logout/', OpenBench.views.logout), django.urls.path(r'profile/', OpenBench.views.profile), + django.urls.path(r'profileConfig/', OpenBench.views.profileConfig), # Links for viewing test tables django.urls.path(r'index/', OpenBench.views.index), diff --git a/OpenBench/views.py b/OpenBench/views.py index db8c8c0..8882bda 100644 --- a/OpenBench/views.py +++ b/OpenBench/views.py @@ -200,6 +200,52 @@ def profile(request): return django.http.HttpResponseRedirect('/index/') +def profileConfig(request): + if not request.user.is_authenticated: + return django.http.HttpResponseRedirect('/login/') + + if request.method == 'GET': + return render(request, 'profile.html') + + profile = Profile.objects.filter(user=request.user) + profile = profile.first() + + changes = False # To check if any changes are made. + + default_status = request.POST.get('default-status', '') + + if default_status != '': + # update the default engine + profile.engine = default_status + changes = True + + deleted_repos = request.POST.get('deleted-repos', '[]') + deleted_repos_array = json.loads(deleted_repos) + + for engine in deleted_repos_array: + if engine in profile.repos: + del profile.repos[engine] + + if len(deleted_repos_array) != 0: + changes = True + + if 'new-engine-name' in request.POST: + if request.POST['new-engine-name'] == "None": + return index(request, error="Choose engine can't be None.") + elif request.POST['new-engine-name'] != "None" and not request.POST['new-engine-repo'].startswith('https://github.com/'): + return index(request, error="Not a valid repository!") + elif request.POST['new-engine-name'] != "None" and request.POST['new-engine-repo'].startswith('https://github.com/'): + engine_name = request.POST['new-engine-name'] + engine_repo = request.POST['new-engine-repo'] + + # Append the new engine and repo to the profile's repos field + profile.repos[engine_name] = engine_repo + changes = True + + if changes: + profile.save() # Save if any changes are made + + return django.http.HttpResponseRedirect('/index/') # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # TEST LIST VIEWS # diff --git a/Templates/OpenBench/profile.html b/Templates/OpenBench/profile.html index 63aa8b2..18bb3b9 100644 --- a/Templates/OpenBench/profile.html +++ b/Templates/OpenBench/profile.html @@ -7,42 +7,87 @@
- +
- -
-
- +
+
-
- - -
- - - - +
+
+ +
+ {% csrf_token %} +
+ {% for engine, repo in profile.repos.items %} +
+ + + + + + +
+ {% endfor %} + +
+ + +
-{% endblock %} + + +
+
+ + + + +{% endblock %} \ No newline at end of file From b5b95ec9cf0a5017b2b4223779a1b009e107f6fc Mon Sep 17 00:00:00 2001 From: andrew Date: Fri, 9 Jun 2023 00:39:15 -0400 Subject: [PATCH 42/51] Small cleanups --- OpenBench/models.py | 2 +- OpenBench/templatetags/mytags.py | 4 ++ OpenBench/urls.py | 4 +- OpenBench/views.py | 20 ++++---- Templates/OpenBench/profile.html | 87 +++++++++++++++++--------------- 5 files changed, 64 insertions(+), 53 deletions(-) diff --git a/OpenBench/models.py b/OpenBench/models.py index 75d0c15..2ce9b72 100644 --- a/OpenBench/models.py +++ b/OpenBench/models.py @@ -38,7 +38,7 @@ class Profile(Model): user = ForeignKey(User, PROTECT, related_name='user') games = IntegerField(default=0) tests = IntegerField(default=0) - repos = JSONField() + repos = JSONField(default=dict) engine = CharField(max_length=128, blank=True) enabled = BooleanField(default=False) approver = BooleanField(default=False) diff --git a/OpenBench/templatetags/mytags.py b/OpenBench/templatetags/mytags.py index 818d9fd..4bf1595 100644 --- a/OpenBench/templatetags/mytags.py +++ b/OpenBench/templatetags/mytags.py @@ -210,6 +210,9 @@ def compilerBlock(machine): string += '%-16s %-8s (%s)\n' % (engine, info[0], info[1]) return string +def removePrefix(value, prefix): + return value.removeprefix(prefix) + register = django.template.Library() register.filter('oneDigitPrecision', oneDigitPrecision) register.filter('twoDigitPrecision', twoDigitPrecision) @@ -227,3 +230,4 @@ register.filter('testIdToPrettyName', testIdToPrettyName) register.filter('testIdToTimeControl', testIdToTimeControl) register.filter('cpuflagsBlock', cpuflagsBlock) register.filter('compilerBlock', compilerBlock) +register.filter('removePrefix', removePrefix) diff --git a/OpenBench/urls.py b/OpenBench/urls.py index 68ab564..a881748 100644 --- a/OpenBench/urls.py +++ b/OpenBench/urls.py @@ -22,12 +22,12 @@ import django.urls, OpenBench.views urlpatterns = [ - # Links for account managment + # Links for account management django.urls.path(r'register/', OpenBench.views.register), django.urls.path(r'login/', OpenBench.views.login), django.urls.path(r'logout/', OpenBench.views.logout), django.urls.path(r'profile/', OpenBench.views.profile), - django.urls.path(r'profileConfig/', OpenBench.views.profileConfig), + django.urls.path(r'profileConfig/', OpenBench.views.profile_config), # Links for viewing test tables django.urls.path(r'index/', OpenBench.views.index), diff --git a/OpenBench/views.py b/OpenBench/views.py index 8882bda..8e9a797 100644 --- a/OpenBench/views.py +++ b/OpenBench/views.py @@ -200,32 +200,32 @@ def profile(request): return django.http.HttpResponseRedirect('/index/') -def profileConfig(request): +def profile_config(request): + if not request.user.is_authenticated: return django.http.HttpResponseRedirect('/login/') - + if request.method == 'GET': return render(request, 'profile.html') - profile = Profile.objects.filter(user=request.user) - profile = profile.first() + profile = Profile.objects.get(user=request.user) changes = False # To check if any changes are made. - + default_status = request.POST.get('default-status', '') if default_status != '': # update the default engine profile.engine = default_status changes = True - + deleted_repos = request.POST.get('deleted-repos', '[]') deleted_repos_array = json.loads(deleted_repos) for engine in deleted_repos_array: if engine in profile.repos: del profile.repos[engine] - + if len(deleted_repos_array) != 0: changes = True @@ -237,15 +237,15 @@ def profileConfig(request): elif request.POST['new-engine-name'] != "None" and request.POST['new-engine-repo'].startswith('https://github.com/'): engine_name = request.POST['new-engine-name'] engine_repo = request.POST['new-engine-repo'] - + # Append the new engine and repo to the profile's repos field profile.repos[engine_name] = engine_repo changes = True - + if changes: profile.save() # Save if any changes are made - return django.http.HttpResponseRedirect('/index/') + return render(request, 'profile.html') # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # TEST LIST VIEWS # diff --git a/Templates/OpenBench/profile.html b/Templates/OpenBench/profile.html index 18bb3b9..1870e01 100644 --- a/Templates/OpenBench/profile.html +++ b/Templates/OpenBench/profile.html @@ -1,5 +1,8 @@ {% extends "OpenBench/base.html" %} +{% load static %} +{% load mytags %} + {% block content %}
@@ -12,7 +15,7 @@
- +
@@ -23,57 +26,61 @@
-
+
- +
{% csrf_token %} -
- {% for engine, repo in profile.repos.items %} -
- - - - - - -
- {% endfor %} - -
- - -
+
+
- - + + {% for engine, repo in profile.repos.items %} +
+ + + + + + +
+ {% endfor %} + +
+ + +
+ + + +
- + - + {% endblock %} \ No newline at end of file From c581be947d605ccc1a7cdce0f959273d71325984 Mon Sep 17 00:00:00 2001 From: andrew Date: Fri, 9 Jun 2023 02:59:42 -0400 Subject: [PATCH 43/51] Fix error in select_workload() Cross-engine play broke this, by saving the test into the table, instead of test.id --- OpenBench/utils.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/OpenBench/utils.py b/OpenBench/utils.py index 96c3536..e4e089f 100644 --- a/OpenBench/utils.py +++ b/OpenBench/utils.py @@ -549,13 +549,10 @@ def test_maps_onto_thread_count(test, threads, ncutechess, hyperthreads): def select_workload(machine, tests, variance=0.25): - # For reference for later - test_ids = [test.id for test in tests] - # Determine how many threads are assigned to each workload - table = { test : 0 for test in tests } + table = { test.id : 0 for test in tests } for m in getRecentMachines(): - if m.workload in test_ids and m != machine: + if m.workload in table and m != machine: table[m.workload] = table[m.workload] + m.info['concurrency'] # Find the tests most deserving of resources currently @@ -563,7 +560,7 @@ def select_workload(machine, tests, variance=0.25): lowest_idxs = [i for i, r in enumerate(ratios) if r == min(ratios)] # Machine is out of date; or there is an unassigned test - if machine.workload not in test_ids or min(ratios) == 0: + if machine.workload not in table or min(ratios) == 0: return tests[random.choice(lowest_idxs)] # No test has less than (1-variance)% of its deserved resources, and From c148505e001505621add81411de641d273ece4b1 Mon Sep 17 00:00:00 2001 From: andrew Date: Fri, 9 Jun 2023 03:01:25 -0400 Subject: [PATCH 44/51] Fix misnamed field in models.py for Test --- OpenBench/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenBench/models.py b/OpenBench/models.py index f52ef68..0a274f5 100644 --- a/OpenBench/models.py +++ b/OpenBench/models.py @@ -141,7 +141,7 @@ class Test(Model): updated = DateTimeField(auto_now=True) def __str__(self): - return '{0} vs {1} @ {2}'.format(self.dev.name, self.base.name, self.dev_timecontrol) + return '{0} vs {1} @ {2}'.format(self.dev.name, self.base.name, self.dev_time_control) class LogEvent(Model): From 6c749c93168a9a32d6aa70422d1e92119d2c9989 Mon Sep 17 00:00:00 2001 From: andrew Date: Fri, 9 Jun 2023 03:06:20 -0400 Subject: [PATCH 45/51] More fixes to select_workload() More bugs from converting Machine's workload from a key to an integer --- OpenBench/utils.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/OpenBench/utils.py b/OpenBench/utils.py index e4e089f..633337b 100644 --- a/OpenBench/utils.py +++ b/OpenBench/utils.py @@ -550,13 +550,13 @@ def test_maps_onto_thread_count(test, threads, ncutechess, hyperthreads): def select_workload(machine, tests, variance=0.25): # Determine how many threads are assigned to each workload - table = { test.id : 0 for test in tests } + table = { test.id : { 'cores' : 0, 'throughput' : test.throughput } for test in tests } for m in getRecentMachines(): if m.workload in table and m != machine: - table[m.workload] = table[m.workload] + m.info['concurrency'] + table[m.workload]['cores'] += m.info['concurrency'] # Find the tests most deserving of resources currently - ratios = [table[test] / test.throughput for test in tests] + ratios = [table[x]['cores'] / table[x]['throughput'] for x in table] lowest_idxs = [i for i, r in enumerate(ratios) if r == min(ratios)] # Machine is out of date; or there is an unassigned test @@ -565,7 +565,7 @@ def select_workload(machine, tests, variance=0.25): # No test has less than (1-variance)% of its deserved resources, and # therefore we may have this machine repeat its existing workload again - ideal_ratio = sum(table.values()) / sum([x.throughput for x in tests]) + ideal_ratio = sum([x['cores'] for x in table]) / sum([x['throughput'] for x in table]) if min(ratios) / ideal_ratio > 1 - variance: return OpenBench.models.Test.objects(id=machine.workload) From 345b9bfd6ad67a3ed1cbb77be6b387d66db59f8d Mon Sep 17 00:00:00 2001 From: andrew Date: Fri, 9 Jun 2023 03:09:23 -0400 Subject: [PATCH 46/51] Final fix for select_workload() --- OpenBench/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenBench/utils.py b/OpenBench/utils.py index 633337b..7c62508 100644 --- a/OpenBench/utils.py +++ b/OpenBench/utils.py @@ -565,7 +565,7 @@ def select_workload(machine, tests, variance=0.25): # No test has less than (1-variance)% of its deserved resources, and # therefore we may have this machine repeat its existing workload again - ideal_ratio = sum([x['cores'] for x in table]) / sum([x['throughput'] for x in table]) + ideal_ratio = sum([x['cores'] for x in table.values()]) / sum([x['throughput'] for x in table.values()]) if min(ratios) / ideal_ratio > 1 - variance: return OpenBench.models.Test.objects(id=machine.workload) From bf15be1e1f4279f80660f0aa1f191f774a4ebc52 Mon Sep 17 00:00:00 2001 From: andrew Date: Fri, 9 Jun 2023 03:10:09 -0400 Subject: [PATCH 47/51] Final fix for select_workload() --- OpenBench/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenBench/utils.py b/OpenBench/utils.py index 7c62508..dbbd8ec 100644 --- a/OpenBench/utils.py +++ b/OpenBench/utils.py @@ -567,7 +567,7 @@ def select_workload(machine, tests, variance=0.25): # therefore we may have this machine repeat its existing workload again ideal_ratio = sum([x['cores'] for x in table.values()]) / sum([x['throughput'] for x in table.values()]) if min(ratios) / ideal_ratio > 1 - variance: - return OpenBench.models.Test.objects(id=machine.workload) + return OpenBench.models.Test.objects.get(id=machine.workload) # Fallback to simply doing the least attention given test return tests[random.choice(lowest_idxs)] From be55d74daa03688c9e8d9e7822c338c4ae27d630 Mon Sep 17 00:00:00 2001 From: rafid-dev Date: Fri, 9 Jun 2023 14:06:59 +0600 Subject: [PATCH 48/51] Use current page for updating status and error --- OpenBench/static/style.css | 6 ++- OpenBench/views.py | 69 +++++++++++++++++++++----------- Templates/OpenBench/base.html | 3 +- Templates/OpenBench/profile.html | 24 ++++++++++- 4 files changed, 74 insertions(+), 28 deletions(-) diff --git a/OpenBench/static/style.css b/OpenBench/static/style.css index 7617f8b..df04c54 100644 --- a/OpenBench/static/style.css +++ b/OpenBench/static/style.css @@ -314,8 +314,12 @@ td pre { padding: 0px; } -#content .error { +#content .error-message { color: red; +} + +#content .status-message { + color: green; } #content .site-title { diff --git a/OpenBench/views.py b/OpenBench/views.py index 8e9a797..5546dca 100644 --- a/OpenBench/views.py +++ b/OpenBench/views.py @@ -109,13 +109,13 @@ def register(request): return login(request, OpenBench.config.OPENBENCH_CONFIG['error']['manual_registration']) if request.POST['password1'] != request.POST['password2']: - return index(request, error='Passwords Do Not Match') + return render(request, 'register.html', {'error_message': 'Passwords Do Not Match'}) if not request.POST['username'].isalnum(): - return index(request, error='Alpha Numeric Usernames Only') + return render(request, 'register.html', {'error_message': 'Alpha Numeric Usernames Only'}) if User.objects.filter(username=request.POST['username']): - return index(request, error='That Username is taken') + return render(request, 'register.html', {'error_message': 'That Username is taken'}) email = request.POST['email'] username = request.POST['username'] @@ -185,20 +185,27 @@ def profile(request): return render(request, 'profile.html') profile = Profile.objects.filter(user=request.user) - profile.update(engine=request.POST['engine'], repo=request.POST['repo']) + + #profile.update(engine=request.POST['engine'], repo=request.POST['repo']) + + changes_message = '' + + if request.user.email != request.POST['email']: + changes_message += 'Updated Email!\n' request.user.email = request.POST['email'] request.user.save() if request.POST['password1'] != request.POST['password2']: - return index(request, error='Passwords Do Not Match') + return render(request, 'profile.html', {'error_message': "Passwords Do Not Match!", 'status_message': changes_message}) if request.POST['password1'] != '': request.user.set_password(request.POST['password1']) django.contrib.auth.login(request, request.user) request.user.save() + changes_message += 'Updated Password!\n' - return django.http.HttpResponseRedirect('/index/') + return render(request, 'profile.html', {'status_message': changes_message}) def profile_config(request): @@ -211,13 +218,18 @@ def profile_config(request): profile = Profile.objects.get(user=request.user) changes = False # To check if any changes are made. + changes_message = '' default_status = request.POST.get('default-status', '') if default_status != '': - # update the default engine - profile.engine = default_status - changes = True + if default_status != profile.engine: + changes_message += f'Removed {profile.engine} as default engine\n' + # update the default engine + profile.engine = default_status + changes_message += f'Set {profile.engine} as default engine\n' + changes = True + deleted_repos = request.POST.get('deleted-repos', '[]') deleted_repos_array = json.loads(deleted_repos) @@ -225,27 +237,35 @@ def profile_config(request): for engine in deleted_repos_array: if engine in profile.repos: del profile.repos[engine] + changes_message += f'Deleted engine: {engine}!\n' + if len(deleted_repos_array) != 0: changes = True if 'new-engine-name' in request.POST: - if request.POST['new-engine-name'] == "None": - return index(request, error="Choose engine can't be None.") - elif request.POST['new-engine-name'] != "None" and not request.POST['new-engine-repo'].startswith('https://github.com/'): - return index(request, error="Not a valid repository!") + if request.POST['new-engine-name'] != "None" and not request.POST['new-engine-repo'].startswith('https://github.com/'): + return render(request, 'profile.html', {'error_message': "Not a valid repository!"}) elif request.POST['new-engine-name'] != "None" and request.POST['new-engine-repo'].startswith('https://github.com/'): engine_name = request.POST['new-engine-name'] engine_repo = request.POST['new-engine-repo'] + if profile.engine == '': + profile.engine = engine_name + # Append the new engine and repo to the profile's repos field + engine_repo = engine_repo.removesuffix('/') profile.repos[engine_name] = engine_repo + if profile.engine == '': + profile.engine = engine_name + + changes_message += f'Added engine: {engine_name} with repository {engine_repo}!\n' changes = True if changes: profile.save() # Save if any changes are made - return render(request, 'profile.html') + return render(request, 'profile.html', {'status_message': changes_message}) # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # TEST LIST VIEWS # @@ -272,7 +292,7 @@ def index(request, page=1, error=''): 'pending' : pending, 'active' : active, 'completed' : completed[start:end], 'awaiting' : awaiting, 'paging' : paging, 'status' : OpenBench.utils.getMachineStatus(), - 'error' : error, + 'error_message' : error, } return render(request, 'index.html', data) @@ -536,13 +556,14 @@ def newTest(request): if request.method == 'GET': data = { 'networks' : list(Network.objects.all().values()) } return render(request, 'newTest.html', data) + test, errors = OpenBench.utils.create_new_test(request) if errors != [] and errors != None: errors = ["[{0}]: {1}".format(i, e) for i, e in enumerate(errors)] longest = max([len(e) for e in errors]) errors = ["{0}{1}".format(e, ' ' * (longest-len(e))) for e in errors] - return index(request, error='\n'.join(errors)) + return render(request, 'newTest.html', {'error_message': '\n'.join(errors)}) username = request.user.username profile = Profile.objects.get(user=request.user) @@ -609,16 +630,16 @@ def networks(request, action=None, sha256=None, client=False): sha256 = hashlib.sha256(netfile.file.read()).hexdigest()[:8].upper() if not re.match(r'^[a-zA-Z0-9_.-]+$', name): - return index(request, error='Name may only contain letters, numbers, dashes, underscores, and dots') + return render(request, "uploadnet.html", {'error_message': 'Name may only contain letters, numbers, dashes, underscores, and dots'}) if Network.objects.filter(sha256=sha256): - return index(request, error='Network with that hash already exists') + return render(request, "uploadnet.html", {'error_message':'Network with that hash already exists'}) if Network.objects.filter(engine=engine, name=sha256): - return index(request, error='Network with that name already exists for that engine') + return render(request, "uploadnet.html", {'error_message':'Network with that name already exists for that engine'}) if engine not in OpenBench.utils.OPENBENCH_CONFIG['engines'].keys(): - return index(request, error='No Engine found with matching name') + return render(request, "uploadnet.html", {'error_message':'No Engine found with matching name'}) FileSystemStorage().save(sha256, netfile) @@ -626,12 +647,12 @@ def networks(request, action=None, sha256=None, client=False): sha256=sha256, name=name, engine=engine, author=request.user.username) - return index(request) + return render(request, "uploadnet.html", {'status_message': f"Created a network for engine {engine}, Network Name: {name} , SHA: {sha256}"}) if action.upper() == 'DEFAULT': if not Network.objects.filter(sha256=sha256): - return index(request, error='No Network found with matching SHA256') + return HttpResponse('No network found with matching SHA256') network = Network.objects.get(sha256=sha256) Network.objects.filter(engine=network.engine).update(default=False) @@ -642,7 +663,7 @@ def networks(request, action=None, sha256=None, client=False): if action.upper() == 'DELETE': if not Network.objects.filter(sha256=sha256): - return index(request, error='No Network found with matching SHA256') + return HttpResponse('No network found with matching SHA256') Network.objects.get(sha256=sha256).delete() FileSystemStorage().delete(sha256) @@ -652,7 +673,7 @@ def networks(request, action=None, sha256=None, client=False): if action.upper() == 'DOWNLOAD': if not Network.objects.filter(sha256=sha256): - return index(request, error='No Network found with matching SHA256') + return HttpResponse('No network found with matching SHA256') netfile = os.path.join(MEDIA_ROOT, sha256) fwrapper = FileWrapper(open(netfile, 'rb'), 8192) diff --git a/Templates/OpenBench/base.html b/Templates/OpenBench/base.html index 2bde718..41d4444 100644 --- a/Templates/OpenBench/base.html +++ b/Templates/OpenBench/base.html @@ -108,7 +108,8 @@

OpenBench Testing Framework

- {% if error %}
{{error}}
{% endif %} + {% if error_message %}
{{error_message}}
{% endif %} + {% if status_message %}
{{status_message}}
{% endif %} {% block content %} {% endblock %}
diff --git a/Templates/OpenBench/profile.html b/Templates/OpenBench/profile.html index 1870e01..a86ea68 100644 --- a/Templates/OpenBench/profile.html +++ b/Templates/OpenBench/profile.html @@ -48,7 +48,7 @@
- + +
From 55f8da1f92d23e8d6b7221a920a02147212eae85 Mon Sep 17 00:00:00 2001 From: andrew Date: Fri, 9 Jun 2023 08:17:10 -0400 Subject: [PATCH 49/51] Fix private engines cross-engine support --- OpenBench/management/commands/runserver.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/OpenBench/management/commands/runserver.py b/OpenBench/management/commands/runserver.py index e171007..4f2f003 100644 --- a/OpenBench/management/commands/runserver.py +++ b/OpenBench/management/commands/runserver.py @@ -10,16 +10,18 @@ class ArtifactWatcher(threading.Thread): dev_has_all = test.dev.source.endswith('artifacts') base_has_all = test.base.source.endswith('artifacts') - headers = OpenBench.utils.read_git_credentials(test.engine) - if headers and not dev_has_all: + dev_headers = OpenBench.utils.read_git_credentials(test.dev_engine) + base_headers = OpenBench.utils.read_git_credentials(test.base_engine) + + if dev_headers and not dev_has_all: test.dev.source, dev_has_all = OpenBench.utils.fetch_artifact_url( - test.dev.source, test.engine, headers, test.dev.sha) + test.dev.source, test.dev_engine, dev_headers, test.dev.sha) test.dev.save() - if headers and not base_has_all: + if base_headers and not base_has_all: test.base.source, base_has_all = OpenBench.utils.fetch_artifact_url( - test.base.source, test.engine, headers, test.base.sha) + test.base.source, test.base_engine, base_headers, test.base.sha) test.base.save() if dev_has_all and base_has_all: From 59917f960df65dfdf113bc78248e675130b2ed30 Mon Sep 17 00:00:00 2001 From: andrew Date: Fri, 9 Jun 2023 11:03:35 -0400 Subject: [PATCH 50/51] Work in progress on some view changes --- OpenBench/config.py | 2 +- OpenBench/static/form.css | 9 + OpenBench/static/style.css | 4 +- OpenBench/urls.py | 6 +- OpenBench/views.py | 358 +++++++++++------------------- Templates/OpenBench/base.html | 19 +- Templates/OpenBench/profile.html | 14 +- Templates/OpenBench/register.html | 22 +- 8 files changed, 183 insertions(+), 251 deletions(-) diff --git a/OpenBench/config.py b/OpenBench/config.py index 47c8d3a..1d3a63e 100644 --- a/OpenBench/config.py +++ b/OpenBench/config.py @@ -33,7 +33,7 @@ def load_folder_of_configs(*path): USE_CROSS_APPROVAL = False # Require a second user to approve patches REQUIRE_LOGIN_TO_VIEW = True # Block all content but Login and Regiser by default -REQUIRE_MANUAL_REGISTRATION = True # Disable the public facing registration page +REQUIRE_MANUAL_REGISTRATION = False # Disable the public facing registration page OPENBENCH_CONFIG = { diff --git a/OpenBench/static/form.css b/OpenBench/static/form.css index 8c2882d..5b1c162 100644 --- a/OpenBench/static/form.css +++ b/OpenBench/static/form.css @@ -107,4 +107,13 @@ #content .form .flex button{ max-width: 100%; +} + +#content #engines-container span { + margin: 0px 4px 0px 4px; + cursor: pointer; +} + +#content #engines-container span input { + cursor: pointer; } \ No newline at end of file diff --git a/OpenBench/static/style.css b/OpenBench/static/style.css index df04c54..d1de851 100644 --- a/OpenBench/static/style.css +++ b/OpenBench/static/style.css @@ -316,7 +316,7 @@ td pre { #content .error-message { color: red; -} +} #content .status-message { color: green; @@ -324,4 +324,4 @@ td pre { #content .site-title { color: var(--color-font3); -} \ No newline at end of file +} diff --git a/OpenBench/urls.py b/OpenBench/urls.py index a881748..d31593d 100644 --- a/OpenBench/urls.py +++ b/OpenBench/urls.py @@ -32,15 +32,15 @@ urlpatterns = [ # Links for viewing test tables django.urls.path(r'index/', OpenBench.views.index), django.urls.path(r'index//', OpenBench.views.index), + django.urls.path(r'user//', OpenBench.views.user), + django.urls.path(r'user///', OpenBench.views.user), django.urls.path(r'greens/', OpenBench.views.greens), django.urls.path(r'greens//', OpenBench.views.greens), django.urls.path(r'search/', OpenBench.views.search), - django.urls.path(r'user//', OpenBench.views.user), - django.urls.path(r'user///', OpenBench.views.user), - django.urls.path(r'event//', OpenBench.views.event), # Links for viewing general information tables django.urls.path(r'users/', OpenBench.views.users), + django.urls.path(r'event//', OpenBench.views.event), django.urls.path(r'events/', OpenBench.views.events_actions), django.urls.path(r'events//', OpenBench.views.events_actions), django.urls.path(r'errors/', OpenBench.views.events_errors), diff --git a/OpenBench/views.py b/OpenBench/views.py index 5546dca..7cbbb1c 100644 --- a/OpenBench/views.py +++ b/OpenBench/views.py @@ -27,6 +27,8 @@ import django.contrib.auth import OpenBench.config import OpenBench.utils +from OpenBench.config import OPENBENCH_CONFIG + from OpenBench.models import * from django.contrib.auth.models import User from OpenSite.settings import MEDIA_ROOT @@ -37,7 +39,6 @@ from django.http import HttpResponse, FileResponse, JsonResponse from django.views.decorators.csrf import csrf_exempt from django.core.files.storage import FileSystemStorage from django.core.files.base import ContentFile -from htmlmin.decorators import not_minified_response # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # GENERAL UTILITIES # @@ -49,11 +50,11 @@ class UnableToAuthenticate(Exception): def render(request, template, content={}, always_allow=False): data = content.copy() - data.update({'config' : OpenBench.config.OPENBENCH_CONFIG}) + data.update({ 'config' : OPENBENCH_CONFIG }) if OpenBench.config.REQUIRE_LOGIN_TO_VIEW: if not request.user.is_authenticated and not always_allow: - return login(request, OpenBench.config.OPENBENCH_CONFIG['error']['requires_login']) + return redirect(request, '/login/', error=data['config']['error']['requires_login']) if request.user.is_authenticated: @@ -61,12 +62,27 @@ def render(request, template, content={}, always_allow=False): data.update({'profile' : profile.first()}) if profile.first() and not profile.first().enabled: - data.update({'error' : data['config']['error']['disabled']}) + request.session['error_message'] = data['config']['error']['disabled'] - if request.user.is_authenticated and not profile.first(): - data.update({'error' : data['config']['error']['fakeuser']}) + elif request.user.is_authenticated and not profile.first(): + request.session['error_message'] = data['config']['error']['fakeuser'] - return django.shortcuts.render(request, 'OpenBench/{0}'.format(template), data) + response = django.shortcuts.render(request, 'OpenBench/{0}'.format(template), data) + + for key in ['status_message', 'error_message']: + if key in request.session: del request.session[key] + + return response + +def redirect(request, destination, error=None, status=None): + + if error: + request.session['error_message'] = error + + if status: + request.session['status_message'] = status + + return django.http.HttpResponseRedirect(destination) def authenticate(request, requireEnabled=False): @@ -93,29 +109,19 @@ def authenticate(request, requireEnabled=False): def register(request): - # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # - # # - # GET : Return the HTML template used for registering a new User # - # # - # POST : Enforce matching alpha-numeric passwords, and then attempt to # - # generate a new User and Profile. Return to the homepage after # - # after logging the User in. Share any errors with the viewer # - # # - # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # - if request.method == 'GET': if not OpenBench.config.REQUIRE_MANUAL_REGISTRATION: return render(request, 'register.html', always_allow=True) - return login(request, OpenBench.config.OPENBENCH_CONFIG['error']['manual_registration']) + return redirect(request, '/login/', error=OPENBENCH_CONFIG['error']['manual_registration']) if request.POST['password1'] != request.POST['password2']: - return render(request, 'register.html', {'error_message': 'Passwords Do Not Match'}) + return redirect(request, '/register/', error='Passwords do not match') if not request.POST['username'].isalnum(): - return render(request, 'register.html', {'error_message': 'Alpha Numeric Usernames Only'}) + return redirect(request, '/register/', error='Alpha-numeric usernames Only') if User.objects.filter(username=request.POST['username']): - return render(request, 'register.html', {'error_message': 'That Username is taken'}) + return redirect(request, '/register/', error='That username is already taken') email = request.POST['email'] username = request.POST['username'] @@ -125,161 +131,99 @@ def register(request): django.contrib.auth.login(request, user) Profile.objects.create(user=user) - return django.http.HttpResponseRedirect('/index/') + return redirect(request, '/index/') -def login(request, error=''): +def login(request): - # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # - # # - # GET : Return the HTML template used for logging in a User # - # # - # POST : Attempt to login the User. If their login is invalid, let them # - # know. In all cases, return the User back to the main page # - # # - # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # - - if request.method == 'GET' or error: - data = { 'error' : error } - return render(request, 'login.html', data, always_allow=True) + if request.method == 'GET': + return render(request, 'login.html', always_allow=True) try: - user = authenticate(request) - django.contrib.auth.login(request, user) - return django.http.HttpResponseRedirect('/index/') + django.contrib.auth.login(request, authenticate(request)) + return redirect(request, '/index/') except UnableToAuthenticate: - data = { 'error' : 'Unable to authenticate username and password' } - return render(request, 'login.html', data, always_allow=True) + return redirect(request, '/login/', error='Unable to authenticate user') def logout(request): - # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # - # # - # GET : Logout the User if they are logged in. Return to the main page # - # # - # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # - django.contrib.auth.logout(request) - return django.http.HttpResponseRedirect('/index/') + return redirect(request, '/index/', status='Logged out') def profile(request): - # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # - # # - # GET : If the User is logged in, return the HTML template which shows # - # all of the information about the User, and a form to change the # - # email address, password, and default engine of the User. If the # - # User is not logged in, return them to the main page # - # # - # POST : Modify the User's email address and selected Engine, if the # - # User has requested this. Update the password for the User if # - # they have requested a change and provided a new set of matching # - # passwords. Return the User to the main page # - # # - # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # - if not request.user.is_authenticated: - return django.http.HttpResponseRedirect('/login/') + return redirect(request, '/login/') + + if not Profile.objects.filter(user=request.user).first(): + return redirect(request, '/index/') if request.method == 'GET': return render(request, 'profile.html') - profile = Profile.objects.filter(user=request.user) - - #profile.update(engine=request.POST['engine'], repo=request.POST['repo']) - changes_message = '' - if request.user.email != request.POST['email']: - changes_message += 'Updated Email!\n' - - request.user.email = request.POST['email'] - request.user.save() + changes_message += 'Updated email address to %s' % (request.POST['email']) + request.user.email = request.POST['email'] + request.user.save() if request.POST['password1'] != request.POST['password2']: - return render(request, 'profile.html', {'error_message': "Passwords Do Not Match!", 'status_message': changes_message}) + return redirect(request, '/profile/', status=changes_message, error='Passwords do not match') - if request.POST['password1'] != '': + if request.POST['password1']: request.user.set_password(request.POST['password1']) - django.contrib.auth.login(request, request.user) request.user.save() - changes_message += 'Updated Password!\n' + django.contrib.auth.login(request, request.user) + changes_message += '\nUpdated password' - return render(request, 'profile.html', {'status_message': changes_message}) + return redirect(request, '/profile/', status=changes_message.removeprefix('\n')) def profile_config(request): if not request.user.is_authenticated: - return django.http.HttpResponseRedirect('/login/') + return redirect(request, '/login/') + + if not (profile := Profile.objects.filter(user=request.user).first()): + return redirect(request, 'index') if request.method == 'GET': return render(request, 'profile.html') - profile = Profile.objects.get(user=request.user) + changes = '' - changes = False # To check if any changes are made. - changes_message = '' + if (engine := request.POST.get('default-status', profile.engine)) != profile.engine: + changes += 'Set %s as the default, replacing %s\n' % (engine, profile.engine) + profile.engine = engine - default_status = request.POST.get('default-status', '') - - if default_status != '': - if default_status != profile.engine: - changes_message += f'Removed {profile.engine} as default engine\n' - # update the default engine - profile.engine = default_status - changes_message += f'Set {profile.engine} as default engine\n' - changes = True - - - deleted_repos = request.POST.get('deleted-repos', '[]') - deleted_repos_array = json.loads(deleted_repos) - - for engine in deleted_repos_array: - if engine in profile.repos: - del profile.repos[engine] - changes_message += f'Deleted engine: {engine}!\n' - - - if len(deleted_repos_array) != 0: - changes = True - - if 'new-engine-name' in request.POST: - if request.POST['new-engine-name'] != "None" and not request.POST['new-engine-repo'].startswith('https://github.com/'): - return render(request, 'profile.html', {'error_message': "Not a valid repository!"}) - elif request.POST['new-engine-name'] != "None" and request.POST['new-engine-repo'].startswith('https://github.com/'): - engine_name = request.POST['new-engine-name'] - engine_repo = request.POST['new-engine-repo'] - - if profile.engine == '': - profile.engine = engine_name - - # Append the new engine and repo to the profile's repos field - engine_repo = engine_repo.removesuffix('/') - profile.repos[engine_name] = engine_repo - if profile.engine == '': - profile.engine = engine_name - - changes_message += f'Added engine: {engine_name} with repository {engine_repo}!\n' - changes = True + for engine in json.loads(request.POST.get('deleted-repos', '[]')): + profile.repos.pop(engine, False) + changes += 'Deleted Engine: %s\n' % (engine) if changes: - profile.save() # Save if any changes are made + profile.save() - return render(request, 'profile.html', {'status_message': changes_message}) + engine_name = request.POST.get('new-engine-name', 'None') + engine_repo = request.POST.get('new-engine-repo', '').removesuffix('/') + + if engine_name != 'None' and engine_repo: + + if not engine_repo.startswith('https://github.com/'): + return redirect(request, '/profile/', error='Repositories must be on Github') + + if not profile.engine: + profile.engine = engine_name + + changes += 'Added Engine: %s at %s' % (engine_name, engine_repo) + profile.repos[engine_name] = engine_repo + profile.save() + + return redirect(request, '/profile/', status=changes) # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # TEST LIST VIEWS # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # -def index(request, page=1, error=''): - - # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # - # # - # GET : Return all pending, active, and completed tests. Limit the # - # display of tests by the requested page number. Also display the # - # status for connected machines. # - # # - # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # +def index(request, page=1): pending = OpenBench.utils.get_pending_tests() active = OpenBench.utils.get_active_tests() @@ -289,40 +233,46 @@ def index(request, page=1, error=''): start, end, paging = OpenBench.utils.getPaging(completed, page, 'index') data = { - 'pending' : pending, 'active' : active, - 'completed' : completed[start:end], 'awaiting' : awaiting, - 'paging' : paging, 'status' : OpenBench.utils.getMachineStatus(), - 'error_message' : error, + 'pending' : pending, + 'active' : active, + 'completed' : completed[start:end], + 'awaiting' : awaiting, + 'paging' : paging, + 'status' : OpenBench.utils.getMachineStatus(), + } + + return render(request, 'index.html', data) + +def user(request, username, page=1): + + pending = OpenBench.utils.get_pending_tests().filter(author=username) + active = OpenBench.utils.get_active_tests().filter(author=username) + completed = OpenBench.utils.get_completed_tests().filter(author=username) + awaiting = OpenBench.utils.get_awaiting_tests().filter(author=username) + + start, end, paging = OpenBench.utils.getPaging(completed, page, 'user/%s' % (username)) + + data = { + 'pending' : pending, + 'active' : active, + 'completed' : completed[start:end], + 'awaiting' : awaiting, + 'paging' : paging, + 'status' : OpenBench.utils.getMachineStatus(username), } return render(request, 'index.html', data) def greens(request, page=1): - # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # - # # - # GET : Return all tests both passed and completed. Limit the display # - # of tests by the requested page number. # - # # - # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # - completed = OpenBench.utils.get_completed_tests().filter(passed=True) start, end, paging = OpenBench.utils.getPaging(completed, page, 'greens') - data = {'completed' : completed[start:end], 'paging' : paging} + data = { 'completed' : completed[start:end], 'paging' : paging } return render(request, 'index.html', data) def search(request): - # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # - # # - # GET : Return the HTML template for searching tests on the framework. # - # # - # POST : Filter the tests by the provided criteria, and return a display # - # with the filtered results. Keywords are case insensitive # - # # - # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # - if request.method == 'GET': return render(request, 'search.html', {}) @@ -358,31 +308,14 @@ def search(request): return render(request, 'search.html', {'tests' : filtered}) -def user(request, username, page=1): +# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # +# GENERAL DATA TABLE VIEWS # +# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # - # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # - # # - # GET : Return all pending, active, and completed tests for the User # - # that has been requested. Limit the display of completed tests # - # by the requested page number. Also display the User's machines # - # # - # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # +def users(request): - pending = OpenBench.utils.get_pending_tests().filter(author=username) - active = OpenBench.utils.get_active_tests().filter(author=username) - completed = OpenBench.utils.get_completed_tests().filter(author=username) - awaiting = OpenBench.utils.get_awaiting_tests().filter(author=username) - - url = 'user/{0}'.format(username) - start, end, paging = OpenBench.utils.getPaging(completed, page, url) - - data = { - 'pending' : pending, 'active' : active, - 'completed' : completed[start:end], 'awaiting' : awaiting, - 'paging' : paging, 'status' : OpenBench.utils.getMachineStatus(username), - } - - return render(request, 'index.html', data) + data = { 'profiles' : Profile.objects.order_by('-games', '-tests') } + return render(request, 'users.html', data) def event(request, id): @@ -390,31 +323,14 @@ def event(request, id): with open(os.path.join(MEDIA_ROOT, LogEvent.objects.get(id=id).log_file)) as fin: return render(request, 'event.html', { 'content' : fin.read() }) except: - return HttpResponseRedirect('/index/') - -# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # -# GENERAL DATA TABLE VIEWS # -# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # - -def users(request): - - # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # - # # - # GET : Return information about all users on the Framework. Sort the # - # Users by games completed, tests created. The HTML template will # - # filter out disabled users later. # - # # - # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # - - data = {'profiles' : Profile.objects.order_by('-games', '-tests')} - return render(request, 'users.html', data) + return redirect(request, '/index/', error='No logs for event exist') def events_actions(request, page=1): events = LogEvent.objects.all().filter(machine_id=0).order_by('-id') start, end, paging = OpenBench.utils.getPaging(events, page, 'events') - data = {'events' : events[start:end], 'paging' : paging}; + data = { 'events' : events[start:end], 'paging' : paging }; return render(request, 'events.html', data) def events_errors(request, page=1): @@ -422,26 +338,22 @@ def events_errors(request, page=1): events = LogEvent.objects.all().exclude(machine_id=0).order_by('-id') start, end, paging = OpenBench.utils.getPaging(events, page, 'errors') - data = {'events' : events[start:end], 'paging' : paging}; + data = { 'events' : events[start:end], 'paging' : paging }; return render(request, 'errors.html', data) def machines(request, machineid=None): - # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # - # # - # GET : Return information about all of the machines that have been # - # active on the Framework within the last fifteen minutes # - # # - # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # - if machineid == None: - data = {'machines' : OpenBench.utils.getRecentMachines()} + data = { 'machines' : OpenBench.utils.getRecentMachines() } return render(request, 'machines.html', data) - else: - data = {'machine' : OpenBench.models.Machine.objects.get(id=machineid)} + try: + data = { 'machine' : OpenBench.models.Machine.objects.get(id=machineid) } return render(request, 'machine.html', data) + except: + return redirect(request, '/machines/', error='Machine does not exist') + # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # TEST MANAGEMENT VIEWS # @@ -449,29 +361,12 @@ def machines(request, machineid=None): def test(request, id, action=None): - # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # - # # - # GET : The User is either trying to view the status of the selected # - # test, or adjust the running state of the test in some way. When # - # viewing a test, collect the results and return an HTML template # - # using that data. Otherwise, look to adjust the running state of # - # the test. We throw out any invalid requests. Create a LogEvent # - # if the we attempt to modify the test's state in any way # - # # - # POST : The only valid POST request is for the action MODIFY. Requests # - # to modify contain an updated Priority and Throughput parameter # - # for the selected test. Bound the updated values, and log the # - # modification of the test with the creation of a new LogEvent # - # # - # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # - - if not Test.objects.filter(id=id): + if not (test := Test.objects.filter(id=id).first()): return django.http.HttpResponseRedirect('/index/') if action not in ['APPROVE', 'RESTART', 'STOP', 'DELETE', 'MODIFY']: # Select the Test, and all Result objects attached - test = Test.objects.get(id=id) results = Result.objects.filter(test=test).order_by('machine_id') data = { 'test' : test, 'results': {} } @@ -504,7 +399,6 @@ def test(request, id, action=None): return django.http.HttpResponseRedirect('/login/') user = request.user - test = Test.objects.get(id=id) profile = Profile.objects.get(user=user) if not profile.approver and test.author != profile.user.username: @@ -556,7 +450,7 @@ def newTest(request): if request.method == 'GET': data = { 'networks' : list(Network.objects.all().values()) } return render(request, 'newTest.html', data) - + test, errors = OpenBench.utils.create_new_test(request) if errors != [] and errors != None: @@ -638,7 +532,7 @@ def networks(request, action=None, sha256=None, client=False): if Network.objects.filter(engine=engine, name=sha256): return render(request, "uploadnet.html", {'error_message':'Network with that name already exists for that engine'}) - if engine not in OpenBench.utils.OPENBENCH_CONFIG['engines'].keys(): + if engine not in OPENBENCH_CONFIG['engines'].keys(): return render(request, "uploadnet.html", {'error_message':'No Engine found with matching name'}) FileSystemStorage().save(sha256, netfile) @@ -714,8 +608,8 @@ def client_verify_worker(request): except: return None, JsonResponse({ 'error' : 'Bad Machine Id' }) # Ensure the Client is using the same version as the Server - if machine.info['client_ver'] != OpenBench.config.OPENBENCH_CONFIG['client_version']: - expected_ver = OpenBench.config.OPENBENCH_CONFIG['client_version'] + if machine.info['client_ver'] != OPENBENCH_CONFIG['client_version']: + expected_ver = OPENBENCH_CONFIG['client_version'] return machine, JsonResponse({ 'error' : 'Bad Client Version: Expected %s' % (expected_ver)}) # Use the secret token as our soft verification @@ -730,7 +624,7 @@ def client_get_files(request): ## Location of static compile of Cutechess for Windows and Linux. ## OpenBench does not serve these files, but points to a repo ideally. - return JsonResponse( {'location' : OpenBench.config.OPENBENCH_CONFIG['corefiles'] }) + return JsonResponse( {'location' : OPENBENCH_CONFIG['corefiles'] }) @csrf_exempt def client_get_build_info(request): @@ -739,7 +633,7 @@ def client_get_build_info(request): ## Toss in a private flag as well to indicate the need for Github Tokens. data = {} - for engine, config in OpenBench.config.OPENBENCH_CONFIG['engines'].items(): + for engine, config in OPENBENCH_CONFIG['engines'].items(): data[engine] = config['build'] return JsonResponse(data) @@ -765,7 +659,7 @@ def client_worker_info(request): # Tag engines that the Machine can build and/or run with binaries machine.info['supported'] = [] - for engine, data in OpenBench.config.OPENBENCH_CONFIG['engines'].items(): + for engine, data in OPENBENCH_CONFIG['engines'].items(): # Must have all CPU flags, for both Public and Private engines if any([flag not in machine.info['cpu_flags'] for flag in data['build']['cpuflags']]): diff --git a/Templates/OpenBench/base.html b/Templates/OpenBench/base.html index 41d4444..69be0c8 100644 --- a/Templates/OpenBench/base.html +++ b/Templates/OpenBench/base.html @@ -107,9 +107,22 @@
-

OpenBench Testing Framework

- {% if error_message %}
{{error_message}}
{% endif %} - {% if status_message %}
{{status_message}}
{% endif %} +

+ OpenBench Testing Framework +

+ + {% if request.session.error_message %} +
+
{{request.session.error_message}}
+
+ {% endif %} + + {% if request.session.status_message %} +
+
{{request.session.status_message}}
+
+ {% endif %} + {% block content %} {% endblock %}
diff --git a/Templates/OpenBench/profile.html b/Templates/OpenBench/profile.html index a86ea68..f58abfe 100644 --- a/Templates/OpenBench/profile.html +++ b/Templates/OpenBench/profile.html @@ -39,9 +39,14 @@
- + + + + + - +
{% endfor %} @@ -49,7 +54,6 @@