]> Creatis software - clitk.git/blobdiff - fast_make.sh
Added Varian OBI file format
[clitk.git] / fast_make.sh
index 249ca5e0935abba525ac93275dec368de69e2303..38d94a187816b9820e034c420a9a910976b88886 100755 (executable)
@@ -3,39 +3,38 @@ vv_dir=$(dirname $(readlink -e $(which $0)))
 echo clitk3 directory: $vv_dir
 cd ${vv_dir}/build
 
-nice -n 19 ionice -c3 make -j4 #is this good enough?
 
-#
-#function handle_exit
-#{
-#    rm mem_use 2>>/dev/null
-#    killall -s SIGCONT make
-#    killall make
-#    killall cc1plus
-#    echo "Terminated, exiting..."
-#    echo
-#    echo
-#    exit
-#}
-#
-#trap handle_exit SIGINT
-#available_mem=$(cat /proc/meminfo | grep MemTotal | grep -o [0-9]*)
-#if [ -a "memory_exhausted_lock" ]
-#then
-#   echo "Running in memory conservation mode..."
-#   max_cpp_process_mem_use=1600000
-#   cpus=$(( $available_mem / $max_cpp_process_mem_use ))
-#   echo "Using $cpus cpu(s) should be safe..."
-#   sleep 1
-#   make -j${cpus}
-#else #use all the available computing power by default
-#    cpus=$(( $(cat /proc/cpuinfo | grep -c ^processor) + 0 ))
-#fi
-#
-#nice -n12 ionice -c3 make -j ${cpus} $@ &
-#make_pid=$(jobs -p %nice)
-#
-##watch memory use to avoid crashes
+function handle_exit
+{
+    rm mem_use 2>>/dev/null
+    killall -s SIGCONT make
+    killall make
+    killall cc1plus
+    echo "Terminated, exiting..."
+    echo
+    echo
+    exit
+}
+
+trap handle_exit SIGINT
+available_mem=$(cat /proc/meminfo | grep MemTotal | grep -o [0-9]*)
+if [ -a "memory_exhausted_lock" ]
+then
+   echo "Running in memory conservation mode..."
+   max_cpp_process_mem_use=1600000
+   cpus=$(( $available_mem / $max_cpp_process_mem_use ))
+   echo "Using $cpus cpu(s) should be safe..."
+   sleep 1
+   make -j${cpus}
+else #use all the available computing power by default
+    cpus=$(( $(cat /proc/cpuinfo | grep -c ^processor) + 0 ))
+    echo "Building with ${cpus} cpus..."
+fi
+
+nice -n12 ionice -c3 make -j ${cpus} $@ &
+make_pid=$(jobs -p %nice)
+
+#watch memory use to avoid crashes
 #while ps $make_pid >>/dev/null 
 #do
 #    if [ x"$(ps aux | grep cc1plus | grep -v grep | wc -l)" != x0 ]
@@ -69,5 +68,6 @@ nice -n 19 ionice -c3 make -j4 #is this good enough?
 #    sleep 1
 #done
 #rm memory_exhausted_lock 2>>/dev/null
-#echo Done!
-#echo
+wait
+echo Done!
+echo