Commit ba7d7cdf authored by Peter W. Draper's avatar Peter W. Draper
Browse files

Change so that tasks are plotted with the full range of the step and the threadpool is offset

Previously worked the other way around, which is incorrect.

When given a range of 0 autorange the tasks and plot the threadpoool using the autoranged limits of the tasks
parent 5f2b67be
......@@ -55,7 +55,7 @@ parser.add_argument("input", help="Thread data file (-y output)")
parser.add_argument("outbase", help="Base name for output graphic files (PNG)")
parser.add_argument("-l", "--limit", dest="limit",
help="Upper time limit in millisecs (def: depends on data)",
default=0, type=int)
default=0, type=float)
parser.add_argument("-e", "--expand", dest="expand",
help="Thread expansion factor (def: 1)",
default=1, type=int)
......@@ -226,30 +226,35 @@ if delta_t == 0:
# Once more doing the real gather and plots this time.
for rank in ranks:
print "# Processing rank: ", rank
if mpimode:
data = sdata[sdata[:,rankcol] == rank]
full_step = data[0,:]
if mintic < 0:
tic_step = int(full_step[ticcol])
else:
tic_step = mintic
tic_step = int(full_step[ticcol])
toc_step = int(full_step[toccol])
print "# Min tic = ", tic_step
data = data[1:,:]
typesseen = []
nethread = 0
# 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)
ax.set_ylim(0, nthread*expand)
start_t = tic_step
if mintic < 0:
start_t = tic_step
else:
start_t = mintic
end_t = (toc_step - start_t) / CPU_CLOCK
else:
start_t = float(tic_step)
if mintic < 0:
start_t = float(tic_step)
else:
start_t = float(mintic)
data[:,ticcol] -= start_t
data[:,toccol] -= start_t
end_t = (toc_step - start_t) / CPU_CLOCK
......@@ -333,7 +338,12 @@ for rank in ranks:
ax.set_position([box.x0, box.y0, box.width, box.height*0.8])
# Start and end of time-step
ax.plot([0, 0], [0, nethread + nrow + 1], 'k--', linewidth=1)
if mintic < 0:
ax.plot([0, 0], [0, nethread + nrow + 1], 'k--', linewidth=1)
else:
print tic_step, mintic, tic_step - mintic
real_start = tic_step - mintic
ax.plot([real_start, real_start], [0, nethread + nrow + 1], 'k--', linewidth=1)
ax.plot([end_t, end_t], [0, nethread + nrow + 1], 'k--', linewidth=1)
ax.set_xlabel("Wall clock time [ms]")
......
......@@ -45,7 +45,7 @@ parser.add_argument("input", help="Threadpool data file (-Y output)")
parser.add_argument("outpng", help="Name for output graphic file (PNG)")
parser.add_argument("-l", "--limit", dest="limit",
help="Upper time limit in millisecs (def: depends on data)",
default=0, type=int)
default=0, type=float)
parser.add_argument("-e", "--expand", dest="expand",
help="Thread expansion factor (def: 1)",
default=1, type=int)
......@@ -61,12 +61,16 @@ 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("-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
outpng = args.outpng
delta_t = args.limit
expand = args.expand
mintic = args.mintic
# Basic plot configuration.
PLOT_PARAMS = {"axes.labelsize": 10,
......@@ -136,10 +140,12 @@ threads = pl.array(threads)
chunks = pl.array(chunks)
# Recover the start and end time
tic_step = min(tics)
mintic_step = min(tics)
tic_step = mintic_step
toc_step = max(tocs)
print "# Min tic = ", tic_step
print "# Max toc = ", toc_step
print "# Min tic = ", mintic_step
if mintic > 0:
tic_step = mintic
# Calculate the time range, if not given.
delta_t = delta_t * CPU_CLOCK
......@@ -249,7 +255,9 @@ if not args.nolegend:
ax.set_position([box.x0, box.y0, box.width, box.height*0.8])
# Start and end of time-step
ax.plot([0, 0], [0, nthread + nrow + 1], 'k--', linewidth=1)
real_start_t = (mintic_step - tic_step)/ CPU_CLOCK
ax.plot([real_start_t, real_start_t], [0, nthread + nrow + 1], 'k--', linewidth=1)
ax.plot([end_t, end_t], [0, nthread + nrow + 1], 'k--', linewidth=1)
ax.set_xlabel("Wall clock time [ms]", labelpad=0.)
......
......@@ -9,12 +9,18 @@ step="$4"
# Locate script.
SCRIPTHOME=$(dirname "$0")
# Process threadpool and capture minimum tic.
result=$(${SCRIPTHOME}/plot_threadpool.py --expand 1 --limit $range \
--width 16 --height 4 $poolfile poolstep${step}r)
# Process tasks and capture minimum tic from start of step and the data
# range, if appropriate.
result=$(${SCRIPTHOME}/plot_tasks.py --expand 1 --limit $range \
--width 16 --height 4 $taskfile taskstep${step}r)
echo "$result"
mintic=$(echo "$result" | grep 'Min tic'|awk '{print $5}')
mintic=$(echo "$result" | grep 'Min tic'| awk '{print $5}')
echo "range: $range"
if test $range -eq 0; then
range=$(echo "$result" | grep 'Data range:' | awk '{print $4}')
echo "new range: $range"
fi
${SCRIPTHOME}/plot_threadpool.py --expand 1 --mintic $mintic --limit $range \
--width 16 --height 4 $poolfile poolstep${step}r
${SCRIPTHOME}/plot_tasks.py --mintic $mintic --expand 1 --limit $range \
--width 16 --height 4 $taskfile taskstep${step}r
exit
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment