115 lines
3.1 KiB
Bash
115 lines
3.1 KiB
Bash
|
#!/bin/bash -l
|
||
|
set -ev # exit on any error; echo commands
|
||
|
|
||
|
# this script requires two variables $GIT_COMMIT and $TARGET.
|
||
|
# The former spcifies with git commit to install, the latter
|
||
|
# specifies the target system, ie "laki" or "hermit".
|
||
|
if [ -z ${GIT_COMMIT} ]; then
|
||
|
echo "Need to define variable GIT_COMMIT on commandline .. exiting.";
|
||
|
exit 1;
|
||
|
fi
|
||
|
|
||
|
if [ -z ${TARGET} ]; then
|
||
|
echo "Need to define variable TARGET on commandline .. exiting.";
|
||
|
exit 1;
|
||
|
fi
|
||
|
|
||
|
if [ ${TARGET} = "laki" ]; then
|
||
|
echo "Building for laki."
|
||
|
else
|
||
|
if [ ${TARGET} = "hermit" ]; then
|
||
|
echo "Building for hermit."
|
||
|
else
|
||
|
echo "TARGET needs to be hermit or laki ... exiting."
|
||
|
exit 1
|
||
|
fi
|
||
|
fi
|
||
|
|
||
|
# ok, we are good to go
|
||
|
STARSS_OPT_DIR=/sw/${TARGET}/hlrs/StarSs
|
||
|
STARSS_VERSION=2.3_c${GIT_COMMIT}-gnu-4.5
|
||
|
STARSS_DIR=${STARSS_OPT_DIR}/${STARSS_VERSION}
|
||
|
|
||
|
WORK_DIR=${HOME}/src
|
||
|
|
||
|
# clean up mess from previous builds
|
||
|
cd ${WORK_DIR}; rm -rf hlrs-text StarSs_c${GIT_COMMIT}
|
||
|
if [ ${TARGET} = "laki" ]; then
|
||
|
rm -f StarSs_c${GIT_COMMIT}.tar
|
||
|
fi
|
||
|
|
||
|
|
||
|
# load modules
|
||
|
if [ ${TARGET} = "laki" ]; then
|
||
|
module load compiler/gnu/4.5
|
||
|
module use /opt/amtopt/autotools/modulefiles
|
||
|
module load local
|
||
|
fi
|
||
|
|
||
|
if [ ${TARGET} = "hermit" ]; then
|
||
|
module swap $(module list -l 2>&1 | awk '/^PrgEnv-/{print $1}') PrgEnv-gnu
|
||
|
fi
|
||
|
|
||
|
# prep git repo, needs hlrs-gitolite in .ssh/config and ssh key
|
||
|
cd ${WORK_DIR}
|
||
|
|
||
|
if [ ${TARGET} = "laki" ]; then
|
||
|
git clone hlrs-gitolite:hlrs-text
|
||
|
cd hlrs-text
|
||
|
git checkout -b ayudame origin/ayudame
|
||
|
cd ProgModel/SMPSs_repository/starss
|
||
|
git archive --format=tar --prefix=StarSs_c${GIT_COMMIT}/ -o ${WORK_DIR}/StarSs_c${GIT_COMMIT}.tar ${GIT_COMMIT} .
|
||
|
fi
|
||
|
|
||
|
# unpack, configure and build
|
||
|
cd ${WORK_DIR}
|
||
|
tar xvf StarSs_c${GIT_COMMIT}.tar
|
||
|
cd StarSs_c${GIT_COMMIT}
|
||
|
|
||
|
autoreconf -fiv 2>&1 | tee autoreconf.log
|
||
|
./configure --prefix=$STARSS_DIR \
|
||
|
--with-flavour=smp \
|
||
|
--enable-comm-thread \
|
||
|
--enable-ayudame
|
||
|
gzip autoreconf.log; gzip config.log
|
||
|
|
||
|
make 2>&1 | tee make.log
|
||
|
rm -rf ${STARSS_DIR}; make install 2>&1 | tee make_install.log
|
||
|
gzip make.log ; gzip make_install.log
|
||
|
|
||
|
# save logs
|
||
|
cp -a autoreconf.log.gz config.log.gz make.log.gz make_install.log.gz $STARSS_DIR
|
||
|
|
||
|
# copy header files
|
||
|
mkdir $STARSS_DIR/include/master
|
||
|
cp -a master/*.h $STARSS_DIR/include/master/
|
||
|
|
||
|
# setup smpss-cc.conf
|
||
|
if
|
||
|
if [ ${TARGET} = "hermit" ]; then
|
||
|
cd $STARSS_DIR/etc
|
||
|
cp -a smpss-cc.conf smpss-cc.conf_orig
|
||
|
cat smpss-cc.conf | \
|
||
|
sed "s/^compiler =.*/compiler = cc/" | \
|
||
|
sed "s/^linker =.*/linker = CC/" | \
|
||
|
sed "s/^linker_parameters =.*/\0 -dynamic/" | \
|
||
|
sed "s/^fortran_compiler =.*/fortran_compiler = ftn/" | \
|
||
|
sed "s/^fortran_libs =.*/#\0\nfortran_libs = -lm/" \
|
||
|
>> smpss-cc.conf_next
|
||
|
mv smpss-cc.conf_next smpss-cc.conf
|
||
|
fi
|
||
|
|
||
|
|
||
|
# do module
|
||
|
cd $STARSS_OPT_DIR
|
||
|
chmod -R g=u $STARSS_VERSION
|
||
|
chmod -R o=u $STARSS_VERSION
|
||
|
chmod -R o-w $STARSS_VERSION
|
||
|
|
||
|
cd modulefiles
|
||
|
cat 2.3_testing-gnu-4.5 | \
|
||
|
sed "s/set VERSION.*/set VERSION ${STARSS_VERSION}/" | \
|
||
|
sed "s/ Installed.*/ Installed `date`/" > ${STARSS_VERSION}
|
||
|
chmod 664 ${STARSS_VERSION}
|
||
|
rm 2.3_testing-gnu-4.5
|
||
|
ln -s ${STARSS_VERSION} 2.3_testing-gnu-4.5
|