Commit 6b0db63d authored by Praetorius, Simon's avatar Praetorius, Simon

installation-script for dune added

parent 4a51c82c
import os
import subprocess
def shell(command):
subprocess.check_output(command, shell=True)
def cd(directory):
os.chdir(directory)
def rm(filename):
os.remove(filename)
def mkdir(directory):
if not os.path.exists(directory):
os.makedirs(directory)
# configure blas library
blas_name = 'blas'
blas_dir = '/usr/lib/openblas-base'
blas_lib = blas_dir + '/lib' + blas_name + '.a'
# configure source and install directory
source_dir = '/opt/sources/dune'
install_dir = '/opt/software/dune'
num_proc = 4
alberta_source = ['alberta-3.0.1',
'http://www.mathematik.uni-stuttgart.de/fak8/ians/lehrstuhl/nmh/downloads/alberta/alberta-3.0.1.tar.gz',
'https://www.ians.uni-stuttgart.de/subversion/alberta/trunk/albertadist']
ug_source = ['ug-3.12.1',
'http://conan.iwr.uni-heidelberg.de/download/ug-3.12.1.tar.gz']
vc_source = 'https://github.com/VcDevel/Vc.git'
modules = ['dune-common', 'dune-geometry', 'dune-localfunctions', 'dune-istl',
'dune-grid', 'dune-typetree', 'dune-functions']
repos = ['https://gitlab.dune-project.org/core/dune-common.git',
'https://gitlab.dune-project.org/core/dune-geometry.git',
'https://gitlab.dune-project.org/core/dune-localfunctions.git',
'https://gitlab.dune-project.org/core/dune-istl.git',
'https://gitlab.dune-project.org/core/dune-grid.git',
'https://gitlab.dune-project.org/pdelab/dune-typetree.git',
'https://gitlab.dune-project.org/staging/dune-functions.git']
mkdir(source_dir)
# install alberta
cd(source_dir)
if not os.path.exists(alberta_source[0] + '.tar-gz') and \
not os.path.exists(alberta_source[0]):
shell('wget ' + alberta_source[1])
shell('tar -xzf ' + alberta_source[0] + '.tar.gz')
mkdir(alberta_source[0] + '/build')
cd(alberta_source[0] + '/build')
shell('../configure --disable-graphics --disable-debug '
+ '--disable-chained-basis-functions --disable-vector-basis-functions '
+ '--with-blas --with-blas-name=' + blas_name + ' --with-blas-lib=' + blas_dir + ' '
+ '--prefix=/opt/software/alberta')
shell('make -j' + str(num_proc))
shell('make install')
# install UG
cd(source_dir)
if not os.path.exists(ug_source[0] + '.tar.gz') and \
not os.path.exists(ug_source[0]):
shell('wget ' + ug_source[1])
shell('tar -xzf ' + ug_source[0] + '.tar.gz')
mkdir(ug_source[0] + '/build')
cd(ug_source[0] + '/build')
shell('../configure --enable-dune --enable-parallel --prefix=' + install_dir)
shell('make -j' + str(num_proc))
shell('make install')
# install Vc
cd(source_dir)
if not os.path.exists('Vc'):
shell('git clone ' + vc_source + ' Vc')
mkdir('Vc/build')
cd(source_dir + '/Vc/build')
rm('CMakeCache.txt')
shell('cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=' + install_dir + ' '
+ '-DENABLE_MIC:BOOL=OFF ..')
shell('make -j' + str(num_proc) + ' install')
# install Dune modules
for i, m in enumerate(modules):
cd(source_dir)
if not os.path.exists(m):
shell('git clone ' + repos[i] + ' ' + m)
mkdir(m + '/build')
for m in modules:
cd(source_dir + '/' + m + '/build')
rm('CMakeCache.txt')
shell('cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=' + install_dir + ' '
+ '-DCXX_MAX_STANDARD=14 -DCMAKE_PREFIX_PATH:PATH=' + install_dir + '/lib/cmake '
+ '-DUG_DIR:PATH=' + install_dir + '/lib/cmake/ug -DVc_DIR:PATH=' + install_dir + '/lib/cmake/Vc '
+ '-DBLAS_blas_LIBRARY:PATH=' + blas_lib + ' '
+ '-DALBERTA_ROOT:PATH=/opt/software/alberta ..')
shell('make -j' + str(num_proc) + ' install')
# manually change the following things:
# 1) Add AddVcFlags.cmake to /opt/sources/dune/dune-common/cmake/modules/CMakeLists.txt
# 2) Add constexpr to line 291 in /opt/sources/dune/dune-functions/dune/functions/functionspacesbases/interpolate.hh
# 3) Modiy /opt/sources/dune/dune-functions/CMakeLists and remove examples sub-directory
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment