Skip to content

Commit 11e0493

Browse files
committed
Merge branch 'master' of github.com:ECP-CANDLE/Supervisor
2 parents 2728133 + 17a64f7 commit 11e0493

File tree

1 file changed

+53
-11
lines changed

1 file changed

+53
-11
lines changed

workflows/README.adoc

Lines changed: 53 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11

2+
:toc:
3+
24
////
35
You can compile this locally with
46
$ ../docs/adoc.sh README.adoc
@@ -75,18 +77,14 @@ Demonstration of P1B1 on a regular grid parameter sweep.
7577
See https://github.com/ECP-CANDLE/Supervisor/tree/master/workflows/p1b1_grid for more details.
7678

7779
[[AUEN_DEAP]]
78-
== AUEN_DEAP
80+
=== AUEN_DEAP
7981

8082
This demo runs an AUEN/Theano evolutionary algorithm.
8183

8284
See the https://github.com/CODARcode/SwiftExamples/tree/master/auen[README here].
8385

8486
*Systems tested:* http://swift-lang.github.io/swift-t/sites.html#_beagle[Beagle]
8587

86-
== Synthetic examples
87-
88-
These do not actually use an ML call, but demonstrate relevant use of Swift
89-
9088
=== Simple Sweep Command Line
9189

9290
Simple parameter sweep that uses a Python command line task.
@@ -112,7 +110,7 @@ This is a Beagle parameter sweep over an older AUEN.
112110

113111
* https://github.com/CODARcode/SwiftExamples/tree/master/auen
114112

115-
== auen41_ff on Cooley
113+
=== auen41_ff on Cooley
116114

117115
*Contacts:* Wozniak and Balaprakash +
118116
*Source:* [email protected]:ECP-CANDLE/Supervisor.git+ http://github.com/ECP-CANDLE/Supervisor/tree/master/workflows[+/workflows/auen41_ff+] +
@@ -152,21 +150,21 @@ $ less out-001/output.txt
152150
----
153151

154152
[[p1b1_hyperopt]]
155-
== p1b1_hyperopt
153+
=== p1b1_hyperopt
156154

157155
The P1B1 hyperopt workflow evaluates a modified version of the P1B1 benchmark autoencoder using hyperparameters provided by a hyperopt instance. The P1B1 code (p1b1_baseline.py) has been modified to expose a functional interface. The neural net remains the same. Currently, hyperopt minimizes the validation loss.
158156

159157
See https://github.com/ECP-CANDLE/Supervisor/tree/master/workflows/p1b1_hyperopt for more details.
160158

161159
[[p1b1_mlrMBO]]
162-
== p1b1_mlrMBO
160+
=== p1b1_mlrMBO
163161

164162
The P1B1 mlrMBO workflow evaluates a modified version of the P1B1 benchmark autoencoder using hyperparameters provided by a mlrMBO instance. The P1B1 code (p1b1_baseline.py) has been modified to expose a functional interface. The neural net remains the same. Currently, mlrMBO minimizes the validation loss.
165163

166164
See https://github.com/ECP-CANDLE/Supervisor/tree/master/workflows/p1b1_mlrMBO for more details.
167165

168166
[[p1b3_mlrMBO]]
169-
== p1b3_mlrMBO
167+
=== p1b3_mlrMBO
170168

171169
The P1B3 mlrMBO workflow evaluates the P1B3 benchmark
172170
using hyperparameters provided by a mlrMBO instance. mlrMBO
@@ -177,7 +175,7 @@ See https://github.com/ECP-CANDLE/Supervisor/tree/master/workflows/p1b3_mlrMBO f
177175
*Systems tested:* http://www.nersc.gov/users/computational-systems/cori[Cori]
178176

179177
[[p2b1_mlrMBO]]
180-
== p2b1_mlrMBO
178+
=== p2b1_mlrMBO
181179

182180
The P2B1 mlrMBO workflow evaluates the P2B1 benchmark
183181
using hyperparameters provided by a mlrMBO instance. mlrMBO
@@ -189,10 +187,54 @@ See https://github.com/ECP-CANDLE/Supervisor/tree/master/workflows/p2b1_mlrMBO f
189187

190188

191189
[[nt3_mlrMBO]]
192-
== nt3_mlrMBO
190+
=== nt3_mlrMBO
193191

194192
See https://github.com/ECP-CANDLE/Supervisor/tree/master/workflows/nt3_mlrMBO for more details.
195193

194+
== Objective function guide
195+
196+
In CANDLE, *objective functions* are the calls to the machine learning (ML) models. They are functions that accept some parameter tuple describing how the model will be run, and return some value, such as a loss. Typical CANDLE workflows optimize the return value in some parameter space using some model exploration algorithm (ME).
197+
198+
This documents how to read existing objective functions and develop new ones.
199+
200+
=== Swift/T leaf functions
201+
202+
Objective functions are implemented as Swift/T leaf functions, which are http://swift-lang.github.io/swift-t/guide.html#leaf_functions[described here]. In short, leaf functions are opaque to Swift. For the purposes of CANDLE, a leaf function is a command line program or a call to evaluate a string of Python code in-memory. Normally, Swift/T is free to evaluate leaf functions anywhere in the system (load balancing) in any order (as long as all input data is ready).
203+
204+
=== Command-line programs
205+
206+
A typical command line invocation is here:
207+
208+
https://github.com/ECP-CANDLE/Supervisor/blob/3e53ec93ba5ad79c114a96287f2d280a8e93ad8a/workflows/p3b1_mlrMBO/swift/ai_workflow3.swift#L83[P3B1 mlrMBO: ai_workflow3.swift]
209+
----
210+
(string obj_result) obj(string params, string iter_indiv_id) {
211+
string outdir = "%s/run_%s" % (turbine_output, iter_indiv_id);
212+
file out <"%s/out.txt" % outdir>;
213+
file err <"%s/err.txt" % outdir>;
214+
215+
(out,err) = run_model(model_script, params, outdir, iter_indiv_id) =>
216+
string result_file = "%s/result.txt" % outdir;
217+
obj_result = get_results(result_file);
218+
printf(obj_result);
219+
}
220+
----
221+
222+
+obj()+ is an objective function that takes parameters and returns a string to Swift. The parameters (+params+) are produced by the ME and are encoded as a JSON fragment. You can simply print them out in Swift (via +printf()+) to see them. A unique identifier +iter_indiv_id+ is also provided and used to create a unique output directory for +out.txt+ and +err.txt+. The model is actually executed in +run_model()+, described below. Then, its results are obtained by +get_results()+, and also logged to +stdout+ (via +printf()+).
223+
224+
https://github.com/ECP-CANDLE/Supervisor/blob/3e53ec93ba5ad79c114a96287f2d280a8e93ad8a/workflows/p3b1_mlrMBO/swift/ai_workflow3.swift#L35[P3B1 mlrMBO: ai_workflow3.swift]
225+
----
226+
app (file out, file err) run_model (file shfile, string params_string, string instance, string run_id)
227+
{
228+
"bash" shfile params_string emews_root instance FRAMEWORK exp_id run_id benchmark_timeout @stdout=out @stderr=err;
229+
}
230+
----
231+
232+
This is a Swift +app+ function. Its body is a command line, populated with the input and output arguments. Thus, it runs +bash+ on a given script with the parameters, as specified in +obj()+. Some of the variables referenced in the body are Swift global variables. The special syntax +@stdout+, +@stderr+ capture those streams respectively.
233+
234+
=== In-memory Python functions
235+
236+
237+
196238
== Works in progress
197239

198240
=== Oversample

0 commit comments

Comments
 (0)