-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
386 lines (381 loc) · 18.5 KB
/
index.html
File metadata and controls
386 lines (381 loc) · 18.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
<!DOCTYPE html>
<html>
<!-- Prevent caching of template files during development -->
<meta http-equiv="Cache-Control" content="no-store" />
<meta charset="UTF-8">
<title>libEnsemble Script Generator</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/FileSaver.js/2.0.5/FileSaver.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/mustache@4.2.0/mustache.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/github.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/languages/python.min.js"></script>
<style>
body { font-family: sans-serif; font-size: 10px; }
input, select {
margin-bottom: 8px;
display: block;
width: 100%;
max-width: 400px;
padding: 2px 3px;
border: 1px solid #ccc;
border-radius: 4px;
background-color: #fefefe;
font-size: 12px;
transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus, select:focus {
border-color: #007bff;
box-shadow: 0 0 3px rgba(0,123,255,0.5);
outline: none;
}
fieldset {
margin-bottom: 12px;
padding: 10px 12px;
border: 1px solid #bbb;
border-radius: 8px;
background-color: #f9f9f9;
box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
pre { background: #f6f8fa; padding: 10px; overflow-x: auto; border: 1px solid #ccc; border-radius: 5px; position: relative; }
#fillBtn { margin: 10px 0; }
.form-columns { display: flex; gap: 20px; align-items: flex-start; }
.form-column { flex: 1; min-width: 0; align-self: flex-start; }
.output-columns, .output-stack { gap: 20px; }
.output-columns { display: flex; }
.output-stack { display: block; }
.output-column { flex: 1; }
.button-row { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.toggle-option { border: 1px solid #ccc; padding: 4px 8px; cursor: pointer; user-select: none; }
.toggle-option.active { background-color: #007bff; color: white; }
.toggle-group { display: flex; gap: 5px; }
details summary { background-color: #e9ecef; padding: 6px 10px; cursor: pointer; border: 1px solid #ccc; border-radius: 4px; font-weight: bold; }
details summary::after, details[open] summary::after { content: none; }
.checkbox-label {
display: flex;
align-items: center;
gap: 6px;
direction: ltr;
}
.checkbox-label input[type="checkbox"] {
width: 14px;
height: 14px;
min-width: 14px;
min-height: 14px;
vertical-align: middle;
margin: 0 4px 0 0;
}
.copy-btn {
position: absolute;
top: 8px;
right: 8px;
background: none;
border: none;
cursor: pointer;
padding: 2px;
z-index: 2;
opacity: 0.7;
transition: opacity 0.2s;
}
.copy-btn:hover { opacity: 1; }
.copy-btn svg { width: 22px; height: 22px; display: block; }
.copy-btn.copied svg { color: #28a745; }
.side-by-side-row {
display: flex;
gap: 12px;
align-items: flex-end;
margin-bottom: 8px;
}
.side-by-side-row label {
flex: 1;
margin-bottom: 0;
}
.short-number {
width: 80px !important;
max-width: 100px;
display: inline-block;
}
/* Custom dropdown styles */
.custom-select-wrapper {
position: relative;
width: 100%;
max-width: 400px;
margin-bottom: 8px;
}
.custom-select {
width: 100%;
padding: 2px 3px;
border: 1px solid #ccc;
border-radius: 4px;
background-color: #fefefe;
font-size: 12px;
cursor: pointer;
}
.custom-select-options {
position: absolute;
top: 100%;
left: 0;
right: 0;
z-index: 1000;
background: white;
border: 1px solid #ccc;
border-radius: 4px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
max-height: 200px;
overflow-y: auto;
display: none;
}
.custom-select-option {
padding: 6px 8px;
cursor: pointer;
border-bottom: 1px solid #eee;
}
.custom-select-option:hover {
background-color: #f0f0f0;
}
.custom-select-option .description {
font-size: 11px;
color: #666;
margin-top: 2px;
}
.info-link {
display: inline-flex;
align-items: center;
justify-content: center;
width: 14px;
height: 14px;
border-radius: 50%;
background: #007bff;
color: white;
text-decoration: none;
font-size: 10px;
margin-left: 4px;
font-weight: bold;
vertical-align: middle;
}
.info-link:hover {
background: #0056b3;
}
.field-help {
display: inline-flex;
align-items: center;
gap: 4px;
margin-left: 6px;
font-size: 10px;
color: #666;
}
</style>
</head>
<body>
<h2>Generate libEnsemble Run Scripts</h2>
<div style="display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px;">
<p style="margin: 0;">Generate scripts for an ensemble that runs a user application on each worker.</p>
<a href="https://github.com/Libensemble/script-creator" target="_blank" style="font-size: 11px; text-decoration: underline; color: #007bff; margin-left: 12px; white-space: nowrap;">Report Issues / Give Star</a>
</div>
<div style="display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px;">
<button id="fillBtn" type="button">Fill with Sample Data</button>
<!-- Subtle Load/Save dropdown -->
<div id="devLoadSaveDropdown" style="position: relative;">
<button id="devLoadSaveBtn" type="button" style="font-size: 11px; padding: 2px 10px; opacity: 0.7;">Load/Save ▼</button>
<div id="devLoadSaveMenu" style="display: none; position: absolute; right: 0; top: 120%; background: #f6f8fa; border: 1px solid #bbb; border-radius: 6px; box-shadow: 0 2px 8px rgba(0,0,0,0.12); padding: 8px 10px; min-width: 180px; z-index: 100; font-size: 11px;">
<div style="font-size: 11px; color: #666; font-weight: bold; margin-bottom: 4px;">Load/save form entries</div>
<div style="margin-bottom: 6px;">
<select id="savedEntriesDropdown" style="width: 100%; font-size: 11px;">
<option value="">-- Select Saved Entry --</option>
</select>
</div>
<div style="display: flex; gap: 4px;">
<button id="saveEntryBtn" type="button" style="font-size: 11px; padding: 2px 6px;">Save</button>
<button id="loadEntryBtn" type="button" style="font-size: 11px; padding: 2px 6px;">Load</button>
<button id="deleteEntryBtn" type="button" style="font-size: 11px; padding: 2px 6px;">Delete</button>
</div>
</div>
</div>
</div>
<form id="scriptForm">
<div class="form-columns">
<div class="form-column">
<fieldset><legend><strong>Application Reference</strong> <span class="info-link" title="Provide any name as a label">?</span></legend>
<label>Application Reference Name: <input name="app_ref" required></label>
</fieldset>
<fieldset><legend><strong>Manager Settings</strong></legend>
<div class="side-by-side-row">
<label>Dimension (no. of params): <input class="short-number" name="dimension" type="number" min="1" value="2" required></label>
<label>Max Simulations: <input class="short-number" name="max_sims" type="number" min="1"></label>
</div>
<label>MPI App Full Path: <input name="sim_app" required></label>
<div style="margin-bottom: 8px;">
<label style="display: block; margin-bottom: 4px;">Input Type:</label>
<div style="display: flex; flex-direction: row; gap: 15px; align-items: center;">
<label class="checkbox-label" style="margin-bottom: 0; margin-right: 0;">
<input type="radio" name="input_type" value="file" checked> File
</label>
<label class="checkbox-label" style="margin-bottom: 0; margin-right: 0;">
<input type="radio" name="input_type" value="directory"> Directory
</label>
</div>
</div>
<div style="display: flex; align-items: center; gap: 15px; margin-bottom: 8px;">
<label id="inputPathLabel" style="flex: 1;">
<span id="inputPathLabelText">Input File Path:</span>
<input name="input_path" required>
</label>
<label class="checkbox-label" id="templatedTooltipLabel" style="position: relative; cursor: pointer;">
Templated <input type="checkbox" id="templatedEnable" name="templated_enable">
<span id="templatedTooltip" style="
display: none;
position: absolute;
left: 0;
top: 120%;
z-index: 10;
background: #f6f8fa;
color: #222;
padding: 2px 10px;
border-radius: 6px;
border: 1px solid #bbb;
font-size: 10px;
min-width: 260px;
box-shadow: 0 2px 8px rgba(0,0,0,0.18);
white-space: pre-line;
pointer-events: none;
">
Input file contains templated parameters that will vary for each simulation (below bl and bh are the variables). Usually maps to number of parameters.<br>
<strong>Example (input.txt):</strong>
<pre style="background: #f6f8fa; color: #222; border-radius: 4px; padding: 6px 8px; margin: 2px 0 0 0; font-size: 10px; line-height: 1.2; box-shadow: none;">
beam_length: {{bl}}
beam_height: {{bh}}
</pre>
</span>
</label>
</div>
<div id="templatedFields" style="display:none; margin-top:8px; margin-left: 32px; border-left: 2px solid #eee; padding-left: 12px;">
<label id="templatedFileLabel" style="display:none;">Template Filename: <input name="templated_filename" placeholder="input.txt"></label>
<label>Template Variables:</label>
<div id="templateVars">
<div class="template-var-row">
<input name="template_var" placeholder="variable name" style="width: 200px; display: inline-block;">
<button type="button" class="add-var-btn" style="margin-left: 5px;">+</button>
</div>
</div>
</div>
</fieldset>
<fieldset><legend><strong>Generator Selection</strong> <a href="https://libensemble.readthedocs.io/en/main/examples/gen_funcs.html" target="_blank" class="info-link" title="View full list of generators">?</a></legend>
<label>Generator Module: <select name="gen_module" id="gen_module"></select></label>
<label>Generator Function: <select name="gen_function" id="gen_function"></select></label>
</fieldset>
</div>
<div class="form-column">
<fieldset><legend><strong>Run Configuration</strong></legend>
<label>Number of Workers: <input name="num_workers" type="number" min="1" required></label>
<label class="checkbox-label">Run on Cluster <input type="checkbox" id="clusterEnable" name="cluster_enable"></label>
<div id="clusterFields" style="display:none; margin-top:8px;">
<label>Total Nodes: <input name="cluster_total_nodes" type="number" min="1" value="1"></label>
<label>Scheduler Type:
<select name="scheduler_type">
<option value="slurm">Slurm</option>
<option value="pbs">PBS</option>
</select>
</label>
</div>
</fieldset>
<fieldset><legend><strong>Worker Settings (for each simulation)</strong></legend>
<div class="side-by-side-row">
<label>Number of Nodes: <input class="short-number" name="nodes" type="number" min="0" placeholder="Auto"></label>
<label>Number of Procs: <input class="short-number" name="procs" type="number" min="0" placeholder="Auto" value="1"></label>
</div>
<div style="display: flex; align-items: center; gap: 8px; margin-bottom: 8px;">
<label style="margin-bottom: 0; margin-right: 8px;">Number of GPUs: <input class="short-number" name="gpus" type="number" min="0" value="0" id="gpusInput"></label>
<label class="checkbox-label" style="margin-bottom: 0; cursor: pointer; position: relative; display: flex; align-items: center; gap: 3px;">
<input type="checkbox" id="autoGpus"> Auto
<span id="autoGpusTooltip" style="
display: none;
position: absolute;
left: auto;
right: 0;
top: 120%;
z-index: 10;
background: #f6f8fa;
color: #222;
padding: 6px 10px;
border-radius: 6px;
border: 1px solid #bbb;
font-size: 10px;
width: 260px;
box-shadow: 0 2px 8px rgba(0,0,0,0.18);
pointer-events: none;
">
Assign GPUs available to this worker.<br>
The number of processes / nodes are set to match.
</span>
</label>
</div>
<div style="margin-top: 12px; margin-bottom: 8px;">
<span style="font-size: 11px;">
Input file is:
<span class="toggle-group" style="display: inline-flex; gap: 2px; margin-left: 4px;">
<label class="toggle-option active" id="inputUsageDir" style="padding: 2px 8px; font-size: 11px; cursor: pointer; position: relative;">
<input type="radio" name="input_usage" value="directory" checked style="display:none;">
read from run dir
<span id="runDirTooltip" style="display:none; position: absolute; left: 0; top: 120%; z-index: 10; background: #f6f8fa; color: #222; padding: 6px 10px; border-radius: 6px; border: 1px solid #bbb; font-size: 10px; min-width: 220px; box-shadow: 0 2px 8px rgba(0,0,0,0.18); pointer-events: none;">Input file only needs to be present in the run directory</span>
</label>
<label class="toggle-option" id="inputUsageCmd" style="padding: 2px 8px; font-size: 11px; cursor: pointer; position: relative;">
<input type="radio" name="input_usage" value="cmdline" style="display:none;">
in command line
<span id="cmdLineTooltip" style="display:none; position: absolute; left: 0; top: 120%; z-index: 10; background: #f6f8fa; color: #222; padding: 6px 10px; border-radius: 6px; border: 1px solid #bbb; font-size: 10px; min-width: 220px; box-shadow: 0 2px 8px rgba(0,0,0,0.18); pointer-events: none;">Input file is specified on run line</span>
</label>
</span>
</span>
</div>
<fieldset style="margin-top:12px;">
<legend><strong>Output Parsing</strong></legend>
<label class="checkbox-label">
<input type="checkbox" id="customSetObjective" name="custom_set_objective">
Customize <code>set_objective_value()</code> function
</label>
<div id="setObjectiveEditorContainer" style="display:none; margin-top:8px;">
<label>
<code>set_objective_value()</code> function (Python):
<textarea id="setObjectiveEditor" name="set_objective_code" rows="8" style="width:100%;font-family:monospace;"></textarea>
</label>
<small>Advanced: Edit how the simulation output is parsed and the objective is set.</small>
</div>
</fieldset>
</fieldset>
</div>
</div>
<div class="button-row">
<button type="submit">Generate Scripts</button>
<div class="toggle-group" title="Toggle output layout">
<div id="layoutSideBySide" class="toggle-option active">⬌</div>
<div id="layoutStacked" class="toggle-option">⬍</div>
</div>
</div>
<p id="customizeText" style="margin-top: -10px; display: none; margin-bottom: 20px;">To customize these scripts further, see the <a href="https://libensemble.readthedocs.io" target="_blank">libEnsemble documentation</a>.</p>
</form>
<div id="output" style="display:none">
<p><strong><a id="zipLink" href="#">Download All</a></strong></p>
<div id="batchColumn" style="display:none; margin-bottom: 20px;">
<p><strong id="batchFilename">submit.sh:</strong> <a id="batchLink" download="submit.sh">Download</a></p>
<details><summary>Show Script</summary>
<pre><button type="button" class="copy-btn" data-copytarget="batchScript" title="Copy"><svg viewBox="0 0 24 24" fill="none"><rect x="5" y="9" width="10" height="10" rx="2" stroke="currentColor" stroke-width="1.5"/><rect x="9" y="5" width="10" height="10" rx="2" fill="none" stroke="currentColor" stroke-width="1.5"/></svg></button><code id="batchScript" class="language-bash"></code></pre>
</details>
</div>
<div id="outputLayout" class="output-columns">
<div class="output-column">
<p><strong>run_libe.py:</strong> <a id="runLink" download="run_libe.py">Download</a></p>
<details open><summary>Show Script</summary>
<pre><button type="button" class="copy-btn" data-copytarget="runScript" title="Copy"><svg viewBox="0 0 24 24" fill="none"><rect x="5" y="9" width="10" height="10" rx="2" stroke="currentColor" stroke-width="1.5"/><rect x="9" y="5" width="10" height="10" rx="2" fill="none" stroke="currentColor" stroke-width="1.5"/></svg></button><code id="runScript" class="language-python"></code></pre>
</details>
</div>
<div class="output-column">
<p><strong>simf.py:</strong> <a id="simfLink" download="simf.py">Download</a></p>
<details open><summary>Show Script</summary>
<pre><button type="button" class="copy-btn" data-copytarget="simfScript" title="Copy"><svg viewBox="0 0 24 24" fill="none"><rect x="5" y="9" width="10" height="10" rx="2" stroke="currentColor" stroke-width="1.5"/><rect x="9" y="5" width="10" height="10" rx="2" fill="none" stroke="currentColor" stroke-width="1.5"/></svg></button><code id="simfScript" class="language-python"></code></pre>
</details>
</div>
</div>
</div>
<script src="processTemplateData.js"></script>
<script src="main.js"></script>
</body>
</html>