2013-12-19 04:08:44 +05:30
|
|
|
# sets up an environment for DAMASK on bash
|
2013-12-20 18:00:17 +05:30
|
|
|
# usage: source DAMASK_env.sh
|
2014-01-12 00:43:02 +05:30
|
|
|
|
2016-07-14 17:16:08 +05:30
|
|
|
|
2014-01-29 22:40:19 +05:30
|
|
|
if [ "$OSTYPE" == "linux-gnu" ] || [ "$OSTYPE" == 'linux' ]; then
|
2016-07-14 17:16:08 +05:30
|
|
|
DAMASK_ROOT=$(python -c "import os,sys; print(os.path.realpath(os.path.expanduser(sys.argv[1])))" "$(dirname $BASH_SOURCE)")
|
2014-01-11 18:16:30 +05:30
|
|
|
else
|
2014-08-21 03:21:46 +05:30
|
|
|
[[ "${BASH_SOURCE::1}" == "/" ]] && BASE="" || BASE="`pwd`/"
|
|
|
|
STAT=$(stat "`dirname $BASE$BASH_SOURCE`")
|
2014-01-24 18:00:27 +05:30
|
|
|
DAMASK_ROOT=${STAT##* }
|
2014-01-11 18:16:30 +05:30
|
|
|
fi
|
2014-01-24 18:00:27 +05:30
|
|
|
|
2016-07-14 17:16:08 +05:30
|
|
|
# allows to source the same file for tcsh and bash, with and without space around =
|
|
|
|
set() {
|
|
|
|
export $1$2$3
|
|
|
|
}
|
|
|
|
source $DAMASK_ROOT/CONFIG
|
2014-01-29 22:40:19 +05:30
|
|
|
|
2014-02-28 13:17:11 +05:30
|
|
|
# if DAMASK_BIN is present and not in $PATH, add it
|
|
|
|
if [[ "x$DAMASK_BIN" != "x" && ! `echo ":$PATH:" | grep $DAMASK_BIN:` ]]; then
|
|
|
|
export PATH=$DAMASK_BIN:$PATH
|
|
|
|
fi
|
|
|
|
|
2014-08-12 20:45:47 +05:30
|
|
|
SOLVER=`which DAMASK_spectral 2>/dev/null`
|
2014-02-28 13:17:11 +05:30
|
|
|
if [ "x$SOLVER" == "x" ]; then
|
2016-04-06 01:49:14 +05:30
|
|
|
SOLVER='Not found!'
|
2014-02-28 13:17:11 +05:30
|
|
|
fi
|
2014-08-12 20:45:47 +05:30
|
|
|
PROCESSING=`which postResults 2>/dev/null`
|
2014-02-28 13:17:11 +05:30
|
|
|
if [ "x$PROCESSING" == "x" ]; then
|
2016-04-06 01:49:14 +05:30
|
|
|
PROCESSING='Not found!'
|
2014-02-28 13:17:11 +05:30
|
|
|
fi
|
2016-07-14 17:16:08 +05:30
|
|
|
if [ "x$DAMASK_NUM_THREADS" == "x" ]; then
|
|
|
|
DAMASK_NUM_THREADS=1
|
|
|
|
fi
|
2014-01-24 18:47:54 +05:30
|
|
|
|
2014-04-29 22:13:59 +05:30
|
|
|
# according to http://software.intel.com/en-us/forums/topic/501500
|
|
|
|
# this seems to make sense for the stack size
|
2014-08-21 03:21:46 +05:30
|
|
|
FREE=`which free 2>/dev/null`
|
|
|
|
if [ "x$FREE" != "x" ]; then
|
|
|
|
freeMem=`free -k | grep -E '(Mem|Speicher):' | awk '{print $4;}'`
|
|
|
|
heap=`expr $freeMem / 2`
|
|
|
|
stack=`expr $freeMem / $DAMASK_NUM_THREADS / 2`
|
2014-04-29 22:13:59 +05:30
|
|
|
|
2014-08-21 03:21:46 +05:30
|
|
|
# http://superuser.com/questions/220059/what-parameters-has-ulimit
|
|
|
|
ulimit -s $stack 2>/dev/null # maximum stack size (kB)
|
|
|
|
ulimit -d $heap 2>/dev/null # maximum heap size (kB)
|
|
|
|
fi
|
2014-05-19 14:40:01 +05:30
|
|
|
ulimit -c 2000 2>/dev/null # core file size (512-byte blocks)
|
|
|
|
ulimit -v unlimited 2>/dev/null # maximum virtual memory size
|
|
|
|
ulimit -m unlimited 2>/dev/null # maximum physical memory size
|
|
|
|
|
2013-12-21 17:27:02 +05:30
|
|
|
# disable output in case of scp
|
|
|
|
if [ ! -z "$PS1" ]; then
|
|
|
|
echo
|
|
|
|
echo Düsseldorf Advanced Materials Simulation Kit - DAMASK
|
|
|
|
echo Max-Planck-Institut für Eisenforschung, Düsseldorf
|
|
|
|
echo http://damask.mpie.de
|
|
|
|
echo
|
2014-01-27 15:42:29 +05:30
|
|
|
echo Using environment with ...
|
2014-04-29 22:13:59 +05:30
|
|
|
echo "DAMASK $DAMASK_ROOT"
|
2014-08-16 00:54:56 +05:30
|
|
|
[[ "x$SOLVER" != "x" ]] && echo "Spectral Solver $SOLVER"
|
|
|
|
[[ "x$PROCESSING" != "x" ]] && echo "Post Processing $PROCESSING"
|
2014-04-29 22:13:59 +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-04-06 01:49:14 +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
|
2014-08-16 00:54:56 +05:30
|
|
|
[[ "x$PETSC_ARCH" != "x" ]] && echo "PETSc architecture $PETSC_ARCH"
|
2014-04-29 22:13:59 +05:30
|
|
|
echo "MSC.Marc/Mentat $MSC_ROOT"
|
2014-01-29 22:40:19 +05:30
|
|
|
echo
|
2014-08-07 22:21:26 +05:30
|
|
|
echo -n "heap size/MiB "; echo "`ulimit -d`/1024" | bc
|
|
|
|
echo -n "stack size/MiB "; echo "`ulimit -s`/1024" | bc
|
2014-08-06 23:25:13 +05:30
|
|
|
fi
|
2014-04-29 22:13:59 +05:30
|
|
|
|
2014-02-03 15:34:45 +05:30
|
|
|
export DAMASK_NUM_THREADS
|
2014-01-29 20:55:27 +05:30
|
|
|
export PYTHONPATH=$DAMASK_ROOT/lib:$PYTHONPATH
|
2014-01-27 19:40:49 +05:30
|
|
|
|
2016-07-14 17:16:08 +05:30
|
|
|
for var in BASE STAT SOLVER PROCESSING FREE DAMASK_BIN; do
|
2014-08-21 03:21:46 +05:30
|
|
|
unset "${var}"
|
|
|
|
done
|
2016-07-14 17:16:08 +05:30
|
|
|
for var in DAMASK MSC; do
|
2014-01-29 22:40:19 +05:30
|
|
|
unset "${var}_ROOT"
|
|
|
|
done
|
2016-07-14 17:16:08 +05:30
|
|
|
for var in ABAQUS MARC; do
|
|
|
|
unset "${var}_VERSION"
|
|
|
|
done
|