This is the ugly triple loop that I set up to run this long batch,
#!/usr/bin/bash
echo "testing output" > test_times.txt
echo "" >> test_times.txt
# list directory names here
SIZE=( 100K 500K 1M )
for SIZE in ${SIZE[@]}
do
echo "Runtimes for servlet 4," $SIZE "structures" >> test_times.txt
echo "" >> test_times.txt
CPDS=( 10 100 500 1000 2500 5000 10000 25000 50000 )
for CPDS in ${CPDS[@]}
do
echo "Runs where N="$CPDS >> test_times.txt
REP=( 1 2 3 4 5 )
for REP in ${REP[@]}
do
echo 'run' $REP 'test_ActiMol_'$SIZE'.sdf -n 4 -t 1000 -l 100 -d t -N' $CPDS >> test_times.txt
time ./servert.exe -n 4 -t 1000 -l 100 -d t -N $CPDS \
-i 'test_ActiMol_'$SIZE'.sdf' \
-o 'test_ActiMol_100K_'$CPDS'N_'$REP'.s' >> test_times.txt
echo " TIMEOUTS=" $(grep -c "TIMEOUT" 'test_ActiMol_100K_'$CPDS'N_'$REP'.s') >> test_times.txt
echo " SEGFAULTS=" $(grep -c "SEGFAULT" 'test_ActiMol_100K_'$CPDS'N_'$REP'.s') >> test_times.txt
echo " NUMBER PROCESSED=" $(wc -l 'test_ActiMol_100K_'$CPDS'N_'$REP'.s') >> test_times.txt
done
echo " " >> test_times.txt
done
echo " " >> test_times.txt
echo " " >> test_times.txt
done
This works in every respect other than printing the output of time to the file. I am very unclear as to how to utilize the here-document in this context.
This is giving me the output I need,
Runtimes for servlet 4, 100K structures
Runs where N=10
run 1 test_ActiMol_100K.sdf -n 4 -t 1000 -l 100 -d t -N 10
TIMEOUTS= 0
SEGFAULTS= 0
NUMBER PROCESSED= 100002 test_ActiMol_100K_10N_1.s
run 2 test_ActiMol_100K.sdf -n 4 -t 1000 -l 100 -d t -N 10
TIMEOUTS= 0
SEGFAULTS= 0
NUMBER PROCESSED= 100002 test_ActiMol_100K_10N_2.s
run 3 test_ActiMol_100K.sdf -n 4 -t 1000 -l 100 -d t -N 10
TIMEOUTS= 0
SEGFAULTS= 0
NUMBER PROCESSED= 100002 test_ActiMol_100K_10N_3.s
run 4 test_ActiMol_100K.sdf -n 4 -t 1000 -l 100 -d t -N 10
TIMEOUTS= 0
SEGFAULTS= 0
NUMBER PROCESSED= 100002 test_ActiMol_100K_10N_4.s
run 5 test_ActiMol_100K.sdf -n 4 -t 1000 -l 100 -d t -N 10
TIMEOUTS= 0
SEGFAULTS= 0
NUMBER PROCESSED= 100002 test_ActiMol_100K_10N_5.s
minus the times.
LMHmedchem
---------- Post updated at 08:44 PM ---------- Previous update was at 08:27 PM ----------
I have tried the following to get stderr appended to my output file,
time ./servert.exe -n 4 -t 1000 -l 100 -d t -N $CPDS \
-i 'test_ActiMol_'$SIZE'.sdf' \
-o 'test_ActiMol_100K_'$CPDS'N_'$REP'.s' >>test_times.txt 2>&1
time ./servert.exe -n 4 -t 1000 -l 100 -d t -N $CPDS \
-i 'test_ActiMol_'$SIZE'.sdf' \
-o 'test_ActiMol_100K_'$CPDS'N_'$REP'.s' 2>>test_times.txt
time ./servert.exe -n 4 -t 1000 -l 100 -d t -N $CPDS \
-i 'test_ActiMol_'$SIZE'.sdf' \
-o 'test_ActiMol_100K_'$CPDS'N_'$REP'.s' &>>test_times.txt
the third one being a shot in the dark. None of these make any difference and I am still getting the time data printed to the terminal.
There always seems to be a hangup somewhere.
LMHmedchem
---------- Post updated at 09:13 PM ---------- Previous update was at 08:44 PM ----------
Apparently, but using the following command,
time ./servert.exe -n 4 -t 1000 -l 100 -d t -N $CPDS \
-i 'test_ActiMol_'$SIZE'.sdf' \
-o 'test_ActiMol_100K_'$CPDS'N_'$REP'.s' >> test_times.txt 2>&1
I am redirecting the stderr and stdout of servert.exe to test_times.txt and not the stderr/stdout of time. This was fixed by grouping the time and servert.exe commands,
( time ./servert.exe -n 4 -t 1000 -l 100 -d t -N $CPDS \
-i 'test_ActiMol_'$SIZE'.sdf' \
-o 'test_ActiMol_100K_'$CPDS'N_'$REP'.s' ) >> test_times.txt 2>&1
with this revision, the output is as expected,
Runtimes for servlet 4, 100K structures
Runs where N=10
run 1 test_ActiMol_100K.sdf -n 4 -t 1000 -l 100 -d t -N 10
real 0m43.656s
user 0m0.015s
sys 0m0.015s
TIMEOUTS= 0
SEGFAULTS= 0
NUMBER PROCESSED= 100002 test_ActiMol_100K_10N_1.s
run 2 test_ActiMol_100K.sdf -n 4 -t 1000 -l 100 -d t -N 10
real 0m43.203s
user 0m0.031s
sys 0m0.015s
TIMEOUTS= 0
SEGFAULTS= 0
NUMBER PROCESSED= 100002 test_ActiMol_100K_10N_2.s
run 3 test_ActiMol_100K.sdf -n 4 -t 1000 -l 100 -d t -N 10
now I think I need to try to incorporate the here-document suggested by Corona688 to minimize the number of echo commands.
LMHmedchem