#!/bin/bash write_result() { N=$1 NODES=$2 NPN=$3 FILENAME=$(printf 'study_n%05d/n%03dppn%d/diag_time.dat' $N $NODES $NPN) if [ -f $FILENAME ] ; then RESULT=$(gawk -F' ' '{ print $1 }' $FILENAME 2>/dev/null) printf ' %8s ' $RESULT else # If the file does not exist, write out a '---' printf ' %8s ' '---' fi } write_header() { printf '%20s' '' for i in $@ { printf '%10s ' $i } printf '\n' } for N in 1024 2048 4096 do echo "N = $N" write_header 'p=1' 'p=2' 'p=4' 'p=8' 'p=16' 'p=32' for NPERNODE in 1 2 4 8 do if [ $NPERNODE -eq 1 ] ; then printf '%d process per node' $NPERNODE else printf '%d processes per node' $NPERNODE fi for NODES in 1 2 4 8 16 32 do write_result $N $NODES $NPERNODE done printf '\n' done printf '\n' done