2016-07-14 17:16:08 +05:30
|
|
|
# sets up an environment for DAMASK on zsh
|
|
|
|
# usage: source DAMASK_env.zsh
|
|
|
|
|
2016-07-30 03:15:37 +05:30
|
|
|
DAMASK_ROOT=${0:a:h}
|
2015-05-08 15:15:38 +05:30
|
|
|
|
2017-01-25 12:26:26 +05:30
|
|
|
# shorthand command to change to DAMASK_ROOT directory
|
|
|
|
eval "function damask() { cd $DAMASK_ROOT; }"
|
|
|
|
|
2016-07-14 20:37:08 +05:30
|
|
|
# defining set() allows to source the same file for tcsh and zsh, with and without space around =
|
2016-07-14 17:16:08 +05:30
|
|
|
set() {
|
|
|
|
export $1$2$3
|
|
|
|
}
|
|
|
|
source $DAMASK_ROOT/CONFIG
|
2016-07-16 00:33:34 +05:30
|
|
|
unset -f set
|
2015-05-08 15:15:38 +05:30
|
|
|
|
2016-07-30 03:15:37 +05:30
|
|
|
# add DAMASK_BIN if present but not yet in $PATH
|
2016-07-14 17:16:08 +05:30
|
|
|
MATCH=`echo ":$PATH:" | grep $DAMASK_BIN:`
|
|
|
|
if [[ ( "x$DAMASK_BIN" != "x" ) && ( "x$MATCH" = "x" ) ]]; then
|
2015-05-08 15:15:38 +05:30
|
|
|
export PATH=$DAMASK_BIN:$PATH
|
2016-07-14 17:16:08 +05:30
|
|
|
fi
|
2015-05-08 15:15:38 +05:30
|
|
|
|
2017-04-13 11:50:30 +05:30
|
|
|
SOLVER=`which DAMASK_spectral || True 2>/dev/null`
|
|
|
|
PROCESSING=`which postResults || True 2>/dev/null`
|
2016-07-14 17:16:08 +05:30
|
|
|
if [ "x$DAMASK_NUM_THREADS" = "x" ]; then
|
|
|
|
DAMASK_NUM_THREADS=1
|
|
|
|
fi
|
2015-05-08 15:15:38 +05:30
|
|
|
|
|
|
|
# according to http://software.intel.com/en-us/forums/topic/501500
|
|
|
|
# this seems to make sense for the stack size
|
2016-07-30 03:15:37 +05:30
|
|
|
if [ "`which free 2>/dev/null`" != "free not found" ]; then
|
2015-05-08 15:15:38 +05:30
|
|
|
freeMem=`free -k | grep -E '(Mem|Speicher):' | awk '{print $4;}'`
|
|
|
|
|
|
|
|
# http://superuser.com/questions/220059/what-parameters-has-ulimit
|
2016-11-05 17:25:07 +05:30
|
|
|
#ulimit -d `expr $freeMem / 2` 2>/dev/null # maximum heap size (kB)
|
2016-07-30 03:15:37 +05:30
|
|
|
ulimit -s `expr $freeMem / $DAMASK_NUM_THREADS / 2` 2>/dev/null # maximum stack size (kB)
|
2015-05-08 15:15:38 +05:30
|
|
|
fi
|
|
|
|
ulimit -v unlimited 2>/dev/null # maximum virtual memory size
|
|
|
|
ulimit -m unlimited 2>/dev/null # maximum physical memory size
|
|
|
|
|
|
|
|
# disable output in case of scp
|
|
|
|
if [ ! -z "$PS1" ]; then
|
|
|
|
echo
|
2016-07-30 03:15:37 +05:30
|
|
|
echo Düsseldorf Advanced Materials Simulation Kit --- DAMASK
|
|
|
|
echo Max-Planck-Institut für Eisenforschung GmbH, Düsseldorf
|
2016-07-14 20:51:44 +05:30
|
|
|
echo https://damask.mpie.de
|
2015-05-08 15:15:38 +05:30
|
|
|
echo
|
2016-08-01 01:00:23 +05:30
|
|
|
echo "Using environment with ..."
|
2015-05-08 15:15:38 +05:30
|
|
|
echo "DAMASK $DAMASK_ROOT"
|
2016-07-14 20:37:08 +05:30
|
|
|
echo "Spectral Solver $SOLVER"
|
|
|
|
echo "Post Processing $PROCESSING"
|
2015-05-08 15:15:38 +05:30
|
|
|
echo "Multithreading DAMASK_NUM_THREADS=$DAMASK_NUM_THREADS"
|
2016-03-11 17:18:35 +05:30
|
|
|
if [ "x$PETSC_DIR" != "x" ]; then
|
|
|
|
echo "PETSc location $PETSC_DIR"
|
2016-07-30 03:15:37 +05:30
|
|
|
[[ $(python -c "import os,sys; print(os.path.realpath(os.path.expanduser(sys.argv[1])))" "$PETSC_DIR") == $PETSC_DIR ]] \
|
|
|
|
|| echo " ~~> "$(python -c "import os,sys; print(os.path.realpath(os.path.expanduser(sys.argv[1])))" "$PETSC_DIR")
|
2016-03-11 17:18:35 +05:30
|
|
|
fi
|
2015-05-08 15:15:38 +05:30
|
|
|
echo "MSC.Marc/Mentat $MSC_ROOT"
|
|
|
|
echo
|
2016-07-30 03:15:37 +05:30
|
|
|
echo -n "heap size "
|
|
|
|
[[ "$(ulimit -d)" == "unlimited" ]] \
|
|
|
|
&& echo "unlimited" \
|
2016-07-30 06:10:40 +05:30
|
|
|
|| echo $(python -c \
|
|
|
|
"import math; \
|
|
|
|
size=$(( 1024*$(ulimit -d) )); \
|
2016-07-30 12:23:42 +05:30
|
|
|
print('{:.4g} {}'.format(size / (1 << ((int(math.log(size,2) / 10) if size else 0) * 10)), \
|
|
|
|
['bytes','KiB','MiB','GiB','TiB','EiB','ZiB'][int(math.log(size,2) / 10) if size else 0]))")
|
2016-07-30 03:15:37 +05:30
|
|
|
echo -n "stack size "
|
|
|
|
[[ "$(ulimit -s)" == "unlimited" ]] \
|
|
|
|
&& echo "unlimited" \
|
2016-07-30 06:10:40 +05:30
|
|
|
|| echo $(python -c \
|
|
|
|
"import math; \
|
|
|
|
size=$(( 1024*$(ulimit -s) )); \
|
2016-07-30 12:23:42 +05:30
|
|
|
print('{:.4g} {}'.format(size / (1 << ((int(math.log(size,2) / 10) if size else 0) * 10)), \
|
|
|
|
['bytes','KiB','MiB','GiB','TiB','EiB','ZiB'][int(math.log(size,2) / 10) if size else 0]))")
|
2015-05-08 15:15:38 +05:30
|
|
|
fi
|
|
|
|
|
|
|
|
export DAMASK_NUM_THREADS
|
|
|
|
export PYTHONPATH=$DAMASK_ROOT/lib:$PYTHONPATH
|
|
|
|
|
2016-07-14 17:16:08 +05:30
|
|
|
for var in BASE STAT SOLVER PROCESSING FREE DAMASK_BIN MATCH; do
|
2015-05-08 15:15:38 +05:30
|
|
|
unset "${var}"
|
|
|
|
done
|
2016-07-14 17:16:08 +05:30
|
|
|
for var in DAMASK MSC; do
|
2015-05-08 15:15:38 +05:30
|
|
|
unset "${var}_ROOT"
|
|
|
|
done
|
2016-07-14 17:16:08 +05:30
|
|
|
for var in ABAQUS MARC; do
|
|
|
|
unset "${var}_VERSION"
|
|
|
|
done
|