2011-05-16 13:25:53 +00:00
|
|
|
#!/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".
|
2011-07-28 09:19:21 +00:00
|
|
|
|
2011-05-16 13:25:53 +00:00
|
|
|
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
|
2011-07-28 09:19:21 +00:00
|
|
|
if [ ${TARGET} = "hermit_cray" ]; then
|
|
|
|
echo "Building for hermit with Cray compiler."
|
|
|
|
else
|
|
|
|
echo "TARGET needs to be laki, hermit or hermit_cray... exiting."
|
|
|
|
exit 1
|
|
|
|
fi
|
2011-05-16 13:25:53 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2011-07-28 09:19:21 +00:00
|
|
|
COMPILER=gnu-4.5
|
|
|
|
if [ ${TARGET} = "hermit_cray" ]; then
|
|
|
|
COMPILER=cray
|
|
|
|
TARGET=hermit
|
|
|
|
fi
|
|
|
|
|
2011-05-16 13:25:53 +00:00
|
|
|
# ok, we are good to go
|
|
|
|
STARSS_OPT_DIR=/sw/${TARGET}/hlrs/StarSs
|
2011-07-28 09:19:21 +00:00
|
|
|
STARSS_VERSION=2.4_c${GIT_COMMIT}-${COMPILER}
|
2011-05-16 13:25:53 +00:00
|
|
|
STARSS_DIR=${STARSS_OPT_DIR}/${STARSS_VERSION}
|
|
|
|
|
|
|
|
WORK_DIR=${HOME}/src
|
|
|
|
|
|
|
|
# clean up mess from previous builds
|
2011-07-28 09:19:21 +00:00
|
|
|
cd ${WORK_DIR}; rm -rf hlrs-text StarSs_c${GIT_COMMIT} Ayudame_c${GIT_COMMIT}
|
|
|
|
rm -rf $STARSS_DIR
|
2011-05-16 13:25:53 +00:00
|
|
|
if [ ${TARGET} = "laki" ]; then
|
2011-07-28 09:19:21 +00:00
|
|
|
rm -f StarSs_c${GIT_COMMIT}.tar Ayudame_c${GIT_COMMIT}.tar
|
2011-05-16 13:25:53 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# load modules
|
|
|
|
if [ ${TARGET} = "laki" ]; then
|
|
|
|
module load compiler/gnu/4.5
|
|
|
|
module use /opt/amtopt/autotools/modulefiles
|
|
|
|
module load local
|
2011-07-28 09:19:21 +00:00
|
|
|
module load system/perfctr system/papi/4.1.2.1a
|
|
|
|
PAPI_DIR=/sw/laki/hlrs/system/papi/4.1.2.1a
|
2011-05-16 13:25:53 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ${TARGET} = "hermit" ]; then
|
2011-07-28 09:19:21 +00:00
|
|
|
if [ ${COMPILER} = "cray" ]; then
|
|
|
|
module swap $(module list -l 2>&1 | awk '/^PrgEnv-/{print $1}') PrgEnv-cray
|
|
|
|
module load gcc
|
|
|
|
else
|
|
|
|
module swap $(module list -l 2>&1 | awk '/^PrgEnv-/{print $1}') PrgEnv-gnu
|
|
|
|
fi
|
2011-05-16 13:25:53 +00:00
|
|
|
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} .
|
2011-07-28 09:19:21 +00:00
|
|
|
cd ../../../Tools/Ayudame
|
|
|
|
git archive --format=tar --prefix=Ayudame_c${GIT_COMMIT}/ -o ${WORK_DIR}/Ayudame_c${GIT_COMMIT}.tar ${GIT_COMMIT} .
|
2011-05-16 13:25:53 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# unpack, configure and build
|
|
|
|
cd ${WORK_DIR}
|
|
|
|
tar xvf StarSs_c${GIT_COMMIT}.tar
|
2011-07-28 09:19:21 +00:00
|
|
|
tar xvf Ayudame_c${GIT_COMMIT}.tar
|
|
|
|
|
2011-05-16 13:25:53 +00:00
|
|
|
cd StarSs_c${GIT_COMMIT}
|
|
|
|
|
2011-07-28 09:19:21 +00:00
|
|
|
if [ ${COMPILER} = "cray" ]; then
|
|
|
|
tar xvf ../StarSs_patch_cray.tar
|
|
|
|
cat c-metadriver/SMPCompiler.cc | \
|
|
|
|
sed 's/compiler.addArgument(std::string("--cpp=") + m_options.m_compiler/compiler.addArgument(std::string("--cpp=gcc")/' > c-metadriver/SMPCompiler.cc_next
|
|
|
|
mv c-metadriver/SMPCompiler.cc_next c-metadriver/SMPCompiler.cc
|
|
|
|
fi
|
|
|
|
|
|
|
|
# install dependencies first
|
|
|
|
tar xvjf $WORK_DIR/libbitmask-2.0.tar.bz2
|
|
|
|
tar xvjf $WORK_DIR/libcpuset-1.0.tar.bz2
|
|
|
|
cd libbitmask && autoreconf -fiv && ./configure --prefix=$STARSS_DIR && make install
|
|
|
|
cd ../libcpuset && autoreconf -fiv && ./configure CFLAGS=-I$STARSS_DIR/include LDFLAGS=-L$STARSS_DIR/lib --prefix=$STARSS_DIR && make install
|
|
|
|
cd ..
|
|
|
|
|
|
|
|
# ok, now StarSs
|
2011-05-16 13:25:53 +00:00
|
|
|
autoreconf -fiv 2>&1 | tee autoreconf.log
|
2011-07-28 09:19:21 +00:00
|
|
|
PAPI_CONF=
|
|
|
|
if [ ${TARGET} = "laki" ]; then
|
|
|
|
PAPI_CONF="--enable-papi --with-papi=$PAPI_DIR"
|
|
|
|
fi
|
|
|
|
if [ ${COMPILER} = "cray" ]; then
|
|
|
|
./configure CC=gcc SMPFC=ftn SMPCC=cc SMPFPP=gfortran SMPCXX=g++ \
|
|
|
|
--prefix=$STARSS_DIR \
|
2011-05-16 13:25:53 +00:00
|
|
|
--with-flavour=smp \
|
|
|
|
--enable-comm-thread \
|
2011-07-28 09:19:21 +00:00
|
|
|
--with-libcpuset=$STARSS_DIR \
|
|
|
|
--with-ayudame-include=${WORK_DIR}/Ayudame_c${GIT_COMMIT}/include \
|
|
|
|
${PAPI_CONF} \
|
|
|
|
# empty line
|
|
|
|
else
|
|
|
|
./configure \
|
|
|
|
--prefix=$STARSS_DIR \
|
|
|
|
--with-flavour=smp \
|
|
|
|
--enable-comm-thread \
|
|
|
|
--with-libcpuset=$STARSS_DIR \
|
|
|
|
--with-ayudame-include=${WORK_DIR}/Ayudame_c${GIT_COMMIT}/include \
|
|
|
|
${PAPI_CONF} \
|
|
|
|
# empty line
|
|
|
|
fi
|
2011-05-16 13:25:53 +00:00
|
|
|
|
|
|
|
make 2>&1 | tee make.log
|
2011-07-28 09:19:21 +00:00
|
|
|
make install 2>&1 | tee make_install.log
|
2011-05-16 13:25:53 +00:00
|
|
|
|
|
|
|
# save logs
|
2011-07-28 09:19:21 +00:00
|
|
|
gzip autoreconf.log; gzip config.log; gzip make.log ; gzip make_install.log
|
2011-05-16 13:25:53 +00:00
|
|
|
cp -a autoreconf.log.gz config.log.gz make.log.gz make_install.log.gz $STARSS_DIR
|
|
|
|
|
|
|
|
# copy header files
|
2011-07-28 09:19:21 +00:00
|
|
|
#mkdir $STARSS_DIR/include/master
|
|
|
|
#cp -a master/*.h $STARSS_DIR/include/master/
|
|
|
|
|
|
|
|
cd ..
|
|
|
|
|
|
|
|
# do Ayudame
|
|
|
|
cd Ayudame_c${GIT_COMMIT}
|
|
|
|
#cat makefile | \
|
|
|
|
# sed "s/INCLUDE =.*/INCLUDE = ${WORK_DIR}/StarSs_c${GIT_COMMIT}/master/" \
|
|
|
|
# makefile_new
|
|
|
|
#mv makefile_new makefile
|
|
|
|
#make
|
|
|
|
SMPSS_DIR=${WORK_DIR}/StarSs_c${GIT_COMMIT}/master/ make
|
|
|
|
cd ..
|
|
|
|
|
|
|
|
|
|
|
|
# hacky install of Temanejo/Ayudame
|
|
|
|
cd Ayudame_c${GIT_COMMIT}
|
|
|
|
mkdir $STARSS_DIR/temanejo
|
|
|
|
cp -a *.py resources libayudame.so $STARSS_DIR/temanejo
|
|
|
|
ln -s $STARSS_DIR/temanejo/temanejo.py $STARSS_DIR/bin
|
|
|
|
cd ../StarSs_c${GIT_COMMIT}
|
|
|
|
|
2011-05-16 13:25:53 +00:00
|
|
|
|
|
|
|
# setup smpss-cc.conf
|
|
|
|
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/" \
|
2011-07-28 09:19:21 +00:00
|
|
|
> smpss-cc.conf_next
|
2011-05-16 13:25:53 +00:00
|
|
|
mv smpss-cc.conf_next smpss-cc.conf
|
2011-07-28 09:19:21 +00:00
|
|
|
if [ ${COMPILER} = "cray" ]; then
|
|
|
|
cat smpss-cc.conf | \
|
|
|
|
sed "s/mf95ss_variables = .*/mf95ss_variables = --variable=int_size:4 --variable=size_t_size:8 --variable=void_p_size:8 --variable=long_size:8/" \
|
|
|
|
> smpss-cc.conf_next
|
|
|
|
mv smpss-cc.conf_next smpss-cc.conf
|
|
|
|
cd ../share/mcxx/config.d
|
|
|
|
cat config.superscalar | \
|
|
|
|
sed "s/{gcc} compiler_options = .*/#\0\n{gcc} compiler_options = -hgnu/" \
|
|
|
|
> config.superscalar_next
|
|
|
|
mv config.superscalar_next config.superscalar
|
|
|
|
fi
|
2011-05-16 13:25:53 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# do module
|
|
|
|
cd $STARSS_OPT_DIR
|
|
|
|
chmod -R g=u $STARSS_VERSION
|
2011-07-28 09:19:21 +00:00
|
|
|
chmod -R o=u-w $STARSS_VERSION
|
2011-05-16 13:25:53 +00:00
|
|
|
|
|
|
|
cd modulefiles
|
2011-07-28 09:19:21 +00:00
|
|
|
cat 2.4_testing-${COMPILER} | \
|
2011-05-16 13:25:53 +00:00
|
|
|
sed "s/set VERSION.*/set VERSION ${STARSS_VERSION}/" | \
|
2011-07-28 09:19:21 +00:00
|
|
|
sed "s/ Installed.*/ Installed `date`/" > ${STARSS_VERSION}_next
|
|
|
|
mv ${STARSS_VERSION}_next ${STARSS_VERSION}
|
2011-05-16 13:25:53 +00:00
|
|
|
chmod 664 ${STARSS_VERSION}
|
2011-07-28 09:19:21 +00:00
|
|
|
rm 2.4_testing-${COMPILER}
|
|
|
|
ln -s ${STARSS_VERSION} 2.4_testing-${COMPILER}
|