#!/bin/bash unset DISPLAY unset LUI export LANG=en_US.UTF-8 date=$(date "+%Y-%m-%d@%H:%M") host=${HOSTNAME%%.*} user=$(whoami) root=${LOGONROOT} if [ "${OSTYPE}" = "linux" -o "${OSTYPE}" = "linux-gnu" ]; then # # apparently, (some) Debian installations come with an older uname(1), where # `-i' is not available :-{. (11-mar-05; oe) # if uname -i > /dev/null 2>&1; then cpu=$(uname -i) if [ "${cpu}" = "unknown" ]; then cpu=$(uname -m); fi else cpu=$(uname -m) fi case ${cpu} in i?86) cpu=32; ;; x86_64) cpu=64; ;; *) echo "LOGONOS: unknown Linux variant (check \`uname -m'); exit." exit 1; esac fi while [ $# -gt 0 -a "${1#-}" != "$1" ]; do case ${1} in --32) LOGONOS=linux.x86.32; export LOGONOS; cpu=32; cross=yes; shift 1; ;; --count) count=${2}; shift 2; ;; --log) log=${2}; shift 2; ;; --id) id=${2}; shift 2; ;; --quiet) log=/dev/null; shift 1; ;; esac; done; if [ -n "${1}" ]; then task=${1}; else task=all fi tmp=/tmp/.${task}.${user}.$$ if [ -z "${log}" ]; then log=${root}/uio/test/logs/${task}.${host}.${cpu}.${user}.${date}; fi if [ -n "${count}" -a "${log}" != "/dev/null" ]; then master=${log}.0@${count}; else master=${log}; fi; initialize() { case ${1} in ape) ;; cheap) ;; cheap) ;; generate) ;; tadm) ;; esac; } # initialize() validate() { case ${1} in cheap) [ ! -f ${2} ] && return 1; egrep '^\([0-9]+\) .* --- ' ${2} \ | sed 's/^.* --- //g' | sed 's/ (.*$//g' > ${tmp}/cheap; diff ${tmp}/cheap ${root}/uio/test/cheap.out > /dev/null 2>&1; return; ;; generate) [ ! -f ${2} ] && return 1; egrep '^\([0-9]+\) .* --- ' ${2} \ | sed 's/^.* --- //g' | sed 's/ (.*$//g' > ${tmp}/generate; diff ${tmp}/generate ${root}/uio/test/generate.out > /dev/null 2>&1; return; ;; tadm) [ ! -f ${2} ] && return 1; awk \ '/^H\(p_ref\) / { on=1; } /^Converged: / { on=0; } { if (on) print; } ' \ ${2} > ${tmp}/iterations; # # _fix_me_ # we actually see surprising variation in the number of iterations until # convergence, even across two 64-bit machines (`teflon' and `dalco'). # we will need to investigate this more one day. (13-mar-06; oe) # [ "$(wc -l ${tmp}/iterations)" != "499" ]; return 0; ;; esac; } # validate() { initialize ${task}; start=$(date "+%d-%m-%Y (%H:%M:%S)") epoch=$(date "+%s"); if [ -n "${count}" ]; then if [ -n "${cross}" ]; then options="${options} --32"; fi while [ ${count} -ge 1 ]; do command="${0}${options} --log ${log}.${count} --id ${count} $*"; echo " $command"; { eval "${command} &"; } > /dev/null 2>&1; count=$[${count} - 1]; done; wait; else rm -rf ${tmp} > /dev/null 2>&1; mkdir ${tmp} trace=${tmp}/trace; echo; for (( i=79; i; i-- )); do echo -n "="; done; echo; echo; cat /proc/version; echo; echo; cat /proc/meminfo; echo; echo; cat /proc/cpuinfo; echo; echo; uptime; echo; echo; case ${task} in all) # # the generator, oddly, seems to benefit from having to compile from # source upon its first execution, possibly having the compiler loaded # into the Lisp universe, we end up avoiding a global gc(), or run it # sooner or later, such that address adjustment comes out different. # attempting to make sure the generator code is compiled, go through # the `mrs' treebank once before doing actual work. # ${root}/generate \ --suffix ".${host}" --best 1 --update mrs; if [ "${cpu}" == "64" ]; then LOGONOS=linux.x86.32 \ ${root}/generate \ --suffix ".${host}" --best 1 --update mrs; fi cpus=$(egrep '^processor' /proc/cpuinfo | wc -l); for (( i=4; i; i-- )); do ${0} tadm; if [ $? -ne 0 ]; then error=yes; break; fi if [ "${cpu}" == "64" ]; then ${0} --32 tadm; if [ $? -ne 0 ]; then error=yes; break; fi fi ${0} ape; if [ $? -ne 0 ]; then error=yes; break; fi if [ "${cpu}" == "64" ]; then ${0} --32 ape; if [ $? -ne 0 ]; then error=yes; break; fi fi ${0} cheap; if [ $? -ne 0 ]; then error=yes; break; fi ${0} generate; if [ $? -ne 0 ]; then error=yes; break; fi if [ "${cpu}" == "64" ]; then ${0} --32 generate; if [ $? -ne 0 ]; then error=yes; break; fi fi for (( j=2; j <= $cpus; j *= 2 )); do ${0} --count ${j} tadm; if [ $? -ne 0 ]; then error=yes; break 2; fi ${0} --count ${j} ape; if [ $? -ne 0 ]; then error=yes; break 2; fi ${0} --count ${j} cheap; if [ $? -ne 0 ]; then error=yes; break 2; fi ${0} --count ${j} generate; if [ $? -ne 0 ]; then error=yes; break 2; fi done; done; ;; ape) command time -v \ ${root}/bin/ace -G ${tmp}/erg.ace \ -g ${root}/lingo/erg/ace/config.tdl; echo; head -400 ${root}/uio/test/jh1.items \ | command time -v \ ${root}/bin/ace -R -n 1000 -g ${tmp}/erg.ace ;; cheap) cat ${root}/uio/test/jh1.items \ | command time -v \ ${root}/bin/cheap -limit=100000 -packing \ ${root}/lingo/erg/english.grm 2>&1 | tee ${trace}; if [ $? -eq 0 ] && validate cheap ${trace}; then : else error=yes; fi ;; tadm) cp ${root}/uio/test/events.tadm.gz ${tmp}/events.gz; command time -v \ ${root}/bin/tadm \ -events_in ${tmp}/events.gz -params_out /dev/null \ -frtol 1e-12 -fatol 1e-24 -monitor 2>&1 | tee ${trace}; if [ $? -eq 0 ] && validate tadm ${trace}; then : else error=yes; fi ;; svm) gunzip -c ${root}/uio/test/events.svm.gz > ${tmp}/events; command time -v \ ${root}/bin/svm_learn \ -v 1 -n 30 -q 40 -m 3000 -z p -t 0 \ ${tmp}/events /dev/null; ;; generate) if [ -n "${id}" ]; then suffix=".${id}"; else suffix=""; fi command time -v \ ${root}/generate \ --suffix "${suffix}" --best 50 --update hike 2>&1 | tee ${trace}; if [ $? -eq 0 ] && validate generate ${trace}; then : else error=yes; fi ;; sleep) sleep ${2}; ;; *) echo "run: unknown benchmark \`${1}'."; ;; esac [ -z "${error}" ] && rm -rf ${tmp} > /dev/null 2>&1; fi end=$(date "+%d-%m-%Y (%H:%M:%S)") now=$(date "+%s"); echo; uptime; echo; if [ -z "${error}" ]; then echo -n "wall clock time: ${start} -- ${end}"; echo " ($[${now} - ${epoch}]s)."; else echo "run: unexpected failure completing this task."; fi } 2>&1 | tee ${master}