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
i4
manycore
emper-io-eval
Commits
d972bc72
Commit
d972bc72
authored
Aug 28, 2021
by
Florian Fischer
Browse files
enable mypy and fix/ignore all complaints
parent
e3b55401
Pipeline
#67418
failed with stage
in 41 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Makefile
View file @
d972bc72
...
...
@@ -10,7 +10,7 @@ servers:
clients
:
$(MAKE)
-C
clients/
check
:
check-pylint check-format
check
:
check-pylint check-format
check-mypy
format
:
yapf
-i
$(PYTHONFILES)
...
...
@@ -21,6 +21,9 @@ check-format:
check-pylint
:
pylint
--rcfile
=
.pylint.rc
-j
0
$(PYTHONFILES)
||
./tools/check-pylint
$$
?
check-mypy
:
mypy
--ignore-missing-imports
$(PYTHONFILES)
clean-emper-client
:
rm
-rf
emper-client
git
-C
emper/ worktree prune
...
...
parse_results.py
View file @
d972bc72
...
...
@@ -6,7 +6,7 @@ import csv
import
fnmatch
import
io
from
pathlib
import
Path
from
typing
import
Sequence
,
Union
from
typing
import
Iterable
,
Mapping
,
Optional
,
Sequence
,
Union
import
numpy
as
np
...
...
@@ -20,9 +20,9 @@ def to_number(string: str) -> Number:
DataPoint
=
Union
[
list
[
Number
],
Number
]
Experiment
Results
=
dict
[
str
,
DataPoint
]
Impl
Results
=
dict
[
int
,
Experiment
Results
]
EvaluationResults
=
dict
[
str
,
Impl
Results
]
Experiment
Data
=
dict
[
str
,
DataPoint
]
Impl
Data
=
dict
[
int
,
list
[
Experiment
Data
]
]
EvaluationResults
=
dict
[
str
,
Impl
Data
]
def
collect_results
(
result_dir
:
Union
[
Path
,
str
],
...
...
@@ -55,7 +55,7 @@ def collect_results(result_dir: Union[Path, str],
data
=
{}
for
impl
,
impl_dir
in
impl_dirs
.
items
():
impl_d
:
Impl
Results
=
{}
impl_d
:
Impl
Data
=
{}
data_files
=
impl_dir
.
glob
(
f
'*.
{
file_extension
}
'
)
...
...
@@ -64,8 +64,7 @@ def collect_results(result_dir: Union[Path, str],
configparser
=
ConfigParser
()
configparser
.
read
(
data_path
)
# convert everything to numbers if possible
exp_data
=
{}
exp_data
:
ExperimentData
=
{}
error
=
False
for
k
in
[
'connect_duration'
,
'echo_duration'
,
'total_duration'
]:
try
:
...
...
@@ -93,7 +92,8 @@ def collect_results(result_dir: Union[Path, str],
echos
=
sum
(
client_iterations
)
exp_data
[
'total_iterations'
]
=
echos
iops
=
echos
/
(
exp_data
[
'echo_duration'
]
*
10
**-
9
)
# We know that echo_duration is a Number so ignore mypy
iops
=
echos
/
(
exp_data
[
'echo_duration'
]
*
10
**-
9
)
# type: ignore
exp_data
[
'iops'
]
=
iops
if
cons
in
impl_d
:
...
...
@@ -114,7 +114,8 @@ def collect_results(result_dir: Union[Path, str],
return
data
ConnectionStats
=
dict
[
str
,
Number
]
Stats
=
dict
[
str
,
float
]
ConnectionStats
=
dict
[
str
,
Stats
]
ImplStats
=
dict
[
int
,
ConnectionStats
]
EvaluationStats
=
dict
[
str
,
ImplStats
]
...
...
@@ -127,28 +128,30 @@ def calculate_stats(data: EvaluationResults, warn=False) -> EvaluationStats:
for
cons
in
impl_d
:
cons_stats
=
{}
for
k
in
impl_d
[
cons
][
0
]:
all_k
=
[
x
[
k
]
for
x
in
impl_d
[
cons
]]
for
k
ey
in
impl_d
[
cons
][
0
]:
_values
=
[
x
[
k
ey
]
for
x
in
impl_d
[
cons
]]
if
isinstance
(
all_k
[
0
],
list
):
all_k
=
[
x
for
l
in
all_k
for
x
in
l
]
if
isinstance
(
_values
[
0
],
list
):
values
=
[
x
for
l
in
_values
for
x
in
l
]
# type: ignore
else
:
values
=
_values
cur_stats
=
{}
cur_stats
[
'mean'
]
=
np
.
mean
(
al
l_k
)
cur_stats
[
'median'
]
=
np
.
median
(
al
l_k
)
cur_stats
[
'min'
]
=
min
(
al
l_k
)
cur_stats
[
'max'
]
=
max
(
al
l_k
)
cur_stats
[
'std'
]
=
np
.
std
(
al
l_k
)
cur_stats
[
'mean'
]
=
np
.
mean
(
v
al
ues
)
cur_stats
[
'median'
]
=
np
.
median
(
v
al
ues
)
cur_stats
[
'min'
]
=
min
(
v
al
ues
)
cur_stats
[
'max'
]
=
max
(
v
al
ues
)
cur_stats
[
'std'
]
=
np
.
std
(
v
al
ues
)
if
warn
:
precision
=
cur_stats
[
'std'
]
/
cur_stats
[
'mean'
]
if
precision
>
0.05
:
print
(
'Warning: imprecise data impl:'
,
end
=
''
)
print
(
f
'
{
impl
}
, c:
{
cons
}
, k:
{
k
}
p:
{
precision
*
100
:
.
5
}
%'
f
'
{
impl
}
, c:
{
cons
}
, k:
{
k
ey
}
p:
{
precision
*
100
:
.
5
}
%'
)
cons_stats
[
k
]
=
cur_stats
cons_stats
[
k
ey
]
=
cur_stats
impl_stats
[
cons
]
=
cons_stats
...
...
@@ -157,14 +160,14 @@ def calculate_stats(data: EvaluationResults, warn=False) -> EvaluationStats:
return
stats
def
print_stats_for_variable
(
variable
:
str
,
stats
:
dict
):
def
print_stats_for_variable
(
variable
:
str
,
stats
:
Mapping
):
print
(
f
'
{
variable
}
: '
,
end
=
''
)
for
name
,
value
in
stats
.
items
():
print
(
f
'
{
name
}
:
{
value
}
, '
,
end
=
''
)
print
(
f
'std[%]:
{
(
stats
[
"std"
]
/
stats
[
"mean"
])
*
100
:
.
2
f
}
%'
)
def
print_stats
(
stats
:
EvaluationStats
,
variables
:
list
):
def
print_stats
(
stats
:
EvaluationStats
,
variables
:
Optional
[
Iterable
]
):
for
impl
,
impl_stats
in
stats
.
items
():
print
(
f
'
{
impl
}
:'
)
for
cons
in
sorted
(
list
(
impl_stats
.
keys
())):
...
...
@@ -200,7 +203,8 @@ def main():
parser
.
add_argument
(
"--print-stats"
,
help
=
"variables about which the collected statistics should be print"
,
nargs
=
'*'
)
nargs
=
'*'
,
default
=
[
'iops'
])
args
=
parser
.
parse_args
()
...
...
plot.py
View file @
d972bc72
...
...
@@ -11,7 +11,7 @@ import plot_utils
#https://stackoverflow.com/questions/2371436/evaluating-a-mathematical-expression-in-a-string
def
_eval_with_stat
(
evaluation
:
str
,
stats
:
str
,
stat
:
str
):
def
_eval_with_stat
(
evaluation
:
str
,
stats
,
stat
:
str
):
"""Helper to evaluate a datapoint description string as arithmetic operation"""
def
_eval
(
node
):
"""evaluate a arithmetic ast node"""
...
...
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