try unlimited heap and stack first

This commit is contained in:
Philip Eisenlohr 2017-04-13 18:59:52 -04:00
parent ae3a5187c0
commit 6114541dba
1 changed files with 6 additions and 3 deletions

View File

@ -39,12 +39,15 @@ fi
# according to http://software.intel.com/en-us/forums/topic/501500
# this seems to make sense for the stack size
FREE=$(which free 2>/dev/null)
FREE=$(type -p free 2>/dev/null)
if [ "x$FREE" != "x" ]; then
freeMem=$(free -k | grep -E '(Mem|Speicher):' | awk '{print $4;}')
# http://superuser.com/questions/220059/what-parameters-has-ulimit
ulimit -d $(expr $freeMem / 2) 2>/dev/null # maximum heap size (kB)
ulimit -s $(expr $freeMem / $DAMASK_NUM_THREADS / 2) 2>/dev/null # maximum stack size (kB)
ulimit -d unlimited 2>/dev/null \
|| ulimit -d $(expr $freeMem / 2) 2>/dev/null # maximum heap size (kB)
ulimit -s unlimited 2>/dev/null \
|| echo "cannot unlimit stack..." \
&& ulimit -s $(expr $freeMem / $DAMASK_NUM_THREADS / 2) 2>/dev/null # maximum stack size (kB)
fi
ulimit -v unlimited 2>/dev/null # maximum virtual memory size
ulimit -m unlimited 2>/dev/null # maximum physical memory size