Implement SPSA for OpenBench (#169)
* Support Worker and Thread Limits * Drop report_rate from the Client * Creation page * WIP for SPSA; Lots of code shuffling to clean it up * Able to create a Tune in the interface * Start to work on a display page for Tunes * Move all workload utilities to their own dir * Ignore config files going forward * Able to produce an SPSA test from the Server * Round integers with probabilities that make sense * Client side working * Report as results come in, don't wait * Fix workload size comment * Cleanup and fix Tune modifications * Adustment to random value in tuning * Delete engine configs
This commit is contained in:
1 parent
bc26be7a4c
commit
ee267381fc
40 files changed
+1799
-1562
No files matched your search
@@ -2,7 +2,12 @@
|
||||
<td><a href="/user/{{test.author}}">{{test.author|capfirst|slice:":6"}}</a></td>
|
||||
<td>{{test.dev_engine}}</td>
|
||||
<td>
|
||||
<a href="/test/{{test.id}}">{{test|prettyDevName}}</a>
|
||||
{% if test.test_mode != "SPSA" %}
|
||||
<a href="/test/{{test.id}}">{{test|prettyDevName}}</a>
|
||||
{% else %}
|
||||
<a href="/tune/{{test.id}}">{{test|prettyDevName}}</a>
|
||||
{% endif %}
|
||||
|
||||
{% if test.error %} <span style="color: red">*</span> {% endif %}
|
||||
{% if test|testIsFRC %} <span style="color: green">*</span> {% endif %}
|
||||
</td>
|
||||
|
||||
@@ -86,6 +86,7 @@
|
||||
<ul>
|
||||
<li class="header">Actions</li>
|
||||
<li><a href="/newTest"><i class="fa-solid fa-plus fa-fw"></i> Create Test</a></li>
|
||||
<li><a href="/newTune"><i class="fa-solid fa-plus fa-fw"></i> Create Tune</a></li>
|
||||
<li><a href="/newNetwork"><i class="fa-solid fa-upload fa-fw"></i> Upload Net</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
@@ -129,7 +129,15 @@
|
||||
<div class="row">
|
||||
<label> Throughput </label> <input value="1000" id="throughput" , name="throughput">
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<label> Worker Limit</label> <input value="None" id="worker_limit" name="worker_limit">
|
||||
</div>
|
||||
<div class="row">
|
||||
<label> Thread Limit </label> <input value="None" id="thread_limit" name="thread_limit">
|
||||
</div>
|
||||
<div class="row">
|
||||
<label> Workload Size </label> <input id="workload_size" name="workload_size">
|
||||
</div>
|
||||
<div class="row">
|
||||
<label> Syzygy WDL </label> <select name="syzygy_wdl">
|
||||
<option selected value="DISABLED"> Disabled </option>
|
||||
@@ -142,14 +150,6 @@
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<h3> Workload Settings </h3>
|
||||
<div class="row">
|
||||
<label> Report Rate </label> <input id="report_rate" name="report_rate">
|
||||
</div>
|
||||
<div class="row">
|
||||
<label> Workload Size </label> <input id="workload_size" name="workload_size">
|
||||
</div>
|
||||
|
||||
<h3> Adjudication Settings </h3>
|
||||
<div class="row">
|
||||
<label> Syzygy ADJ. </label>
|
||||
|
||||
@@ -0,0 +1,159 @@
|
||||
{% extends "OpenBench/base.html" %}
|
||||
|
||||
{% load static %}
|
||||
|
||||
{% block scripts %}
|
||||
|
||||
{{ config|json_script:"json-config" }}
|
||||
{{ networks|json_script:"json-networks" }}
|
||||
{{ profile.repos|json_script:"json-repos" }}
|
||||
|
||||
<script src="{% static 'create_tune.js' %}"></script>
|
||||
|
||||
<script>
|
||||
document.addEventListener(
|
||||
'DOMContentLoaded', function () {
|
||||
set_engine('{{ profile.engine }}');
|
||||
enforce_default_text('repo', 'https://github.com/');
|
||||
}, false
|
||||
);
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<form method="POST" action="/newTune/">
|
||||
{% csrf_token %}
|
||||
|
||||
<div class="form w-100">
|
||||
<div class="col">
|
||||
|
||||
<h3> Engine </h3>
|
||||
|
||||
<div class="row">
|
||||
<label> Engine </label>
|
||||
<select id="engine" name="dev_engine" onchange="set_engine(value);">
|
||||
{% for engine in config.engines %}
|
||||
<option value="{{ engine }}">{{ engine }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label> Source </label> <input id="repo" name="dev_repo">
|
||||
</div>
|
||||
|
||||
<h3> Engine Settings </h3>
|
||||
|
||||
<div class="row">
|
||||
<label> Branch </label> <input id="branch" name="dev_branch" autofocus>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label> Bench </label> <input value="Autofill" name="dev_bench">
|
||||
</div>
|
||||
<div class="row">
|
||||
<label> Network </label> <select id="network" name="dev_network"></select>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label> Options </label> <input id="options" name="dev_options">
|
||||
</div>
|
||||
<div class="row">
|
||||
<label> Time </label> <input id="time_control" name="dev_time_control">
|
||||
</div>
|
||||
|
||||
<h3> SPSA Input </h3>
|
||||
|
||||
<div class="row">
|
||||
|
||||
<textarea style="margin-left:24px" id="spsa_inputs" name="spsa_inputs" rows=17></textarea>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col">
|
||||
|
||||
<h3> SPSA Settings </h3>
|
||||
|
||||
<div class="row">
|
||||
<label> Opening Book </label> <select id="book_name" name="book_name">
|
||||
{% for name, data in config.books.items %}
|
||||
<option value="{{ name }}">{{ name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<label> Alpha </label> <input value="0.602" id="spsa_alpha" name="spsa_alpha">
|
||||
</div>
|
||||
<div class="row">
|
||||
<label> Gamma </label> <input value="0.101" id="spsa_gamma" name="spsa_gamma">
|
||||
</div>
|
||||
<div class="row">
|
||||
<label> A-Ratio </label> <input value="0.1" id="spsa_A_ratio" name="spsa_A_ratio">
|
||||
</div>
|
||||
<div class="row">
|
||||
<label> Iterations </label> <input value="200000" id="spsa_iterations" name="spsa_iterations">
|
||||
</div>
|
||||
<div class="row">
|
||||
<label> Pairs-Per </label> <input value="1" id="spsa_pairs_per" name="spsa_pairs_per">
|
||||
</div>
|
||||
|
||||
<h3> General Settings </h3>
|
||||
<div class="row">
|
||||
<label> Priority </label> <input value="1" name="priority">
|
||||
</div>
|
||||
<div class="row">
|
||||
<label> Throughput </label> <input value="1000" id="throughput" , name="throughput">
|
||||
</div>
|
||||
<div class="row">
|
||||
<label> Worker Limit</label> <input value="5" id="worker_limit" name="worker_limit">
|
||||
</div>
|
||||
<div class="row">
|
||||
<label> Thread Limit </label> <input value="None" id="thread_limit" name="thread_limit">
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<label> Syzygy WDL </label> <select name="syzygy_wdl">
|
||||
<option selected value="DISABLED"> Disabled </option>
|
||||
<option value="OPTIONAL"> Optional </option>
|
||||
<option value="7-MAN"> 7-Man </option>
|
||||
<option value="6-MAN"> 6-Man </option>
|
||||
<option value="5-MAN"> 5-Man </option>
|
||||
<option value="4-MAN"> 4-Man </option>
|
||||
<option value="3-MAN"> 3-Man </option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<h3> Adjudication Settings </h3>
|
||||
<div class="row">
|
||||
<label> Syzygy ADJ. </label>
|
||||
<select name="syzygy_adj">
|
||||
<option value="DISABLED"> Disabled </option>
|
||||
<option selected value="OPTIONAL"> Optional </option>
|
||||
<option value="7-MAN"> 7-Man </option>
|
||||
<option value="6-MAN"> 6-Man </option>
|
||||
<option value="5-MAN"> 5-Man </option>
|
||||
<option value="4-MAN"> 4-Man </option>
|
||||
<option value="3-MAN"> 3-Man </option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label> Win ADJ. </label> <input id="win_adj" name="win_adj">
|
||||
</div>
|
||||
<div class="row">
|
||||
<label> Draw ADJ. </label> <input id="draw_adj" name="draw_adj">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="submit" class="anchorbutton btn-start mt-3 mw-84" name="submit" value="Create SPSA Tune">
|
||||
</form>
|
||||
|
||||
<div class="form">
|
||||
<div class="col-full">
|
||||
<div id="test-mode-buttons">
|
||||
<!-- Generated based on the selected Engine -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
@@ -151,7 +151,10 @@
|
||||
<label>Throughput</label><input value="{{test.throughput}}" name="throughput">
|
||||
</div>
|
||||
<div class="row">
|
||||
<label>Report Rate</label><input value="{{test.report_rate}}" name="report_rate">
|
||||
<label>Worker Limit</label><input value="{{test.worker_limit|default:'None'}}" name="worker_limit">
|
||||
</div>
|
||||
<div class="row">
|
||||
<label>Thread Limit</label><input value="{{test.thread_limit|default:'None'}}" name="thread_limit">
|
||||
</div>
|
||||
<div class="row">
|
||||
<label>Workload Size</label><input value="{{test.workload_size}}" name="workload_size">
|
||||
@@ -173,12 +176,12 @@
|
||||
<th>#</th>
|
||||
<th>User</th>
|
||||
<th>Updated</th>
|
||||
<th style="width: 60px">Games</th>
|
||||
<th style="width: 60px">Won</th>
|
||||
<th style="width: 60px">Lost</th>
|
||||
<th style="width: 60px">Drawn</th>
|
||||
<th style="width: 60px">Time</th>
|
||||
<th style="width: 60px">Crash</th>
|
||||
<th style="width: 45px">Games</th>
|
||||
<th style="width: 45px">Won</th>
|
||||
<th style="width: 45px">Lost</th>
|
||||
<th style="width: 45px">Drawn</th>
|
||||
<th style="width: 45px">Time</th>
|
||||
<th style="width: 45px">Crash</th>
|
||||
</tr>
|
||||
|
||||
{% for result in results %}
|
||||
|
||||
@@ -0,0 +1,218 @@
|
||||
{% extends "OpenBench/base.html" %}
|
||||
|
||||
{% load mytags %}
|
||||
|
||||
{% block style %}
|
||||
{% endblock %}
|
||||
|
||||
{% block scripts %}
|
||||
|
||||
<script>
|
||||
|
||||
function copy_statblock() {
|
||||
|
||||
var text = document.getElementById("long-statblock").innerHTML;
|
||||
text = text.replace(/<br>/g, "\n");
|
||||
text += "\n" + window.location.href;
|
||||
|
||||
// navigator.clipboard.writeText(text); // Optimal solution
|
||||
|
||||
// Suboptimal, HTTP solution
|
||||
|
||||
var area = document.createElement("textarea");
|
||||
area.value = text;
|
||||
document.body.append(area);
|
||||
|
||||
area.focus();
|
||||
area.select();
|
||||
|
||||
try {
|
||||
document.execCommand("copy");
|
||||
document.body.removeChild(area);
|
||||
}
|
||||
|
||||
catch (err) {
|
||||
document.body.removeChild(area);
|
||||
console.error("Unable to copy to Clipboard");
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<div id="config" style="display: block; overflow-x: auto;">
|
||||
<table class="test-config left-align wrappable" style="table-layout: auto; width: 100%;">
|
||||
<tr><td class="td-label">Author</td><td>{{test.author|capfirst}}</td></tr>
|
||||
<tr><td class="td-label">Creation</td><td class="timestamp">{{test.creation|date:'U'}}</td></tr>
|
||||
<tr><td class="td-label">Engine</td><td>{{test.dev_engine}}</td></tr>
|
||||
<tr><td class="td-label">Source</td><td><a href="{{test.dev_repo}}">{{test.dev_repo}}</a></td></tr>
|
||||
<tr><td class="td-label">Sha</td><td>{{test.dev.sha}}</td></tr>
|
||||
<tr><td class="td-label">Branch</td><td>{{test.dev.name|prettyName}}</td></tr>
|
||||
<tr><td class="td-label">Bench</td><td>{{test.dev.bench}}</td></tr>
|
||||
{% if test.dev_network %}
|
||||
<tr>
|
||||
<td class="td-label">Network</td>
|
||||
<td><a href="{{test.devnetwork|resolveNetworkURL}}">{{test.dev_netname}}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
<tr><td class="td-label">Options</td><td>{{test.dev_options}}</td></tr>
|
||||
<tr><td class="td-label">Time</td><td>{{test.dev_time_control}}</td></tr>
|
||||
<tr><td class="td-label">Opening Book</td><td><a href="{{config.framework}}raw/master/Books/{{test.bookname}}.zip">{{test.book_name}}</a></td></tr>
|
||||
<tr><td class="td-label">Syzygy WDL</td><td>{{test.syzygy_wdl}}</td></tr>
|
||||
<tr><td class="td-label">Syzygy ADJ.</td><td>{{test.syzygy_adj}}</td></tr>
|
||||
<tr><td class="td-label">Win ADJ.</td><td>{{test.win_adj}}</td></tr>
|
||||
<tr><td class="td-label">Draw ADJ.</td><td>{{test.draw_adj}}</td></tr>
|
||||
<tr><td class="td-label">Alpha</td><td>{{test.spsa.Alpha}}</td></tr>
|
||||
<tr><td class="td-label">Gamma</td><td>{{test.spsa.Gamma}}</td></tr>
|
||||
<tr><td class="td-label">A-Ratio</td><td>{{test.spsa.A}}</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div id="actions" class="ml-3">
|
||||
|
||||
<!-- Dev vs Base [Git Diff Link] -->
|
||||
<h4><a href="{{test|gitDiffLink}}">
|
||||
{{test.dev.name|prettyName}} vs {{test.base.name|prettyName}}
|
||||
</a></h4>
|
||||
|
||||
<!-- Approve Button: For Admins, or Cross-approvers -->
|
||||
{% if not test.approved and profile.approver and profile.user.username != test.author %}
|
||||
<a class="w-25 mr-2 anchorbutton btn-blue" href="/tune/{{test.id}}/APPROVE">Approve</a>
|
||||
{% elif not test.approved and request.user.is_superuser %}
|
||||
<a class="w-25 mr-2 anchorbutton btn-blue" href="/tune/{{test.id}}/APPROVE">Approve</a>
|
||||
{% else %}
|
||||
<a class="w-25 mr-2 anchorbutton btn-disabled">Approve</a>
|
||||
{% endif %}
|
||||
|
||||
<!-- Restart Button: For Approvers or Test Authors of finished tests -->
|
||||
{% if test.finished and profile.approver %}
|
||||
<a class="w-25 mr-2 anchorbutton btn-yellow" href="/tune/{{test.id}}/RESTART">Restart</a>
|
||||
{% elif test.finished and profile.user.username == test.author %}
|
||||
<a class="w-25 mr-2 anchorbutton btn-yellow" href="/tune/{{test.id}}/RESTART">Restart</a>
|
||||
{% elif test.finished %}
|
||||
<a class="w-25 mr-2 anchorbutton btn-disabled">Restart</a>
|
||||
{% endif %}
|
||||
|
||||
<!-- Stop Button: For Approvers or Test Authors of active tests -->
|
||||
{% if not test.finished and profile.approver %}
|
||||
<a class="w-25 mr-2 anchorbutton btn-yellow" href="/tune/{{test.id}}/STOP">Stop</a>
|
||||
{% elif not test.finished and profile.user.username == test.author %}
|
||||
<a class="w-25 mr-2 anchorbutton btn-yellow" href="/tune/{{test.id}}/STOP">Stop</a>
|
||||
{% elif not test.finished %}
|
||||
<a class="w-25 mr-2 anchorbutton btn-disabled">Stop</a>
|
||||
{% endif %}
|
||||
|
||||
<!-- Delete/Restore Button: For Approvers or Test Authors -->
|
||||
{% if profile.approver or profile.user.username == test.author %}
|
||||
{% if test.deleted %}
|
||||
<a class="w-25 mr-2 anchorbutton btn-preset" href="/tune/{{test.id}}/RESTORE">Restore</a>
|
||||
{% else %}
|
||||
<a class="w-25 mr-2 anchorbutton btn-red" href="/tune/{{test.id}}/DELETE">Delete</a>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% if test.deleted %}
|
||||
<a class="w-25 mr-2 anchorbutton btn-disabled">Restore</a>
|
||||
{% else %}
|
||||
<a class="w-25 mr-2 anchorbutton btn-disabled">Delete</a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
<!-- Copy Button: Copy the current results statblock -->
|
||||
<a class="copy-button" onclick="copy_statblock()">
|
||||
<i class="fa-regular fa-clone copy-button"></i>
|
||||
</a>
|
||||
|
||||
<!-- Elo, (SPRT/LRR if SPRT, otherwise CONF), Games -->
|
||||
<!-- For SPSA, # of Params, Iterations, and Games -->
|
||||
<pre class="long-statblock" id="long-statblock">{{test|shortStatBlock|linebreaksbr}}</pre>
|
||||
|
||||
<!-- Forum to modify the Priority or Throughput -->
|
||||
<form method="POST" action="/tune/{{test.id}}/MODIFY">
|
||||
{% csrf_token %}
|
||||
<div class="form">
|
||||
<div class="col-full">
|
||||
<div class="row">
|
||||
<label>Priority</label>
|
||||
<input value="{{test.priority}}" name="priority">
|
||||
</div>
|
||||
<div class="row">
|
||||
<label>Throughput</label>
|
||||
<input value="{{test.throughput}}" name="throughput">
|
||||
</div>
|
||||
<div class="row">
|
||||
<label>Worker Limit</label>
|
||||
<input value="{{test.worker_limit|default:'None'}}" name="worker_limit">
|
||||
</div>
|
||||
<div class="row">
|
||||
<label>Thread Limit</label>
|
||||
<input value="{{test.thread_limit|default:'None'}}" name="thread_limit">
|
||||
</div>
|
||||
<!-- Edit Button: For Approvers or Test Authors -->
|
||||
{% if profile.approver or profile.user.username == test.author %}
|
||||
<input class="anchorbutton btn-blue w-100" type="submit" name="submit" value="Modify">
|
||||
{% else %}
|
||||
<input class="anchorbutton btn-disabled w-100" type="submit" name="submit" value="Modify">
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div id="parameters" class="w-100 mt-3" style="float:left;">
|
||||
<table class="stripes wrappable">
|
||||
<tr class="table-header">
|
||||
<th> Name </th>
|
||||
<th> Start </th>
|
||||
<th> Curr </th>
|
||||
<th> Min </th>
|
||||
<th> Max </th>
|
||||
<th> C </th>
|
||||
<th> C_end </th>
|
||||
<th> R </th>
|
||||
<th> R_end </th>
|
||||
</tr>
|
||||
|
||||
{% for row in test|spsa_param_digest %}
|
||||
<tr>
|
||||
{% for element in row %}
|
||||
<td> {{ element }} </td>
|
||||
{% endfor %}
|
||||
<tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div id="results" class="w-100 mt-3" style="float:left;">
|
||||
<table class="stripes wrappable">
|
||||
<tr class="table-header">
|
||||
<th>#</th>
|
||||
<th>User</th>
|
||||
<th>Updated</th>
|
||||
<th style="width: 45px">Games</th>
|
||||
<th style="width: 45px">Won</th>
|
||||
<th style="width: 45px">Lost</th>
|
||||
<th style="width: 45px">Drawn</th>
|
||||
<th style="width: 45px">Time</th>
|
||||
<th style="width: 45px">Crash</th>
|
||||
</tr>
|
||||
|
||||
{% for result in results %}
|
||||
<tr>
|
||||
<td><a href="/machines/{{result.machine.id}}">{{result.machine.id}}</a></td>
|
||||
<td>{{result.machine.user.username|capfirst}}</td>
|
||||
<td class="timestamp">{{result.updated|date:'U'}}</td>
|
||||
<td class="numeric">{{result.games}}</td>
|
||||
<td class="numeric">{{result.wins}}</td>
|
||||
<td class="numeric">{{result.losses}}</td>
|
||||
<td class="numeric">{{result.draws}}</td>
|
||||
<td class="numeric">{{result.timeloss}}</td>
|
||||
<td class="numeric">{{result.crashes}}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
Reference in new issue
Block a user