Browse Source

Add simple timers for `_data` scripts

master
Jean-Sébastien 2 years ago
parent
commit
b7233d004a
2 changed files with 28 additions and 3 deletions
  1. 10
    0
      scripts/catalogue/c_fixed_N_prog_data.sh
  2. 18
    3
      scripts/catalogue/c_scan_N_fixed_data.sh

+ 10
- 0
scripts/catalogue/c_fixed_N_prog_data.sh View File

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

+ 18
- 3
scripts/catalogue/c_scan_N_fixed_data.sh View File

@@ -37,6 +37,7 @@ if [[ $5 -lt 0 ]]; then
37 37
     exit 1
38 38
 fi
39 39
 
40
+timestart=$(date +%s)
40 41
 
41 42
 whichDSF=$1
42 43
 kBT=$2
@@ -83,7 +84,6 @@ basedir="$(pwd)"
83 84
 # Safety barrier:
84 85
 # if directory exists, don't do anything and request directory deletion before proceeding
85 86
 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
86
-echo $dircheck
87 87
 if [[ -d $dircheck ]]; then
88 88
     echo 'A c scan with these parameters already exists. Aborting.'
89 89
     echo 'If you really want to run this command, please first delete directory:\n'$dircheck
@@ -97,9 +97,24 @@ do
97 97
     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
98 98
     mkdir -p $dir
99 99
     cd $dir
100
+    clock1=$(date +%s)
100 101
     LiebLin_DSF $whichDSF $c $N $N 0 $iKmax $kBT $Max_Secs $target_sumrule $refine
102
+    clock2=$(date +%s)
103
+    dt=$(($clock2 - $clock1))
104
+    dt_hrs=$(($dt/3600))
105
+    dt_min=$((($dt - 3600*$dt_hrs)/60))
106
+    dt_sec=$(($dt - 3600*$dt_hrs - 60*$dt_min))
101 107
     cd $basedir
102
-    echo '++ Successfully computed DSFs for c =' $c', N = '$N'.\n' | tee -a $logfile
108
+    echo '++ Successfully computed DSFs for c =' $c', N = '$N'.' | tee -a $logfile
109
+    echo 'Time required: '$dt_hrs'h '$dt_min'm '$dt_sec's.\n' | tee -a $logfile
103 110
 done
104 111
 
105
-echo '\n\n++ Successfully completed c_scan_N_fixed_data for N = '$N' on '$(date '+%Y-%m-%d-%Hh%M')'.\n' | tee -a $logfile
112
+echo '\n++ Successfully completed c_scan_N_fixed_data for N = '$N' on '$(date '+%Y-%m-%d-%Hh%M')'.\n' | tee -a $logfile
113
+
114
+timestop=$(date +%s)
115
+
116
+duration=$(($timestop - $timestart))
117
+hours=$(($duration/3600))
118
+minutes=$((($duration - 3600*$hours)/60))
119
+seconds=$(($duration - 3600*$hours - 60*$minutes)) # don't bother printing
120
+echo 'Total time required: '$hours'h '$minutes'm.\n' | tee -a $logfile

Loading…
Cancel
Save