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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SWIFT
SWIFTsim
Commits
e275cf4d
Commit
e275cf4d
authored
9 years ago
by
Peter W. Draper
Browse files
Options
Downloads
Patches
Plain Diff
One more attempt at colour selection
parent
27a98593
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!136
Master
,
!70
Include parallel sort tasks in task dump and add support for MPI dumps
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/plot_tasks_MPI.py
+41
-45
41 additions, 45 deletions
examples/plot_tasks_MPI.py
with
41 additions
and
45 deletions
examples/plot_tasks_MPI.py
+
41
−
45
View file @
e275cf4d
...
@@ -58,49 +58,37 @@ params = {"axes.labelsize": 10,
...
@@ -58,49 +58,37 @@ params = {"axes.labelsize": 10,
}
}
pl
.
rcParams
.
update
(
params
)
pl
.
rcParams
.
update
(
params
)
types
=
{
"
0
"
:
"
none
"
,
# Tasks and subtypes. Indexed as in tasks.h.
"
1
"
:
"
sort
"
,
types
=
[
"
none
"
,
"
sort
"
,
"
self
"
,
"
pair
"
,
"
sub
"
,
"
ghost
"
,
"
kick1
"
,
"
kick2
"
,
"
2
"
:
"
self
"
,
"
send
"
,
"
recv
"
,
"
grav_pp
"
,
"
grav_mm
"
,
"
grav_up
"
,
"
grav_down
"
,
"
3
"
:
"
pair
"
,
"
psort
"
,
"
split_cell
"
,
"
rewait
"
,
"
count
"
]
"
4
"
:
"
sub
"
,
"
5
"
:
"
ghost
"
,
taskcolours
=
{
"
none
"
:
"
black
"
,
"
6
"
:
"
kick1
"
,
"
sort
"
:
"
lightblue
"
,
"
7
"
:
"
kick2
"
,
"
self
"
:
"
greenyellow
"
,
"
8
"
:
"
send
"
,
"
pair
"
:
"
navy
"
,
"
9
"
:
"
recv
"
,
"
sub
"
:
"
hotpink
"
,
"
10
"
:
"
grav_pp
"
,
"
ghost
"
:
"
cyan
"
,
"
11
"
:
"
grav_mm
"
,
"
kick1
"
:
"
maroon
"
,
"
12
"
:
"
grav_up
"
,
"
kick2
"
:
"
green
"
,
"
13
"
:
"
grav_down
"
,
"
send
"
:
"
yellow
"
,
"
14
"
:
"
psort
"
,
"
recv
"
:
"
magenta
"
,
"
15
"
:
"
split_cell
"
,
"
grav_pp
"
:
"
mediumorchid
"
,
"
16
"
:
"
rewait
"
,
"
grav_mm
"
:
"
mediumturquoise
"
,
"
17
"
:
"
count
"
}
"
grav_up
"
:
"
mediumvioletred
"
,
"
grav_down
"
:
"
mediumnightblue
"
,
subtypes
=
{
"
0
"
:
"
none
"
,
"
psort
"
:
"
steelblue
"
,
"
1
"
:
"
density
"
,
"
split_cell
"
:
"
seagreen
"
,
"
2
"
:
"
force
"
,
"
rewait
"
:
"
olive
"
,
"
3
"
:
"
grav
"
,
"
count
"
:
"
powerblue
"
}
"
4
"
:
"
count
"
}
subtypes
=
[
"
none
"
,
"
density
"
,
"
force
"
,
"
grav
"
,
"
count
"
]
# Assign colours for all types.
subtypecolours
=
{
"
none
"
:
"
black
"
,
#colours = ["blue","green","red","cyan","magenta","yellow","black"]
"
density
"
:
"
red
"
,
#colours = colours + list(matplotlib.colors.cnames)
"
force
"
:
"
blue
"
,
colours
=
list
(
matplotlib
.
colors
.
cnames
)
"
grav
"
:
"
indigo
"
,
"
count
"
:
"
purple
"
}
index
=
0
subtypecolours
=
{}
for
key
in
subtypes
:
subtypecolours
[
subtypes
[
key
]]
=
colours
[
index
]
print
subtypes
[
key
],
"
=
"
,
colours
[
index
]
index
=
index
+
1
taskcolours
=
{}
for
key
in
types
:
taskcolours
[
types
[
key
]]
=
colours
[
index
]
print
types
[
key
],
"
=
"
,
colours
[
index
]
index
=
index
+
1
# Read input.
# Read input.
data
=
pl
.
loadtxt
(
infile
)
data
=
pl
.
loadtxt
(
infile
)
...
@@ -110,6 +98,7 @@ print "Number of ranks:", nranks
...
@@ -110,6 +98,7 @@ print "Number of ranks:", nranks
if
rank
<
0
or
rank
>=
nranks
:
if
rank
<
0
or
rank
>=
nranks
:
print
"
Cannot read rank:
"
,
rank
,
"
, out of range
"
print
"
Cannot read rank:
"
,
rank
,
"
, out of range
"
sys
.
exit
(
1
)
sys
.
exit
(
1
)
print
"
Processing rank:
"
,
rank
nthread
=
int
(
max
(
data
[:,
1
]))
+
1
nthread
=
int
(
max
(
data
[:,
1
]))
+
1
print
"
Number of threads:
"
,
nthread
print
"
Number of threads:
"
,
nthread
...
@@ -135,14 +124,16 @@ num_lines = pl.size(sdata) / 10
...
@@ -135,14 +124,16 @@ num_lines = pl.size(sdata) / 10
for
line
in
range
(
num_lines
):
for
line
in
range
(
num_lines
):
thread
=
int
(
sdata
[
line
,
1
])
thread
=
int
(
sdata
[
line
,
1
])
tasks
[
thread
].
append
({})
tasks
[
thread
].
append
({})
tasks
[
thread
][
-
1
][
"
type
"
]
=
types
[
str
(
int
(
sdata
[
line
,
2
])
)
]
tasks
[
thread
][
-
1
][
"
type
"
]
=
types
[
int
(
sdata
[
line
,
2
])]
tasks
[
thread
][
-
1
][
"
subtype
"
]
=
subtypes
[
str
(
int
(
sdata
[
line
,
3
])
)
]
tasks
[
thread
][
-
1
][
"
subtype
"
]
=
subtypes
[
int
(
sdata
[
line
,
3
])]
tic
=
int
(
sdata
[
line
,
5
])
/
CPU_CLOCK
*
1000
tic
=
int
(
sdata
[
line
,
5
])
/
CPU_CLOCK
*
1000
toc
=
int
(
sdata
[
line
,
6
])
/
CPU_CLOCK
*
1000
toc
=
int
(
sdata
[
line
,
6
])
/
CPU_CLOCK
*
1000
tasks
[
thread
][
-
1
][
"
tic
"
]
=
tic
tasks
[
thread
][
-
1
][
"
tic
"
]
=
tic
tasks
[
thread
][
-
1
][
"
toc
"
]
=
toc
tasks
[
thread
][
-
1
][
"
toc
"
]
=
toc
tasks
[
thread
][
-
1
][
"
t
"
]
=
(
toc
+
tic
)
/
2
tasks
[
thread
][
-
1
][
"
t
"
]
=
(
toc
+
tic
)
/
2
print
"
Collection done...
"
combtasks
=
{}
combtasks
=
{}
combtasks
[
-
1
]
=
[]
combtasks
[
-
1
]
=
[]
for
i
in
range
(
nthread
):
for
i
in
range
(
nthread
):
...
@@ -169,6 +160,8 @@ for thread in range(nthread):
...
@@ -169,6 +160,8 @@ for thread in range(nthread):
else
:
else
:
combtasks
[
thread
][
-
1
][
"
toc
"
]
=
task
[
"
toc
"
]
combtasks
[
thread
][
-
1
][
"
toc
"
]
=
task
[
"
toc
"
]
print
"
Combination done...
"
typesseen
=
[]
typesseen
=
[]
for
i
in
range
(
nthread
):
for
i
in
range
(
nthread
):
for
task
in
combtasks
[
i
]:
for
task
in
combtasks
[
i
]:
...
@@ -193,3 +186,6 @@ pl.yticks(pl.array(range(nthread)) + 0.5, pl.array(range(nthread)))
...
@@ -193,3 +186,6 @@ pl.yticks(pl.array(range(nthread)) + 0.5, pl.array(range(nthread)))
pl
.
show
()
pl
.
show
()
pl
.
savefig
(
outpng
)
pl
.
savefig
(
outpng
)
print
"
Graphics done, output written to
"
,
outpng
sys
.
exit
(
0
)
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