2010-05-06 14:20:54 +05:30
#!/bin/bash
2010-05-06 19:47:53 +05:30
2013-12-19 19:07:35 +05:30
DEFAULT_VERSION = '2013.1'
2011-10-20 21:43:38 +05:30
2014-01-22 21:33:27 +05:30
WORKINGDIR = " $( cd " $( dirname " $0 " ) " && pwd ) "
2011-10-20 21:43:38 +05:30
2014-01-24 18:47:54 +05:30
if [ -f $HOME /.damask/damask.conf ] ; then
2014-01-24 18:00:27 +05:30
source $HOME /.damask/damask.conf
else
source /etc/damask.conf
fi
2014-01-12 22:59:00 +05:30
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 "
2014-01-22 21:33:27 +05:30
if [ " x $MSC_ROOT " != "x" ] ; then
INSTALLDIR = $MSC_ROOT
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
2012-01-17 14:07:09 +05:30
echo "Input path of MARC/MENTAT installation:"
2011-10-20 21:43:38 +05:30
read INSTALLDIR
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 = ''
2012-01-17 14:07:09 +05:30
BLASTYPE = ''
2014-01-22 21:33:27 +05:30
if [ " x $LAPACK_ROOT " != "x" ] ; then
2014-01-15 00:33:41 +05:30
BLASDIR = $LAPACK_ROOT
2014-01-12 22:59:00 +05:30
BLASTYPE = 'LAPACK'
fi
2014-01-22 21:33:27 +05:30
if [ " x $ACML_ROOT " != "x" ] ; then
2014-01-15 00:33:41 +05:30
BLASDIR = $ACML_ROOT
2014-01-12 22:59:00 +05:30
BLASTYPE = 'ACML'
fi
2014-01-22 21:33:27 +05:30
if [ " x $IMKL_ROOT " != "x" ] ; then
2014-01-15 00:33:41 +05:30
BLASDIR = $IMKL_ROOT
2014-01-12 22:59:00 +05:30
BLASTYPE = 'IMKL'
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
2012-11-13 20:57:06 +05:30
echo "Input type of BLAS installation [IMKL | ACML | LAPACK]:"
2011-12-20 15:17:27 +05:30
read BLASTYPE
2013-09-24 00:57:34 +05:30
echo "Input path of BLAS installation:"
read BLASDIR
2011-11-14 20:29:16 +05:30
done
2011-12-20 15:17:27 +05:30
BLASDIR = ${ BLASDIR %/ } # remove trailing slash
case $BLASTYPE in
2012-11-13 20:57:06 +05:30
IMKL | imkl)
2014-02-14 21:29:25 +05:30
BLAS = " -I $BLASDIR /include -lmkl_intel_lp64 -lmkl_core -lmkl_intel_thread -lpthread -lm -Wl,-rpath, $BLASDIR /lib/intel64 -L $BLASDIR /lib/intel64 " #I'm not too shure about the include (does that work for linker?)
2011-12-20 15:17:27 +05:30
; ;
ACML | acml)
2014-02-14 21:29:25 +05:30
BLAS = " -lacml -Wl,-rpath, $BLASDIR /ifort64/lib -L $BLASDIR /ifort64/lib "
2011-12-20 15:17:27 +05:30
; ;
LAPACK | lapack)
2014-02-14 21:29:25 +05:30
BLAS = " -llapack -Wl,-rpath, $BLASDIR /lib,-rpath, $BLASDIR /lib64 -L $BLASDIR /lib64 -L $BLASDIR /lib "
2011-12-20 15:17:27 +05:30
; ;
*)
2012-11-13 20:57:06 +05:30
echo "error, BLAS type must be IMKL, ACML, or LAPACK"
2011-12-20 15:17:27 +05:30
exit
; ;
esac
2012-11-13 20:57:06 +05:30
DEFAULT_EDITOR = 'vi'
EDITOR = ''
while [ -z " $EDITOR " ]
do
echo " Input command to invoke your preferred editor: [ ${ DEFAULT_EDITOR } ] "
read EDITOR
if [ -z " $EDITOR " ] ; then
2013-08-02 19:25:06 +05:30
EDITOR = ${ DEFAULT_EDITOR }
2012-11-13 20:57:06 +05:30
fi
done
2013-08-02 19:25:06 +05:30
echo " Editor: $EDITOR "
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
2013-07-24 14:11:58 +05:30
for filename in 'comp_damask' \
'comp_damask_l' \
'comp_damask_h' \
'comp_damask_mp' \
'comp_damask_lmp' \
'comp_damask_hmp' \
'run_damask' \
'run_damask_l' \
'run_damask_h' \
'run_damask_mp' \
'run_damask_lmp' \
'run_damask_hmp' \
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 "
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' \
2013-04-26 19:13:10 +05:30
'submit4' \
'submit5' \
'submit6' \
'submit7' \
'submit8' \
'submit9' \
'kill4' \
'kill5' \
'kill6' \
'kill7' \
'kill8' \
'kill9' ; 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 "
2012-11-13 20:57:06 +05:30
echo $theDIR /$filename | xargs perl -pi -e " s:%EDITOR%: ${ EDITOR } :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...'
2013-07-24 14:11:58 +05:30
chmod 555 $INSTALLDIR /marc$VERSION /tools/run_damask*
chmod 555 $INSTALLDIR /marc$VERSION /tools/comp_damask*
2013-04-26 19:13:10 +05:30
chmod 555 $INSTALLDIR /mentat$VERSION /bin/submit{ 4..9}
chmod 555 $INSTALLDIR /mentat$VERSION /bin/kill{ 4..9}
2010-07-31 01:09:54 +05:30
2013-08-02 19:25:06 +05:30
#creating symlinks for run_damask_scripts in /usr/local/bin
BIN_DIR = /usr/local/bin
echo ''
echo " Do you want to create symlinks for run_damask scripts in ${ BIN_DIR } [YES/no] ? "
read YESNO
if [ -z " $YESNO " ] ; then
YESNO = yes
fi
case $YESNO in
y* | Y* )
echo''
echo 'creating symlinks ...'
echo''
theDIR = $INSTALLDIR /marc$VERSION /tools
for filename in 'run_damask' \
'run_damask_l' \
'run_damask_h' \
'run_damask_mp' \
'run_damask_lmp' \
'run_damask_hmp' ; do
echo ${ filename : 4 } $VERSION
ln -s $theDIR /$filename $BIN_DIR /${ filename : 4 } $VERSION
done
; ;
esac
2011-07-28 12:57:39 +05:30
echo ''
2010-07-31 01:09:54 +05:30
echo 'done.'