Skip to content

Commit

Permalink
Minor improvement of info script (CP2K).
Browse files Browse the repository at this point in the history
  • Loading branch information
hfp committed Sep 14, 2023
1 parent 4bfaf5f commit 0fe2b19
Showing 1 changed file with 19 additions and 23 deletions.
42 changes: 19 additions & 23 deletions config/cp2k/info.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,15 @@
# Hans Pabst (Intel Corp.)
###############################################################################

BC=$(which bc 2> /dev/null)
PATTERN="*.txt"

BEST=0
if [ "-best" = "$1" ]; then
SORT="sort -k2,2n -k6,6n | sort -u -k2,2n"
SORT="sort -k2,2g -k6,6g | sort -u -k2,2g"
BEST=1
shift
else
SORT="sort -k2,2n -k6,6n"
SORT="sort -k2,2g -k6,6g"
fi

if [ "-depth" = "$1" ]; then
Expand All @@ -42,24 +41,19 @@ if [ "0" = "${NUMFILES}" ]; then
PATTERN="*"
fi

FILES=$(find ${FILEPATH} -maxdepth ${DEPTH} -type f -name "${PATTERN}" | grep -v "..*\.sh")
FILE0=$(echo "${FILES}" | head -n1)
PRINTFLOPS=0
FILES=$(find ${FILEPATH} -maxdepth ${DEPTH} -type f -name "${PATTERN}" | grep -v "..*\.sh\|CMakeLists\.txt")
FILE0=$(head -n1 <<<"${FILES}")
NUMFILES=0
if [ "" != "${FILE0}" ]; then
NUMFILES=$(echo "${FILES}" | wc -l)
NUMFILES=$(wc -l <<<"${FILES}")
PROJECT=$(grep "GLOBAL| Project name" "${FILE0}" | sed -n "s/..*\s\s*\(\w\)/\1/p" | head -n1)
if [ "PROJECT" = "${PROJECT}" ]; then
PROJECT=$(grep "GLOBAL| Method name" "${FILE0}" | sed -n "s/..*\s\s*\(\w\)/\1/p" | head -n1)
fi
if [ "" != "${BC}" ]; then
if [ "LIBTEST" = "${PROJECT}" ] || [ "TEST" = "${PROJECT}" ]; then
PRINTFLOPS=1
fi
fi
NUMACCDEVS=$(grep " DBCSR| ACC: Number of devices/node" "${FILE0}" | sed -n "s/..*\s\s*\(\w\)/\1/p" | head -n1)
echo -e -n "$(printf %-23.23s "${PROJECT}")\tNodes\tR/N\tT/R\tCases/d\tSeconds"
if [ "0" != "${PRINTFLOPS}" ]; then
echo -e -n "\tGFLOPS/s"
if [ "${NUMACCDEVS}" ]; then
echo -e -n "\t\tDevices"
fi
echo
fi
Expand All @@ -73,8 +67,8 @@ for FILE in ${FILES}; do
if [ "" = "${RANKS}" ]; then RANKS=1; fi
fi
if [ "" = "${NODERANKS}" ]; then
for TOKEN in $(echo "${BASENAME}" | tr -s "[=_=][=-=]" " "); do
NODES=$(echo "${TOKEN}" | sed -n "s/^\([0-9][0-9]*\)\(x[0-9][0-9]*\)*$/\1/p;s/^\([0-9][0-9]*\)n$/\1/p;s/^n\([0-9][0-9]*\)$/\1/p")
for TOKEN in $(tr -s "[=_=][=-=]" " " <<<"${BASENAME}"); do
NODES=$(sed -n "s/^\([0-9][0-9]*\)\(x[0-9][0-9]*\)*$/\1/p;s/^\([0-9][0-9]*\)n$/\1/p;s/^n\([0-9][0-9]*\)$/\1/p" <<<"${TOKEN}")
if [ "" != "${NODES}" ]; then
break
fi
Expand All @@ -92,17 +86,19 @@ for FILE in ${FILES}; do
if [ "" = "${TPERR}" ] || [ "0" = "${TPERR}" ]; then TPERR=1; fi
fi
DURATION=$(grep "CP2K 1" "${FILE}" | tr -s "\n" " " | tr -s " " | cut -d" " -f7)
TWALL=$(echo "${DURATION}" | cut -d. -f1 | sed -n "s/\([0-9][0-9]*\)/\1/p")
TWALL=$(cut -d. -f1 <<<"${DURATION}" | sed -n "s/\([0-9][0-9]*\)/\1/p")
if [ "" != "${TWALL}" ] && [ "0" != "${TWALL}" ]; then
echo -e -n "$(printf %-23.23s "${BASENAME}")\t${NODES}\t${RANKS}\t${TPERR}"
echo -e -n "\t$((86400/TWALL))\t${DURATION}"
if [ "0" != "${PRINTFLOPS}" ]; then
FLOPS=$(sed -n "s/ marketing flops\s\s*\(..*\)$/\1/p" "${FILE}" | sed -e "s/[eE]+*/\*10\^/")
TBCSR=$(sed -n "s/ dbcsr_multiply_generic\s\s*\(..*\)$/\1/p" "${FILE}" | tr -s " " | rev | cut -d" " -f1 | rev)
if [ "" != "${FLOPS}" ] && [ "" != "${TBCSR}" ]; then
GFLOPS=$(echo "scale=3;((${FLOPS})/(${TBCSR}*10^9))" | ${BC})
echo -e -n "\t${GFLOPS}"
NDEVS=$(grep " DBCSR| ACC: Number of devices/node" "${FILE}" | sed -n "s/..*\s\s*\(\w\)/\1/p" | head -n1)
if [ "${NUMACCDEVS}" ]; then
if [ "${NDEVS}" ]; then
echo -e -n "\t\t${NDEVS}"
else
echo -e -n "\t\t-"
fi
elif [ "${NDEVS}" ]; then
echo -e -n "\t\tACC"
fi
echo
elif [ "0" != "${NUMFILES}" ] && [ "0" = "${BEST}" ]; then
Expand Down

0 comments on commit 0fe2b19

Please sign in to comment.