From f711de29b357a42517ee57e9bd6194473276459d Mon Sep 17 00:00:00 2001 From: Andrew Grant Date: Mon, 8 Aug 2022 05:42:55 -0400 Subject: [PATCH] Allow dynamic test modes to be defined in config.py --- OpenBench/config.py | 209 ++++++++++++++++--------------- Templates/OpenBench/newTest.html | 208 +++++++++++++++++------------- 2 files changed, 227 insertions(+), 190 deletions(-) diff --git a/OpenBench/config.py b/OpenBench/config.py index 01b10b3..f2b40d6 100644 --- a/OpenBench/config.py +++ b/OpenBench/config.py @@ -40,7 +40,6 @@ OPENBENCH_CONFIG = { 'tests' : { 'max_games' : '20000', # Default for Fixed Games 'confidence' : '[0.05, 0.05]', # SPRT Type I/II Confidence - 'throughput' : { 'stc' : 1000, 'ltc' : 1000, 'smpstc' : 1000, 'smpltc' : 1000 }, }, # Book Configuration. When addding a book, follow the provided template. @@ -107,12 +106,16 @@ OPENBENCH_CONFIG = { 'cpuflags' : ['AVX2', 'AVX', 'FMA', 'POPCNT', 'SSE2', 'SSE'], }, - 'testmodes' : { - 'stc' : { 'threads' : 1, 'hash' : 8, 'timecontrol' : '10.0+0.1' }, - 'ltc' : { 'threads' : 1, 'hash' : 64, 'timecontrol' : '60.0+0.6' }, - 'smpstc' : { 'threads' : 8, 'hash' : 64, 'timecontrol' : '5.0+0.05' }, - 'smpltc' : { 'threads' : 8, 'hash' : 256, 'timecontrol' : '20.0+0.2' }, - }, + '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 }, + ], }, 'Laser' : { @@ -129,12 +132,12 @@ OPENBENCH_CONFIG = { 'cpuflags' : ['POPCNT'], }, - 'testmodes' : { - 'stc' : { 'threads' : 1, 'hash' : 8, 'timecontrol' : '8.0+0.08' }, - 'ltc' : { 'threads' : 1, 'hash' : 64, 'timecontrol' : '40.0+0.4' }, - 'smpstc' : { 'threads' : 8, 'hash' : 64, 'timecontrol' : '5.0+0.05' }, - 'smpltc' : { 'threads' : 8, 'hash' : 256, 'timecontrol' : '20.0+0.2' }, - }, + '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' : { @@ -151,12 +154,12 @@ OPENBENCH_CONFIG = { 'cpuflags' : ['POPCNT'], }, - 'testmodes' : { - 'stc' : { 'threads' : 1, 'hash' : 32, 'timecontrol' : '8.0+0.08' }, - 'ltc' : { 'threads' : 1, 'hash' : 128, 'timecontrol' : '40.0+0.4' }, - 'smpstc' : { 'threads' : 8, 'hash' : 128, 'timecontrol' : '5.0+0.05' }, - 'smpltc' : { 'threads' : 8, 'hash' : 512, 'timecontrol' : '20.0+0.2' }, - }, + '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' : { @@ -173,12 +176,12 @@ OPENBENCH_CONFIG = { 'cpuflags' : ['POPCNT'], }, - 'testmodes' : { - 'stc' : { 'threads' : 1, 'hash' : 8, 'timecontrol' : '8.0+0.08' }, - 'ltc' : { 'threads' : 1, 'hash' : 32, 'timecontrol' : '32.0+0.32'}, - 'smpstc' : { 'threads' : 8, 'hash' : 32, 'timecontrol' : '4.0+0.04' }, - 'smpltc' : { 'threads' : 8, 'hash' : 128, 'timecontrol' : '16.0+0.16'}, - }, + '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' : { @@ -195,12 +198,12 @@ OPENBENCH_CONFIG = { 'cpuflags' : ['POPCNT'], }, - 'testmodes' : { - 'stc' : { 'threads' : 1, 'hash' : 8, 'timecontrol' : '10.0+0.1' }, - 'ltc' : { 'threads' : 1, 'hash' : 64, 'timecontrol' : '60.0+0.6' }, - 'smpstc' : { 'threads' : 8, 'hash' : 64, 'timecontrol' : '5.0+0.05' }, - 'smpltc' : { 'threads' : 8, 'hash' : 256, 'timecontrol' : '20.0+0.2' }, - }, + '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' : { @@ -217,12 +220,12 @@ OPENBENCH_CONFIG = { 'cpuflags' : ['POPCNT'], }, - 'testmodes' : { - 'stc' : { 'threads' : 1, 'hash' : 8, 'timecontrol' : '8.0+0.08' }, - 'ltc' : { 'threads' : 1, 'hash' : 64, 'timecontrol' : '40.0+0.4' }, - 'smpstc' : { 'threads' : 8, 'hash' : 64, 'timecontrol' : '5.0+0.05' }, - 'smpltc' : { 'threads' : 8, 'hash' : 256, 'timecontrol' : '20.0+0.2' }, - }, + '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' : { @@ -239,12 +242,12 @@ OPENBENCH_CONFIG = { 'cpuflags' : ['POPCNT'], }, - 'testmodes' : { - 'stc' : { 'threads' : 1, 'hash' : 8, 'timecontrol' : '10.0+0.1' }, - 'ltc' : { 'threads' : 1, 'hash' : 64, 'timecontrol' : '60.0+0.6' }, - 'smpstc' : { 'threads' : 8, 'hash' : 64, 'timecontrol' : '5.0+0.05' }, - 'smpltc' : { 'threads' : 8, 'hash' : 256, 'timecontrol' : '20.0+0.2' }, - }, + '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' : { @@ -261,12 +264,12 @@ OPENBENCH_CONFIG = { 'cpuflags' : ['POPCNT'], }, - 'testmodes' : { - 'stc' : { 'threads' : 1, 'hash' : 8, 'timecontrol' : '8.0+0.08' }, - 'ltc' : { 'threads' : 1, 'hash' : 64, 'timecontrol' : '40.0+0.4' }, - 'smpstc' : { 'threads' : 8, 'hash' : 64, 'timecontrol' : '5.0+0.05' }, - 'smpltc' : { 'threads' : 8, 'hash' : 256, 'timecontrol' : '20.0+0.2' }, - }, + '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' : { @@ -283,12 +286,12 @@ OPENBENCH_CONFIG = { 'cpuflags' : ['POPCNT'], }, - 'testmodes' : { - 'stc' : { 'threads' : 1, 'hash' : 8, 'timecontrol' : '8.0+0.08' }, - 'ltc' : { 'threads' : 1, 'hash' : 64, 'timecontrol' : '40.0+0.4' }, - 'smpstc' : { 'threads' : 8, 'hash' : 64, 'timecontrol' : '5.0+0.05' }, - 'smpltc' : { 'threads' : 8, 'hash' : 256, 'timecontrol' : '20.0+0.2' }, - }, + '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' : { @@ -305,12 +308,12 @@ OPENBENCH_CONFIG = { 'cpuflags' : ['POPCNT'], }, - 'testmodes' : { - 'stc' : { 'threads' : 1, 'hash' : 16, 'timecontrol' : '8.0+0.08' }, - 'ltc' : { 'threads' : 1, 'hash' : 64, 'timecontrol' : '40.0+0.4' }, - 'smpstc' : { 'threads' : 8, 'hash' : 64, 'timecontrol' : '5.0+0.05' }, - 'smpltc' : { 'threads' : 8, 'hash' : 256, 'timecontrol' : '20.0+0.2' }, - }, + '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' : { @@ -327,12 +330,12 @@ OPENBENCH_CONFIG = { 'cpuflags' : ['AVX2', 'AVX', 'FMA', 'POPCNT', 'SSE2', 'SSE'], }, - 'testmodes' : { - 'stc' : { 'threads' : 1, 'hash' : 32, 'timecontrol' : '8.0+0.08' }, - 'ltc' : { 'threads' : 1, 'hash' : 64, 'timecontrol' : '40.0+0.4' }, - 'smpstc' : { 'threads' : 8, 'hash' : 64, 'timecontrol' : '5.0+0.05' }, - 'smpltc' : { 'threads' : 8, 'hash' : 256, 'timecontrol' : '20.0+0.2' }, - }, + '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' : { @@ -349,12 +352,12 @@ OPENBENCH_CONFIG = { 'cpuflags' : ['AVX2', 'AVX', 'FMA', 'POPCNT', 'SSE2', 'SSE'], }, - 'testmodes' : { - 'stc' : { 'threads' : 1, 'hash' : 8, 'timecontrol' : '8.0+0.08' }, - 'ltc' : { 'threads' : 1, 'hash' : 64, 'timecontrol' : '40.0+0.4' }, - 'smpstc' : { 'threads' : 8, 'hash' : 64, 'timecontrol' : '5.0+0.05' }, - 'smpltc' : { 'threads' : 8, 'hash' : 256, 'timecontrol' : '20.0+0.2' }, - }, + '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' : { @@ -371,12 +374,12 @@ OPENBENCH_CONFIG = { 'cpuflags' : ['POPCNT'], }, - 'testmodes' : { - 'stc' : { 'threads' : 1, 'hash' : 8, 'timecontrol' : '8.0+0.08' }, - 'ltc' : { 'threads' : 1, 'hash' : 64, 'timecontrol' : '40.0+0.4' }, - 'smpstc' : { 'threads' : 8, 'hash' : 64, 'timecontrol' : '5.0+0.05' }, - 'smpltc' : { 'threads' : 8, 'hash' : 256, 'timecontrol' : '20.0+0.2' }, - }, + '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' : { @@ -393,12 +396,12 @@ OPENBENCH_CONFIG = { 'cpuflags' : ['POPCNT'], }, - 'testmodes' : { - 'stc' : { 'threads' : 1, 'hash' : 8, 'timecontrol' : '8.0+0.08' }, - 'ltc' : { 'threads' : 1, 'hash' : 64, 'timecontrol' : '40.0+0.4' }, - 'smpstc' : { 'threads' : 8, 'hash' : 64, 'timecontrol' : '5.0+0.05' }, - 'smpltc' : { 'threads' : 8, 'hash' : 256, 'timecontrol' : '20.0+0.2' }, - }, + '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' : { @@ -415,12 +418,12 @@ OPENBENCH_CONFIG = { 'cpuflags' : ['POPCNT'], }, - 'testmodes' : { - 'stc' : { 'threads' : 1, 'hash' : 8, 'timecontrol' : '8.0+0.08' }, - 'ltc' : { 'threads' : 1, 'hash' : 64, 'timecontrol' : '40.0+0.4' }, - 'smpstc' : { 'threads' : 8, 'hash' : 64, 'timecontrol' : '5.0+0.05' }, - 'smpltc' : { 'threads' : 8, 'hash' : 256, 'timecontrol' : '20.0+0.2' }, - }, + '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' }, + ], }, 'Zahak' : { @@ -437,12 +440,12 @@ OPENBENCH_CONFIG = { 'cpuflags' : ['AVX', 'POPCNT'], }, - 'testmodes' : { - 'stc' : { 'threads' : 1, 'hash' : 8, 'timecontrol' : '8.0+0.08' }, - 'ltc' : { 'threads' : 1, 'hash' : 64, 'timecontrol' : '40.0+0.4' }, - 'smpstc' : { 'threads' : 8, 'hash' : 64, 'timecontrol' : '5.0+0.05' }, - 'smpltc' : { 'threads' : 8, 'hash' : 256, 'timecontrol' : '20.0+0.2' }, - }, + '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' : { @@ -459,12 +462,12 @@ OPENBENCH_CONFIG = { 'cpuflags' : [], }, - 'testmodes' : { - 'stc' : { 'threads' : 1, 'hash' : 8, 'timecontrol' : '8.0+0.08' }, - 'ltc' : { 'threads' : 1, 'hash' : 64, 'timecontrol' : '40.0+0.4' }, - 'smpstc' : { 'threads' : 8, 'hash' : 64, 'timecontrol' : '5.0+0.05' }, - 'smpltc' : { 'threads' : 8, 'hash' : 256, 'timecontrol' : '20.0+0.2' }, - }, + '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' }, + ], }, }, } diff --git a/Templates/OpenBench/newTest.html b/Templates/OpenBench/newTest.html index dc042cf..ef03aa9 100644 --- a/Templates/OpenBench/newTest.html +++ b/Templates/OpenBench/newTest.html @@ -2,73 +2,135 @@ {% block scripts %} - // Take the settings from OpenBench/config.py for each engine - // and generate a new dictionary in javascript that can be used - var Configurations = { - {% for name, data in config.engines.items %} - '{{name}}' : { - 'base' : "{{data.base}}", - 'book' : "{{data.book}}", - 'bounds' : "{{data.bounds}}", - {% for type, settings in data.testmodes.items %} - '{{type}}' : { - "threads" : "{{settings.threads}}", - "hash" : "{{settings.hash}}", - "timecontrol" : "{{settings.timecontrol}}" + {% for name, data in config.engines.items %} + '{{name}}' : { + 'base' : "{{data.base}}", + 'book' : "{{data.book}}", + 'bounds' : "{{data.bounds}}", }, - {% endfor %} - }, - {% endfor %} + {% endfor %} }; - var Throughputs = { - "stc" : "{{config.tests.throughput.stc }}", - "ltc" : "{{config.tests.throughput.ltc }}", - "smpstc" : "{{config.tests.throughput.smpstc}}", - "smpltc" : "{{config.tests.throughput.smpltc}}", + var TestModes = { + {% for name, data in config.engines.items %} + '{{name}}' : [ + {% for mode in data.testmodes %} + { + {% for key, value in mode.items %} + '{{key}}' : '{{value}}', + {% endfor %} + }, + {% endfor %} + ], + {% endfor %} }; var Networks = [ - {% for network in networks %} - { - "name" : "{{network.name}}", - "sha256" : "{{network.sha256}}", - "engine" : "{{network.engine}}", - "default" : "{{network.default}}", - - }, - {% endfor %} + {% for network in networks %} + { + "name" : "{{network.name}}", + "sha256" : "{{network.sha256}}", + "engine" : "{{network.engine}}", + "default" : "{{network.default}}", + }, + {% endfor %} ]; - function configure(mode) { - // Find the selected engine - var selection = document.getElementById("enginename"); - var engine = selection.options[selection.selectedIndex].value; + function set_test_type(type) { - if (mode != null) { + //// When the test mode is set or changed, run this. + //// Sets the bounds, confidence intervals, and max games fields. - // Parse out the needed configuration settings - var threads = Configurations[engine][mode]["threads"]; - var hash = Configurations[engine][mode]["hash"]; - var timecontrol = Configurations[engine][mode]["timecontrol"]; + var selectA = document.getElementById("test_mode"); + var mode = selectA.options[selectA.selectedIndex].value; - // Adjust all the fields to auto-fill the settings - document.getElementById("devoptions").value = "Threads=" + threads + " Hash=" + hash; - document.getElementById("baseoptions").value = "Threads=" + threads + " Hash=" + hash; - document.getElementById("timecontrol").value = timecontrol; - document.getElementById("throughput").value = Throughputs[mode]; + var selectB = document.getElementById("enginename"); + var engine = selectB.options[selectB.selectedIndex].value; - return; // Don't change the Network setup unless asked + if (mode == "SPRT") { + document.getElementById("test_bounds").value = Configurations[engine]["bounds"] + document.getElementById("test_confidence").value = "{{config.tests.confidence}}"; + document.getElementById("test_max_games").value = "N/A"; + } + + if (mode == "GAMES") { + document.getElementById("test_bounds").value = "N/A"; + document.getElementById("test_confidence").value = "N/A"; + document.getElementById("test_max_games").value = "{{config.tests.max_games}}"; + } + } + + function set_test_mode(mode_idx) { + + //// Sets any of the possible following options: + //// Threads, Hash, Book, time Control, Test Mode, Bounds, Games + + var selection = document.getElementById("enginename"); + var engine = selection.options[selection.selectedIndex].value; + var mode = TestModes[engine][mode_idx]; + + if (mode["th"] != null && mode["hash"] != null) { + var threads = mode["th"]; var hash = mode["hash"]; + document.getElementById("devoptions").value = "Threads=" + threads + " Hash=" + hash; + document.getElementById("baseoptions").value = "Threads=" + threads + " Hash=" + hash; + } + + if (mode["book"] != null) { + document.getElementById("bookname").value = mode["book"] + } + + if (mode["tc"] != null) { + document.getElementById("timecontrol").value = mode["tc"];; + } + + if (mode["bounds"] != null) { + document.getElementById("test_mode").value = "SPRT"; set_test_type(); + document.getElementById("test_bounds").value = mode["bounds"]; + } + + if (mode["games"] != null) { + document.getElementById("test_mode").value = "GAMES"; set_test_type(); + document.getElementById("test_max_games").value = mode["games"]; + } + + // Default back when not specified + + if (mode["bounds"] == null && mode["games"] == null) { + document.getElementById("test_mode").value = "SPRT"; set_test_type(); + } + + if (mode["book"] == null) { + document.getElementById("bookname").value = Configurations[engine]["book"]; + } + } + + function set_engine(engine) { + + //// Creates a button to setup test modes, as specififed in the Engine's + //// entry in config.py. Also sets the opening book, and default base branch + //// based on the same config entry. Finally, creates a list of all uploaded + //// Network files that can be selected. The default Network is set as such, + //// if it exists. In all cases, a blank Network is included in the options. + + document.getElementById("enginename").value = engine; + + var button_div = document.getElementById("test-mode-buttons"); + while (button_div.hasChildNodes()) button_div.removeChild(button_div.lastChild); + + for (let i in TestModes[engine]) { + const btn = document.createElement('button') + btn.innerHTML = TestModes[engine][i]["id"]; + btn.onclick = function() { set_test_mode(i); }; + btn.class = (i % 2) ? "left-floated" : "right-floated"; + button_div.append(btn); } - // Fetch each option selection for Dev & Base var devnet = document.getElementById("devnetwork"); var basenet = document.getElementById("basenetwork"); var hasdefault = false; - // Remove all options initially while (devnet.length) devnet.remove(0); while (basenet.length) basenet.remove(0); @@ -100,41 +162,21 @@ baseopt.selected = (hasdefault == false); basenet.add(baseopt); } - // Update the Base Branch for the selected Engine var base_branch = document.getElementById("basebranch"); base_branch.value = Configurations[engine]["base"]; - // Update the Default Book for the selected Engine var book_selection = document.getElementById("bookname"); book_selection.value = Configurations[engine]["book"]; - - return test_type(); // Refresh the settings for the new Engine } - function test_type() { - var selectA = document.getElementById("test_mode"); - var mode = selectA.options[selectA.selectedIndex].value; - - var selectB = document.getElementById("enginename"); - var engine = selectB.options[selectB.selectedIndex].value; - - if (mode == "SPRT") { - document.getElementById("test_bounds").value = Configurations[engine]["bounds"] - document.getElementById("test_confidence").value = "{{config.tests.confidence}}"; - document.getElementById("test_max_games").value = "N/A"; - } - - if (mode == "GAMES") { - document.getElementById("test_bounds").value = "N/A"; - document.getElementById("test_confidence").value = "N/A"; - document.getElementById("test_max_games").value = "{{config.tests.max_games}}"; - } - } - - document.addEventListener('DOMContentLoaded', function () { configure('stc'); }, false); - document.addEventListener('DOMContentLoaded', function () { configure(null); }, false); - document.addEventListener('DOMContentLoaded', function () { test_type(); }, false); + document.addEventListener( + 'DOMContentLoaded', function () { + set_test_type(); + set_test_mode(0); + set_engine("{{profile.engine}}"); + }, false + ); {% endblock %} @@ -145,15 +187,10 @@

Engine

- {% for engine in config.engines %} - {% if engine == profile.engine %} - - {% else %} - - {% endif %} + {% endfor %} -

@@ -182,7 +219,7 @@

Test Settings

-
@@ -192,7 +229,7 @@

General Settings


-
+