Allow dynamic test modes to be defined in config.py

This commit is contained in:
Andrew Grant committed 2022-08-08 05:42:55 -04:00
1 parent f9fc3b8e2c
commit f711de29b3
2 files changed
+213 -176

No files matched your search

+106 -103
View File
@@ -40,7 +40,6 @@ OPENBENCH_CONFIG = {
'tests' : { 'tests' : {
'max_games' : '20000', # Default for Fixed Games 'max_games' : '20000', # Default for Fixed Games
'confidence' : '[0.05, 0.05]', # SPRT Type I/II Confidence '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. # Book Configuration. When addding a book, follow the provided template.
@@ -107,12 +106,16 @@ OPENBENCH_CONFIG = {
'cpuflags' : ['AVX2', 'AVX', 'FMA', 'POPCNT', 'SSE2', 'SSE'], 'cpuflags' : ['AVX2', 'AVX', 'FMA', 'POPCNT', 'SSE2', 'SSE'],
}, },
'testmodes' : { 'testmodes' : [
'stc' : { 'threads' : 1, 'hash' : 8, 'timecontrol' : '10.0+0.1' }, { 'id' : 'STC', 'th' : 1, 'hash' : 8, 'tc' : '10.0+0.1' },
'ltc' : { 'threads' : 1, 'hash' : 64, 'timecontrol' : '60.0+0.6' }, { 'id' : 'LTC', 'th' : 1, 'hash' : 64, 'tc' : '60.0+0.6' },
'smpstc' : { 'threads' : 8, 'hash' : 64, 'timecontrol' : '5.0+0.05' }, { 'id' : 'SMP STC', 'th' : 8, 'hash' : 64, 'tc' : '5.0+0.05' },
'smpltc' : { 'threads' : 8, 'hash' : 256, 'timecontrol' : '20.0+0.2' }, { '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' : { 'Laser' : {
@@ -129,12 +132,12 @@ OPENBENCH_CONFIG = {
'cpuflags' : ['POPCNT'], 'cpuflags' : ['POPCNT'],
}, },
'testmodes' : { 'testmodes' : [
'stc' : { 'threads' : 1, 'hash' : 8, 'timecontrol' : '8.0+0.08' }, { 'id' : 'STC', 'th' : 1, 'hash' : 8, 'tc' : '8.0+0.08' },
'ltc' : { 'threads' : 1, 'hash' : 64, 'timecontrol' : '40.0+0.4' }, { 'id' : 'LTC', 'th' : 1, 'hash' : 64, 'tc' : '40.0+0.4' },
'smpstc' : { 'threads' : 8, 'hash' : 64, 'timecontrol' : '5.0+0.05' }, { 'id' : 'SMP STC', 'th' : 8, 'hash' : 64, 'tc' : '5.0+0.05' },
'smpltc' : { 'threads' : 8, 'hash' : 256, 'timecontrol' : '20.0+0.2' }, { 'id' : 'SMP LTC', 'th' : 8, 'hash' : 256, 'tc' : '20.0+0.2' },
}, ],
}, },
'Weiss' : { 'Weiss' : {
@@ -151,12 +154,12 @@ OPENBENCH_CONFIG = {
'cpuflags' : ['POPCNT'], 'cpuflags' : ['POPCNT'],
}, },
'testmodes' : { 'testmodes' : [
'stc' : { 'threads' : 1, 'hash' : 32, 'timecontrol' : '8.0+0.08' }, { 'id' : 'STC', 'th' : 1, 'hash' : 32, 'tc' : '8.0+0.08' },
'ltc' : { 'threads' : 1, 'hash' : 128, 'timecontrol' : '40.0+0.4' }, { 'id' : 'LTC', 'th' : 1, 'hash' : 128, 'tc' : '40.0+0.4' },
'smpstc' : { 'threads' : 8, 'hash' : 128, 'timecontrol' : '5.0+0.05' }, { 'id' : 'SMP STC', 'th' : 8, 'hash' : 128, 'tc' : '5.0+0.05' },
'smpltc' : { 'threads' : 8, 'hash' : 512, 'timecontrol' : '20.0+0.2' }, { 'id' : 'SMP LTC', 'th' : 8, 'hash' : 512, 'tc' : '20.0+0.2' },
}, ],
}, },
'Demolito' : { 'Demolito' : {
@@ -173,12 +176,12 @@ OPENBENCH_CONFIG = {
'cpuflags' : ['POPCNT'], 'cpuflags' : ['POPCNT'],
}, },
'testmodes' : { 'testmodes' : [
'stc' : { 'threads' : 1, 'hash' : 8, 'timecontrol' : '8.0+0.08' }, { 'id' : 'STC', 'th' : 1, 'hash' : 8, 'tc' : '8.0+0.08' },
'ltc' : { 'threads' : 1, 'hash' : 32, 'timecontrol' : '32.0+0.32'}, { 'id' : 'LTC', 'th' : 1, 'hash' : 32, 'tc' : '32.0+0.32'},
'smpstc' : { 'threads' : 8, 'hash' : 32, 'timecontrol' : '4.0+0.04' }, { 'id' : 'SMP STC', 'th' : 8, 'hash' : 32, 'tc' : '4.0+0.04' },
'smpltc' : { 'threads' : 8, 'hash' : 128, 'timecontrol' : '16.0+0.16'}, { 'id' : 'SMP LTC', 'th' : 8, 'hash' : 128, 'tc' : '16.0+0.16'},
}, ],
}, },
'RubiChess' : { 'RubiChess' : {
@@ -195,12 +198,12 @@ OPENBENCH_CONFIG = {
'cpuflags' : ['POPCNT'], 'cpuflags' : ['POPCNT'],
}, },
'testmodes' : { 'testmodes' : [
'stc' : { 'threads' : 1, 'hash' : 8, 'timecontrol' : '10.0+0.1' }, { 'id' : 'STC', 'th' : 1, 'hash' : 8, 'tc' : '10.0+0.1' },
'ltc' : { 'threads' : 1, 'hash' : 64, 'timecontrol' : '60.0+0.6' }, { 'id' : 'LTC', 'th' : 1, 'hash' : 64, 'tc' : '60.0+0.6' },
'smpstc' : { 'threads' : 8, 'hash' : 64, 'timecontrol' : '5.0+0.05' }, { 'id' : 'SMP STC', 'th' : 8, 'hash' : 64, 'tc' : '5.0+0.05' },
'smpltc' : { 'threads' : 8, 'hash' : 256, 'timecontrol' : '20.0+0.2' }, { 'id' : 'SMP LTC', 'th' : 8, 'hash' : 256, 'tc' : '20.0+0.2' },
}, ],
}, },
'FabChess' : { 'FabChess' : {
@@ -217,12 +220,12 @@ OPENBENCH_CONFIG = {
'cpuflags' : ['POPCNT'], 'cpuflags' : ['POPCNT'],
}, },
'testmodes' : { 'testmodes' : [
'stc' : { 'threads' : 1, 'hash' : 8, 'timecontrol' : '8.0+0.08' }, { 'id' : 'STC', 'th' : 1, 'hash' : 8, 'tc' : '8.0+0.08' },
'ltc' : { 'threads' : 1, 'hash' : 64, 'timecontrol' : '40.0+0.4' }, { 'id' : 'LTC', 'th' : 1, 'hash' : 64, 'tc' : '40.0+0.4' },
'smpstc' : { 'threads' : 8, 'hash' : 64, 'timecontrol' : '5.0+0.05' }, { 'id' : 'SMP STC', 'th' : 8, 'hash' : 64, 'tc' : '5.0+0.05' },
'smpltc' : { 'threads' : 8, 'hash' : 256, 'timecontrol' : '20.0+0.2' }, { 'id' : 'SMP LTC', 'th' : 8, 'hash' : 256, 'tc' : '20.0+0.2' },
}, ],
}, },
'Igel' : { 'Igel' : {
@@ -239,12 +242,12 @@ OPENBENCH_CONFIG = {
'cpuflags' : ['POPCNT'], 'cpuflags' : ['POPCNT'],
}, },
'testmodes' : { 'testmodes' : [
'stc' : { 'threads' : 1, 'hash' : 8, 'timecontrol' : '10.0+0.1' }, { 'id' : 'STC', 'th' : 1, 'hash' : 8, 'tc' : '10.0+0.1' },
'ltc' : { 'threads' : 1, 'hash' : 64, 'timecontrol' : '60.0+0.6' }, { 'id' : 'LTC', 'th' : 1, 'hash' : 64, 'tc' : '60.0+0.6' },
'smpstc' : { 'threads' : 8, 'hash' : 64, 'timecontrol' : '5.0+0.05' }, { 'id' : 'SMP STC', 'th' : 8, 'hash' : 64, 'tc' : '5.0+0.05' },
'smpltc' : { 'threads' : 8, 'hash' : 256, 'timecontrol' : '20.0+0.2' }, { 'id' : 'SMP LTC', 'th' : 8, 'hash' : 256, 'tc' : '20.0+0.2' },
}, ],
}, },
'Winter' : { 'Winter' : {
@@ -261,12 +264,12 @@ OPENBENCH_CONFIG = {
'cpuflags' : ['POPCNT'], 'cpuflags' : ['POPCNT'],
}, },
'testmodes' : { 'testmodes' : [
'stc' : { 'threads' : 1, 'hash' : 8, 'timecontrol' : '8.0+0.08' }, { 'id' : 'STC', 'th' : 1, 'hash' : 8, 'tc' : '8.0+0.08' },
'ltc' : { 'threads' : 1, 'hash' : 64, 'timecontrol' : '40.0+0.4' }, { 'id' : 'LTC', 'th' : 1, 'hash' : 64, 'tc' : '40.0+0.4' },
'smpstc' : { 'threads' : 8, 'hash' : 64, 'timecontrol' : '5.0+0.05' }, { 'id' : 'SMP STC', 'th' : 8, 'hash' : 64, 'tc' : '5.0+0.05' },
'smpltc' : { 'threads' : 8, 'hash' : 256, 'timecontrol' : '20.0+0.2' }, { 'id' : 'SMP LTC', 'th' : 8, 'hash' : 256, 'tc' : '20.0+0.2' },
}, ],
}, },
'Halogen' : { 'Halogen' : {
@@ -283,12 +286,12 @@ OPENBENCH_CONFIG = {
'cpuflags' : ['POPCNT'], 'cpuflags' : ['POPCNT'],
}, },
'testmodes' : { 'testmodes' : [
'stc' : { 'threads' : 1, 'hash' : 8, 'timecontrol' : '8.0+0.08' }, { 'id' : 'STC', 'th' : 1, 'hash' : 8, 'tc' : '8.0+0.08' },
'ltc' : { 'threads' : 1, 'hash' : 64, 'timecontrol' : '40.0+0.4' }, { 'id' : 'LTC', 'th' : 1, 'hash' : 64, 'tc' : '40.0+0.4' },
'smpstc' : { 'threads' : 8, 'hash' : 64, 'timecontrol' : '5.0+0.05' }, { 'id' : 'SMP STC', 'th' : 8, 'hash' : 64, 'tc' : '5.0+0.05' },
'smpltc' : { 'threads' : 8, 'hash' : 256, 'timecontrol' : '20.0+0.2' }, { 'id' : 'SMP LTC', 'th' : 8, 'hash' : 256, 'tc' : '20.0+0.2' },
}, ],
}, },
'Stash' : { 'Stash' : {
@@ -305,12 +308,12 @@ OPENBENCH_CONFIG = {
'cpuflags' : ['POPCNT'], 'cpuflags' : ['POPCNT'],
}, },
'testmodes' : { 'testmodes' : [
'stc' : { 'threads' : 1, 'hash' : 16, 'timecontrol' : '8.0+0.08' }, { 'id' : 'STC', 'th' : 1, 'hash' : 16, 'tc' : '8.0+0.08' },
'ltc' : { 'threads' : 1, 'hash' : 64, 'timecontrol' : '40.0+0.4' }, { 'id' : 'LTC', 'th' : 1, 'hash' : 64, 'tc' : '40.0+0.4' },
'smpstc' : { 'threads' : 8, 'hash' : 64, 'timecontrol' : '5.0+0.05' }, { 'id' : 'SMP STC', 'th' : 8, 'hash' : 64, 'tc' : '5.0+0.05' },
'smpltc' : { 'threads' : 8, 'hash' : 256, 'timecontrol' : '20.0+0.2' }, { 'id' : 'SMP LTC', 'th' : 8, 'hash' : 256, 'tc' : '20.0+0.2' },
}, ],
}, },
'Seer' : { 'Seer' : {
@@ -327,12 +330,12 @@ OPENBENCH_CONFIG = {
'cpuflags' : ['AVX2', 'AVX', 'FMA', 'POPCNT', 'SSE2', 'SSE'], 'cpuflags' : ['AVX2', 'AVX', 'FMA', 'POPCNT', 'SSE2', 'SSE'],
}, },
'testmodes' : { 'testmodes' : [
'stc' : { 'threads' : 1, 'hash' : 32, 'timecontrol' : '8.0+0.08' }, { 'id' : 'STC', 'th' : 1, 'hash' : 32, 'tc' : '8.0+0.08' },
'ltc' : { 'threads' : 1, 'hash' : 64, 'timecontrol' : '40.0+0.4' }, { 'id' : 'LTC', 'th' : 1, 'hash' : 64, 'tc' : '40.0+0.4' },
'smpstc' : { 'threads' : 8, 'hash' : 64, 'timecontrol' : '5.0+0.05' }, { 'id' : 'SMP STC', 'th' : 8, 'hash' : 64, 'tc' : '5.0+0.05' },
'smpltc' : { 'threads' : 8, 'hash' : 256, 'timecontrol' : '20.0+0.2' }, { 'id' : 'SMP LTC', 'th' : 8, 'hash' : 256, 'tc' : '20.0+0.2' },
}, ],
}, },
'Koivisto' : { 'Koivisto' : {
@@ -349,12 +352,12 @@ OPENBENCH_CONFIG = {
'cpuflags' : ['AVX2', 'AVX', 'FMA', 'POPCNT', 'SSE2', 'SSE'], 'cpuflags' : ['AVX2', 'AVX', 'FMA', 'POPCNT', 'SSE2', 'SSE'],
}, },
'testmodes' : { 'testmodes' : [
'stc' : { 'threads' : 1, 'hash' : 8, 'timecontrol' : '8.0+0.08' }, { 'id' : 'STC', 'th' : 1, 'hash' : 8, 'tc' : '8.0+0.08' },
'ltc' : { 'threads' : 1, 'hash' : 64, 'timecontrol' : '40.0+0.4' }, { 'id' : 'LTC', 'th' : 1, 'hash' : 64, 'tc' : '40.0+0.4' },
'smpstc' : { 'threads' : 8, 'hash' : 64, 'timecontrol' : '5.0+0.05' }, { 'id' : 'SMP STC', 'th' : 8, 'hash' : 64, 'tc' : '5.0+0.05' },
'smpltc' : { 'threads' : 8, 'hash' : 256, 'timecontrol' : '20.0+0.2' }, { 'id' : 'SMP LTC', 'th' : 8, 'hash' : 256, 'tc' : '20.0+0.2' },
}, ],
}, },
'Drofa' : { 'Drofa' : {
@@ -371,12 +374,12 @@ OPENBENCH_CONFIG = {
'cpuflags' : ['POPCNT'], 'cpuflags' : ['POPCNT'],
}, },
'testmodes' : { 'testmodes' : [
'stc' : { 'threads' : 1, 'hash' : 8, 'timecontrol' : '8.0+0.08' }, { 'id' : 'STC', 'th' : 1, 'hash' : 8, 'tc' : '8.0+0.08' },
'ltc' : { 'threads' : 1, 'hash' : 64, 'timecontrol' : '40.0+0.4' }, { 'id' : 'LTC', 'th' : 1, 'hash' : 64, 'tc' : '40.0+0.4' },
'smpstc' : { 'threads' : 8, 'hash' : 64, 'timecontrol' : '5.0+0.05' }, { 'id' : 'SMP STC', 'th' : 8, 'hash' : 64, 'tc' : '5.0+0.05' },
'smpltc' : { 'threads' : 8, 'hash' : 256, 'timecontrol' : '20.0+0.2' }, { 'id' : 'SMP LTC', 'th' : 8, 'hash' : 256, 'tc' : '20.0+0.2' },
}, ],
}, },
'Bit-Genie' : { 'Bit-Genie' : {
@@ -393,12 +396,12 @@ OPENBENCH_CONFIG = {
'cpuflags' : ['POPCNT'], 'cpuflags' : ['POPCNT'],
}, },
'testmodes' : { 'testmodes' : [
'stc' : { 'threads' : 1, 'hash' : 8, 'timecontrol' : '8.0+0.08' }, { 'id' : 'STC', 'th' : 1, 'hash' : 8, 'tc' : '8.0+0.08' },
'ltc' : { 'threads' : 1, 'hash' : 64, 'timecontrol' : '40.0+0.4' }, { 'id' : 'LTC', 'th' : 1, 'hash' : 64, 'tc' : '40.0+0.4' },
'smpstc' : { 'threads' : 8, 'hash' : 64, 'timecontrol' : '5.0+0.05' }, { 'id' : 'SMP STC', 'th' : 8, 'hash' : 64, 'tc' : '5.0+0.05' },
'smpltc' : { 'threads' : 8, 'hash' : 256, 'timecontrol' : '20.0+0.2' }, { 'id' : 'SMP LTC', 'th' : 8, 'hash' : 256, 'tc' : '20.0+0.2' },
}, ],
}, },
'Berserk' : { 'Berserk' : {
@@ -415,12 +418,12 @@ OPENBENCH_CONFIG = {
'cpuflags' : ['POPCNT'], 'cpuflags' : ['POPCNT'],
}, },
'testmodes' : { 'testmodes' : [
'stc' : { 'threads' : 1, 'hash' : 8, 'timecontrol' : '8.0+0.08' }, { 'id' : 'STC', 'th' : 1, 'hash' : 8, 'tc' : '8.0+0.08' },
'ltc' : { 'threads' : 1, 'hash' : 64, 'timecontrol' : '40.0+0.4' }, { 'id' : 'LTC', 'th' : 1, 'hash' : 64, 'tc' : '40.0+0.4' },
'smpstc' : { 'threads' : 8, 'hash' : 64, 'timecontrol' : '5.0+0.05' }, { 'id' : 'SMP STC', 'th' : 8, 'hash' : 64, 'tc' : '5.0+0.05' },
'smpltc' : { 'threads' : 8, 'hash' : 256, 'timecontrol' : '20.0+0.2' }, { 'id' : 'SMP LTC', 'th' : 8, 'hash' : 256, 'tc' : '20.0+0.2' },
}, ],
}, },
'Zahak' : { 'Zahak' : {
@@ -437,12 +440,12 @@ OPENBENCH_CONFIG = {
'cpuflags' : ['AVX', 'POPCNT'], 'cpuflags' : ['AVX', 'POPCNT'],
}, },
'testmodes' : { 'testmodes' : [
'stc' : { 'threads' : 1, 'hash' : 8, 'timecontrol' : '8.0+0.08' }, { 'id' : 'STC', 'th' : 1, 'hash' : 8, 'tc' : '8.0+0.08' },
'ltc' : { 'threads' : 1, 'hash' : 64, 'timecontrol' : '40.0+0.4' }, { 'id' : 'LTC', 'th' : 1, 'hash' : 64, 'tc' : '40.0+0.4' },
'smpstc' : { 'threads' : 8, 'hash' : 64, 'timecontrol' : '5.0+0.05' }, { 'id' : 'SMP STC', 'th' : 8, 'hash' : 64, 'tc' : '5.0+0.05' },
'smpltc' : { 'threads' : 8, 'hash' : 256, 'timecontrol' : '20.0+0.2' }, { 'id' : 'SMP LTC', 'th' : 8, 'hash' : 256, 'tc' : '20.0+0.2' },
}, ],
}, },
'BlackMarlin' : { 'BlackMarlin' : {
@@ -459,12 +462,12 @@ OPENBENCH_CONFIG = {
'cpuflags' : [], 'cpuflags' : [],
}, },
'testmodes' : { 'testmodes' : [
'stc' : { 'threads' : 1, 'hash' : 8, 'timecontrol' : '8.0+0.08' }, { 'id' : 'STC', 'th' : 1, 'hash' : 8, 'tc' : '8.0+0.08' },
'ltc' : { 'threads' : 1, 'hash' : 64, 'timecontrol' : '40.0+0.4' }, { 'id' : 'LTC', 'th' : 1, 'hash' : 64, 'tc' : '40.0+0.4' },
'smpstc' : { 'threads' : 8, 'hash' : 64, 'timecontrol' : '5.0+0.05' }, { 'id' : 'SMP STC', 'th' : 8, 'hash' : 64, 'tc' : '5.0+0.05' },
'smpltc' : { 'threads' : 8, 'hash' : 256, 'timecontrol' : '20.0+0.2' }, { 'id' : 'SMP LTC', 'th' : 8, 'hash' : 256, 'tc' : '20.0+0.2' },
}, ],
}, },
}, },
} }
+107 -73
View File
@@ -2,31 +2,28 @@
{% block scripts %} {% 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 = { var Configurations = {
{% for name, data in config.engines.items %} {% for name, data in config.engines.items %}
'{{name}}' : { '{{name}}' : {
'base' : "{{data.base}}", 'base' : "{{data.base}}",
'book' : "{{data.book}}", 'book' : "{{data.book}}",
'bounds' : "{{data.bounds}}", 'bounds' : "{{data.bounds}}",
{% for type, settings in data.testmodes.items %}
'{{type}}' : {
"threads" : "{{settings.threads}}",
"hash" : "{{settings.hash}}",
"timecontrol" : "{{settings.timecontrol}}"
},
{% endfor %}
}, },
{% endfor %} {% endfor %}
}; };
var Throughputs = { var TestModes = {
"stc" : "{{config.tests.throughput.stc }}", {% for name, data in config.engines.items %}
"ltc" : "{{config.tests.throughput.ltc }}", '{{name}}' : [
"smpstc" : "{{config.tests.throughput.smpstc}}", {% for mode in data.testmodes %}
"smpltc" : "{{config.tests.throughput.smpltc}}", {
{% for key, value in mode.items %}
'{{key}}' : '{{value}}',
{% endfor %}
},
{% endfor %}
],
{% endfor %}
}; };
var Networks = [ var Networks = [
@@ -36,39 +33,104 @@
"sha256" : "{{network.sha256}}", "sha256" : "{{network.sha256}}",
"engine" : "{{network.engine}}", "engine" : "{{network.engine}}",
"default" : "{{network.default}}", "default" : "{{network.default}}",
}, },
{% endfor %} {% endfor %}
]; ];
function configure(mode) {
// Find the selected engine function set_test_type(type) {
var selection = document.getElementById("enginename");
var engine = selection.options[selection.selectedIndex].value;
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 selectA = document.getElementById("test_mode");
var threads = Configurations[engine][mode]["threads"]; var mode = selectA.options[selectA.selectedIndex].value;
var hash = Configurations[engine][mode]["hash"];
var timecontrol = Configurations[engine][mode]["timecontrol"];
// Adjust all the fields to auto-fill the settings var selectB = document.getElementById("enginename");
document.getElementById("devoptions").value = "Threads=" + threads + " Hash=" + hash; var engine = selectB.options[selectB.selectedIndex].value;
document.getElementById("baseoptions").value = "Threads=" + threads + " Hash=" + hash;
document.getElementById("timecontrol").value = timecontrol;
document.getElementById("throughput").value = Throughputs[mode];
return; // Don't change the Network setup unless asked 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 devnet = document.getElementById("devnetwork");
var basenet = document.getElementById("basenetwork"); var basenet = document.getElementById("basenetwork");
var hasdefault = false; var hasdefault = false;
// Remove all options initially
while (devnet.length) devnet.remove(0); while (devnet.length) devnet.remove(0);
while (basenet.length) basenet.remove(0); while (basenet.length) basenet.remove(0);
@@ -100,41 +162,21 @@
baseopt.selected = (hasdefault == false); basenet.add(baseopt); baseopt.selected = (hasdefault == false); basenet.add(baseopt);
} }
// Update the Base Branch for the selected Engine
var base_branch = document.getElementById("basebranch"); var base_branch = document.getElementById("basebranch");
base_branch.value = Configurations[engine]["base"]; base_branch.value = Configurations[engine]["base"];
// Update the Default Book for the selected Engine
var book_selection = document.getElementById("bookname"); var book_selection = document.getElementById("bookname");
book_selection.value = Configurations[engine]["book"]; 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"); document.addEventListener(
var mode = selectA.options[selectA.selectedIndex].value; 'DOMContentLoaded', function () {
set_test_type();
var selectB = document.getElementById("enginename"); set_test_mode(0);
var engine = selectB.options[selectB.selectedIndex].value; set_engine("{{profile.engine}}");
}, false
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);
{% endblock %} {% endblock %}
@@ -145,15 +187,10 @@
<div class="settings-column"> <div class="settings-column">
<h3> Engine </h3> <h3> Engine </h3>
<label> Engine </label> <select onClick="configure(null)" id="enginename" name="enginename"> <label> Engine </label> <select id="enginename" name="enginename">
{% for engine in config.engines %} {% for engine in config.engines %}
{% if engine == profile.engine %} <option onClick="set_engine('{{engine}}')" value="{{engine}}">{{engine}}</option>
<option onClick="configure(null)" selected value="{{engine}}">{{engine}}</option>
{% else %}
<option onClick="configure(null)" value="{{engine}}">{{engine}}</option>
{% endif %}
{% endfor %} {% endfor %}
<option value="{{engine}}">{{engine}}</option>
</select><br> </select><br>
<label> Source </label> <input value="{{profile.repo}}" name="source"><br> <label> Source </label> <input value="{{profile.repo}}" name="source"><br>
@@ -182,7 +219,7 @@
<label> Time </label> <input id="timecontrol" name="timecontrol"><br> <label> Time </label> <input id="timecontrol" name="timecontrol"><br>
<h3> Test Settings </h3> <h3> Test Settings </h3>
<label> Test Mode </label> <select onchange='test_type()' id="test_mode" name="test_mode"> <label> Test Mode </label> <select onchange='set_test_type()' id="test_mode" name="test_mode">
<option selected value="SPRT"> SPRT </option> <option selected value="SPRT"> SPRT </option>
<option value="GAMES"> Fixed Games </option> <option value="GAMES"> Fixed Games </option>
</select><br> </select><br>
@@ -192,7 +229,7 @@
<h3> General Settings </h3> <h3> General Settings </h3>
<label> Priority </label> <input value="0" name="priority"><br> <label> Priority </label> <input value="0" name="priority"><br>
<label> Throughput </label> <input id="throughput", name="throughput"><br> <label> Throughput </label> <input value="1000" id="throughput", name="throughput"><br>
<label> Syzygy ADJ </label> <select name="syzygy_adj"> <label> Syzygy ADJ </label> <select name="syzygy_adj">
<option selected value="OPTIONAL"> Optional </option> <option selected value="OPTIONAL"> Optional </option>
@@ -213,10 +250,7 @@
</form> </form>
<div id="test-mode-buttons"> <div id="test-mode-buttons">
<button class="left-floated" onClick="configure('stc')">Setup STC</button> <!-- Generated based on the selected Engine -->
<button class="right-floated" onClick="configure('ltc')">Setup LTC</button><br>
<button class="left-floated" onClick="configure('smpstc')">Setup SMP STC</button>
<button class="right-floated" onClick="configure('smpltc')">Setup SMP LTC</button>
</div> </div>
{% endblock %} {% endblock %}