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
15b38868
Commit
15b38868
authored
7 years ago
by
Peter W. Draper
Browse files
Options
Downloads
Patches
Plain Diff
Add -m and -r options to define the tic zero point and rank(s) to process
parent
d228d317
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!425
Clean up task and threadpool plotting scripts
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/plot_tasks.py
+35
-15
35 additions, 15 deletions
examples/plot_tasks.py
with
35 additions
and
15 deletions
examples/plot_tasks.py
+
35
−
15
View file @
15b38868
...
...
@@ -71,12 +71,23 @@ parser.add_argument("--nolegend", dest="nolegend",
parser
.
add_argument
(
"
-v
"
,
"
--verbose
"
,
dest
=
"
verbose
"
,
help
=
"
Show colour assignments and other details (def: False)
"
,
default
=
False
,
action
=
"
store_true
"
)
parser
.
add_argument
(
"
-r
"
,
"
--ranks
"
,
dest
=
"
ranks
"
,
help
=
"
Comma delimited list of ranks to process, if MPI in effect
"
,
default
=
None
,
type
=
str
)
parser
.
add_argument
(
"
-m
"
,
"
--mintic
"
,
dest
=
"
mintic
"
,
help
=
"
Value of the smallest tic (def: least in input file)
"
,
default
=-
1
,
type
=
int
)
args
=
parser
.
parse_args
()
infile
=
args
.
input
outbase
=
args
.
outbase
delta_t
=
args
.
limit
expand
=
args
.
expand
mintic
=
args
.
mintic
if
args
.
ranks
!=
None
:
ranks
=
[
int
(
item
)
for
item
in
args
.
ranks
.
split
(
'
,
'
)]
else
:
ranks
=
None
# Basic plot configuration.
PLOT_PARAMS
=
{
"
axes.labelsize
"
:
10
,
...
...
@@ -156,10 +167,11 @@ data = pl.loadtxt( infile )
# Do we have an MPI file?
full_step
=
data
[
0
,:]
if
full_step
.
size
==
13
:
print
"
MPI mode
"
print
"
#
MPI mode
"
mpimode
=
True
nranks
=
int
(
max
(
data
[:,
0
]))
+
1
print
"
Number of ranks:
"
,
nranks
if
ranks
==
None
:
ranks
=
range
(
int
(
max
(
data
[:,
0
]))
+
1
)
print
"
# Number of ranks:
"
,
len
(
ranks
)
rankcol
=
0
threadscol
=
1
taskcol
=
2
...
...
@@ -167,8 +179,8 @@ if full_step.size == 13:
ticcol
=
5
toccol
=
6
else
:
print
"
non MPI mode
"
n
ranks
=
1
print
"
#
non MPI mode
"
ranks
=
[
0
]
mpimode
=
False
rankcol
=
-
1
threadscol
=
0
...
...
@@ -180,10 +192,10 @@ else:
# Get CPU_CLOCK to convert ticks into milliseconds.
CPU_CLOCK
=
float
(
full_step
[
-
1
])
/
1000.0
if
args
.
verbose
:
print
"
CPU frequency:
"
,
CPU_CLOCK
*
1000.0
print
"
#
CPU frequency:
"
,
CPU_CLOCK
*
1000.0
nthread
=
int
(
max
(
data
[:,
threadscol
]))
+
1
print
"
Number of threads:
"
,
nthread
print
"
#
Number of threads:
"
,
nthread
# Avoid start and end times of zero.
sdata
=
data
[
data
[:,
ticcol
]
!=
0
]
...
...
@@ -194,25 +206,33 @@ sdata = sdata[sdata[:,toccol] != 0]
# precalculating this, unless the user knows better.
delta_t
=
delta_t
*
CPU_CLOCK
if
delta_t
==
0
:
for
rank
in
range
(
n
ranks
)
:
for
rank
in
ranks
:
if
mpimode
:
data
=
sdata
[
sdata
[:,
rankcol
]
==
rank
]
full_step
=
data
[
0
,:]
tic_step
=
int
(
full_step
[
ticcol
])
# Start and end times for this rank. Can be changed using the mintic
# option. This moves our zero time to other time. Useful for
# comparing to other plots.
if
mintic
<
0
:
tic_step
=
int
(
full_step
[
ticcol
])
else
:
tic_step
=
mintic
toc_step
=
int
(
full_step
[
toccol
])
dt
=
toc_step
-
tic_step
if
dt
>
delta_t
:
delta_t
=
dt
print
"
Data range:
"
,
delta_t
/
CPU_CLOCK
,
"
ms
"
print
"
#
Data range:
"
,
delta_t
/
CPU_CLOCK
,
"
ms
"
# Once more doing the real gather and plots this time.
for
rank
in
range
(
n
ranks
)
:
for
rank
in
ranks
:
if
mpimode
:
data
=
sdata
[
sdata
[:,
rankcol
]
==
rank
]
full_step
=
data
[
0
,:]
# Start and end times for this rank.
tic_step
=
int
(
full_step
[
ticcol
])
if
mintic
<
0
:
tic_step
=
int
(
full_step
[
ticcol
])
else
:
tic_step
=
mintic
toc_step
=
int
(
full_step
[
toccol
])
data
=
data
[
1
:,:]
typesseen
=
[]
...
...
@@ -220,7 +240,7 @@ for rank in range(nranks):
# Dummy image for ranks that have no tasks.
if
data
.
size
==
0
:
print
"
rank
"
,
rank
,
"
has no tasks
"
print
"
#
rank
"
,
rank
,
"
has no tasks
"
fig
=
pl
.
figure
()
ax
=
fig
.
add_subplot
(
1
,
1
,
1
)
ax
.
set_xlim
(
-
delta_t
*
0.01
/
CPU_CLOCK
,
delta_t
*
1.01
/
CPU_CLOCK
)
...
...
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