#! /usr/bin/awk -f # $Id$ # awk script to extract timing information from FMS run protocol in a # format suitable for gnuplot. # most of this information is written bu FMS to stdout. # The line starting with ``real'' comes from the time command, which writes it to stderr. # When submitting jobs to loadleveler, the stderr file should be appended the stdout file # before processing with this script. Or redirect both into the same file # in the job description file. BEGIN { outpipe="sort -b -n -k2 -k1"; print("#npes diag_step concurrent ocean_npes atmos_npes ocean_layout_x ocean_layout_y memuse_max wallclock total Ocean Atmos cplClock Initial") | outpipe; } function printit(npes, diag_step, conc, oc_npes, at_npes, oc_l_x, oc_l_y, memuse, wallclock, total, Ocean, Atmos, cplClock, Init) { printf("%3d %4d %s %3d %3d %3d %3d %7.1f %11s %8.1f %8.1f %5.1f %7.1f %8.1f\n", npes, diag_step, conc, oc_npes, at_npes, oc_l_x, oc_l_y, memuse, wallclock, total, Ocean, Atmos, cplClock, Init) | outpipe; } /^[0-9]+ machines [0-9]+ nodes$/ { if (NR > 1) { printit(npes, diag_step, concurrent, ocean_npes, atmos_npes, ocean_layout_x, ocean_layout_y, memuse, wallclock, total, Ocean, Atmos, cplClock, Init); npes = diag_step = concurrent = ocean_npes = atmos_npes = ocean_layout_x = ocean_layout_y = memuse = wallclock = total = Ocean = Atmos = cplClock = Init = 0; } npes=$3; # print "#", FILENAME; } /Running with SERIAL coupling/ { concurrent = "f"; } /Running with CONCURRENT coupling/ { concurrent = "t"; } / DIAG_STEP/ { if (diag_step != 0 && diag_step != $3) { print("different DIAG_STEPs", diag_step, $3, "file", FILENAME, "line", FNR) > "/dev/stderr"; } diag_step = $3; } /Atmos PE range:/ { atmos_npes = $10 - $9 + 1; } /Ocean PE range:/ { ocean_npes = $10 - $9 + 1; } /LAYOUT += +[0-9]+, +[0-9]+/ { ocean_layout_x = $3; ocean_layout_y = $4; next; } /LAYOUT += 2[*]+[0-9]+/ { split($3, l, "*"); ocean_layout_x = l[2]; ocean_layout_y = l[2]; next; } /LAYOUT += / { print("unknown LAYOUT file ", FILENAME, " line ", FNR, $0) > "/dev/stderr"; next; } /Memuse/ { memuse = $6; } /^real\t/ { wallclock = $2; n = split($2, t, "[ms]"); if (2 == n) total=t[1] else if (3 == n) total=t[1]*60+t[2] else total=0; } /^Initialization / { Init = $3; } /^Ocean / { Ocean = $3; } /^Atmosphere / { Atmos = $3; } /^Land-ice-atm coupler / { cplClock = $4; } END { printit(npes, diag_step, concurrent, ocean_npes, atmos_npes, ocean_layout_x, ocean_layout_y, memuse, wallclock, total, Ocean, Atmos, cplClock, Init); }