general improvements and adoptions to be compatible with csh

This commit is contained in:
Martin Diehl 2016-07-14 13:46:08 +02:00
parent 83e1970f71
commit 72d60039c1
3 changed files with 37 additions and 17 deletions

7
CONFIG
View File

@ -1,10 +1,9 @@
# "set syntax" needed only for tcsh (but works with bash etc) # "set"-syntax needed only for tcsh (but works with bash and zsh)
set MSC_ROOT=/opt/MSC set MSC_ROOT=/opt/MSC
set MARC_VERSION=2015 set MARC_VERSION=2015
set DAMASK_NUM_THREADS=4 set DAMASK_NUM_THREADS = 4
set ABAQUS_VERSION=6.14-5 set ABAQUS_VERSION=6.14-5
#Set DAMASK_BIN if not $DAMASK_ROOT/bin set DAMASK_BIN=${DAMASK_ROOT}/lib
#DAMASK_BIN

View File

@ -1,15 +1,20 @@
# sets up an environment for DAMASK on bash # sets up an environment for DAMASK on bash
# usage: source DAMASK_env.sh # usage: source DAMASK_env.sh
if [ "$OSTYPE" == "linux-gnu" ] || [ "$OSTYPE" == 'linux' ]; then if [ "$OSTYPE" == "linux-gnu" ] || [ "$OSTYPE" == 'linux' ]; then
DAMASK_ROOT=$(python -c "import os,sys; print(os.path.realpath(os.path.expanduser(sys.argv[1])))" "`dirname $BASH_SOURCE`") DAMASK_ROOT=$(python -c "import os,sys; print(os.path.realpath(os.path.expanduser(sys.argv[1])))" "$(dirname $BASH_SOURCE)")
else else
[[ "${BASH_SOURCE::1}" == "/" ]] && BASE="" || BASE="`pwd`/" [[ "${BASH_SOURCE::1}" == "/" ]] && BASE="" || BASE="`pwd`/"
STAT=$(stat "`dirname $BASE$BASH_SOURCE`") STAT=$(stat "`dirname $BASE$BASH_SOURCE`")
DAMASK_ROOT=${STAT##* } DAMASK_ROOT=${STAT##* }
fi fi
[[ -f $HOME/.damask/damask.conf ]] && source $HOME/.damask/damask.conf || source /etc/damask.conf # allows to source the same file for tcsh and bash, with and without space around =
set() {
export $1$2$3
}
source $DAMASK_ROOT/CONFIG
# if DAMASK_BIN is present and not in $PATH, add it # if DAMASK_BIN is present and not in $PATH, add it
if [[ "x$DAMASK_BIN" != "x" && ! `echo ":$PATH:" | grep $DAMASK_BIN:` ]]; then if [[ "x$DAMASK_BIN" != "x" && ! `echo ":$PATH:" | grep $DAMASK_BIN:` ]]; then
@ -24,6 +29,9 @@ PROCESSING=`which postResults 2>/dev/null`
if [ "x$PROCESSING" == "x" ]; then if [ "x$PROCESSING" == "x" ]; then
PROCESSING='Not found!' PROCESSING='Not found!'
fi fi
if [ "x$DAMASK_NUM_THREADS" == "x" ]; then
DAMASK_NUM_THREADS=1
fi
# according to http://software.intel.com/en-us/forums/topic/501500 # according to http://software.intel.com/en-us/forums/topic/501500
# this seems to make sense for the stack size # this seems to make sense for the stack size
@ -68,10 +76,12 @@ fi
export DAMASK_NUM_THREADS export DAMASK_NUM_THREADS
export PYTHONPATH=$DAMASK_ROOT/lib:$PYTHONPATH export PYTHONPATH=$DAMASK_ROOT/lib:$PYTHONPATH
for var in BASE STAT SOLVER PROCESSING FREE; do for var in BASE STAT SOLVER PROCESSING FREE DAMASK_BIN; do
unset "${var}" unset "${var}"
done done
for var in DAMASK IMKL ACML LAPACK MSC FFTW HDF5; do for var in DAMASK MSC; do
unset "${var}_ROOT" unset "${var}_ROOT"
done done
for var in ABAQUS MARC; do
unset "${var}_VERSION"
done

View File

@ -1,5 +1,6 @@
# sets up an environment for DAMASK on bash # sets up an environment for DAMASK on zsh
# usage: source DAMASK_env.sh # usage: source DAMASK_env.zsh
if [ "$OSTYPE" = "linux-gnu" ] || [ "$OSTYPE" = 'linux' ]; then if [ "$OSTYPE" = "linux-gnu" ] || [ "$OSTYPE" = 'linux' ]; then
DAMASK_ROOT=$(readlink -f "`dirname ${(%):-%N}`") DAMASK_ROOT=$(readlink -f "`dirname ${(%):-%N}`")
@ -7,12 +8,17 @@ else
print 'Not done yet' print 'Not done yet'
fi fi
[[ -f $HOME/.damask/damask.conf ]] && source $HOME/.damask/damask.conf || source /etc/damask.conf # allows to source the same file for tcsh and zsh, with and without space around =
set() {
export $1$2$3
}
source $DAMASK_ROOT/CONFIG
# if DAMASK_BIN is present and not in $PATH, add it # if DAMASK_BIN is present and not in $PATH, add it
#if [[ [[ "x$DAMASK_BIN" != "x" ]] && ! `echo ":$PATH:" | grep $DAMASK_BIN:` ]]; then MATCH=`echo ":$PATH:" | grep $DAMASK_BIN:`
if [[ ( "x$DAMASK_BIN" != "x" ) && ( "x$MATCH" = "x" ) ]]; then
export PATH=$DAMASK_BIN:$PATH export PATH=$DAMASK_BIN:$PATH
#fi fi
SOLVER=`which DAMASK_spectral 2>/dev/null` SOLVER=`which DAMASK_spectral 2>/dev/null`
if [ "x$SOLVER" = "x" ]; then if [ "x$SOLVER" = "x" ]; then
@ -22,6 +28,9 @@ PROCESSING=`which postResults 2>/dev/null`
if [ "x$PROCESSING" = "x" ]; then if [ "x$PROCESSING" = "x" ]; then
export PROCESSING='Not found!' export PROCESSING='Not found!'
fi fi
if [ "x$DAMASK_NUM_THREADS" = "x" ]; then
DAMASK_NUM_THREADS=1
fi
# according to http://software.intel.com/en-us/forums/topic/501500 # according to http://software.intel.com/en-us/forums/topic/501500
# this seems to make sense for the stack size # this seems to make sense for the stack size
@ -65,10 +74,12 @@ fi
export DAMASK_NUM_THREADS export DAMASK_NUM_THREADS
export PYTHONPATH=$DAMASK_ROOT/lib:$PYTHONPATH export PYTHONPATH=$DAMASK_ROOT/lib:$PYTHONPATH
for var in BASE STAT SOLVER PROCESSING FREE; do for var in BASE STAT SOLVER PROCESSING FREE DAMASK_BIN MATCH; do
unset "${var}" unset "${var}"
done done
for var in DAMASK IMKL ACML LAPACK MSC FFTW HDF5; do for var in DAMASK MSC; do
unset "${var}_ROOT" unset "${var}_ROOT"
done done
for var in ABAQUS MARC; do
unset "${var}_VERSION"
done