-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdae-arg.mc
69 lines (65 loc) · 2.51 KB
/
dae-arg.mc
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
include "arg.mc"
type Options = {
debug : Bool,
disableDebugStructure : Bool,
disablePeval : Bool,
constantFold : Bool,
cse : Bool,
aliasElim : Bool,
numericJac : Bool,
jacSpecThreshold : Float,
jacSpecThresholdAbsolute : Option Int,
benchmarkResidual : Bool,
benchmarkJacobian : Bool
}
let defaultOptions = {
debug = false,
disableDebugStructure = false,
disablePeval = false,
constantFold = false,
cse = false,
aliasElim = false,
numericJac = false,
jacSpecThreshold = 1.,
jacSpecThresholdAbsolute = None (),
benchmarkResidual = false,
benchmarkJacobian = false
}
let argConfig = [
([("--debug", "", "")],
"Print debug information during compilation. ",
lam p. { p.options with debug = true }),
([("--disable-peval", "", "")],
"Disable partial evaluation. ",
lam p. { p.options with disablePeval = true }),
([("--constant-fold", "", "")],
"Do constant folding after partial evaluation. ",
lam p. { p.options with constantFold = true }),
([("--cse", "", "")],
"Perform common subexpression elimination. ",
lam p. { p.options with cse = true }),
([("--alias-elim", "", "")],
"Eliminate alias equations. ",
lam p. { p.options with aliasElim = true }),
([("--numeric-jac", "", "")],
"Numerically approximate Jacobian. ",
lam p. { p.options with numericJac = true }),
([("--jac-spec-threshold", " ", "<value>")],
"Abstract interval that constrols how many partial derivatives in the Jacobian should be specialized, where 0 means none and 1 means all. More specialized partial derivatives results in more code. For a DAE with n equations this and --jac-spec-threshold phi, this is equivalent to --jac-spec-threshold-absolute (floor phi*n)",
lam p. { p.options with jacSpecThreshold = argToFloatInterval p 0. 1. }),
([("--jac-spec-absolute", " ", "<value>")],
"The maximum number non-zero elements a partial derivative in the Jacobian must in order to be specialized. Overrides --jac-spec-threshold. ",
lam p. { p.options with jacSpecThresholdAbsolute = Some (argToInt p) }),
([("--benchmark-res", "", "")],
"Do not simulate but instead evaluate the residual function the given number of times. ",
lam p. { p.options with benchmarkResidual = true }),
([("--benchmark-jac", "", "")],
"Do not simulate but instead evaluate the jacobian function the given number of times. ",
lam p. { p.options with benchmarkJacobian = true })
]
let usage = lam prog. join [
"Usage: ", prog, " FILE [OPTION]\n\n",
"Options:\n",
argHelpOptions argConfig,
"\n"
]