Document Title: utility.txt Subject: Utility Programs that ship with the HPC2002 suite Last updated: 2002 08 10 wj (To check for possible updates to this document, please see http://www.spec.org/hpg/hpc2002 ) ------------------------------------------------------------------------ Contents -------- Introduction extract_config extract_raw go (Unix only) printkids.pl relocate (Unix only) rawformat specdiff specinvoke specmake Introduction ------------ This document describes various useful utilities that ship with SPEC HPC2002. It is assumed that you have already read config.txt. extract_config -------------- If you have a rawfile, you can extract the config file that was used with it. For example, starting with a freshly-installed SPEC HPC2002 directory tree: % runspec --config=Tru64_Unix --size=test --iterations=1 \ --tuning=peak --output_format=ps wrf_m > /dev/null % cd result % ls HPC2002.001.ps HPC2002.001.raw log.001 log.lock Note that we have just the single result. Let's make a temporary directory and copy the rawfile there: % mkdir tmp % cd tmp % cp ../HPC2002.001.raw . % ls HPC2002.001.raw Now, attempt to extract the config file: % extract_config HPC2002.001.raw > tmp.cfg Does the extracted file match the original? % diff ../../config/Tru64_Unix.cfg ./tmp.cfg 0a1,3 > # Invocation command line: > # /hpc2002/kit96/bin/runspec --config=Tru64_Unix --size=test --iterations=1 --tuning=peak --output_format=ps wrf_m > ############################################################################ 96,102d98 < < __MD5__ < 361.wrf_m=peak=oct6a=default: < # Last updated Wed Dec 15 10:05:06 2001 < optmd5=764e8d466d967f5dacae93415dbfbe71 < exemd5=d7cccb73a236bbe7a548385ee4eff137 < % Yes. The only differences are: - The copy in the rawfile adds a comment to tell you how the config file was invoked. - The original copy (in $SPEC/config) has the MD5 information for swim. (The config file is tucked away into the rawfile prior to any additions that are needed for MD5.) extract_raw ----------- If you have a pdf, html, or ps output file, you can extract the rawfile that was used to generate it. For example: % ls HPC2002.001.ps HPC2002.001.raw log.001 log.lock % mkdir tmp % cd tmp % cp ../*ps . % ls HPC2002.001.ps Note that at this point we have just the postscript output in the current directory. Now, attempt to extract the raw file: % extract_raw *ps % ls HPC2001.001.ps HPC2002.001.raw Does the extracted file match the original? % diff ../HPC2002.001.raw ./HPC2002.001.raw % Yes. go (Unix only) -------------- When you source the shrc, as described in $SPEC/docs/runspec.txt, the 'go' shell alias is created. Note: if you leave the shell where you sourced shrc, for example by spawning csh, the alias is no longer available! So if you want to use this alias, use a Bourne-compatible shell. For those of you who will have it, here are the various things it understands, as well as the places they'll take you. $SPEC is your top-level directory. They're awfully handy. If you say You'll end up in ---------- ------------------------------------------------------------- go $SPEC go top $SPEC go bin $SPEC/bin (where the tools live) go config $SPEC/config go result $SPEC/result go results $SPEC/result go doc $SPEC/docs go docs $SPEC/docs go hpc $SPEC/benchspec/HPC2002 go src foo foo's src directory, if it can be found. For example: go src 351 $SPEC/benchspec/HPC2002/351.seis_m/src go src wrf_m $SPEC/benchspec/HPC2002/361.wrf_m/src go src nada . (There's no benchmark named *nada*) go work foo foo's run directory, if it can be found. For example: go work 351 $SPEC/benchspec/HPC2002/351.seis_m/run go work wrf_m $SPEC/benchspec/HPC2002/361.wrf_m/run go work nada . (There's no benchmark named *nada*) go data foo foo's data directory, if it can be found. For example: go data 351 $SPEC/benchspec/HPC2002/351.seis_m/data go data wrf_m $SPEC/benchspec/HPC2002/361.wrf_m/data go data nada . (There's no benchmark named *nada*) go foo foo's top level directory, if it can be found. For example: go 351 $SPEC/benchspec/HPC2002/351.seis_m go wrf_m $SPEC/benchspec/HPC2002/361.wrf_m go nada . (There's no benchmark named *nada*) printkids.pl ------------ Some benchmark executables are invoked multiple times. If you'd like to know how much time was spent on each invocation, it may not be easy to tell. You could examine "speccmds.out", but that file is not easy to interpret: $ go work wrf_m $ cat list | fold -s 00000001 dir=/hpc2002/kit92/benchspec/HPC2002/177.gcc/run/00000001 ext=nov11c_ns lock=0 mach=default size=ref tune=base type=run username=john __END__ $ cd *01 $ $ cat speccmds.out | fold -s running commands in speccmds.cmd 1 times runs started at 943371319, 399184000, Tue Nov 23 10:35:19 2001 run 1 started at 943371319, 399184000, Tue Nov 23 10:35:19 2001 child started: 0, 943371319, 400160000, 11128, '../00000001/cc1_base.nov11c_ns 166.i -o 166.s' child finished: 0, 943371519, 814960000, 200, 414800000, 11128, 0 child started: 0, 943371519, 815936000, 11135, '../00000001/cc1_base.nov11c_ns 200.i -o 200.s' child finished: 0, 943371854, 339648000, 334, 523712000, 11135, 0 child started: 0, 943371854, 339648000, 11154, '../00000001/cc1_base.nov11c_ns expr.i -o expr.s' child finished: 0, 943371892, 803248000, 38, 463600000, 11154, 0 child started: 0, 943371892, 803248000, 11126, '../00000001/cc1_base.nov11c_ns integrate.i -o integrate.s' child finished: 0, 943371939, 571936000, 46, 768688000, 11126, 0 child started: 0, 943371939, 571936000, 11146, '../00000001/cc1_base.nov11c_ns scilab.i -o scilab.s' child finished: 0, 943372136, 993568000, 197, 421632000, 11146, 0 run 1 finished at: 943372136, 993568000, Tue Nov 23 10:48:56 2001 run 1 elapsed time: 817, 594384000, 817.594384000 runs finished at 943372136, 993568000, Tue Nov 23 10:48:56 2001 runs elapsed time: 817, 594384000, 817.594384000 Fortunately, SPEC has provided a tool to interpret the above for you: $ printkids.pl Seconds Command 200.41 cc1_base.nov11c_ns 166.i -o 166.s 334.52 cc1_base.nov11c_ns 200.i -o 200.s 38.46 cc1_base.nov11c_ns expr.i -o expr.s 46.77 cc1_base.nov11c_ns integrate.i -o integrate.s 197.42 cc1_base.nov11c_ns scilab.i -o scilab.s ========= 817.59 Total by adding children 817.59 Total according to speccmds.out $ relocate (Unix only) -------------------- If you rearrange mount points or rename your SPEC root directory, you will probably find confusing problems like the one in the example that follows. We used to have a working SPEC tree under /hpc2002/kit96, but we're going to change that: $ cd /hpc2002 $ mv kit96 larry $ cd larry $ . ./shrc $ runspec -h ksh: runspec: cannot execute The problem is that the first line of runspec points to a path that no longer exists: $ head -1 bin/runspec #!/hpc2002/kit96/bin/specperl $ Fortunately, SPEC has provided a tool to relocate the tools in the new tree: $ bin/relocate Top of SPEC tree is '/hpc2002/larry' $ runspec -h | head -3 runspec v2.00 - Copyright (C) 2001 Standard Performance Evaluation Corporation Usage: bin/runspec [options] LIMITATIONS: there are some limitations to this tool. Most notably, it uses perl, so if the tree has been re-arranged in such a way that perl has an identity crisis and can't find itself, you'll be in trouble. Make sure that you have sourced shrc, as in the next example; if it still fails, check $SPEC/docs/techsupport.txt for information on troubleshooting libperl.so: $ mv larry carol $ cd carol $ bin/relocate Top of SPEC tree is '/hpc2002/carol' 1062:/hpc2002/carol/bin/specperl: /sbin/loader: Fatal Error: cannot map libperl.so $ . ./shrc $ bin/relocate Top of SPEC tree is '/hpc2002/carol' $ runspec -h | head -2 runspec v2.00 - Copyright (C) 2001 Standard Performance Evaluation Corporation Usage: bin/runspec [options] $ rawformat --------- "rawformat" is simply another name for runspec --rawformat so please see runspec.txt for basic information on using this command. But a couple of additional points are worth mentioning: 1) What do you do when Marketing decides to change the name from "SuperHero 4" to "SuperHero IV" just before you submit the results to SPEC? SPEC does allow you to edit the rawfile to make corrections. Just make sure that you only edit the fields located before the "fence": # =============== do not edit below this point =================== WARNING: Make a backup copy of the rawfile first! For example: copy HPC2002.001.raw new.raw (edit new.raw to make your changes) rawformat -o ps new.raw runspec v2.00 - Copyright (C) 2001 Standard Performance Evaluation Corporation Loading standard modules.............. Loading runspec modules............. Identifying output formats...asc...config...html...pdf...ps...raw... Formatting new.raw format: PostScript -> new.ps specdiff -------- In order to decide whether your system got the correct answer for a benchmark, runspec writes a file called "compare.cmd" in the run directory, and then calls specinvoke, which calls specdiff. (The specinvoke utility is described later in this document.) Suppose that your results are flagged as incorrect, but you'd like to have more detail. You could look ask for more than 10 lines of detail by changing the "-l 10" to something else. For example, a file chock-full of wrong answers for ammp has been created by hand. First, let's see how specdiff would normally be run (line wraps added for readability): $ specinvoke -c 1 -f compare.cmd -n /hpc2002/kit96/bin/specdiff -m -l 10 -a 0.0001 -r 0.003 /hpc2002/kit96/benchspec/HPC2002/188.ammp/data/test/output/ammp.out ammp.out > ammp.out.cmp The above says that normally we test for correct answers by comparing data/test/output/ammp.out to ammp.out in the current directory. Normally, 10 lines of detail are printed. Let's change that to 15 lines, and compare versus our intentionally wrong file instead: $ /hpc2002/kit96/bin/specdiff -m -l 15 -a 0.0001 -r 0.003 \ /hpc2002/kit96/benchspec/HPC2002/188.ammp/data/test/output/ammp.out \ ammp.wrong_output 0002: setf mxdq 0.75; setf mxdq 01.75; ^ 0003: setf mmbox 10.; setf mmbox 101.; ^ 0006: setf bbox 35.; setf bbox 351.; ^ 0009: 0.000000 unknown potential type 01.000000 unknown potential type ^ 0010: 1181.693079 bond energy 11811.693079 bond energy ^ 0011: 2056.767980 angle energy 20561.767980 angle energy ^ 0012: 61.501074 hybrid energy 611.501074 hybrid energy ^ 0013: 533.960821 torsion energy 5331.960821 torsion energy ^ 0014: -15410.005122 non-bonded energy -154101.005122 non-bonded energy ^ 0015: -11576.082168 total potential energy -115761.082168 total potential energy ^ 0016: 8584.512662 total kinetic energy 85841.512662 total kinetic energy ^ 0017: -2991.569506 total energy -29911.569506 total energy ^ 0018: 20160.594829 total action 201601.594829 total action ^ 0020: tpac numstp .00001 temp; tpac numstp 1.00001 temp; ^ 0022: 0.000000 unknown potential type 01.000000 unknown potential type ^ 0023: 1184.181101 bond energy 11841.181101 bond energy ^ $ Here are the switches supported by specdiff: $ specdiff -h Usage: /hpc2002/kit96/bin/specdiff [-l #] [-q] file1 [file2] -l # of lines of differences to print -q don't print lines just set return code -a absolute tolerance (for floating point compares) -r relative tolerance (for floating point compares) -t set calctol -s set skiptol -o allow off-by-one errors -O *don't* allow off-by-one errors -m write file2.mis with miscompares -c collapse whitespace (doesn't do what you think it does) -C *don't* collapse whitespace -d Compare against file(s) in data directory --os Set the operating system type (you don't need to do this) -v Set the level of noisiness for the output -h Print this message $ specinvoke ---------- In order to run a benchmark, runspec writes a series of commands in the run directory, in the file "speccmds.cmd". These commands are then interpreted by specinvoke. When something goes wrong, it is often useful to try the commands by hand. Ask specinvoke what it did, by using the "-n" switch: $ go work swim_m $ cd 00000002 $ ls SWIM7 compare.out swim.err swim_peak.oct6a SWIM7.cmp speccmds.cmd swim.in compare.cmd speccmds.err swim.out compare.err speccmds.out swim.out.cmp $ specinvoke -n ../00000002/swim_peak.oct6a < swim.in > swim.out 2> swim.err $ In the above example, we see how swim is invoked. If you wanted to enter your own variations on the above command by hand, you could do so. Here are the switches supported by specinvoke: $ specinvoke -h Usage: specinvoke [options] [instructionfile] -i # iterations -c # concurrent processes (overrides -u in command file) -E return non-zero exit code if child does -s shell shell to invoke -f file instruction file -o file output file -e file error file -d dir change to dir first -n[n] print a 'dry_run' of commands -A return 0 error code -h this message specmake -------- To build a benchmark, runspec uses specmake, which is simply gnu make under a unique name to avoid possible conflicts with other versions of make on your system. If a benchmark build fails, the most massively useful thing you can do is to ask specmake what it did, by using the "-n" switch for dry run. For example, let's create a config file that is unlikely to work: $ cat >tmp.cfg ext = silly FC = f66 $ and try it out: $ runspec --config=tmp --tuning=base --action=build swim_m runspec v2.00 - Copyright (C) 2001 Standard Performance Evaluation Corporation Loading standard modules.............. Loading runspec modules............. Identifying output formats...asc...config...html...pdf...ps...raw... We will use: 312.swim_m Compiling Binaries Building 312.swim_m ref base silly default Error with make 'specmake build > make.out 2> make.err': check file '/hpc2002/kit96/benchspec/HPC2002/312.swim_m/run/00000004/make.err' Error with make! *** Error building 312.swim_m If you wish to ignore this error, please use '-I' or ignore errors. $ Sure enough, it failed. Let's find the appropriate run directory where our silly build was attempted: $ go run swim_m $ grep build list | grep silly | cut -b 1-9 00000004 $ cd 00000004 And ask specmake just exactly what it generated: $ specmake -n f66 -c -o swim.o swim.f f66 swim.o -o swim OK, let's enter the command by hand: $ f66 -c -o swim.o swim.f ksh: f66: not found $ A great convenience of the HPC2002 suite is the fact that you can now proceed to play with all the files in this run directory, to prototype different changes and try out ideas, without fear that you will break anything. As long as you confine your edits to (in this example) $SPEC/benchspec/HPC2002/312.swim_m/run/00000004/, you are in a private sandbox and will not harm the original sources. Here are the switches supported by specmake: $ specmake -h Usage: specmake [options] [target] ... Options: -b, -m Ignored for compatibility. -C DIRECTORY, --directory=DIRECTORY Change to DIRECTORY before doing anything. -d, --debug Print lots of debugging information. -e, --environment-overrides Environment variables override makefiles. -f FILE, --file=FILE, --makefile=FILE Read FILE as a makefile. -h, --help Print this message and exit. -i, --ignore-errors Ignore errors from commands. -I DIRECTORY, --include-dir=DIRECTORY Search DIRECTORY for included makefiles. -j [N], --jobs[=N] Allow N jobs at once; infinite jobs with no arg. -k, --keep-going Keep going when some targets can't be made. -l [N], --load-average[=N], --max-load[=N] Don't start multiple jobs unless load is below N. -n, --just-print, --dry-run, --recon Don't actually run any commands; just print them. -o FILE, --old-file=FILE, --assume-old=FILE Consider FILE to be very old and don't remake it. -p, --print-data-base Print make's internal database. -q, --question Run no commands; exit status says if up to date. -r, --no-builtin-rules Disable the built-in implicit rules. -s, --silent, --quiet Don't echo commands. -S, --no-keep-going, --stop Turns off -k. -t, --touch Touch targets instead of remaking them. -v, --version Print the version number of make and exit. -w, --print-directory Print the current directory. --no-print-directory Turn off -w, even if it was turned on implicitly. -W FILE, --what-if=FILE, --new-file=FILE, --assume-new=FILE Consider FILE to be infinitely new. --warn-undefined-variables Warn when an undefined variable is referenced.