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

Merge branch 'html_anchors' into 'master'

Add HTML anchors to the different sections of the task plot webpage.

Closes #628

See merge request !980
parents c3cf5c82 fe2065f5
......@@ -7,5 +7,5 @@ then
./getIC.sh
fi
../../swift --cosmology --hydro --self-gravity --stars --threads=16 eagle_6.yml 2>&1 | tee output.log
../../swift --hydro --threads=4 -n 16 -y 1 eagle_6.yml 2>&1 | tee output.log
......@@ -57,9 +57,17 @@ parser.add_argument(
default="all",
action="store",
)
parser.add_argument(
"--html",
dest="html",
help="Use html titles and anchors in the output (default: False)",
default=False,
action="store_true",
)
args = parser.parse_args()
infile = args.input
with_html = args.html
# Tasks and subtypes. Indexed as in tasks.h.
TASKTYPES = [
......@@ -301,6 +309,8 @@ for rank in ranks:
sidtimes[my_sid] = []
sidtimes[my_sid].append(dt)
if with_html:
print('<div id="thread{}"></div>'.format(i))
print("# Thread : ", i)
for key in sorted(tasktimes.keys()):
taskmin = min(tasktimes[key])
......@@ -319,6 +329,8 @@ for rank in ranks:
)
print()
if with_html:
print('<div id="all"></div>')
print("# All threads : ")
for key in sorted(alltasktimes.keys()):
taskmin = min(alltasktimes[key])
......@@ -338,6 +350,8 @@ for rank in ranks:
print()
# For pairs, show stuff sorted by SID
if with_html:
print('<div id="sid"></div>')
print("# By SID (all threads): ")
print(
"# {0:<17s}: {1:>7s} {2:>9s} {3:>9s} {4:>9s} {5:>9s} {6:>9s}".format(
......@@ -375,6 +389,8 @@ for rank in ranks:
# Dead times.
print("# Times not in tasks (deadtimes)")
print("# ------------------------------")
if with_html:
print('<div id="before"></div>')
print("# Time before first task:")
print("# no. : {0:>9s} {1:>9s}".format("value", "percent"))
predeadtimes = []
......@@ -410,6 +426,8 @@ for rank in ranks:
)
print()
if with_html:
print('<div id="after"></div>')
print("# Time after last task:")
print("# no. : {0:>9s} {1:>9s}".format("value", "percent"))
postdeadtimes = []
......@@ -446,6 +464,8 @@ for rank in ranks:
print()
# Time in engine, i.e. from first to last tasks.
if with_html:
print('<div id="between"></div>')
print("# Time between tasks (engine deadtime):")
print(
"# no. : {0:>9s} {1:>9s} {2:>9s} {3:>9s} {4:>9s} {5:>9s}".format(
......@@ -503,6 +523,8 @@ for rank in ranks:
print()
# All times in step.
if with_html:
print('<div id="dead"></div>')
print("# All deadtimes:")
print(
"# no. : {0:>9s} {1:>9s} {2:>9s} {3:>9s} {4:>9s} {5:>9s}".format(
......
......@@ -49,9 +49,17 @@ parser.add_argument(
default=False,
action="store_true",
)
parser.add_argument(
"--html",
dest="html",
help="Use html titles and anchors in the output (default: False)",
default=False,
action="store_true",
)
args = parser.parse_args()
infile = args.input
with_html = args.html
# Read header. First two lines.
with open(infile) as infid:
......@@ -145,6 +153,8 @@ for i in threadids:
alltasktimes[key] = []
alltasktimes[key].append(dt)
if with_html:
print('<div id="thread{}"></div>'.format(i))
print("# Thread : ", i)
for key in sorted(tasktimes.keys()):
taskmin = min(tasktimes[key])
......@@ -163,6 +173,8 @@ for i in threadids:
)
print()
if with_html:
print('<div id="all"></div>')
print("# All threads : ")
for key in sorted(alltasktimes.keys()):
taskmin = min(alltasktimes[key])
......@@ -184,6 +196,8 @@ print()
# Dead times.
print("# Times not in tasks (deadtimes)")
print("# ------------------------------")
if with_html:
print('<div id="before"></div>')
print("# Time before first task:")
print("# no. : {0:>9s} {1:>9s}".format("value", "percent"))
predeadtimes = []
......@@ -216,6 +230,8 @@ print(
)
print()
if with_html:
print('<div id="after"></div>')
print("# Time after last task:")
print("# no. : {0:>9s} {1:>9s}".format("value", "percent"))
postdeadtimes = []
......@@ -249,6 +265,8 @@ print(
print()
# Time in threadpool, i.e. from first to last tasks.
if with_html:
print('<div id="between"></div>')
print("# Time between tasks (threadpool deadtime):")
print(
"# no. : {0:>9s} {1:>9s} {2:>9s} {3:>9s} {4:>9s} {5:>9s}".format(
......@@ -303,6 +321,8 @@ print(
print()
# All times in step.
if with_html:
print('<div id="dead"></div>')
print("# All deadtimes:")
print(
"# no. : {0:>9s} {1:>9s} {2:>9s} {3:>9s} {4:>9s} {5:>9s}".format(
......
......@@ -60,7 +60,7 @@ done
# And process them,
echo "Processing thread info files..."
echo $list | xargs -P $NPROCS -n 3 /bin/bash -c "${SCRIPTHOME}/plot_tasks.py --expand 1 --limit $TIMERANGE --width 16 --height 4 \$0 \$2 "
echo $list | xargs -P $NPROCS -n 3 /bin/bash -c "${SCRIPTHOME}/analyse_tasks.py \$0 > \$2.stats"
echo $list | xargs -P $NPROCS -n 3 /bin/bash -c "${SCRIPTHOME}/analyse_tasks.py --html \$0 > \$2.stats"
echo "Writing output index.html file"
# Construct document - serial.
......@@ -88,6 +88,7 @@ EOF
<img src="step${s}r${i}.png">
<pre>
EOF
echo "<nav>Jump to: <a href="#all">all threads</a> <a href="#dead">dead times</a></nav>" >> step${s}r${i}.html
cat step${s}r${i}.stats >> step${s}r${i}.html
cat <<EOF >> step${s}r${i}.html
</body>
......
......@@ -66,7 +66,7 @@ nrank=$(($nrank-1))
echo "Processing thread info files..."
echo $list | xargs -P $NPROCS -n 3 /bin/bash -c "${SCRIPTHOME}/plot_tasks.py --expand 1 --limit $TIMERANGE \$0 \$2 "
for i in $(seq 0 $nrank); do
echo $list | xargs -P $NPROCS -n 3 /bin/bash -c "${SCRIPTHOME}/analyse_tasks.py -r $i \$0 > \$2${i}.stats"
echo $list | xargs -P $NPROCS -n 3 /bin/bash -c "${SCRIPTHOME}/analyse_tasks.py -r $i --html \$0 > \$2${i}.stats"
done
echo "Writing output index.html file"
......@@ -110,6 +110,7 @@ EOF3
<img src="step${s}r${i}.png">
<pre>
EOF2
echo "<nav>Jump to: <a href="#all">all threads</a> <a href="#dead">dead times</a></nav>" >> step${s}r${i}.html
cat step${s}r${i}.stats >> step${s}r${i}.html
cat <<EOF2 >> step${s}r${i}.html
</pre>
......
......@@ -65,7 +65,7 @@ done
# And process them,
echo "Processing threadpool info files..."
echo $list | xargs -P $NPROCS -n 3 /bin/bash -c "${SCRIPTHOME}/plot_threadpool.py --expand 1 --limit $TIMERANGE --width 16 --height 4 \$0 \$2 "
echo $list | xargs -P $NPROCS -n 3 /bin/bash -c "${SCRIPTHOME}/analyse_threadpool_tasks.py \$0 > \$2.stats"
echo $list | xargs -P $NPROCS -n 3 /bin/bash -c "${SCRIPTHOME}/analyse_threadpool_tasks.py \$0 --html > \$2.stats"
echo "Writing output threadpool-index.html file"
# Construct document - serial.
......
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