Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
pyclaw intstall generic linux
# This is version 2.0 of the script to install Pyclaw and dependencies on linux PC
# Authors: Aron Ahmadia, Damian San Roman
# Collaborators: David Ketcheson, Lisandro Dalcin
# ------------------------------------------------------------------------------ #
# This version uses github and bitbucket sources, alternatively you may select
# non-git sources, supported via wget
# ------------------------------------------------------------------------------ #
# ------------------------------------------------------------------------------ #
echo "\PETSc + PETSc4py Setup"
echo "~~~~~~~~~~"
echo "pyclaw_prep - set up build environment"
custom_riemann_prep() {
pyclaw_prep
customriemanndir=~/devel/sandbox/emclaw/maxwell_vc_3d
echo "custom riemann = ${customriemanndir}"
}
pyclaw_prep() {
echo "pyclaw prerp"
projdir=/simdesk
echo "projdir=${projdir}"
sandbox=${projdir}/sandbox
echo "sandbox=${sandbox}"
builddir=${projdir}/opt/share
echo "builddir=${builddir}"
logdir=${builddir}/logs
echo "logdir=${logdir}"
srcdir=${builddir}/sources
echo "srcdir=${srcdir}"
profile=$HOME/.bashrc
anaconda_ver=2.0.1
psutil_ver=2.1.1
mprofiler_ver=0.31
cython_ver=master
mpi4py_ver=master
petsc_ver=3.5.1
petsc_branch=maint
petsc_subdir=maint
petsc4py_branch=maint
git_source=1
# for visualization
paraview_ver=4.1.0
cmake_ver=2.8.12.2
mkdir -p ${sandbox} ${builddir} ${logdir} ${srcdir}
#disable_threads="yes"
#if [ disable_threads == "yes" ] ; then
#threads_flag="--without-threads"
# echo "Python and extension modules will be built without thread support"
#else
threads_flag="--with-threads"
# echo "Python and extension modules will be built with thread support"
#fi
pic_flag="-fpic"
source ${profile}
}
echo "pyclaw_build_anaconda - install anaconda ${anaconda_ver}"
pyclaw_build_anaconda() {
echo "pyclaw_build_anaconda"
pyclaw_prep
cd ${srcdir}
echo "downloading and unpacking sources"
if [ ! -f $srcdir/Anaconda-${anaconda_ver}-Linux-x86_64.sh ]; then
wget -P ${srcdir} http://09c8d0b2229f813c1b93-c95ac804525aac4b6dba79b00b39d1d3.r79.cf1.rackcdn.com/Anaconda-${anaconda_ver}-Linux-x86_64.sh
fi
echo "running installation script, you might need to interact here"
bash ${srcdir}/Anaconda-${anaconda_ver}-Linux-x86_64.sh \
2>&1 | tee ${logdir}/Anaconda-${anaconda_ver}_ppc64_install.log
}
echo "pyclaw_build_psutil - install psutils ${psutil_ver}"
pyclaw_build_psutil() {
echo "pyclaw_build_psutil"
pyclaw_prep
cd ${sandbox}
if [ -d $sandbox/psutil-${psutil_ver} ]; then
rm -rf psutil-${psutil_ver}
fi
echo "downloading and unpacking sources"
if [ ! -f $srcdir/psutil-${psutil_ver} ]; then
wget --no-check-certificate -P ${srcdir} https://pypi.python.org/packages/source/p/psutil/psutil-${psutil_ver}.tar.gz
fi
tar -zxvf ${srcdir}/psutil-${psutil_ver}.tar.gz
cd psutil-${psutil_ver}
python setup.py -v build \
2>&1 | tee ${logdir}/psutil-${psutil_ver}_build.log
python setup.py -v install \
2>&1 | tee ${logdir}/psutil-${psutil_ver}_install.log
}
echo "pyclaw_build_profiler - install memory profiler ${mprofiler_ver}"
pyclaw_build_profiler() {
echo "pyclaw_build_profiler"
pyclaw_prep
cd ${sandbox}
if [ -d $sandbox/memory_profiler-${mprofiler_ver} ]; then
rm -rf memory_profiler-${mprofiler_ver}
fi
echo "downloading and unpacking sources"
if [ ! -f $srcdir/memory_profiler-${mprofiler_ver}.tar.gz ]; then
wget --no-check-certificate -P ${srcdir} https://pypi.python.org/packages/source/m/memory_profiler/memory_profiler-${mprofiler_ver}.tar.gz
fi
tar -zxvf ${srcdir}/memory_profiler-${mprofiler_ver}.tar.gz
cd memory_profiler-${mprofiler_ver}
python setup.py -v build \
2>&1 | tee ${logdir}/memory_profiler-${mprofiler_ver}_build.log
python setup.py -v install \
2>&1 | tee ${logdir}/memory_profiler-${mprofiler_ver}_install.log
}
echo "pyclaw_build_cython - install cython"
pyclaw_build_cython() {
echo "pyclaw_build_cython"
pyclaw_prep
cd ${srcdir}
if [ ! -d $srcdir/cython ]; then
git clone git@github.com:cython/cython.git
fi
cd cython
git checkout ${cython_ver}
git pull
python setup.py -v build_ext install \
2>&1 | tee ${logdir}/cython_install.log
}
echo "pyclaw_build_mpi4py - install mpi4py ${mpi4py_ver}"
pyclaw_build_mpi4py() {
echo "pyclaw_build_mpi4py"
pyclaw_prep
cd ${srcdir}
if [ ! -d $srcdir/mpi4py ]; then
git clone git@bitbucket.org:mpi4py/mpi4py.git
fi
cd mpi4py
git pull
git checkout ${mpi4py_ver}
git pull
python setup.py -v build_src build_ext install \
2>&1 | tee ${logdir}/mpi4py-${mpi4py_ver}_install.log
python setup.py test \
2>&1 | tee ${logdir}/mpi4py-${mpi4py_ver}_test.log
}
echo "pyclaw_build_petsc - install petsc-${petsc_ver}"
pyclaw_build_petsc() {
echo "pyclaw_build_petsc"
pyclaw_prep
cd ${srcdir}
if [ ${git_source} -eq 0 ]; then
if [ ! -f ${srcdir}/petsc-lite-${petsc_ver}.tar.gz ]; then
wget -P ${srcdir} http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-lite-${petsc_ver}.tar.gz
fi
tar -zxvf ${srcdir}/petsc-lite-${petsc_ver}.tar.gz
cd petsc-${petsc_ver}
petsc_src=${srcdir}/petsc-${petsc_ver}
petsc_subdir=${petsc_ver}
else
cd ${srcdir}
if [ ! -d $srcdir/petsc ]; then
git clone -b ${petsc_branch} git@bitbucket.org:petsc/petsc.git petsc
fi
cd petsc
git pull
petsc_src=${srcdir}/petsc
petsc_subdir=${petsc_branch}
fi
echo "configuration"
conda remove hdf5
unset PETSC_DIR
./configure \
--known-mpi-shared-libraries=1 \
--download-fblaslapack=1 \
--with-shared-libraries=1 \
--download-hdf5=1 \
-CFLAGS=-g -CXXFLAGS=-g \
-FFLAGS=-g --with-debugging=1 \
-COPTFLAGS=-g \
-FOPTFLAGS=-g \
--download-make \
--download-cmake \
LIBS=-dynamic \
PETSC_ARCH=arch-linux-so \
--prefix=${builddir}/petsc/${petsc_subdir}/linux \
2>&1 | tee ${logdir}/petsc-${petsc_subdir}_configure.log
make PETSC_DIR=${petsc_src} PETSC_ARCH=arch-linux-so all \
2>&1 | tee ${logdir}/petsc-${petsc_subdir}_make.log
make PETSC_DIR=${petsc_src} PETSC_ARCH=arch-linux-so install \
2>&1 | tee ${logdir}/petsc-${petsc_subdir}_make_install.log
echo "export PETSC_DIR"
echo -e "# added by PETSc install, version ${petsc_branch}"
echo -e "export PETSC_DIR=${builddir}/petsc/${petsc_subdir}/linux \n" >> ${profile}
echo -e "export PETSC_ARCH=arch-linux-so \n" >> ${profile}
export PETSC_DIR=${builddir}/petsc/${petsc_subdir}/linux
}
echo "pyclaw_build_petsc_git - install petsc via git"
pyclaw_build_petsc_git() {
echo "pyclaw_build_petsc_git"
pyclaw_prep
cd ${srcdir}
if [ ! -d $srcdir/petsc ]; then
git clone -b ${petsc_branch} git@bitbucket.org:petsc/petsc.git petsc
fi
cd petsc
git checkout ${petsc_branch}
git pull
echo "configuration"
conda remove hdf5
unset PETSC_DIR
./configure \
--known-mpi-shared-libraries=1 \
--download-fblaslapack=1 \
--with-shared-libraries=1 \
--download-hdf5=1 \
-CFLAGS=-g -CXXFLAGS=-g \
-FFLAGS=-g --with-debugging=1 \
-COPTFLAGS=-g \
-FOPTFLAGS=-g \
--download-make \
--download-cmake \
LIBS=-dynamic \
PETSC_ARCH=arch-linux-so \
--prefix=${builddir}/petsc/${petsc_branch}/linux \
2>&1 | tee ${logdir}/petsc-${petsc_branch}_configure.log
make PETSC_DIR=${srcdir}/petsc PETSC_ARCH=arch-linux-so all \
2>&1 | tee ${logdir}/petsc-${petsc_branch}_make.log
make PETSC_DIR=${srcdir}/petsc PETSC_ARCH=arch-linux-so install \
2>&1 | tee ${logdir}/petsc-${petsc_branch}_make_install.log
echo "export PETSC_DIR"
echo -e "# added by PETSc install, version ${petsc_branch}"
echo -e "export PETSC_DIR=${builddir}/petsc/${petsc_branch}/linux \n" >> ${profile}
echo -e "export PETSC_ARCH=arch-linux-so \n" >> ${profile}
export PETSC_DIR=${builddir}/petsc/${petsc_branch}/linux
}
echo "pyclaw_build_petsc4py_git - install petsc4py via git"
pyclaw_build_petsc4py_git() {
echo "pyclaw_build_petsc4py_git"
pyclaw_prep
cd ${srcdir}
if [ ! -d $srcdir/petsc4py ]; then
git clone -b ${petsc4py_branch} git@bitbucket.org:petsc/petsc4py.git petsc4py
fi
cd petsc4py
git pull
export PETSC_DIR=${builddir}/petsc/${petsc_subdir}/linux
python setup.py -v build_src build_ext install \
2>&1 | tee ${logdir}/petsc4py-${petsc_branch}_install.log
}
echo "pyclaw_build_petsc4py - install petsc4py ${petsc4py_ver}"
pyclaw_build_petsc4py() {
echo "pyclaw_build_petsc4py"
pyclaw_prep
cd ${srcdir}
if [ ${git_source} -eq 0 ]; then
echo "downloading and unpacking sources"
if [ ! -f $srcdir/petsc4py-${petsc4py_ver}.tar.gz ]; then
wget --no-check-certificate -P ${srcdir} https://petsc4py.googlecode.com/files/petsc4py-${petsc4py_ver}.tar.gz
fi
echo "unpacking sources"
tar -zxvf ${srcdir}/petsc4py-${petsc4py_ver}.tar.gz
cd ${srcdir}/petsc4py-${petsc4py_ver}
petsc4py_subdir=${petsc4py_ver}
else
if [ ! -d $srcdir/petsc4py ]; then
git clone -b ${petsc4py_branch} git@bitbucket.org:petsc/petsc4py.git petsc4py
fi
cd ${srcdir}/petsc4py
git pull
petsc4py_subdir=${petsc4py_branch}
fi
export PETSC_DIR=${builddir}/petsc/${petsc_subdir}/linux
python setup.py -v build build_ext install \
2>&1 | tee ${logdir}/petsc4py-${petsc4py_subdir}_install.log
python setup.py test \
2>&1 | tee ${logdir}/petsc4py-${petsc4py_subdir}_test.log
}
echo "pyclaw_build_clawpack - install clawpack"
pyclaw_build_clawpack() {
echo "pyclaw_build_clawpack"
pyclaw_prep
cd ${sandbox}
git clone git://github.com/clawpack/clawpack.git
cd clawpack/
git submodule init
git submodule update
pip install -e . \
2>&1 | tee ${logdir}/clawpack_make_install.log
}
pyclaw_build_cmake(){
echo "pyclaw_build_cmake"
pyclaw_prep
cd ${srcdir}
if [ ! -f ${srcdir}/cmake-${cmake_ver}.tar.gz ]; then
wget --no-check-certificate -P ${srcdir} http://www.cmake.org/files/v2.8/cmake-${cmake_ver}.tar.gz
fi
if [ -d ${srcdir}/cmake-${cmake_ver} ]; then
rm -rf cmake-${cmake_ver}
fi
tar -zxvf ${srcdir}/cmake-${cmake_ver}.tar.gz
cd ${srcdir}/cmake-${cmake_ver}
./bootstrap \
--prefix=${builddir}/cmake/${cmake_ver} \
--qt-qmake=qmake \
2>&1 | tee ${logdir}/cmake_bootstrap.log
make 2>&1 | tee ${logdir}/cmake_make.log
make install 2>&1 | tee ${logdir}/cmake_install.log
cmake_dir=${builddir}/cmake/${cmake_ver}/bin
export PATH=${cmake_dir}:$PATH
echo "adding to path"
line_to_add="export PATH=\"${cmake_dir}"
printf "\n # added by cmake ${cmake_ver} \n" >> "${profile}"
printf "%s:$" "${line_to_add}" >> "${profile}"
printf "PATH\" \n" >> "${profile}"
unset line_to_add
}
pyclaw_build_paraview(){
echo "pyclaw_build_paraview"
pyclaw_prep
cd ${srcdir}
if [ ! -f $srcdir/ParaView-v4.1.0-source.tar ]; then
wget --no-check-certificate -P ${srcdir} \
http://www.paraview.org/paraview-downloads/download.php?submit=Download\&version=v4.1\&type=source\&os=all\&downloadFile=ParaView-v4.1.0-source.tar.gz
fi
if [ -d ${srcdir}/ParaView-v4.1.0-source ]; then
rm -rf ParaView-v4.1.0-source
fi
tar -zxvf ${srcdir}/paraview-v4.1.0-source.tar
cd ${builddir}
mkdir ${builddir}/paraview
mkdir ${builddir}/paraview/4.1.0/
cd ${builddir}/paraview/4.1.0/
ccmake ${srcdir}/ParaView-v4.1.0-source
}
pyclaw_build_paraview_git(){
echo "pyclaw_build_paraview_git"
pyclaw_prep
cd ${srcdir}
if [ ! -d ${srcdir}/ParaView ]; then
git clone git://paraview.org/ParaView.git ParaView
fi
cd ParaView
}
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
echo "pyclaw_build_all - run all install scripts"
pyclaw_build_all() {
pyclaw_prep
pyclaw_build_psutil
pyclaw_build_profiler
pyclaw_build_cython
pyclaw_build_mpi4py
pyclaw_build_petsc_git
pyclaw_build_petsc4py_git
pyclaw_build_clawpack
###
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment