Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Hans-Peter Deifel
copar-benchmarks
Commits
d16f3738
Commit
d16f3738
authored
Apr 03, 2019
by
Hans-Peter Deifel
Browse files
wta: Pass --different-values argument through
parent
0415ff22
Changes
1
Hide whitespace changes
Inline
Side-by-side
wta/bench.py
View file @
d16f3738
...
...
@@ -10,9 +10,9 @@ import scipy.stats as st
samples
=
5
def
coalg_file
(
states
,
monoid
,
symbols
,
zero_frequency
,
i
):
return
"bench/wta_%s_%s_%s_%s_%d"
%
(
monoid
,
symbols
,
zero_frequency
,
states
,
i
)
def
coalg_file
(
states
,
monoid
,
symbols
,
zero_frequency
,
different_values
,
i
):
return
"bench/wta_%s_%s_%s_%s_%
s_%
d"
%
(
monoid
,
symbols
,
zero_frequency
,
different_values
,
states
,
i
)
def
generate
(
args
):
...
...
@@ -21,11 +21,12 @@ def generate(args):
monoid
=
args
.
monoid
symbols
=
args
.
symbols
zero_frequency
=
args
.
zero_frequency
different_values
=
args
.
different_values
os
.
makedirs
(
"bench"
,
exist_ok
=
True
)
for
i
in
range
(
0
,
samples
):
f
=
coalg_file
(
states
,
monoid
,
symbols
,
zero_frequency
,
f
=
coalg_file
(
states
,
monoid
,
symbols
,
zero_frequency
,
different_values
,
i
)
+
".coalgebra"
if
os
.
path
.
exists
(
f
):
...
...
@@ -33,7 +34,8 @@ def generate(args):
cmd
=
[
generator
,
"--states"
,
states
,
"--monoid"
,
monoid
,
"--symbols"
,
symbols
,
"--zero-frequency"
,
zero_frequency
symbols
,
"--zero-frequency"
,
zero_frequency
,
"--different-values"
,
different_values
]
subprocess
.
run
(
cmd
,
stdout
=
open
(
f
,
"w+"
))
...
...
@@ -44,8 +46,9 @@ def run_one(args, i):
monoid
=
args
.
monoid
symbols
=
args
.
symbols
zero_frequency
=
args
.
zero_frequency
different_values
=
args
.
different_values
f
=
coalg_file
(
states
,
monoid
,
symbols
,
zero_frequency
,
i
)
+
".coalgebra"
f
=
coalg_file
(
states
,
monoid
,
symbols
,
zero_frequency
,
different_values
,
i
)
+
".coalgebra"
copar_args
=
[
copar
,
'refine'
,
'--stats-json'
,
f
]
...
...
@@ -60,6 +63,7 @@ def run_one(args, i):
stats
[
'monoid'
]
=
monoid
stats
[
'symbols'
]
=
symbols
stats
[
'zero-freq'
]
=
zero_frequency
stats
[
'mon-values'
]
=
different_values
stats
[
'i'
]
=
i
return
stats
...
...
@@ -71,8 +75,9 @@ def run_one_simple(args, i):
monoid
=
args
.
monoid
symbols
=
args
.
symbols
zero_frequency
=
args
.
zero_frequency
different_values
=
args
.
different_values
f
=
coalg_file
(
states
,
monoid
,
symbols
,
zero_frequency
,
i
)
+
".coalgebra"
f
=
coalg_file
(
states
,
monoid
,
symbols
,
zero_frequency
,
different_values
,
i
)
+
".coalgebra"
copar_args
=
[
copar
,
'refine'
,
f
]
...
...
@@ -228,6 +233,7 @@ def main():
gen_parser
.
add_argument
(
'--monoid'
,
required
=
True
)
gen_parser
.
add_argument
(
'--symbols'
,
required
=
True
)
gen_parser
.
add_argument
(
'--zero-frequency'
,
required
=
True
)
gen_parser
.
add_argument
(
'--different-values'
,
required
=
True
)
gen_parser
.
set_defaults
(
func
=
generate
)
run_parser
=
subparsers
.
add_parser
(
'run'
)
...
...
@@ -236,6 +242,7 @@ def main():
run_parser
.
add_argument
(
'--monoid'
,
required
=
True
)
run_parser
.
add_argument
(
'--symbols'
,
required
=
True
)
run_parser
.
add_argument
(
'--zero-frequency'
,
required
=
True
)
run_parser
.
add_argument
(
'--different-values'
,
required
=
True
)
run_parser
.
add_argument
(
'--stddev'
,
action
=
'store_true'
,
help
=
"report stddev for timings"
)
run_parser
.
add_argument
(
...
...
@@ -250,6 +257,7 @@ def main():
bisect_parser
.
add_argument
(
'--monoid'
,
required
=
True
)
bisect_parser
.
add_argument
(
'--symbols'
,
required
=
True
)
bisect_parser
.
add_argument
(
'--zero-frequency'
,
required
=
True
)
bisect_parser
.
add_argument
(
'--different-values'
,
required
=
True
)
bisect_parser
.
add_argument
(
'--start-states'
,
type
=
int
,
default
=
50
)
bisect_parser
.
add_argument
(
'--good'
,
type
=
int
)
bisect_parser
.
add_argument
(
'--bad'
,
type
=
int
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment