Add report_rate and workload_size options to Tests

This commit is contained in:
andrew committed 2023-04-06 01:12:02 -04:00
1 parent e229b26f9d
commit c32dbef9dd
7 files changed
+85 -52

No files matched your search

+5 -7
View File
@@ -51,7 +51,6 @@ TIMEOUT_WORKLOAD = 30 # Timeout in seconds between workload requests
CLIENT_VERSION = '7' # 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 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 FLEET_MODE = False # Exit when there are no workloads
ERRORS = { 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 = int(arguments.threads) / int(arguments.ncutechess)
concurrency = concurrency // max(dev_threads, base_threads) 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))) games = max(8, concurrency * 2, games - (games % (2 * concurrency)))
time_control = scale_time_control(workload, nps) 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: if IS_LINUX:
return concurrency, update_interval, './cutechess-ob ' + flags % (args) return concurrency, './cutechess-ob ' + flags % (args)
return concurrency, update_interval, 'cutechess-ob.exe ' + 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)) print('\n[#%d] Launching Cutechess...\n%s\n' % (cutechess_idx, command))
cutechess = Popen(command.split(), stdout=PIPE) 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 # Only report scores after every eight games
score = list(map(int, score_reason.split()[0:5:2])) 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 # Report to the server but allow failed reports to delay
wld = [score[ii] - sent[ii] for ii in range(3)] wld = [score[ii] - sent[ii] for ii in range(3)]
+4
View File
@@ -106,6 +106,10 @@ class Test(Model):
win_adj = CharField(max_length=64, default='movecount=3 score=400') win_adj = CharField(max_length=64, default='movecount=3 score=400')
draw_adj = CharField(max_length=64, default='movenumber=40 movecount=8 score=10') 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 # Only for SPRT Tests
elolower = FloatField(default=0.0) elolower = FloatField(default=0.0)
eloupper = FloatField(default=0.0) eloupper = FloatField(default=0.0)
+11 -6
View File
@@ -17,14 +17,14 @@ a:link, a:visited, a:hover, a:active {
#sidebar ul { #sidebar ul {
list-style-type: none; list-style-type: none;
padding: 0px 16px 0px 8px; padding: 0px 0px 0px 8px;
line-height: 1.75; line-height: 1.50;
} }
#sidebar li a { #sidebar li a {
color: #A2A2A2; color: #A2A2A2;
padding: 0px 16px; padding: 0px 16px;
font-size: 1.0rem; font-size: 16px;
} }
#sidebar li:hover { #sidebar li:hover {
@@ -35,7 +35,7 @@ a:link, a:visited, a:hover, a:active {
#sidebar .header { #sidebar .header {
color: #00AF00; color: #00AF00;
padding: 0px 16px; padding: 0px 16px;
font-size: 1.0rem; font-size: 16px;
} }
#sidebar .header:hover { #sidebar .header:hover {
@@ -58,14 +58,19 @@ a:link, a:visited, a:hover, a:active {
} }
#content input, #content select { #content input, #content select {
background-color: #BBBBBB; background-color: #BBBBBB;
color: #000000; color: #000000;
padding: 10px; padding: 10px;
margin: 1px 0px; margin: 1px 0px;
width: 320px; width: 340px;
box-sizing: border-box;
border: 2px solid black;
border-radius: 6px;
-moz-box-sizing: border-box; -moz-box-sizing: border-box;
-webkit-box-sizing: border-box; -webkit-box-sizing: border-box;
box-sizing: border-box;
} }
#content button { #content button {
+46 -32
View File
@@ -288,9 +288,9 @@ def verifyNewTest(request):
try: int(request.POST[field]) 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): def verifyGreaterThan(field, fieldName, value):
if not float(request.POST[field]) > 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): def verifyOptions(field, option, fieldName):
if extractOption(request.POST[field], option) == None: 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)) except: errors.append('"{0}" is not a parsable Draw Adjudication Seting'.format(content))
verifications = [ verifications = [
(verifyInteger, 'priority', 'Priority'),
(verifyInteger, 'throughput', 'Throughput'), # Must have all of these values for test settings
(verifyGreaterThan, 'throughput', 'Throughput', 0, '0'), (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', 'Threads', 'Dev Options'),
(verifyOptions, 'devoptions', 'Hash', 'Dev Options'), (verifyOptions, 'devoptions', 'Hash', 'Dev Options'),
(verifyOptions, 'baseoptions', 'Threads', 'Base Options'), (verifyOptions, 'baseoptions', 'Threads', 'Base Options'),
@@ -346,23 +355,25 @@ def createNewTest(request):
baseinfo, base_has_all = collect_github_info(request, errors, 'base') baseinfo, base_has_all = collect_github_info(request, errors, 'base')
if errors != []: return None, errors if errors != []: return None, errors
test = Test() test = Test()
test.author = request.user.username test.author = request.user.username
test.engine = request.POST['enginename'] test.engine = request.POST['enginename']
test.test_mode = request.POST['test_mode'] test.test_mode = request.POST['test_mode']
test.source = request.POST['source'] test.source = request.POST['source']
test.devoptions = request.POST['devoptions'].rstrip(' ') test.devoptions = request.POST['devoptions'].rstrip(' ')
test.baseoptions = request.POST['baseoptions'].rstrip(' ') test.baseoptions = request.POST['baseoptions'].rstrip(' ')
test.devnetwork = request.POST['devnetwork'] test.devnetwork = request.POST['devnetwork']
test.basenetwork = request.POST['basenetwork'] test.basenetwork = request.POST['basenetwork']
test.bookname = request.POST['bookname'] test.bookname = request.POST['bookname']
test.timecontrol = parseTimeControl(request.POST['timecontrol']) test.timecontrol = parseTimeControl(request.POST['timecontrol'])
test.priority = int(request.POST['priority']) test.priority = int(request.POST['priority'])
test.throughput = int(request.POST['throughput']) test.throughput = int(request.POST['throughput'])
test.syzygy_wdl = request.POST['syzygy_wdl'] test.syzygy_wdl = request.POST['syzygy_wdl']
test.syzygy_adj = request.POST['syzygy_adj'] test.syzygy_adj = request.POST['syzygy_adj']
test.win_adj = request.POST['win_adj'] test.win_adj = request.POST['win_adj']
test.draw_adj = request.POST['draw_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': if request.POST['test_mode'] == 'SPRT':
test.elolower = float(request.POST['bounds'].split(',')[0].lstrip('[')) test.elolower = float(request.POST['bounds'].split(',')[0].lstrip('['))
@@ -531,18 +542,21 @@ def workload_to_dictionary(test, result, machine):
'test' : { 'test' : {
'id' : test.id, 'id' : test.id,
'engine' : test.engine, 'engine' : test.engine,
'timecontrol' : test.timecontrol, 'timecontrol' : test.timecontrol,
'syzygy_wdl' : test.syzygy_wdl, 'syzygy_wdl' : test.syzygy_wdl,
'syzygy_adj' : test.syzygy_adj, 'syzygy_adj' : test.syzygy_adj,
'win_adj' : test.win_adj, 'win_adj' : test.win_adj,
'draw_adj' : test.draw_adj, 'draw_adj' : test.draw_adj,
'nps' : OPENBENCH_CONFIG['engines'][test.engine]['nps'], 'report_rate' : test.report_rate,
'build' : OPENBENCH_CONFIG['engines'][test.engine]['build'], 'workload_size' : test.workload_size,
'book' : OPENBENCH_CONFIG['books'][test.bookname],
'nps' : OPENBENCH_CONFIG['engines'][test.engine]['nps'],
'build' : OPENBENCH_CONFIG['engines'][test.engine]['build'],
'book' : OPENBENCH_CONFIG['books'][test.bookname],
'dev' : { 'dev' : {
'id' : test.dev.id, 'name' : test.dev.name, 'id' : test.dev.id, 'name' : test.dev.name,
+7 -5
View File
@@ -420,9 +420,9 @@ def test(request, id, action=None):
return django.http.HttpResponseRedirect('/index/') return django.http.HttpResponseRedirect('/index/')
if action not in ['APPROVE', 'RESTART', 'STOP', 'DELETE', 'MODIFY']: 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') 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) return render(request, 'test.html', data)
if not request.user.is_authenticated: 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 == 'DELETE' : test.deleted = True; test.save()
if action == 'MODIFY': if action == 'MODIFY':
test.priority = int(request.POST['priority']) test.priority = int(request.POST['priority'])
test.throughput = max(1, int(request.POST['throughput'])) 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() 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) LogEvent.objects.create(author=user.username, summary=action, log_file='', test_id=test.id)
return django.http.HttpResponseRedirect('/index/') return django.http.HttpResponseRedirect('/index/')
+10 -1
View File
@@ -40,7 +40,7 @@
]; ];
function set_test_type(type) { function set_test_type() {
//// When the test mode is set or changed, run this. //// When the test mode is set or changed, run this.
//// Sets the bounds, confidence intervals, and max games fields. //// Sets the bounds, confidence intervals, and max games fields.
@@ -73,6 +73,9 @@
var engine = selection.options[selection.selectedIndex].value; var engine = selection.options[selection.selectedIndex].value;
var mode = TestModes[engine][mode_idx]; 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) { if (mode["th"] != null && mode["hash"] != null) {
var threads = mode["th"]; var hash = mode["hash"]; var threads = mode["th"]; var hash = mode["hash"];
document.getElementById("devoptions").value = "Threads=" + threads + " Hash=" + hash; document.getElementById("devoptions").value = "Threads=" + threads + " Hash=" + hash;
@@ -168,6 +171,8 @@
document.getElementById("bookname" ).value = Configurations[engine]["book"]; document.getElementById("bookname" ).value = Configurations[engine]["book"];
document.getElementById("win_adj" ).value = Configurations[engine]["win_adj"]; document.getElementById("win_adj" ).value = Configurations[engine]["win_adj"];
document.getElementById("draw_adj" ).value = Configurations[engine]["draw_adj"]; document.getElementById("draw_adj" ).value = Configurations[engine]["draw_adj"];
set_test_mode(0);
} }
document.addEventListener( document.addEventListener(
@@ -206,6 +211,10 @@
<label> Base Options </label> <input id="baseoptions" name="baseoptions"><br> <label> Base Options </label> <input id="baseoptions" name="baseoptions"><br>
<label> Base Network </label> <select id="basenetwork" name="basenetwork"></select><br> <label> Base Network </label> <select id="basenetwork" name="basenetwork"></select><br>
<h3> Workload Settings </h3>
<label> Report Rate </label> <input value="8" id="report_rate" name="report_rate"><br>
<label> Workload Size </label> <input value="32" id="workload_size" name="workload_size"<br>
</div> </div>
<div class="settings-column"> <div class="settings-column">
+2 -1
View File
@@ -39,7 +39,6 @@
<tr><th>Syzygy ADJ.</th><td>{{test.syzygy_adj}}</td></tr> <tr><th>Syzygy ADJ.</th><td>{{test.syzygy_adj}}</td></tr>
<tr><th>Win ADJ.</th><td>{{test.win_adj}}</td></tr> <tr><th>Win ADJ.</th><td>{{test.win_adj}}</td></tr>
<tr><th>Draw ADJ.</th><td>{{test.draw_adj}}</td></tr> <tr><th>Draw ADJ.</th><td>{{test.draw_adj}}</td></tr>
</table> </table>
</div> </div>
@@ -94,6 +93,8 @@
<label>Priority</label><input value="{{test.priority}}" name="priority"><br> <label>Priority</label><input value="{{test.priority}}" name="priority"><br>
<label>Throughput</label><input value="{{test.throughput}}" name="throughput"><br> <label>Throughput</label><input value="{{test.throughput}}" name="throughput"><br>
<label>Report Rate</label><input value="{{test.report_rate}}" name="report_rate"><br>
<label>Workload Size</label><input value="{{test.workload_size}}" name="workload_size"><br>
<!-- Edit Button: For Approvers or Test Authors --> <!-- Edit Button: For Approvers or Test Authors -->
{% if profile.approver or profile.user.username == test.author %} {% if profile.approver or profile.user.username == test.author %}