Skip to content

Commit

Permalink
Adding basic set of scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
sithhell committed Nov 2, 2015
1 parent ecc7a73 commit 09af37b
Show file tree
Hide file tree
Showing 7 changed files with 340 additions and 0 deletions.
5 changes: 5 additions & 0 deletions babbage/info.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
if hostname | grep -q '^bint'
then
VALID=true
fi
NAME="Babbage"
26 changes: 26 additions & 0 deletions babbage/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
echo $BASE_PATH

prepare_hwloc
prepare_jemalloc
prepare_boost

echo "Building dependencies for the XeonPhi"

CC=icc
CXX=icpc
CFLAGS="-mmic"
CXXFLAGS="-std=c++14 -mmic"
LDFLAGS="-mmic"
make_hwloc "babbage/hwloc/mic" --host=x86_64-k1om-linux
make_jemalloc "babbage/jemalloc/mic" --host=x86_64-k1om-linux
make_boost "babbage/boost/mic" toolset=intel

echo "Building dependencies for the Host"
CC=
CXX=
CFLAGS=
CXXFLAGS="-std=c++14"
LDFLAGS=
make_hwloc "babbage/hwloc/host"
make_jemalloc "babbage/jemalloc/mic"
make_boost "babbage/boost/host" toolset=intel
50 changes: 50 additions & 0 deletions misc/boost.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
function prepare_boost()
{
mkdir -p ${BASE_PATH}/source
cd ${BASE_PATH}/source

if [ ! -f boost_1_59_0.tar.bz2 ]
then
echo -n "Downloading boost ..."
wget -q http://downloads.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.bz2
echo "done"
else
echo "Downloading boost ...done"
fi

if [ ! -d boost_1_59_0 ]
then
echo -n "Unpacking boost ..."
tar xf boost_1_59_0.tar.bz2
echo "done"
else
echo "Unpacking boost ...done"
fi

cd ${BASE_PATH}
}

