2010-05-06 14:20:54 +05:30
|
|
|
#!/bin/bash
|
2010-05-06 19:47:53 +05:30
|
|
|
|
2011-10-20 21:43:38 +05:30
|
|
|
DEFAULT_INSTALLDIR='/msc'
|
2011-11-14 20:29:16 +05:30
|
|
|
DEFAULT_ACMLDIR='/opt/acml4.0.0'
|
2011-12-19 21:36:03 +05:30
|
|
|
DEFAULT_VERSION='2011'
|
2011-10-20 21:43:38 +05:30
|
|
|
|
2010-05-06 19:47:53 +05:30
|
|
|
WORKINGDIR=`dirname $0`
|
2011-10-20 21:43:38 +05:30
|
|
|
|
|
|
|
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=''
|
2011-11-14 20:29:16 +05:30
|
|
|
if [ -f $WORKINGDIR/../../lib/pathinfo ]; then
|
2011-12-20 18:23:19 +05:30
|
|
|
INSTALLDIR=`grep -vE "^[[:space:]]*#|^$" $WORKINGDIR/../../lib/pathinfo | grep msc | head -n1 | awk 'BEGIN { FS = "[ \t]+" } ; { print $2 }'`
|
2011-07-28 12:57:39 +05:30
|
|
|
fi
|
2011-12-20 18:23:19 +05:30
|
|
|
|
2011-10-20 21:43:38 +05:30
|
|
|
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
|
2011-07-28 12:57:39 +05:30
|
|
|
|
2010-08-18 02:52:24 +05:30
|
|
|
INSTALLDIR=${INSTALLDIR%/} # remove trailing slash
|
2011-10-20 21:43:38 +05:30
|
|
|
echo "MSC installation path: $INSTALLDIR"
|
2010-07-31 01:09:54 +05:30
|
|
|
|
2011-12-20 15:17:27 +05:30
|
|
|
BLASDIR=''
|
|
|
|
FFTWDIR=''
|
2011-11-14 20:29:16 +05:30
|
|
|
if [ -f $WORKINGDIR/../../lib/pathinfo ]; then
|
2011-12-20 18:23:19 +05:30
|
|
|
IKMLDIR=`grep -vE "^[[:space:]]*#|^$" $WORKINGDIR/../../lib/pathinfo | grep -i ikml | head -n1 | awk 'BEGIN { FS = "[ \t]+" } ; { print $2 }'`
|
|
|
|
ACMLDIR=`grep -vE "^[[:space:]]*#|^$" $WORKINGDIR/../../lib/pathinfo | grep -i acml | head -n1 | awk 'BEGIN { FS = "[ \t]+" } ; { print $2 }'`
|
|
|
|
LAPACKDIR=`grep -vE "^[[:space:]]*#|^$" $WORKINGDIR/../../lib/pathinfo | grep -i lapack | head -n1 | awk 'BEGIN { FS = "[ \t]+" } ; { print $2 }'`
|
|
|
|
FFTWDIR=`grep -vE "^[[:space:]]*#|^$" $WORKINGDIR/../../lib/pathinfo | grep -i fftw | head -n1 | awk 'BEGIN { FS = "[ \t]+" } ; { print $2 }'`
|
|
|
|
if [ -d "$IKMLDIR" ]; then
|
2011-12-20 15:17:27 +05:30
|
|
|
BLASDIR=$IKMLDIR
|
|
|
|
BLASTYPE='IKML'
|
2011-12-20 18:23:19 +05:30
|
|
|
elif [ -d "$ACMLDIR" ]; then
|
2011-12-20 15:17:27 +05:30
|
|
|
BLASDIR=$ACMLDIR
|
|
|
|
BLASTYPE='ACML'
|
2011-12-20 18:23:19 +05:30
|
|
|
elif [ -d "$LAPACKDIR" ]; then
|
2011-12-20 15:17:27 +05:30
|
|
|
BLASDIR=$LAPACKDIR
|
|
|
|
BLASTYPE='LAPACK'
|
|
|
|
fi
|
2011-11-14 20:29:16 +05:30
|
|
|
fi
|
2011-12-20 15:17:27 +05:30
|
|
|
|
|
|
|
while [ ! -d "$BLASDIR" ] || [ -z "$BLASDIR" ]
|
2011-11-14 20:29:16 +05:30
|
|
|
do
|
2011-12-20 15:17:27 +05:30
|
|
|
echo "Input path of BLAS installation:"
|
|
|
|
read BLASDIR
|
|
|
|
echo "Input path of BLAS installation [IKML | ACML | LAPACK]:"
|
|
|
|
read BLASTYPE
|
2011-11-14 20:29:16 +05:30
|
|
|
done
|
|
|
|
|
2011-12-20 18:23:19 +05:30
|
|
|
echo $IKMDIR
|
|
|
|
echo $ACMLDIR
|
|
|
|
echo $LAPACKDIR
|
|
|
|
echo $FFTWDIR
|
|
|
|
|
|
|
|
if [ ! -d "$FFTWDIR" ]; then
|
2011-12-20 15:17:27 +05:30
|
|
|
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
|
2011-12-20 18:23:19 +05:30
|
|
|
echo '3'
|
2011-12-20 15:17:27 +05:30
|
|
|
|
|
|
|
case $BLASTYPE in
|
|
|
|
IKML | ikml)
|
|
|
|
BLAS=" -mkl"
|
|
|
|
;;
|
|
|
|
ACML | acml)
|
2011-12-20 15:49:48 +05:30
|
|
|
BLAS=" -L$BLASDIR/ifort64_mp/lib -lacml_mp"
|
2011-12-20 15:17:27 +05:30
|
|
|
;;
|
|
|
|
LAPACK | lapack)
|
2011-12-20 15:49:48 +05:30
|
|
|
BLAS=" -L$BLASDIR/lib -L$BLASDIR/lib64 -llapack"
|
2011-12-20 15:17:27 +05:30
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "error, BLAS type must be IKML, ACML, or LAPACK"
|
|
|
|
exit
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
FFTW=" -L${FFTWDIR}/lib -lfftw3_threads -lfftw3"
|
2011-12-20 18:23:19 +05:30
|
|
|
echo '4'
|
2011-11-14 20:29:16 +05:30
|
|
|
|
2010-07-31 01:09:54 +05:30
|
|
|
# tools
|
2011-07-28 12:57:39 +05:30
|
|
|
echo ''
|
2010-07-31 01:09:54 +05:30
|
|
|
echo 'copying Marc tools...'
|
2011-07-28 12:57:39 +05:30
|
|
|
theDIR=$INSTALLDIR/marc$VERSION/tools
|
2010-07-31 01:09:54 +05:30
|
|
|
for filename in 'comp_user' \
|
|
|
|
'comp_user_h' \
|
|
|
|
'comp_user_mp' \
|
|
|
|
'run_marc' \
|
|
|
|
'run_h_marc' \
|
|
|
|
'run_mp_marc' \
|
2010-11-24 13:25:08 +05:30
|
|
|
'include_linux64'; do
|
2011-07-28 12:57:39 +05:30
|
|
|
cp $WORKINGDIR/$VERSION/Marc_tools/$filename $theDIR
|
2010-08-18 02:52:24 +05:30
|
|
|
echo $theDIR/$filename | xargs perl -pi -e "s:%INSTALLDIR%:${INSTALLDIR}:g"
|
2011-07-28 12:57:39 +05:30
|
|
|
echo $theDIR/$filename | xargs perl -pi -e "s:%VERSION%:${VERSION}:g"
|
2011-12-20 15:17:27 +05:30
|
|
|
echo $theDIR/$filename | xargs perl -pi -e "s:%BLAS%:${BLAS}:g"
|
|
|
|
echo $theDIR/$filename | xargs perl -pi -e "s:%FFTW%:${FFTW}:g"
|
2010-07-31 01:09:54 +05:30
|
|
|
echo $filename
|
|
|
|
done
|
|
|
|
|
|
|
|
# Mentat scripts
|
2011-07-28 12:57:39 +05:30
|
|
|
echo ''
|
2010-07-31 01:09:54 +05:30
|
|
|
echo 'copying Mentat scripts...'
|
2011-07-28 12:57:39 +05:30
|
|
|
theDIR=$INSTALLDIR/mentat$VERSION/bin
|
2010-07-31 01:09:54 +05:30
|
|
|
for filename in 'edit_window' \
|
|
|
|
'submit1' \
|
|
|
|
'submit2' \
|
|
|
|
'submit3'; do
|
2011-07-28 12:57:39 +05:30
|
|
|
cp $WORKINGDIR/$VERSION/Mentat_bin/$filename $theDIR
|
2010-08-18 02:52:24 +05:30
|
|
|
echo $theDIR/$filename | xargs perl -pi -e "s:%INSTALLDIR%:${INSTALLDIR}:g"
|
2011-07-28 12:57:39 +05:30
|
|
|
echo $theDIR/$filename | xargs perl -pi -e "s:%VERSION%:${VERSION}:g"
|
2010-07-31 01:09:54 +05:30
|
|
|
echo $filename
|
|
|
|
done
|
|
|
|
|
|
|
|
# Mentat scripts
|
2011-07-28 12:57:39 +05:30
|
|
|
echo ''
|
2010-07-31 01:09:54 +05:30
|
|
|
echo 'copying Mentat menus...'
|
2011-07-28 12:57:39 +05:30
|
|
|
theDIR=$INSTALLDIR/mentat$VERSION/menus
|
2010-07-31 01:09:54 +05:30
|
|
|
for filename in 'job_run.ms'; do
|
2011-07-28 12:57:39 +05:30
|
|
|
cp $WORKINGDIR/$VERSION/Mentat_menus/$filename $theDIR
|
2010-08-18 02:52:24 +05:30
|
|
|
echo $theDIR/$filename | xargs perl -pi -e "s:%INSTALLDIR%:${INSTALLDIR}:g"
|
2011-07-28 12:57:39 +05:30
|
|
|
echo $theDIR/$filename | xargs perl -pi -e "s:%VERSION%:${VERSION}:g"
|
2010-07-31 01:09:54 +05:30
|
|
|
echo $filename
|
|
|
|
done
|
|
|
|
|
|
|
|
# compile menus
|
2011-07-28 12:57:39 +05:30
|
|
|
echo ''
|
2010-07-31 01:09:54 +05:30
|
|
|
echo 'compiling menus...'
|
2011-07-28 12:57:39 +05:30
|
|
|
$INSTALLDIR/mentat$VERSION/bin/mentat -compile $INSTALLDIR/mentat$VERSION/menus/linux64/main.msb
|
2010-07-31 01:09:54 +05:30
|
|
|
|
|
|
|
# setting access rights
|
2011-07-28 12:57:39 +05:30
|
|
|
echo ''
|
2010-07-31 01:09:54 +05:30
|
|
|
echo 'setting file access rights...'
|
2011-07-28 12:57:39 +05:30
|
|
|
chmod 555 $INSTALLDIR/marc$VERSION/tools/run_*_marc
|
|
|
|
chmod 555 $INSTALLDIR/marc$VERSION/tools/comp_user?*
|
2010-07-31 01:09:54 +05:30
|
|
|
|
2011-07-28 12:57:39 +05:30
|
|
|
echo ''
|
2010-07-31 01:09:54 +05:30
|
|
|
echo 'done.'
|