Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SWIFTsim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SWIFT
SWIFTsim
Commits
99818c35
Commit
99818c35
authored
Feb 4, 2021
by
Loic Hausammann
Committed by
Matthieu Schaller
Feb 4, 2021
Browse files
Options
Downloads
Patches
Plain Diff
Plot only the most important functions
parent
01eb5182
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
tools/plot_scaling_results_detailed.py
+52
-46
52 additions, 46 deletions
tools/plot_scaling_results_detailed.py
with
52 additions
and
46 deletions
tools/plot_scaling_results_detailed.py
+
52
−
46
View file @
99818c35
...
...
@@ -17,24 +17,7 @@ import matplotlib.pyplot as plt
from
timed_functions
import
labels
params
=
{
"
axes.labelsize
"
:
14
,
"
axes.titlesize
"
:
18
,
"
font.size
"
:
12
,
"
legend.fontsize
"
:
12
,
"
xtick.labelsize
"
:
14
,
"
ytick.labelsize
"
:
14
,
"
text.usetex
"
:
True
,
"
figure.subplot.left
"
:
0.055
,
"
figure.subplot.right
"
:
0.98
,
"
figure.subplot.bottom
"
:
0.05
,
"
figure.subplot.top
"
:
0.95
,
"
figure.subplot.wspace
"
:
0.14
,
"
figure.subplot.hspace
"
:
0.12
,
"
lines.markersize
"
:
6
,
"
lines.linewidth
"
:
2.0
,
}
plt
.
rcParams
.
update
(
params
)
min_fraction
=
2e-2
legendTitle
=
"
"
...
...
@@ -65,13 +48,6 @@ colors = [
hexcols
[
7
],
]
linestyle
=
[
"
-
"
,
"
--
"
,
"
-.
"
,
"
:
"
]
# Work out how many data series there are
if
len
(
sys
.
argv
)
==
1
:
print
(
"
Please specify an input file in the arguments.
"
)
...
...
@@ -91,15 +67,16 @@ def parse_files():
for
i
,
filename
in
enumerate
(
filenames
):
# Loop over each file
print
(
"
Files read %.1f%%
\r
"
%
(
100
*
i
/
n_files
),
end
=
""
)
# Open stdout file
with
open
(
filename
,
"
r
"
)
as
f
:
# Search the different phrases
for
line
in
f
:
# Extract the number of threads
if
re
.
search
(
"
threads / rank and
"
,
line
)
:
if
"
threads / rank and
"
in
line
:
all_numbers
=
re
.
findall
(
r
"
[+-]?((\d+\.?\d*)|(\.\d+))
"
,
line
)
if
len
(
all_numbers
)
!=
12
:
raise
Exception
(
"
Failed to read the following line
"
,
line
)
rank
=
int
(
all_numbers
[
5
][
0
])
thread
=
int
(
all_numbers
[
6
][
0
])
threads
[
i
]
=
rank
*
thread
...
...
@@ -119,6 +96,13 @@ def parse_files():
r
"
^\[[0-9]*[.][0-9]+\][ ]
"
,
line
):
lastline
=
line
return
threads
,
total_time
def
cleanup_data
(
threads
,
total_time
):
n_labels
=
len
(
labels
)
n_files
=
len
(
filenames
)
# Remove the functions not found
time
=
np
.
sum
(
total_time
,
axis
=
1
)
ind
=
time
==
0.
...
...
@@ -128,6 +112,29 @@ def parse_files():
del
labels
[
i
]
n_labels
=
len
(
labels
)
# Get the elements representing a large fraction of the time
frac
=
total_time
/
np
.
sum
(
total_time
,
axis
=
0
)
ind
=
np
.
sum
(
frac
>
min_fraction
,
axis
=
1
)
ind
=
ind
>
0
print
(
"
Grouping:
"
,
np
.
array
(
labels
)[
~
ind
,
0
])
# Group the previous elements together
remaining
=
np
.
zeros
((
1
,
n_files
))
for
i
in
range
(
n_labels
)[::
-
1
]:
if
not
ind
[
i
]:
remaining
+=
total_time
[
i
,
:]
del
labels
[
i
]
remaining_frac
=
remaining
/
np
.
sum
(
total_time
,
axis
=
0
)
total_time
=
np
.
delete
(
total_time
,
~
ind
,
axis
=
0
)
n_labels
=
len
(
labels
)
# Add the other group if required
if
np
.
sum
(
remaining_frac
>
0.5
*
min_fraction
)
>
0
:
labels
.
append
((
"
Others
"
,
-
1
))
total_time
=
np
.
append
(
total_time
,
remaining
,
axis
=
0
)
n_labels
=
len
(
labels
)
# Sort according to the threads number
ind
=
np
.
argsort
(
threads
)
threads
=
threads
[
ind
]
...
...
@@ -146,6 +153,7 @@ def parse_files():
return
threads
,
total_time
,
speed_up
,
parallel_eff
def
plot_results
(
threads
,
total_time
,
speed_up
,
parallel_eff
):
n_files
=
len
(
filenames
)
n_labels
=
len
(
labels
)
...
...
@@ -159,45 +167,42 @@ def plot_results(threads, total_time, speed_up, parallel_eff):
# Plot speed up
speed_up_plot
.
plot
(
threads
,
threads
,
linestyle
=
"
--
"
,
lw
=
1.5
,
color
=
"
0.2
"
)
for
i
in
range
(
n_labels
):
i_line
=
i
%
len
(
linestyle
)
i_color
=
i
%
len
(
colors
)
speed_up_plot
.
plot
(
threads
,
speed_up
[
i
,
:],
c
=
colors
[
i_color
],
linestyle
=
linestyle
[
i_line
])
speed_up_plot
.
plot
(
threads
,
speed_up
[
i
,
:],
c
=
colors
[
i_color
])
speed_up_plot
.
set_ylabel
(
"
${
\\
rm Speed
\\
textendash
up
}$
"
,
labelpad
=
0.0
)
speed_up_plot
.
set_xlabel
(
"
${
\\
rm
Threads
}$
"
,
labelpad
=
0.0
)
speed_up_plot
.
set_ylabel
(
"
Speed
up
"
,
labelpad
=
0.0
)
speed_up_plot
.
set_xlabel
(
"
Threads
"
,
labelpad
=
0.0
)
speed_up_plot
.
set_xlim
([
0.7
,
threads
.
max
()
+
1
])
speed_up_plot
.
set_ylim
([
0.7
,
threads
.
max
()
+
1
])
# Plot parallel efficiency
for
i
in
range
(
n_labels
):
i_line
=
i
%
len
(
linestyle
)
i_color
=
i
%
len
(
colors
)
parallel_eff_plot
.
plot
(
threads
,
parallel_eff
[
i
,
:],
c
=
colors
[
i_color
],
linestyle
=
linestyle
[
i_line
])
parallel_eff_plot
.
plot
(
threads
,
parallel_eff
[
i
,
:],
c
=
colors
[
i_color
])
parallel_eff_plot
.
set_xscale
(
"
log
"
)
parallel_eff_plot
.
set_ylabel
(
"
${
\\
rm
Parallel
~
efficiency
}$
"
,
labelpad
=
0.0
)
parallel_eff_plot
.
set_xlabel
(
"
${
\\
rm
Threads
}$
"
,
labelpad
=
0.0
)
parallel_eff_plot
.
set_ylabel
(
"
Parallel
efficiency
"
,
labelpad
=
0.0
)
parallel_eff_plot
.
set_xlabel
(
"
Threads
"
,
labelpad
=
0.0
)
parallel_eff_plot
.
set_ylim
([
0
,
1.1
])
parallel_eff_plot
.
set_xlim
([
0.9
,
10
**
(
np
.
floor
(
np
.
log10
(
threads
.
max
()))
+
0.5
)])
# Plot time to solution
pts
=
np
.
array
([
1
,
10
**
np
.
floor
(
np
.
log10
(
threads
.
max
())
+
1
)])
total_time_plot
.
loglog
(
pts
,
1.
/
pts
,
"
k--
"
,
lw
=
1.0
,
color
=
"
0.2
"
)
for
i
in
range
(
n_labels
):
i_line
=
i
%
len
(
linestyle
)
i_color
=
i
%
len
(
colors
)
label
=
labels
[
i
][
0
].
replace
(
"
_
"
,
"
\_
"
)
label
=
labels
[
i
][
0
]
# Data
total_time_plot
.
loglog
(
threads
,
total_time
[
i
,
:],
c
=
colors
[
i_color
],
linestyle
=
linestyle
[
i_line
],
label
=
label
)
threads
,
total_time
[
i
,
:],
c
=
colors
[
i_color
],
label
=
label
)
# Perfect scaling
total_time_plot
.
loglog
(
pts
,
total_time
[
i
,
0
]
/
pts
,
"
--
"
,
c
=
colors
[
i_color
],
lw
=
1.0
)
y_min
=
10
**
np
.
floor
(
np
.
log10
(
total_time
.
min
()
*
0.6
))
y_max
=
1.0
*
10
**
np
.
floor
(
np
.
log10
(
total_time
.
max
()
*
1.5
)
+
1
)
total_time_plot
.
set_xscale
(
"
log
"
)
total_time_plot
.
set_xlabel
(
"
${
\\
rm
Threads
}$
"
,
labelpad
=
0.0
)
total_time_plot
.
set_ylabel
(
"
${
\\
rm
Time
~
to
~
solution
}$
"
,
labelpad
=
0.0
)
total_time_plot
.
set_xlabel
(
"
Threads
"
,
labelpad
=
0.0
)
total_time_plot
.
set_ylabel
(
"
Time
to
solution
"
,
labelpad
=
0.0
)
total_time_plot
.
set_xlim
([
0.9
,
10
**
(
np
.
floor
(
np
.
log10
(
threads
.
max
()))
+
0.5
)])
total_time_plot
.
set_ylim
(
y_min
,
y_max
)
...
...
@@ -211,7 +216,7 @@ def plot_results(threads, total_time, speed_up, parallel_eff):
empty_plot
.
axis
(
"
off
"
)
fig
.
suptitle
(
"
${
\\
rm Speed
\\
textendash
up,
~
parallel
~
efficiency
~
and
~
time
~
to
~
solution
}$
"
,
"
Speed
up,
parallel
efficiency
and
time
to
solution
"
,
fontsize
=
16
,
)
...
...
@@ -219,7 +224,8 @@ def plot_results(threads, total_time, speed_up, parallel_eff):
# Calculate results
threads
,
total_time
,
speed_up
,
parallel_eff
=
parse_files
()
threads
,
total_time
=
parse_files
()
threads
,
total_time
,
speed_up
,
parallel_eff
=
cleanup_data
(
threads
,
total_time
)
print
(
"
Functions found:
"
,
[
l
[
0
]
for
l
in
labels
])
...
...
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
sign in
to comment