function make_boost()
{
mkdir -p $BASE_PATH/source/boost_1_59_0/$1
ln -sf $BASE_PATH/source/boost_1_59_0/* $BASE_PATH/source/boost_1_59_0/$1/
cd $BASE_PATH/source/boost_1_59_0/$1/
if [ ! -f b2 ]
then
./bootstrap.sh
fi
echo $2
./b2 -j8 --without-mpi \
--withou-python \
--without-log \
--without-graph \
--without-serialization \
--without-test \
--without-graph_parallel \
--without-math \
variant=release \
$2 \
cxxflags="$CXXFLAGS" \
cxxflags="$LDFLAGS"
echo ""
}
73 changes: 73 additions & 0 deletions misc/hwloc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
function prepare_hwloc()
{
mkdir -p ${BASE_PATH}/source
cd ${BASE_PATH}/source

if [ ! -f hwloc-1.11.1.tar.bz2 ]
then
echo -n "Downloading hwloc ..."
wget -q http://www.open-mpi.org/software/hwloc/v1.11/downloads/hwloc-1.11.1.tar.bz2
echo "done"
else
echo "Downloading hwloc ...done"
fi

if [ ! -d hwloc-1.11.1 ]
then
echo -n "Unpacking hwloc ..."
tar xf hwloc-1.11.1.tar.bz2
echo "done"
else
echo "Unpacking hwloc ...done"
fi

cd ${BASE_PATH}
}

function make_hwloc()
{
mkdir -p $BASE_PATH/source/hwloc-1.11.1/$1
cd $BASE_PATH/source/hwloc-1.11.1/$1
TMP_LOG=$BASE_PATH/source/hwloc-1.11.1/$1/$$.log
if [ ! -f config.log ]
then
echo -n "Configuring hwloc..."
rm -rf $BASE_PATH/packages/$1
CC=$CC CXX=$CXX CFLAGS=$CFLAGS LDFLAGS=$LDFLAGS CXXFLAGS=$CXXFLAGS \
$BASE_PATH/source/hwloc-1.11.1/configure \
--prefix=$BASE_PATH/packages/$1 \
$2 &> $TMP_LOG

if [ $? != 0 ]
then
echo "failed"
tail -n 100 $TMP_LOG
rm -rf *
cd $BASE_PATH
exit 1
fi
echo "done"
fi
echo -n "Building hwloc..."
make -j8 &> $TMP_LOG
if [ $? != 0 ]
then
echo "failed"
tail -n 100 $TMP_LOG
exit 1
fi
echo "done"
echo -n "Installing hwloc..."
if [ ! -f $BASE_PATH/packages/$1/lib/libhwloc.so ]
then
make install &> $TMP_LOG
if [ $? != 0 ]
then
echo "failed"
tail -n 100 $TMP_LOG
exit 1
fi
fi
echo "done"
cd $BASE_PATH
}
74 changes: 74 additions & 0 deletions misc/jemalloc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
function prepare_jemalloc()
{
mkdir -p ${BASE_PATH}/source
cd ${BASE_PATH}/source

if [ ! -f jemalloc-4.0.4.tar.bz2 ]
then
echo -n "Downloading jemalloc ..."
wget -q https://github.com/jemalloc/jemalloc/releases/download/4.0.4/jemalloc-4.0.4.tar.bz2
echo "done"
else
echo "Downloading jemalloc ...done"
fi

if [ ! -d jemalloc-4.0.4 ]
then
echo -n "Unpacking jemalloc ..."
tar xf jemalloc-4.0.4.tar.bz2
echo "done"
else
echo "Unpacking jemalloc ...done"
fi

cd ${BASE_PATH}
}

function make_jemalloc()
{
mkdir -p $BASE_PATH/source/jemalloc-4.0.4/$1
cd $BASE_PATH/source/jemalloc-4.0.4/$1
TMP_LOG=$BASE_PATH/source/jemalloc-4.0.4/$1/$$.log
if [ ! -f config.log ]
then
echo -n "Configuring jemalloc..."
rm -rf $BASE_PATH/packages/$1
CC=$CC CXX=$CXX CFLAGS=$CFLAGS LDFLAGS=$LDFLAGS CXXFLAGS=$CXXFLAGS \
$BASE_PATH/source/jemalloc-4.0.4/configure \
--prefix=$BASE_PATH/packages/$1 \
$2 &> $TMP_LOG

if [ $? != 0 ]
then
echo "failed"
tail -n 100 $TMP_LOG
rm -rf *
cd $BASE_PATH
exit 1
fi
echo "done"
fi
echo -n "Building jemalloc..."
make -j8 build_doc &> $TMP_LOG
make -j8 &> $TMP_LOG
if [ $? != 0 ]
then
echo "failed"
tail -n 100 $TMP_LOG
exit 1
fi
echo "done"
echo -n "Installing jemalloc..."
if [ ! -f $BASE_PATH/packages/$1/lib/libjemalloc.so ]
then
make install &> $TMP_LOG
if [ $? != 0 ]
then
echo "failed"
tail -n 100 $TMP_LOG
exit 1
fi
fi
echo "done"
cd $BASE_PATH
}
35 changes: 35 additions & 0 deletions misc/modules.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
LOADED_MODULES_BAK=`echo $LOADEDMODULES | sed 's/:/ /g'`

function load_modules()
{
module purge
LOADED_MODULES=`echo $LOADEDMODULES | sed 's/:/ /g'`
for module in $1
do
echo -n "Trying to load $module... "
module_name=`echo $module | awk -F'/' '{print $1}'`
module_version=`echo $module | awk -F'/' '{print $2}'`
if echo $LOADED_MODULES | grep -vq "$module_name"
then
# module has not been loaded yet
module load $module
echo "done (loaded)"
else
if echo $LOADED_MODULES | grep -q "$module"
then
echo "done (already loaded)"
else
if [[ "$module_version" == "" ]]
then
echo "done (already loaded, unversioned)"
else
echo ""
echo "A module named $module_name is already loaded with a different version and will conflict"
module list
exit 1
fi
fi
fi
done
module list
}
77 changes: 77 additions & 0 deletions run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#!/bin/bash
#
###############################################################################
#
# This set of scripts compiles HPX and provides a set of modulefiles that can
# be loaded. All dependencies that are needed to compile and run a HPX version
# will be installed.
#
# Run run.sh --help for more information
#
###############################################################################

BASE_PATH=`dirname $(readlink -e $0)`

echo "HPX will be installed to $BASE_PATH/packages/hpx."
echo "Module files will be placed in $BASE_PATH/modulefiles."

HOSTS=
for host in `find $BASE_PATH -maxdepth 1 -type d`
do
if [ -e ${host}/info.sh ]
then
HOSTS="${host} ${HOSTS}"
fi
done

echo $hosts

if [ x"$1" == x"--help" ]
then
echo "Available hosts:"
fi
for host in $HOSTS
do
source ${host}/info.sh
if [ x"$1" == x"--help" ]
then
echo " - ${NAME}"
fi
if [ x"${VALID}" == x"true" ]
then
current_host=${NAME}
HOST_PATH=${host}
fi
done

if [ x"$1" == x"--help" ]
then
echo ""
fi

if [ x"${current_host}" != x"" ]
then
echo "The script is running on $current_host"
else
echo "hostname \"$(hostname)\" is not supported."
exit 1
fi

if [ x"$1" == x"--help" ]
then
exit 1
fi

. $BASE_PATH/misc/modules.sh
. $BASE_PATH/misc/hwloc.sh
. $BASE_PATH/misc/jemalloc.sh
. $BASE_PATH/misc/boost.sh

. $HOST_PATH/install.sh

# Running scripts for Babbage
#if hostname | grep -q '^bint'
#then
# . $BASE_PATH/run.sh
# exit $?
#fi

0 comments on commit 09af37b

Please sign in to comment.