DAMASK_EICMD/installation/mods_MarcMentat/apply_DAMASK_modifications

145 lines
4.3 KiB
Bash
Executable File

#!/bin/bash
DEFAULT_INSTALLDIR='/msc'
DEFAULT_ACMLDIR='/opt/acml4.0.0'
DEFAULT_VERSION='2011'
WORKINGDIR=`dirname $0`
while [ ! -d "$WORKINGDIR/$VERSION" ] || [ -z "$VERSION" ]
do
echo "Input version of MARC/MENTAT installation: [${DEFAULT_VERSION}]"
read VERSION
if [ -z "$VERSION" ]; then
VERSION=${DEFAULT_VERSION}
fi
done
echo "MSC version: $VERSION"
INSTALLDIR=''
if [ -f $WORKINGDIR/../../lib/pathinfo ]; then
INSTALLDIR=`grep -vE "^[[:space:]]*#|^$" | grep msc $WORKINGDIR/../../lib/pathinfo | head -n1 | awk 'BEGIN { FS = "[ \t]+" } ; { print $2 }'`
fi
while [ ! -d "$INSTALLDIR" ] || [ -z "$INSTALLDIR" ]
do
echo "Input path of MARC/MENTAT installation: [${DEFAULT_INSTALLDIR}]"
read INSTALLDIR
if [ -z $INSTALLDIR ]; then
INSTALLDIR=${DEFAULT_INSTALLDIR}
fi
done
INSTALLDIR=${INSTALLDIR%/} # remove trailing slash
echo "MSC installation path: $INSTALLDIR"
BLASDIR=''
FFTWDIR=''
if [ -f $WORKINGDIR/../../lib/pathinfo ]; then
IKMLDIR=`grep -vE "^[[:space:]]*#|^$" | grep ikml $WORKINGDIR/../../lib/pathinfo | head -n1 | awk 'BEGIN { FS = "[ \t]+" } ; { print $2 }'`
ACMLDIR=`grep -vE "^[[:space:]]*#|^$" | grep acml $WORKINGDIR/../../lib/pathinfo | head -n1 | awk 'BEGIN { FS = "[ \t]+" } ; { print $2 }'`
LAPACKDIR=`grep -vE "^[[:space:]]*#|^$" | grep lapack $WORKINGDIR/../../lib/pathinfo | head -n1 | awk 'BEGIN { FS = "[ \t]+" } ; { print $2 }'`
FFTWDIR=`grep -vE "^[[:space:]]*#|^$" | grep fftw $WORKINGDIR/../../lib/pathinfo | head -n1 | awk 'BEGIN { FS = "[ \t]+" } ; { print $2 }'`
if [ -d "$IKMLDIR" ]
BLASDIR=$IKMLDIR
BLASTYPE='IKML'
elif [ -d "$ACMLDIR" ]
BLASDIR=$ACMLDIR
BLASTYPE='ACML'
elif [ -d "$LAPACKDIR" ]
BLASDIR=$LAPACKDIR
BLASTYPE='LAPACK'
fi
fi
while [ ! -d "$BLASDIR" ] || [ -z "$BLASDIR" ]
do
echo "Input path of BLAS installation:"
read BLASDIR
echo "Input path of BLAS installation [IKML | ACML | LAPACK]:"
read BLASTYPE
done
if [ ! -d "$FFTWDIR" ]
echo "error, FFTW must be installed and specified in DAMASK_ROOT/lib/pathinfo"
exit
fi
BLASDIR=${BLASDIR%/} # remove trailing slash
FFTWDIR=${FFTWDIR%/} # remove trailing slash
case $BLASTYPE in
IKML | ikml)
BLAS=" -mkl"
;;
ACML | acml)
BLAS=" -L$BLASDIR/ifort64_mp/lib -lacml_mp"
;;
LAPACK | lapack)
BLAS=" -L$BLASDIR/lib -L$BLASDIR/lib64 -llapack"
;;
*)
echo "error, BLAS type must be IKML, ACML, or LAPACK"
exit
;;
esac
FFTW=" -L${FFTWDIR}/lib -lfftw3_threads -lfftw3"
# tools
echo ''
echo 'copying Marc tools...'
theDIR=$INSTALLDIR/marc$VERSION/tools
for filename in 'comp_user' \
'comp_user_h' \
'comp_user_mp' \
'run_marc' \
'run_h_marc' \
'run_mp_marc' \
'include_linux64'; do
cp $WORKINGDIR/$VERSION/Marc_tools/$filename $theDIR
echo $theDIR/$filename | xargs perl -pi -e "s:%INSTALLDIR%:${INSTALLDIR}:g"
echo $theDIR/$filename | xargs perl -pi -e "s:%VERSION%:${VERSION}:g"
echo $theDIR/$filename | xargs perl -pi -e "s:%BLAS%:${BLAS}:g"
echo $theDIR/$filename | xargs perl -pi -e "s:%FFTW%:${FFTW}:g"
echo $filename
done
# Mentat scripts
echo ''
echo 'copying Mentat scripts...'
theDIR=$INSTALLDIR/mentat$VERSION/bin
for filename in 'edit_window' \
'submit1' \
'submit2' \
'submit3'; do
cp $WORKINGDIR/$VERSION/Mentat_bin/$filename $theDIR
echo $theDIR/$filename | xargs perl -pi -e "s:%INSTALLDIR%:${INSTALLDIR}:g"
echo $theDIR/$filename | xargs perl -pi -e "s:%VERSION%:${VERSION}:g"
echo $filename
done
# Mentat scripts
echo ''
echo 'copying Mentat menus...'
theDIR=$INSTALLDIR/mentat$VERSION/menus
for filename in 'job_run.ms'; do
cp $WORKINGDIR/$VERSION/Mentat_menus/$filename $theDIR
echo $theDIR/$filename | xargs perl -pi -e "s:%INSTALLDIR%:${INSTALLDIR}:g"
echo $theDIR/$filename | xargs perl -pi -e "s:%VERSION%:${VERSION}:g"
echo $filename
done
# compile menus
echo ''
echo 'compiling menus...'
$INSTALLDIR/mentat$VERSION/bin/mentat -compile $INSTALLDIR/mentat$VERSION/menus/linux64/main.msb
# setting access rights
echo ''
echo 'setting file access rights...'
chmod 555 $INSTALLDIR/marc$VERSION/tools/run_*_marc
chmod 555 $INSTALLDIR/marc$VERSION/tools/comp_user?*
echo ''
echo 'done.'