FEniCS
FEniCS is a popular open-source computing platform for solving partial differential equations (PDEs).
FEniCS can be built with various extensions, so we do not offer a single, global installation. Please choose between
- Installation in a virtual environment
- Using a Singularity container
Installation in a virtual environment
These are instructions for installing FEniCS version 2017.2.0.
You can run the script below by copying it to the cluster you are using and running bash fenics-install.sh.
Note that the installation will warn you that it will create (or replace) the application directory, and will give usage instructions when the installation is successful. The script can be modified to change the installation directory if needed.
#!/bin/bash
set -e
FENICS_INSTALL=${HOME}/fenics
FENICS_VERSION=2017.2.0
PYBIND11_VERSION=2.2.3
MODULES="hdf5-mpi/1.8.18\
boost\
eigen\
python/3.5\
scipy-stack/2017b\
petsc/3.7.5\
fftw-mpi/3.3.6\
ipp/9.0.4\
gcc/5.4.0"
module load $MODULES
main () {
warning_install
make_fenics_directory
download_py_packages $FENICS_VERSION
make_py_packages
make_pybind11
make_dolfin
print_instructions
}
warning_install () {
echo "---------------------------------------------------------------"
echo "WARNING: THE FENICS/DOLFIN INSTALL WILL WIPE OUT THIS DIRECTORY"
echo " $FENICS_INSTALL "
echo
echo "IF YOU DON'T WANT THIS TO HAPPEN, PRESS CTRL-C TO ABORT"
echo "PRESS ANY KEY TO CONTINUE"
echo "---------------------------------------------------------------"
read -n 1
}
print_instructions () {
echo "---------------------------------------------------------------"
echo "TO USE FENICS/DOLFIN, YOU NEED TO DO:"
echo
echo "module load $MODULES"
echo "source $FENICS_INSTALL/bin/activate"
echo "source $FENICS_INSTALL/share/dolfin/dolfin.conf"
echo "---------------------------------------------------------------"
}
make_fenics_directory () {
rm -rf $FENICS_INSTALL
mkdir -p $FENICS_INSTALL && cd $FENICS_INSTALL
}
download_py_packages () {
version=$1
cd $FENICS_INSTALL
git clone --branch=$version https://bitbucket.org/fenics-project/fiat.git
git clone --branch=$version https://bitbucket.org/fenics-project/instant.git
git clone --branch=$version https://bitbucket.org/fenics-project/dijitso.git
git clone --branch=$version https://bitbucket.org/fenics-project/ufl.git
git clone --branch=$version https://bitbucket.org/fenics-project/ffc.git
git clone --branch=$version https://bitbucket.org/fenics-project/dolfin.git
git clone --branch=$version https://bitbucket.org/fenics-project/mshr.git
git clone --branch=v$PYBIND11_VERSION \
https://github.com/pybind/pybind11.git
chmod u+w ~/fenics/*/.git/objects/pack/*
mkdir -p $FENICS_INSTALL/pybind11/build
mkdir -p $FENICS_INSTALL/dolfin/build
mkdir -p $FENICS_INSTALL/mshr/build
}
make_pybind11 () {
cd $FENICS_INSTALL/pybind11/build
source $FENICS_INSTALL/bin/activate
cmake -DPYBIND11_TEST=off \
-DCMAKE_INSTALL_PREFIX=$HOME/fenics \
-DPYBIND11_CPP_STANDARD=-std=c++11 ..
nice make -j8 install
}
make_py_packages () {
cd $FENICS_INSTALL
virtualenv --no-download $FENICS_INSTALL
source $FENICS_INSTALL/bin/activate
pip3 install ply
pip3 install numpy
cd $FENICS_INSTALL/fiat && pip3 install .
cd $FENICS_INSTALL/instant && pip3 install .
cd $FENICS_INSTALL/dijitso && pip3 install .
cd $FENICS_INSTALL/ufl && pip3 install .
cd $FENICS_INSTALL/ffc && pip3 install .
}
make_dolfin () {
cd $FENICS_INSTALL/dolfin/build
source $FENICS_INSTALL/bin/activate
cmake .. -DDOLFIN_SKIP_BUILD_TESTS=true \
-DEIGEN3_INCLUDE_DIR=$EBROOTEIGEN/include \
-DCMAKE_INSTALL_PREFIX=$HOME/fenics \
-DCMAKE_SKIP_RPATH=ON \
-DRT_LIBRARY=$EBROOTNIXPKGS/lib64/librt.so \
-DHDF5_C_LIBRARY_dl=$EBROOTNIXPKGS/lib64/libdl.so \
-DHDF5_C_LIBRARY_m=$EBROOTNIXPKGS/lib64/libm.so \
-DHDF5_C_LIBRARY_pthread=$EBROOTNIXPKGS/lib64/libpthread.so \
-DHDF5_C_LIBRARY_z=$EBROOTNIXPKGS/lib/libz.so \
-DLIB_ifcore_pic=$EBROOTIFORT/lib/intel64/libifcore.so \
-DLIB_ipgo=$EBROOTIPP/lib/intel64/libipgo.a \
-DLIB_decimal=$EBROOTIPP/lib/intel64/libdecimal.a \
-DLIB_irc_s=$EBROOTIPP/lib/intel64/libirc_s.a
nice make -j 8 install
cd $FENICS_INSTALL/dolfin/python && pip3 install .
}
main
FEniCS add-ons
First install FEniCS following instructions above.
mshr
module load hdf5-mpi/1.8.18 boost eigen python/3.5 scipy-stack/2017b petsc/3.7.5 fftw-mpi/3.3.6
export CMAKE_PREFIX_PATH=/home/$USER/software/dolfin/share/dolfin/cmake/:$CMAKE_PREFIX_PATH
git clone https://bitbucket.org/fenics-project/mshr.git
cd mshr
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/software/mshr -DCMAKE_BUILD_TYPE=Release -DCMAKE_SKIP_RPATH=ON -DCMAKE_PREFIX_PATH=$NIXUSER_PROFILE:$CMAKE_PREFIX_PATH -DEIGEN3_INCLUDE_DIR=$EBROOTEIGEN/include
make
make install
Then run
module load hdf5-mpi/1.8.18 boost eigen python/3.5 scipy-stack/2017b petsc/3.7.5 fftw-mpi/3.3.6
source ~/software/dolfin/share/dolfin/dolfin.conf
source ~/fenics/bin/activate
export PYTHONPATH=$HOME/software/mshr/lib/python3.5/site-packages:$PYTHONPATH
export LD_LIBRARY_PATH=$HOME/software/mshr/lib:$LD_LIBRARY_PATH
Using a Singularity container
The following Singularity Recipe will download the FEniCS Docker image, install it, and download additional packages, e.g., various Python packages. This recipe must be run on your own machine, that is, a Linux machine with Singularity installed where you have root access.
To build your FEniCS image using this recipe, run the following command:
sudo singularity build FEniCS.simg FEniCS-ComputeCanada-Singularity-Recipe
and then upload FEniCS.simg
to your account. The FEniCS Docker image places a number of files in /home/fenics
.
Bootstrap: docker
From: quay.io/fenicsproject/stable:latest
%post
sudo apt-get -qq update
sudo apt-get -y upgrade
sudo apt-get -y install python-bitstring python3-bitstring
sudo apt-get -y install python-certifi python3-certifi
sudo apt-get -y install python-cryptography python3-cryptography
sudo apt-get -y install python-cycler python3-cycler
sudo apt-get -y install cython cython3
sudo apt-get -y install python-dateutil python3-dateutil
sudo apt-get -y install python-deap python3-deap
sudo apt-get -y install python-decorator python3-decorator
sudo apt-get -y install python-ecdsa python3-ecdsa
sudo apt-get -y install python-ecdsa python3-ecdsa
sudo apt-get -y install python-enum34
sudo apt-get -y install python-funcsigs python3-funcsigs
sudo apt-get -y install ipython ipython3 python-ipython-genutils python3-ipython-genutils
sudo apt-get -y install python-jinja2 python3-jinja2
sudo apt-get -y install python-jsonschema python3-jsonschema
sudo apt-get -y install python-lockfile python3-lockfile
sudo apt-get -y install python-markupsafe python3-markupsafe
sudo apt-get -y install python-matplotlib python3-matplotlib
sudo apt-get -y install python-mistune python3-mistune
sudo apt-get -y install python-mock python3-mock
sudo apt-get -y install python-mpmath python3-mpmath
sudo apt-get -y install python-netaddr python3-netaddr
sudo apt-get -y install python-netifaces python3-netifaces
sudo apt-get -y install python-nose python3-nose
sudo apt-get -y install ipython-notebook ipython3-notebook
sudo apt-get -y install python-numpy python3-numpy
sudo apt-get -y install python-pandas python3-pandas
sudo apt-get -y install python-paramiko python3-paramiko
sudo apt-get -y install python-path python3-path
sudo apt-get -y install python-pathlib
sudo apt-get -y install python-pbr python3-pbr
sudo apt-get -y install python-pexpect python3-pexpect
sudo apt-get -y install python-pickleshare python3-pickleshare
sudo apt-get -y install python-prompt-toolkit python3-prompt-toolkit
sudo apt-get -y install python-ptyprocess python3-ptyprocess
sudo apt-get -y install python-pycryptopp
sudo apt-get -y install python-pygments python3-pygments
sudo apt-get -y install python-pyparsing python3-pyparsing
sudo apt-get -y install python-zmq python3-zmq
sudo apt-get -y install python-requests python3-requests
sudo apt-get -y install python-scipy python3-scipy
sudo apt-get -y install python-setuptools python3-setuptools
sudo apt-get -y install python-simplegeneric python3-simplegeneric
sudo apt-get -y install python-singledispatch python3-singledispatch
sudo apt-get -y install python-six python3-six
sudo apt-get -y install python-sympy python3-sympy
sudo apt-get -y install python-terminado python3-terminado
sudo apt-get -y install python-tornado python3-tornado
sudo apt-get -y install python-traitlets python3-traitlets
sudo apt-get -y install automake git-core libopenmpi-dev libtool mercurial openmpi-bin
sudo apt-get -y install python3-pip python3-venv
# Clean up downloaded and temporary files...
sudo apt-get clean
sudo rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*