From 27a1d5cb9cbbdee62c2cbc99aa6de3607454437d Mon Sep 17 00:00:00 2001 From: Jose Gracia Date: Thu, 28 Jul 2011 09:19:21 +0000 Subject: [PATCH] StarSs_testing script update for Cray compiler on hermit The script StarSs_testing_install.sh now accepts the new TARGET=hermit_cray, which builds for the Cray compiler on Hermit. Needs to jump through quite some loops at the moment to accomodate the cray compiler or the configure scripts. Also, as of 28 July, the resulting installation does not work (segfault when executing SMPSs app). Not sure if this is a problem of the new 2.4 runtime, this script, or the Cray programming environment. --- StarSs_testing_install.sh | 129 +++++++++++++++++++++++++++++++------- 1 file changed, 108 insertions(+), 21 deletions(-) diff --git a/StarSs_testing_install.sh b/StarSs_testing_install.sh index e03878a..0b77968 100755 --- a/StarSs_testing_install.sh +++ b/StarSs_testing_install.sh @@ -4,6 +4,7 @@ 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; @@ -20,22 +21,33 @@ else if [ ${TARGET} = "hermit" ]; then echo "Building for hermit." else - echo "TARGET needs to be hermit or laki ... exiting." - exit 1 + 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 fi fi +COMPILER=gnu-4.5 +if [ ${TARGET} = "hermit_cray" ]; then + COMPILER=cray + TARGET=hermit +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_VERSION=2.4_c${GIT_COMMIT}-${COMPILER} 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} +cd ${WORK_DIR}; rm -rf hlrs-text StarSs_c${GIT_COMMIT} Ayudame_c${GIT_COMMIT} +rm -rf $STARSS_DIR if [ ${TARGET} = "laki" ]; then - rm -f StarSs_c${GIT_COMMIT}.tar + rm -f StarSs_c${GIT_COMMIT}.tar Ayudame_c${GIT_COMMIT}.tar fi @@ -44,10 +56,17 @@ if [ ${TARGET} = "laki" ]; then module load compiler/gnu/4.5 module use /opt/amtopt/autotools/modulefiles module load local + module load system/perfctr system/papi/4.1.2.1a + PAPI_DIR=/sw/laki/hlrs/system/papi/4.1.2.1a fi if [ ${TARGET} = "hermit" ]; then - module swap $(module list -l 2>&1 | awk '/^PrgEnv-/{print $1}') PrgEnv-gnu + 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 fi # prep git repo, needs hlrs-gitolite in .ssh/config and ssh key @@ -59,33 +78,90 @@ if [ ${TARGET} = "laki" ]; then 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} . + cd ../../../Tools/Ayudame + git archive --format=tar --prefix=Ayudame_c${GIT_COMMIT}/ -o ${WORK_DIR}/Ayudame_c${GIT_COMMIT}.tar ${GIT_COMMIT} . fi # unpack, configure and build cd ${WORK_DIR} tar xvf StarSs_c${GIT_COMMIT}.tar +tar xvf Ayudame_c${GIT_COMMIT}.tar + cd StarSs_c${GIT_COMMIT} +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 autoreconf -fiv 2>&1 | tee autoreconf.log -./configure --prefix=$STARSS_DIR \ +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 \ --with-flavour=smp \ --enable-comm-thread \ - --enable-ayudame -gzip autoreconf.log; gzip config.log + --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 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 +make install 2>&1 | tee make_install.log # save logs +gzip autoreconf.log; gzip config.log; gzip make.log ; gzip make_install.log 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/ +#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} + # setup smpss-cc.conf -if if [ ${TARGET} = "hermit" ]; then cd $STARSS_DIR/etc cp -a smpss-cc.conf smpss-cc.conf_orig @@ -95,21 +171,32 @@ if [ ${TARGET} = "hermit" ]; then 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 + > smpss-cc.conf_next mv smpss-cc.conf_next smpss-cc.conf + 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 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 +chmod -R o=u-w $STARSS_VERSION cd modulefiles -cat 2.3_testing-gnu-4.5 | \ +cat 2.4_testing-${COMPILER} | \ sed "s/set VERSION.*/set VERSION ${STARSS_VERSION}/" | \ - sed "s/ Installed.*/ Installed `date`/" > ${STARSS_VERSION} + sed "s/ Installed.*/ Installed `date`/" > ${STARSS_VERSION}_next +mv ${STARSS_VERSION}_next ${STARSS_VERSION} chmod 664 ${STARSS_VERSION} -rm 2.3_testing-gnu-4.5 -ln -s ${STARSS_VERSION} 2.3_testing-gnu-4.5 \ No newline at end of file +rm 2.4_testing-${COMPILER} +ln -s ${STARSS_VERSION} 2.4_testing-${COMPILER}