working compilations

This commit is contained in:
Michael Pilosov 2021-12-19 20:52:03 -07:00
commit 9d8e9e6ab1
8 changed files with 415 additions and 0 deletions

72
Dockerfile Normal file
View File

@ -0,0 +1,72 @@
FROM docker.io/python:3.9.7-bullseye
ARG DEBIAN_FRONTEND=noninteractive
# dolfin
RUN apt-get update -yqq && \
apt-get install -yqq \
build-essential \
cmake \
gfortran \
liblapack3 liblapack-dev \
libblas3 libblas-dev \
libeigen3-dev \
libboost-all-dev \
petsc-dev \
slepc-dev \
&& \
apt-get -qq purge && \
apt-get -qq clean && \
rm -rf /var/lib/apt/lists/*
RUN pip install numpy scipy
# fenics
RUN pip install -U fenics-ffc
ENV FENICS_VERSION=2019.1.0.post0
RUN mkdir -p /tmp/src/
RUN git config --global user.email mm@clfx.cc
RUN git config --global user.name mm
#RUN apt-get update -yqq && apt-get install libopenmpi-dev
RUN cd /tmp/src/ && \
git clone --branch=$FENICS_VERSION https://bitbucket.org/fenics-project/dolfin
COPY *.patch /tmp/src/dolfin/
RUN cd /tmp/src/dolfin && \
git am algorithm.patch && \
git am boost.patch && \
cd .. && \
mkdir dolfin/build && cd dolfin/build && \
cmake .. && make install
ENV PYBIND11_VERSION=2.2.3
RUN cd /tmp/src/ && \
wget -nc --quiet https://github.com/pybind/pybind11/archive/v${PYBIND11_VERSION}.tar.gz && \
tar -xf v${PYBIND11_VERSION}.tar.gz && \
cd pybind11-${PYBIND11_VERSION} && \
mkdir build && cd build && \
cmake -DPYBIND11_TEST=off .. && make install && \
rm -rf v${PYBIND11_VERSION}.tar.gz
RUN cd /tmp/src/dolfin/python && \
pip3 install .
# mshr
RUN apt-get update -yqq && \
apt-get install -yqq \
libgmp-dev \
libmpfr-dev \
&& \
apt-get -qq purge && \
apt-get -qq clean && \
rm -rf /var/lib/apt/lists/*
RUN cd /tmp/src/ && \
git clone --branch=2019.1.0 https://bitbucket.org/fenics-project/mshr && \
mkdir mshr/build && cd mshr/build && \
cmake .. && make install
RUN cd /tmp/src/mshr/python && \
pip3 install .
RUN echo "source /usr/local/share/dolfin/dolfin.conf" >> /root/.profile

73
Dockerfile-2019.1.0 Normal file
View File

@ -0,0 +1,73 @@
FROM docker.io/python:3.9.7-buster
ARG DEBIAN_FRONTEND=noninteractive
# dolfin
RUN apt-get update -yqq && \
apt-get install -yqq \
build-essential \
cmake \
gfortran \
liblapack3 liblapack-dev \
libblas3 libblas-dev \
libeigen3-dev \
libboost-all-dev \
petsc-dev \
slepc-dev \
&& \
apt-get -qq purge && \
apt-get -qq clean && \
rm -rf /var/lib/apt/lists/*
RUN pip install numpy scipy
# fenics
RUN pip install -U fenics-ffc
ENV FENICS_VERSION=2019.1.0
RUN mkdir -p /tmp/src/
RUN git config --global user.email mm@clfx.cc
RUN git config --global user.name mm
#RUN apt-get update -yqq && apt-get install libopenmpi-dev
RUN cd /tmp/src/ && \
git clone --branch=$FENICS_VERSION https://bitbucket.org/fenics-project/dolfin
COPY *.patch /tmp/src/dolfin/
RUN cd /tmp/src/dolfin && \
git revert 8e92f6ee1bb004ab95d9f0788eab25a2b7c45010 && \
git am algorithm.patch && \
git am boost.patch && \
cd .. && \
mkdir dolfin/build && cd dolfin/build && \
cmake .. && make install
ENV PYBIND11_VERSION=2.2.3
RUN cd /tmp/src/ && \
wget -nc --quiet https://github.com/pybind/pybind11/archive/v${PYBIND11_VERSION}.tar.gz && \
tar -xf v${PYBIND11_VERSION}.tar.gz && \
cd pybind11-${PYBIND11_VERSION} && \
mkdir build && cd build && \
cmake -DPYBIND11_TEST=off .. && make install && \
rm -rf v${PYBIND11_VERSION}.tar.gz
RUN cd /tmp/src/dolfin/python && \
pip3 install .
# mshr
RUN apt-get update -yqq && \
apt-get install -yqq \
libgmp-dev \
libmpfr-dev \
&& \
apt-get -qq purge && \
apt-get -qq clean && \
rm -rf /var/lib/apt/lists/*
RUN cd /tmp/src/ && \
git clone --branch=$FENICS_VERSION https://bitbucket.org/fenics-project/mshr && \
mkdir mshr/build && cd mshr/build && \
cmake .. && make install
RUN cd /tmp/src/mshr/python && \
pip3 install .
RUN echo "source /usr/local/share/dolfin/dolfin.conf" >> /root/.profile

72
Dockerfile-2019.1.0.post0 Normal file
View File

@ -0,0 +1,72 @@
FROM docker.io/python:3.9.7-bullseye
ARG DEBIAN_FRONTEND=noninteractive
# dolfin
RUN apt-get update -yqq && \
apt-get install -yqq \
build-essential \
cmake \
gfortran \
liblapack3 liblapack-dev \
libblas3 libblas-dev \
libeigen3-dev \
libboost-all-dev \
petsc-dev \
slepc-dev \
&& \
apt-get -qq purge && \
apt-get -qq clean && \
rm -rf /var/lib/apt/lists/*
RUN pip install numpy scipy
# fenics
RUN pip install -U fenics-ffc
ENV FENICS_VERSION=2019.1.0.post0
RUN mkdir -p /tmp/src/
RUN git config --global user.email mm@clfx.cc
RUN git config --global user.name mm
#RUN apt-get update -yqq && apt-get install libopenmpi-dev
RUN cd /tmp/src/ && \
git clone --branch=$FENICS_VERSION https://bitbucket.org/fenics-project/dolfin
COPY *.patch /tmp/src/dolfin/
RUN cd /tmp/src/dolfin && \
git am algorithm.patch && \
git am boost.patch && \
cd .. && \
mkdir dolfin/build && cd dolfin/build && \
cmake .. && make install
ENV PYBIND11_VERSION=2.2.3
RUN cd /tmp/src/ && \
wget -nc --quiet https://github.com/pybind/pybind11/archive/v${PYBIND11_VERSION}.tar.gz && \
tar -xf v${PYBIND11_VERSION}.tar.gz && \
cd pybind11-${PYBIND11_VERSION} && \
mkdir build && cd build && \
cmake -DPYBIND11_TEST=off .. && make install && \
rm -rf v${PYBIND11_VERSION}.tar.gz
RUN cd /tmp/src/dolfin/python && \
pip3 install .
# mshr
RUN apt-get update -yqq && \
apt-get install -yqq \
libgmp-dev \
libmpfr-dev \
&& \
apt-get -qq purge && \
apt-get -qq clean && \
rm -rf /var/lib/apt/lists/*
RUN cd /tmp/src/ && \
git clone --branch=2019.1.0 https://bitbucket.org/fenics-project/mshr && \
mkdir mshr/build && cd mshr/build && \
cmake .. && make install
RUN cd /tmp/src/mshr/python && \
pip3 install .
RUN echo "source /usr/local/share/dolfin/dolfin.conf" >> /root/.profile

7
Makefile Normal file
View File

@ -0,0 +1,7 @@
build: 2019.1.0
2019.1.0:
docker build -t fenics -t fenics-2019.1.0 -f Dockerfile-2019.1.0
2019.1.0.post0:
docker build -t fenics -t fenics-2019.1.0.post0 -f Dockerfile-2019.1.0.post0

29
README.md Normal file
View File

@ -0,0 +1,29 @@
# fenics installation
Comes with `dolfin` / `fenics` / `mshr`.
Batteries: `petsc`, `slepc`, `boost`, `blas`, `lapack`, `fortran`, `eigen3`
Also includes: `numpy` and `scipy`
Primarily for use as a base image (reflecting the desired python version)
```sh
make
```
```sh
docker run --rm -ti fenics bash
```
There is also the option to build the latest release
```sh
make 2019.1.0.post0
```
## patches
Some patches needed to be applied to successfully compile.
On `bullseye`, `petsc` causes problems which are fixed by using `2019.1.0.post0`.
There is an unused patch for `petsc` and `slepsc` which is included "just in case" it becomes useful at a future date.

39
algorithm.patch Normal file
View File

@ -0,0 +1,39 @@
From 569bbc7f0d218432e76e68137b3f647b4b8faa6f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de>
Date: Thu, 15 Oct 2020 16:09:19 +0200
Subject: [PATCH] Add missing algorithm include for std::min_element/count
algorithm is no longer pulled in implicitly by current boost versions,
do it explicitly.
---
dolfin/geometry/IntersectionConstruction.cpp | 1 +
dolfin/mesh/MeshFunction.h | 1 +
2 files changed, 2 insertions(+)
diff --git a/dolfin/geometry/IntersectionConstruction.cpp b/dolfin/geometry/IntersectionConstruction.cpp
index 765dbb6..7ba99a8 100644
--- a/dolfin/geometry/IntersectionConstruction.cpp
+++ b/dolfin/geometry/IntersectionConstruction.cpp
@@ -18,6 +18,7 @@
// First added: 2014-02-03
// Last changed: 2017-12-12
+#include <algorithm>
#include <iomanip>
#include <dolfin/mesh/MeshEntity.h>
#include "predicates.h"
diff --git a/dolfin/mesh/MeshFunction.h b/dolfin/mesh/MeshFunction.h
index 08cbc82..4e68324 100644
--- a/dolfin/mesh/MeshFunction.h
+++ b/dolfin/mesh/MeshFunction.h
@@ -27,6 +27,7 @@
#include <map>
#include <vector>
+#include <algorithm>
#include <memory>
#include <unordered_set>
#include <dolfin/common/Hierarchical.h>
--
2.28.0

50
boost.patch Normal file
View File

@ -0,0 +1,50 @@
From 50d619e29f7664825a87fa526d3d933b521fabf0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de>
Date: Thu, 15 Oct 2020 16:44:30 +0200
Subject: [PATCH] Use __BYTE_ORDER__ instead of removed Boost endian.hpp
endian.hpp has been removed with Boost 1.73.
---
dolfin/io/VTKFile.cpp | 5 ++---
dolfin/io/VTKWriter.cpp | 1 -
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/dolfin/io/VTKFile.cpp b/dolfin/io/VTKFile.cpp
index 2fee53b..4dba84d 100644
--- a/dolfin/io/VTKFile.cpp
+++ b/dolfin/io/VTKFile.cpp
@@ -20,7 +20,6 @@
#include <vector>
#include <iomanip>
#include <boost/cstdint.hpp>
-#include <boost/detail/endian.hpp>
#include "pugixml.hpp"
@@ -614,9 +613,9 @@ void VTKFile::vtk_header_open(std::size_t num_vertices, std::size_t num_cells,
std::string endianness = "";
if (encode_string == "binary")
{
- #if defined BOOST_LITTLE_ENDIAN
+ #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
endianness = "byte_order=\"LittleEndian\"";
- #elif defined BOOST_BIG_ENDIAN
+ #elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
endianness = "byte_order=\"BigEndian\"";;
#else
dolfin_error("VTKFile.cpp",
diff --git a/dolfin/io/VTKWriter.cpp b/dolfin/io/VTKWriter.cpp
index eff6934..b57a665 100644
--- a/dolfin/io/VTKWriter.cpp
+++ b/dolfin/io/VTKWriter.cpp
@@ -24,7 +24,6 @@
#include <sstream>
#include <vector>
#include <iomanip>
-#include <boost/detail/endian.hpp>
#include <dolfin/fem/GenericDofMap.h>
#include <dolfin/fem/FiniteElement.h>
--
2.28.0

73
petsc-slepc.patch Normal file
View File

@ -0,0 +1,73 @@
From f627a442350560e50dbbb11f7828b6d807369533 Mon Sep 17 00:00:00 2001
From: Alexei Colin <acolin@isi.edu>
Date: Sun, 11 Apr 2021 20:40:00 -0400
Subject: [PATCH] cmake: PETSc,SLEPc: match lowercase .pc pkg-config files
Upstream has moved to lowercase. PETSc has kept the mixed-case file for
compatibility, but SLEPc hasn't.
pkg_search_module takes multiple patterns and succeeds on first match,
so this commit is backward-compatible with older installations of PETSc,
SLEPc.
PETSC: https://gitlab.com/petsc/petsc/-/merge_requests/2754
commit 6fe8eb356ce6cf9027a2b889b1835f808039fe5e
Merge: fd0ee0fbd7 2eefe1c6f1
Author: Satish Balay <balay@mcs.anl.gov>
Date: Tue Jun 9 01:08:49 2020 +0000
Merge branch 'MR--config-lowercase-pkgname' into 'master'
config: pkg-config: default to lowercase file.pc
See merge request petsc/petsc!2754
SLEPc: https://gitlab.com/slepc/slepc/-/merge_requests/68
commit 1632350b0a681e0c4fd08c171912be6e17f3c3f7
Merge: 3c38a3419 b2fcc7199
Author: Jose E. Roman <jroman@dsic.upv.es>
Date: Sun Jun 14 16:19:22 2020 +0000
Merge branch 'jose/pkg-config' into 'master'
pkg-config: default to lowercase file.pc
See merge request slepc/slepc!68
Signed-off-by: Alexei Colin <acolin@isi.edu>
---
cmake/modules/FindPETSc.cmake | 2 +-
cmake/modules/FindSLEPc.cmake | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/cmake/modules/FindPETSc.cmake b/cmake/modules/FindPETSc.cmake
index 80faffdad..728a6ec30 100644
--- a/cmake/modules/FindPETSc.cmake
+++ b/cmake/modules/FindPETSc.cmake
@@ -51,7 +51,7 @@ find_package(PkgConfig REQUIRED)
# Find PETSc pkg-config file. Note: craypetsc_real is on Cray systems
set(ENV{PKG_CONFIG_PATH} "$ENV{CRAY_PETSC_PREFIX_DIR}/lib/pkgconfig:$ENV{PETSC_DIR}/$ENV{PETSC_ARCH}/lib/pkgconfig:$ENV{PETSC_DIR}/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}")
-pkg_search_module(PETSC craypetsc_real PETSc)
+pkg_search_module(PETSC craypetsc_real petsc PETSc)
# Extract major, minor, etc from version string
if (PETSC_VERSION)
diff --git a/cmake/modules/FindSLEPc.cmake b/cmake/modules/FindSLEPc.cmake
index 327cffc23..dec26fcc4 100644
--- a/cmake/modules/FindSLEPc.cmake
+++ b/cmake/modules/FindSLEPc.cmake
@@ -48,7 +48,7 @@ find_package(PkgConfig REQUIRED)
set(ENV{PKG_CONFIG_PATH} "$ENV{SLEPC_DIR}/$ENV{PETSC_ARCH}/lib/pkgconfig:$ENV{SLEPC_DIR}/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}")
set(ENV{PKG_CONFIG_PATH} "$ENV{PETSC_DIR}/$ENV{PETSC_ARCH}/lib/pkgconfig:$ENV{PETSC_DIR}/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}")
set(ENV{PKG_CONFIG_PATH} "$ENV{PETSC_DIR}/$ENV{PETSC_ARCH}:$ENV{PETSC_DIR}:$ENV{PKG_CONFIG_PATH}")
-pkg_search_module(SLEPC crayslepc_real SLEPc)
+pkg_search_module(SLEPC crayslepc_real slepc SLEPc)
# Extract major, minor, etc from version string
if (SLEPC_VERSION)
--
2.30.0