Implement net files support for NNUE engines (#75)
This commit is contained in:
1 parent
74bf5cbb93
commit
d55943d77d
5 files changed
+42
-2
No files matched your search
+21
-1
@@ -23,7 +23,6 @@ from __future__ import print_function
|
||||
import argparse, ast, hashlib, json, math, multiprocessing, os
|
||||
import platform, re, requests, shutil, subprocess, sys, time, zipfile
|
||||
|
||||
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||
|
||||
HTTP_TIMEOUT = 30 # Timeout in seconds for requests
|
||||
@@ -241,6 +240,15 @@ def getEngine(data, engine):
|
||||
# Cleanup the zipfile directory
|
||||
shutil.rmtree('tmp')
|
||||
|
||||
def getNetworkWeights(network):
|
||||
|
||||
if network:
|
||||
fname = pathjoin('Engines', os.path.basename(network)).rstrip('/')
|
||||
if not os.path.isfile(fname): getFile(network, fname)
|
||||
return os.path.basename(network)
|
||||
|
||||
return None
|
||||
|
||||
def getCutechessCommand(arguments, data, nps):
|
||||
|
||||
# Parse options for Dev
|
||||
@@ -257,6 +265,10 @@ def getCutechessCommand(arguments, data, nps):
|
||||
devCommand = addExtension(data['test']['dev']['sha'])
|
||||
baseCommand = addExtension(data['test']['base']['sha'])
|
||||
|
||||
# Download network file(s) if configured
|
||||
devnetwork = getNetworkWeights(data['test']['dev']['network'])
|
||||
basenetwork = getNetworkWeights(data['test']['base']['network'])
|
||||
|
||||
# Scale the time control for this machine's speed
|
||||
timecontrol = computeAdjustedTimecontrol(arguments, data, nps)
|
||||
|
||||
@@ -284,12 +296,20 @@ def getCutechessCommand(arguments, data, nps):
|
||||
'{0}-{1}'.format(data['test']['engine'], data['test']['dev']['name'])
|
||||
)
|
||||
|
||||
# Add evaluation weights for the Dev engine if specified
|
||||
if devnetwork:
|
||||
devflags = devflags + " option.EvalFile=" + devnetwork
|
||||
|
||||
# Options for the Base Engine
|
||||
baseflags = '-engine dir=Engines/ cmd=./{0} proto={1} tc={2}{3} name={4}'.format(
|
||||
baseCommand, data['test']['base']['protocol'], timecontrol, baseoptions,
|
||||
'{0}-{1}'.format(data['test']['engine'], data['test']['base']['name'])
|
||||
)
|
||||
|
||||
# Add evaluation weights for the Base engine if specified
|
||||
if basenetwork:
|
||||
baseflags = baseflags + " option.EvalFile=" + basenetwork
|
||||
|
||||
# Options for opening selection
|
||||
bookflags = '-openings file=Books/{0} format={1} order=random plies=16'.format(
|
||||
data['test']['book']['name'], data['test']['book']['name'].split('.')[-1]
|
||||
|
||||
@@ -87,6 +87,9 @@ class Test(Model):
|
||||
devoptions = CharField(max_length=256)
|
||||
baseoptions = CharField(max_length=256)
|
||||
|
||||
devnetwork = CharField(max_length=256)
|
||||
basenetwork = CharField(max_length=256)
|
||||
|
||||
bookname = CharField(max_length=32)
|
||||
timecontrol = CharField(max_length=16)
|
||||
|
||||
|
||||
+10
-1
@@ -203,6 +203,10 @@ def verifyNewTest(request):
|
||||
if request.POST[field] not in OpenBench.config.OPENBENCH_CONFIG[parent].keys():
|
||||
errors.append('{0} was not found in the configuration'.format(fieldName))
|
||||
|
||||
def verifyGithubLink(field, fieldName):
|
||||
if request.POST[field] and not request.POST[field].startswith('https://github.com/'):
|
||||
errors.append('{0} must be located on a Github URL'.format(fieldName))
|
||||
|
||||
verifications = [
|
||||
(verifyInteger, 'priority', 'Priority'),
|
||||
(verifyInteger, 'throughput', 'Throughput'),
|
||||
@@ -221,6 +225,8 @@ def verifyNewTest(request):
|
||||
(verifyOptions, 'baseoptions', 'Hash', 'Base Options'),
|
||||
(verifyConfiguration, 'enginename', 'Engine', 'engines'),
|
||||
(verifyConfiguration, 'bookname', 'Book', 'books'),
|
||||
(verifyGithubLink, 'devnetwork', 'Dev Network'),
|
||||
(verifyGithubLink, 'basenetwork', 'Base Network'),
|
||||
]
|
||||
|
||||
for verification in verifications:
|
||||
@@ -245,6 +251,8 @@ def createNewTest(request):
|
||||
test.source = request.POST['source']
|
||||
test.devoptions = request.POST['devoptions']
|
||||
test.baseoptions = request.POST['baseoptions']
|
||||
test.devnetwork = request.POST['devnetwork']
|
||||
test.basenetwork = request.POST['basenetwork']
|
||||
test.bookname = request.POST['bookname']
|
||||
test.timecontrol = request.POST['timecontrol']
|
||||
test.priority = int(request.POST['priority'])
|
||||
@@ -376,12 +384,12 @@ def workloadDictionary(test, result, machine):
|
||||
'book' : OPENBENCH_CONFIG['books'][test.bookname],
|
||||
'timecontrol' : test.timecontrol,
|
||||
'engine' : test.engine,
|
||||
|
||||
'dev' : {
|
||||
'id' : test.dev.id, 'name' : test.dev.name,
|
||||
'source' : test.dev.source, 'protocol' : test.dev.protocol,
|
||||
'sha' : test.dev.sha, 'bench' : test.dev.bench,
|
||||
'options' : test.devoptions,
|
||||
'network' : test.devnetwork,
|
||||
},
|
||||
|
||||
'base' : {
|
||||
@@ -389,6 +397,7 @@ def workloadDictionary(test, result, machine):
|
||||
'source' : test.base.source, 'protocol' : test.base.protocol,
|
||||
'sha' : test.base.sha, 'bench' : test.base.bench,
|
||||
'options' : test.baseoptions,
|
||||
'network' : test.basenetwork,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -63,11 +63,13 @@
|
||||
<label> Bench </label> <input name="devbench"><br>
|
||||
<label> Branch </label> <input name="devbranch" autofocus><br>
|
||||
<label> Options </label> <input id="devoptions" name="devoptions"><br>
|
||||
<label> Network </label> <input name="devnetwork"><br>
|
||||
|
||||
<h3> Base Settings </h3>
|
||||
<label> Bench </label> <input name="basebench"><br>
|
||||
<label> Branch </label> <input value="master" name="basebranch"><br>
|
||||
<label> Options </label> <input id="baseoptions" name="baseoptions"><br>
|
||||
<label> Network </label> <input name="basenetwork"><br>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@@ -15,10 +15,16 @@
|
||||
<tr><th>Dev Bench</th><td>{{test.dev.bench}}</td></tr>
|
||||
<tr><th>Dev Options</th><td>{{test.devoptions}}</td></tr>
|
||||
<tr><th>Dev Sha</th><td>{{test.dev.sha}}</td></tr>
|
||||
{% if test.devnetwork %}
|
||||
<tr><th>Dev Network</th><td>{{test.devnetwork}}</td></tr>
|
||||
{% endif %}
|
||||
<tr><th>Base Branch</th><td>{{test.base.name|prettyName}}</td></tr>
|
||||
<tr><th>Base Bench</th><td>{{test.base.bench}}</td></tr>
|
||||
<tr><th>Base Options</th><td>{{test.baseoptions}}</td></tr>
|
||||
<tr><th>Base Sha</th><td>{{test.base.sha}}</td></tr>
|
||||
{% if test.basenetwork %}
|
||||
<tr><th>Base Network</th><td>{{test.basenetwork}}</td></tr>
|
||||
{% endif %}
|
||||
<tr><th>Source Repo</th><td>{{test.source}}</td></tr>
|
||||
<tr><th>Opening Book</th><td>{{test.bookname}}</td></tr>
|
||||
<tr><th>Time Control</th><td>{{test.timecontrol}}s</td></tr>
|
||||
|
||||
Reference in new issue
Block a user