Add simple timers for `_data` scripts

This commit is contained in:
Jean-Sébastien 2021-12-15 09:58:13 +01:00
rodzic e774c063a4
commit b7233d004a
2 zmienionych plików z 28 dodań i 3 usunięć

Wyświetl plik

@ -42,6 +42,8 @@ if [[ $5 -lt 1 ]]; then
exit 1
fi
timestart=$(date +%s)
zmodload zsh/datetime
whichDSF=$1
@ -77,3 +79,11 @@ do
done
echo '\n\n++ Successfully completed c_fixed_N_prog_data on '$(date '+%Y-%m-%d-%Hh%M')'.\n' | tee -a $logfile
timestop=$(date +%s)
duration=$(($timestop - $timestart))
hours=$(($duration/3600))
minutes=$((($duration - 3600*$hours)/60))
seconds=$(($duration - 3600*$hours - 60*$minutes)) # don't bother printing
echo 'Total time used: '$hours'h '$minutes'm.\n' | tee -a $logfile

Wyświetl plik

@ -37,6 +37,7 @@ if [[ $5 -lt 0 ]]; then
exit 1
fi
timestart=$(date +%s)
whichDSF=$1
kBT=$2
@ -83,7 +84,6 @@ basedir="$(pwd)"
# Safety barrier:
# if directory exists, don't do anything and request directory deletion before proceeding
dircheck='Lieb-Liniger/'$correlator'/T_'$kBT'/c_scan_N_fixed/k_0_to_'${(l:2::0:)nkmax}'kFo4/sr_'$target_sumrule'/store/data/N_'$N
echo $dircheck
if [[ -d $dircheck ]]; then
echo 'A c scan with these parameters already exists. Aborting.'
echo 'If you really want to run this command, please first delete directory:\n'$dircheck
@ -97,9 +97,24 @@ do
dir='Lieb-Liniger/'$correlator'/T_'$kBT'/c_scan_N_fixed/k_0_to_'${(l:2::0:)nkmax}'kFo4/sr_'$target_sumrule'/store/data/N_'$N'/c_'$c
mkdir -p $dir
cd $dir
clock1=$(date +%s)
LiebLin_DSF $whichDSF $c $N $N 0 $iKmax $kBT $Max_Secs $target_sumrule $refine
clock2=$(date +%s)
dt=$(($clock2 - $clock1))
dt_hrs=$(($dt/3600))
dt_min=$((($dt - 3600*$dt_hrs)/60))
dt_sec=$(($dt - 3600*$dt_hrs - 60*$dt_min))
cd $basedir
echo '++ Successfully computed DSFs for c =' $c', N = '$N'.\n' | tee -a $logfile
echo '++ Successfully computed DSFs for c =' $c', N = '$N'.' | tee -a $logfile
echo 'Time required: '$dt_hrs'h '$dt_min'm '$dt_sec's.\n' | tee -a $logfile
done
echo '\n\n++ Successfully completed c_scan_N_fixed_data for N = '$N' on '$(date '+%Y-%m-%d-%Hh%M')'.\n' | tee -a $logfile
echo '\n++ Successfully completed c_scan_N_fixed_data for N = '$N' on '$(date '+%Y-%m-%d-%Hh%M')'.\n' | tee -a $logfile
timestop=$(date +%s)
duration=$(($timestop - $timestart))
hours=$(($duration/3600))
minutes=$((($duration - 3600*$hours)/60))
seconds=$(($duration - 3600*$hours - 60*$minutes)) # don't bother printing
echo 'Total time required: '$hours'h '$minutes'm.\n' | tee -a $logfile