diff --git a/OpenBench/static/copy_text.js b/OpenBench/static/copy_text.js
new file mode 100644
index 0000000..a5d72af
--- /dev/null
+++ b/OpenBench/static/copy_text.js
@@ -0,0 +1,24 @@
+
+function copy_text(element_id, keep_url) {
+
+ var text = document.getElementById(element_id).innerHTML;
+ text = text.replace(/
/g, "\n");
+
+ if (keep_url)
+ text += "\n" + window.location.href;
+
+ var area = document.createElement("textarea");
+ area.value = text;
+ document.body.append(area);
+ area.select();
+
+ try {
+ document.execCommand("copy");
+ document.body.removeChild(area);
+ }
+
+ catch (err) {
+ document.body.removeChild(area);
+ console.error("Unable to copy to Clipboard");
+ }
+}
\ No newline at end of file
diff --git a/OpenBench/templatetags/mytags.py b/OpenBench/templatetags/mytags.py
index 3209233..4fcb645 100644
--- a/OpenBench/templatetags/mytags.py
+++ b/OpenBench/templatetags/mytags.py
@@ -238,18 +238,28 @@ def spsa_param_digest(test):
c_compression = iteration ** test.spsa['Gamma']
r_compression = (test.spsa['A'] + iteration) ** test.spsa['Alpha']
- for name, param in test.spsa['parameters'].items():
+ # Maintain the original order, if there was one
+ keys = sorted(
+ test.spsa['parameters'].keys(),
+ key=lambda x: test.spsa['parameters'][x].get('index', -1)
+ )
+
+ for name in keys:
+
+ param = test.spsa['parameters'][name]
# C and R if we got a workload right now
c = param['c'] / c_compression
r = param['a'] / r_compression / c ** 2
+ fstr = '%.4f' if param['float'] else '%d'
+
digest.append([
name,
- '%.4f' % (param['start']),
'%.4f' % (param['value']),
- '%.4f' % (param['min' ]),
- '%.4f' % (param['max' ]),
+ fstr % (param['start']),
+ fstr % (param['min' ]),
+ fstr % (param['max' ]),
'%.4f' % (c),
'%.4f' % (param['c_end']),
'%.4f' % (r),
@@ -258,7 +268,35 @@ def spsa_param_digest(test):
return digest
+def spsa_original_input(test):
+
+ # Maintain the original order, if there was one
+ keys = sorted(
+ test.spsa['parameters'].keys(),
+ key=lambda x: test.spsa['parameters'][x].get('index', -1)
+ )
+
+ lines = []
+ for name in keys:
+
+ param = test.spsa['parameters'][name]
+ dtype = 'float' if param['float'] else 'int'
+
+ # Original 7 token Input
+ lines.append(', '.join([
+ name,
+ dtype,
+ str(param['start']),
+ str(param['min' ]),
+ str(param['max' ]),
+ str(param['c_end']),
+ str(param['r_end']),
+ ]))
+
+ return '\n'.join(lines)
+
register.filter('spsa_param_digest', spsa_param_digest)
+register.filter('spsa_original_input', spsa_original_input)
diff --git a/OpenBench/workloads/create_workload.py b/OpenBench/workloads/create_workload.py
index 1cdfd65..a32bf74 100644
--- a/OpenBench/workloads/create_workload.py
+++ b/OpenBench/workloads/create_workload.py
@@ -209,12 +209,16 @@ def extract_spas_params(request):
# Each individual tuning parameter
spsa['parameters'] = {}
- for line in request.POST['spsa_inputs'].split('\n'):
+ for index, line in enumerate(request.POST['spsa_inputs'].split('\n')):
# Comma-seperated values, already verified in verify_workload()
name, data_type, value, minimum, maximum, c_end, r_end = line.split(',')
- param = {} # Raw extraction
+ # Recall the original order of inputs
+ param = {}
+ param['index'] = index
+
+ # Raw extraction
param['float'] = data_type.strip() == 'float'
param['start'] = float(value)
param['value'] = float(value)
diff --git a/Templates/OpenBench/test.html b/Templates/OpenBench/test.html
index 9af0d62..375168f 100644
--- a/Templates/OpenBench/test.html
+++ b/Templates/OpenBench/test.html
@@ -1,44 +1,13 @@
{% extends "OpenBench/base.html" %}
{% load mytags %}
+{% load static %}
{% block style %}
{% endblock %}
{% block scripts %}
-
-
-
+
{% endblock %}
{% block content %}
@@ -132,7 +101,7 @@
{% endif %}
-
+
diff --git a/Templates/OpenBench/tune.html b/Templates/OpenBench/tune.html
index 8d8ca15..277a432 100644
--- a/Templates/OpenBench/tune.html
+++ b/Templates/OpenBench/tune.html
@@ -1,44 +1,13 @@
{% extends "OpenBench/base.html" %}
{% load mytags %}
+{% load static %}
{% block style %}
{% endblock %}
{% block scripts %}
-
-
-
+
{% endblock %}
{% block content %}
@@ -122,8 +91,9 @@
{% endif %}
{% endif %}
-
-
+
+
+
@@ -152,6 +122,7 @@
+
{% if profile.approver or profile.user.username == test.author %}
@@ -167,8 +138,8 @@
| Name | -Start | Curr | +Start | Min | Max | C | @@ -180,7 +151,11 @@ {% for row in test|spsa_param_digest %}
|---|---|---|---|---|---|---|
| {{ element }} | + {% if not forloop.first %} +{{ element }} | + {% else %} +{{ element }} | + {% endif %} {% endfor %}||||