Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
QuickSched
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SWIFT
QuickSched
Commits
ce57dbc4
Commit
ce57dbc4
authored
9 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Better to actually commit the file....
parent
80d1e8b6
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/plot_tasks.py
+129
-0
129 additions, 0 deletions
examples/plot_tasks.py
with
129 additions
and
0 deletions
examples/plot_tasks.py
0 → 100644
+
129
−
0
View file @
ce57dbc4
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
import
matplotlib
matplotlib
.
use
(
"
Agg
"
)
from
pylab
import
*
from
scipy
import
integrate
import
distinct_colours
as
colours
params
=
{
# 'axes.labelsize': 10,
# 'axes.titlesize': 10,
# 'text.fontsize': 12,
# 'legend.fontsize': 12,
# 'xtick.labelsize': 10,
# 'ytick.labelsize': 10,
'
axes.labelsize
'
:
9
,
'
axes.titlesize
'
:
9
,
'
text.fontsize
'
:
11
,
'
legend.fontsize
'
:
11
,
'
xtick.labelsize
'
:
9
,
'
ytick.labelsize
'
:
9
,
'
text.usetex
'
:
True
,
'
figure.figsize
'
:
(
7.2
,
3.15
),
'
figure.subplot.left
'
:
0.04
,
'
figure.subplot.right
'
:
0.99
,
'
figure.subplot.bottom
'
:
0.1
,
'
figure.subplot.top
'
:
0.99
,
'
figure.subplot.wspace
'
:
0.
,
'
figure.subplot.hspace
'
:
0.02
,
'
lines.markersize
'
:
6
,
'
lines.linewidth
'
:
3.
,
'
text.latex.unicode
'
:
True
}
rcParams
.
update
(
params
)
rc
(
'
font
'
,
**
{
'
family
'
:
'
sans-serif
'
,
'
sans-serif
'
:[
'
Times
'
]})
import
sys
import
os
from
scipy
import
stats
from
scipy
import
optimize
from
matplotlib.colors
import
colorConverter
from
matplotlib.ticker
import
MultipleLocator
,
FormatStrFormatter
from
matplotlib.patches
import
Polygon
from
matplotlib.patches
import
Rectangle
from
matplotlib
import
gridspec
CPU_TPS
=
2.67e9
/
1000
if
sys
.
argv
[
1
]
==
"
bh
"
:
data
=
loadtxt
(
"
output_bh_new.out
"
)
elif
sys
.
argv
[
1
]
==
"
fmm
"
:
data
=
loadtxt
(
"
output_fmm.out
"
)
t_type
=
data
[:,
0
]
t_thread
=
data
[:,
1
]
t_begin
=
data
[:,
2
]
/
CPU_TPS
t_end
=
data
[:,
3
]
/
CPU_TPS
# Correct for empty type...
t_type
[
t_type
==
4
]
=
5
t_type
[
t_type
==
3
]
=
4
# Recover some information
n_task
=
np
.
max
(
t_type
)
n_threads
=
np
.
max
(
t_thread
)
print
n_task
,
"
tasks using
"
,
n_threads
,
"
threads.
"
# Standardize the time
startTime
=
np
.
min
(
t_begin
)
t_begin
-=
startTime
t_end
-=
startTime
startTime
=
np
.
min
(
t_begin
)
endTime
=
np
.
max
(
t_end
)
print
"
t = [
"
,
startTime
,
"
-
"
,
endTime
,
"
] ms.
"
# Prepare for plots
colours
=
colours
.
get_distinct
(
12
)
colors
=
[
colours
[
1
],
colours
[
3
],
colours
[
6
],
colours
[
8
],
colours
[
11
],
colours
[
2
]]
labels
=
[
"
self
"
,
"
pair
"
,
"
m-poles
"
,
"
direct
"
,
"
CoM
"
,
"
Downpass
"
]
count
=
np
.
zeros
(
6
)
for
j
in
range
(
6
):
count
[
j
]
=
np
.
size
(
t_type
[
t_type
==
j
])
figure
()
gs
=
gridspec
.
GridSpec
(
2
,
1
,
height_ratios
=
[
1
,
6
])
# Plot the legend ........................
subplot
(
gs
[
0
])
xlim
(
0
,
6
)
ylim
(
0
,
1
)
for
i
in
range
(
6
):
gca
().
add_patch
(
Rectangle
(
(
0.1
+
i
,
0.1
),
0.8
,
0.8
,
facecolor
=
colors
[
i
],
edgecolor
=
'
k
'
,
lw
=
0.2
))
text
(
0.5
+
i
,
0.5
,
"
${
\\
rm %s~(%d)}$
"
%
(
labels
[
i
],
count
[
i
]),
ha
=
'
center
'
,
va
=
'
center
'
,
fontsize
=
8
)
gca
().
axison
=
False
# Now the actual plot ...................
subplot
(
gs
[
1
])
for
i
in
range
(
np
.
size
(
t_type
)):
#for i in range(100):
gca
().
add_patch
(
Rectangle
((
t_begin
[
i
],
t_thread
[
i
]
+
0.05
),
t_end
[
i
]
-
t_begin
[
i
],
0.9
,
facecolor
=
colors
[
int
(
t_type
[
i
])],
edgecolor
=
'
k
'
,
lw
=
0.2
))
# Remove axis
gca
().
spines
[
'
top
'
].
set_visible
(
False
)
gca
().
spines
[
'
right
'
].
set_visible
(
False
)
gca
().
get_xaxis
().
tick_bottom
()
gca
().
get_yaxis
().
tick_left
()
# Plot limits
ylim
(
0
,
n_threads
+
1
)
yticks
(
np
.
array
(
range
(
int
(
n_threads
)
+
1
))
+
0.5
,
np
.
array
(
range
(
int
(
n_threads
)
+
1
))
)
ylabel
(
"
${
\\
rm Thread~ID}$
"
,
labelpad
=
0.1
)
xlim
(
0
,
endTime
*
1.02
)
xlabel
(
"
${
\\
rm Wallclock~time~[ms]}$
"
,
labelpad
=
0.1
)
if
sys
.
argv
[
1
]
==
"
bh
"
:
savefig
(
"
taskGraph_bh.png
"
,
dpi
=
600
)
elif
sys
.
argv
[
1
]
==
"
fmm
"
:
savefig
(
"
taskGraph_fmm.png
"
,
dpi
=
600
)
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
register
or
sign in
to comment