diff --git a/Dockerfile b/Dockerfile index 604b2ea1..88d1ea7b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -35,141 +35,31 @@ ARG EXAFMM_VERSION WORKDIR /tmp -# Install dependencies available via apt-get. -# - First set of packages are required to build and run Bempp-cl. -# - Second set of packages are recommended and/or required to build -# documentation or tests. -# - Third set of packages are optional, but required to run gmsh -# pre-built binaries. -# - Fourth set of packages are optional, required for meshio. RUN export DEBIAN_FRONTEND=noninteractive && \ apt-get -qq update && \ apt-get -yq --with-new-pkgs -o Dpkg::Options::="--force-confold" upgrade && \ apt-get -y install \ - cmake \ - git \ - ipython3 \ - pkg-config \ - python-is-python3 \ - python3-dev \ - python3-matplotlib \ - python3-mpi4py \ - python3-pip \ - python3-pyopencl \ - python3-scipy \ - python3-setuptools \ - jupyter \ - wget && \ - apt-get -y install \ - libfftw3-dev \ - libfltk-gl1.3 \ - libfltk-images1.3 \ - libfltk1.3 \ - libfreeimage3 \ - libgl2ps1.4 \ - libglu1-mesa \ - libilmbase25 \ - libjxr0 \ - libocct-data-exchange-7.5 \ - libocct-foundation-7.5 \ - libocct-modeling-algorithms-7.5 \ - libocct-modeling-data-7.5 \ - libocct-ocaf-7.5 \ - libocct-visualization-7.5 \ - libopenblas-dev \ - libopenexr25 \ - libopenjp2-7 \ - libraw-dev \ - libtbb2 \ - libxcursor1 \ - libxinerama1 && \ - apt-get -y install \ - python3-lxml && \ - apt-get clean && \ - rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* - -# Install Python packages (via pip) -RUN pip3 install --no-cache-dir "numpy>=1.21,<1.23" numba>=0.55.2 meshio>=4.0.16 && \ - pip3 install --no-cache-dir flake8 pytest pydocstyle pytest-xdist - -# Download Install Gmsh SDK -RUN cd /usr/local && \ - wget -nc --quiet http://gmsh.info/bin/Linux/gmsh-${GMSH_VERSION}-Linux64-sdk.tgz && \ - tar -xf gmsh-${GMSH_VERSION}-Linux64-sdk.tgz && \ - rm gmsh-${GMSH_VERSION}-Linux64-sdk.tgz - -ENV PATH=/usr/local/gmsh-${GMSH_VERSION}-Linux64-sdk/bin:$PATH - -RUN git clone -b v${EXAFMM_VERSION} https://github.com/exafmm/exafmm-t.git -RUN cd exafmm-t && sed -i 's/march=native/march=ivybridge/g' ./setup.py && python3 setup.py install - -# Clear /tmp -RUN rm -rf /tmp/* - -WORKDIR /root - -######################################## - -FROM ubuntu:22.04 as bempp-dev-env-with-dolfin -LABEL maintainer="Matthew Scroggs " -LABEL description="Bempp-cl development environment with FEniCS" - -ARG GMSH_VERSION -ARG MAKEFLAGS -ARG EXAFMM_VERSION - -WORKDIR /tmp - -# Install dependencies -RUN export DEBIAN_FRONTEND=noninteractive && \ - apt-get -qq update && \ - apt-get -yq --with-new-pkgs -o Dpkg::Options::="--force-confold" upgrade && \ - apt-get -y install \ - cmake \ - git \ - ipython3 \ - pkg-config \ - python-is-python3 \ - python3-dev \ - python3-mpi4py \ - python3-pip \ - python3-pyopencl \ - python3-setuptools \ - jupyter \ - wget && \ - apt-get -y install \ - libfftw3-dev \ - libfltk-gl1.3 \ - libfltk-images1.3 \ - libfltk1.3 \ - libfreeimage3 \ - libgl2ps1.4 \ - libglu1-mesa \ - libilmbase25 \ - libjxr0 \ - libocct-data-exchange-7.5 \ - libocct-foundation-7.5 \ - libocct-modeling-algorithms-7.5 \ - libocct-modeling-data-7.5 \ - libocct-ocaf-7.5 \ - libocct-visualization-7.5 \ - libopenblas-dev \ - libopenexr25 \ - libopenjp2-7 \ - libraw-dev \ - libtbb2 \ - libxcursor1 \ - libxinerama1 -RUN pip3 install --no-cache-dir meshio>=4.0.16 \ - numba numpy==1.20 scipy matplotlib && \ - pip3 install --no-cache-dir flake8 pytest pydocstyle pytest-xdist -RUN apt-get -y install \ - python3-dolfin \ - python3-lxml && \ - apt-get clean && \ - rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* - -# Install Python packages (via pip) + wget \ + git \ + pkg-config \ + build-essential \ + # ExaFMM dependencies + libfftw3-dev \ + libopenblas-dev \ + # Gmsh dependencies + libfltk-gl1.3 \ + libfltk-images1.3 \ + libfltk1.3 \ + libglu1-mesa \ + # OpenCL + libpocl-dev \ + # Python + python3-dev \ + python3-pip \ + && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +RUN python3 -m pip install --no-cache-dir matplotlib pyopencl numpy scipy numba meshio && \ + python3 -m pip install --no-cache-dir flake8 pytest pydocstyle pytest-xdist # Download Install Gmsh SDK RUN cd /usr/local && \ @@ -180,7 +70,7 @@ RUN cd /usr/local && \ ENV PATH=/usr/local/gmsh-${GMSH_VERSION}-Linux64-sdk/bin:$PATH RUN git clone -b v${EXAFMM_VERSION} https://github.com/exafmm/exafmm-t.git -RUN cd exafmm-t && sed -i 's/march=native/march=ivybridge/g' ./setup.py && python3 setup.py install +RUN cd exafmm-t && sed -i 's/march=native/march=ivybridge/g' ./setup.py && python3 -m pip install . # Clear /tmp RUN rm -rf /tmp/* @@ -207,19 +97,19 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ apt-get -qq update && \ apt-get -yq --with-new-pkgs -o Dpkg::Options::="--force-confold" upgrade && \ apt-get -y install \ - libpugixml-dev \ - python3-pyopencl \ - python3-pybind11 \ - libfftw3-dev \ - pkg-config \ - python-is-python3 \ + # OpenCL + libpocl-dev \ + # ExaFMM dependencies + libfftw3-dev \ && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* +RUN python3 -m pip install --no-cache-dir matplotlib pyopencl numpy scipy numba meshio && \ + python3 -m pip install --no-cache-dir flake8 pytest pydocstyle pytest-xdist + # Install Python packages (via pip) -RUN pip3 install --no-cache-dir meshio>=4.0.16 numpy matplotlib && \ - pip3 install --upgrade six +RUN python3 -m pip install --no-cache-dir meshio numpy matplotlib pyopencl # Install Basix RUN git clone --depth 1 --branch ${FENICSX_BASIX_TAG} https://github.com/FEniCS/basix.git basix-src && \ @@ -227,12 +117,12 @@ RUN git clone --depth 1 --branch ${FENICSX_BASIX_TAG} https://github.com/FEniCS/ cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -B build-dir -S . && \ cmake --build build-dir && \ cmake --install build-dir && \ - pip3 install ./python + python3 -m pip install ./python # Install FEniCSx components -RUN pip3 install --no-cache-dir ipython && \ - pip3 install --no-cache-dir git+https://github.com/FEniCS/ufl.git@${FENICSX_UFL_TAG} && \ - pip3 install --no-cache-dir git+https://github.com/FEniCS/ffcx.git@${FENICSX_FFCX_TAG} +RUN python3 -m pip install --no-cache-dir ipython && \ + python3 -m pip install --no-cache-dir git+https://github.com/FEniCS/ufl.git@${FENICSX_UFL_TAG} && \ + python3 -m pip install --no-cache-dir git+https://github.com/FEniCS/ffcx.git@${FENICSX_FFCX_TAG} # Install FEniCSx RUN git clone --depth 1 --branch ${FENICSX_DOLFINX_TAG} https://github.com/fenics/dolfinx.git && \ @@ -243,7 +133,7 @@ RUN git clone --depth 1 --branch ${FENICSX_DOLFINX_TAG} https://github.com/fenic ninja ${DOLFINX_MAKEFLAGS} install && \ . /usr/local/dolfinx-complex/lib/dolfinx/dolfinx.conf && \ cd ../python && \ - PETSC_ARCH=linux-gnu-complex-32 pip3 install --target /usr/local/dolfinx-complex/lib/python3.8/dist-packages --no-dependencies --ignore-installed . + PETSC_ARCH=linux-gnu-complex-32 python3 -m pip install --target /usr/local/dolfinx-complex/lib/python3.8/dist-packages --no-dependencies --ignore-installed . # complex by default. ENV LD_LIBRARY_PATH=/usr/local/dolfinx-complex/lib:$LD_LIBRARY_PATH \ @@ -256,7 +146,7 @@ ENV LD_LIBRARY_PATH=/usr/local/dolfinx-complex/lib:$LD_LIBRARY_PATH \ RUN wget -nc --quiet https://github.com/exafmm/exafmm-t/archive/v${EXAFMM_VERSION}.tar.gz && \ tar -xf v${EXAFMM_VERSION}.tar.gz && \ cd exafmm-t-${EXAFMM_VERSION} && \ - sed -i 's/march=native/march=ivybridge/g' ./setup.py && python3 setup.py install + sed -i 's/march=native/march=ivybridge/g' ./setup.py && python3 -m pip install . # Clear /tmp RUN rm -rf /tmp/* @@ -283,18 +173,14 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ apt-get -qq update && \ apt-get -yq --with-new-pkgs -o Dpkg::Options::="--force-confold" upgrade && \ apt-get -y install \ - python3-pybind11 \ - python3-matplotlib \ + # ExaFMM dependencies libfftw3-dev \ - pkg-config \ - python-is-python3 \ && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* # Install Python packages (via pip) -RUN pip3 install --no-cache-dir meshio>=4.0.16 "numpy>=1.21,<1.23" && \ - pip3 install --upgrade six +RUN python3 -m pip install --no-cache-dir meshio numpy matplotlib # Install Basix RUN git clone --depth 1 --branch ${FENICSX_BASIX_TAG} https://github.com/FEniCS/basix.git basix-src && \ @@ -302,12 +188,11 @@ RUN git clone --depth 1 --branch ${FENICSX_BASIX_TAG} https://github.com/FEniCS/ cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -B build-dir -S . && \ cmake --build build-dir && \ cmake --install build-dir && \ - pip3 install ./python + python3 -m pip install ./python # Install FEniCSx components -RUN pip3 install --no-cache-dir ipython && \ - pip3 install --no-cache-dir git+https://github.com/FEniCS/ufl.git@${FENICSX_UFL_TAG} && \ - pip3 install --no-cache-dir git+https://github.com/FEniCS/ffcx.git@${FENICSX_FFCX_TAG} +RUN python3 -m pip install --no-cache-dir git+https://github.com/FEniCS/ufl.git@${FENICSX_UFL_TAG} && \ + python3 -m pip install --no-cache-dir git+https://github.com/FEniCS/ffcx.git@${FENICSX_FFCX_TAG} # Install FEniCSx RUN git clone --depth 1 --branch ${FENICSX_DOLFINX_TAG} https://github.com/fenics/dolfinx.git && \ @@ -318,7 +203,7 @@ RUN git clone --depth 1 --branch ${FENICSX_DOLFINX_TAG} https://github.com/fenic ninja ${DOLFINX_MAKEFLAGS} install && \ . /usr/local/dolfinx-complex/lib/dolfinx/dolfinx.conf && \ cd ../python && \ - PETSC_ARCH=linux-gnu-complex-32 pip3 install --target /usr/local/dolfinx-complex/lib/python3.8/dist-packages --no-dependencies --ignore-installed . + PETSC_ARCH=linux-gnu-complex-32 python3 -m pip install --target /usr/local/dolfinx-complex/lib/python3.8/dist-packages --no-dependencies --ignore-installed . # complex by default. ENV LD_LIBRARY_PATH=/usr/local/dolfinx-complex/lib:$LD_LIBRARY_PATH \ @@ -331,7 +216,7 @@ ENV LD_LIBRARY_PATH=/usr/local/dolfinx-complex/lib:$LD_LIBRARY_PATH \ RUN wget -nc --quiet https://github.com/exafmm/exafmm-t/archive/v${EXAFMM_VERSION}.tar.gz && \ tar -xf v${EXAFMM_VERSION}.tar.gz && \ cd exafmm-t-${EXAFMM_VERSION} && \ - sed -i 's/march=native/march=ivybridge/g' ./setup.py && python3 setup.py install + sed -i 's/march=native/march=ivybridge/g' ./setup.py && python3 -m pip install . # Clear /tmp RUN rm -rf /tmp/* @@ -345,21 +230,7 @@ LABEL description="Bempp-cl environment with FEniCSx" WORKDIR /tmp RUN git clone https://github.com/bempp/bempp-cl -RUN cd bempp-cl && python3 setup.py install - -# Clear /tmp -RUN rm -rf /tmp/* - -WORKDIR /root - -######################################## - -FROM bempp-dev-env-with-dolfin as with-dolfin -LABEL description="Bempp-cl environment with FEniCS" - -WORKDIR /tmp -RUN git clone https://github.com/bempp/bempp-cl -RUN cd bempp-cl && python3 setup.py install +RUN cd bempp-cl && python3 -m pip install . # Clear /tmp RUN rm -rf /tmp/* @@ -373,7 +244,7 @@ LABEL description="Bempp Jupyter Lab" WORKDIR /tmp RUN git clone https://github.com/bempp/bempp-cl -RUN cd bempp-cl && python3 setup.py install +RUN cd bempp-cl && python3 -m pip install . RUN cp -r bempp-cl/notebooks /root/example_notebooks RUN rm /root/example_notebooks/conftest.py /root/example_notebooks/test_notebooks.py @@ -385,7 +256,7 @@ WORKDIR /root ARG TINI_VERSION ADD https://github.com/krallin/tini/releases/download/v${TINI_VERSION}/tini /tini RUN chmod +x /tini && \ - pip3 install --no-cache-dir jupyter jupyterlab plotly + python3 -m pip install --no-cache-dir jupyter jupyterlab plotly EXPOSE 8888/tcp ENTRYPOINT ["/tini", "--", "jupyter", "lab", "--ip", "0.0.0.0", "--no-browser", "--allow-root"] @@ -397,31 +268,7 @@ LABEL description="Bempp Jupyter Lab (Numba only)" WORKDIR /tmp RUN git clone https://github.com/bempp/bempp-cl -RUN cd bempp-cl && python3 setup.py install -RUN cp -r bempp-cl/notebooks /root/example_notebooks -RUN rm /root/example_notebooks/conftest.py /root/example_notebooks/test_notebooks.py - -# Clear /tmp -RUN rm -rf /tmp/* - -WORKDIR /root - -ARG TINI_VERSION -ADD https://github.com/krallin/tini/releases/download/v${TINI_VERSION}/tini /tini -RUN chmod +x /tini && \ - pip3 install --no-cache-dir jupyter jupyterlab plotly -EXPOSE 8888/tcp - -ENTRYPOINT ["/tini", "--", "jupyter", "lab", "--ip", "0.0.0.0", "--no-browser", "--allow-root"] - -######################################## - -FROM bempp-dev-env-with-dolfin as fenics-lab -LABEL description="Bempp Jupyter Lab with legacy FEniCS" - -WORKDIR /tmp -RUN git clone https://github.com/bempp/bempp-cl -RUN cd bempp-cl && pip3 install . +RUN cd bempp-cl && python3 -m pip install . RUN cp -r bempp-cl/notebooks /root/example_notebooks RUN rm /root/example_notebooks/conftest.py /root/example_notebooks/test_notebooks.py @@ -433,7 +280,7 @@ WORKDIR /root ARG TINI_VERSION ADD https://github.com/krallin/tini/releases/download/v${TINI_VERSION}/tini /tini RUN chmod +x /tini && \ - pip3 install --no-cache-dir jupyter jupyterlab plotly + python3 -m pip install --no-cache-dir jupyter jupyterlab plotly EXPOSE 8888/tcp ENTRYPOINT ["/tini", "--", "jupyter", "lab", "--ip", "0.0.0.0", "--no-browser", "--allow-root"] diff --git a/bempp/api/assembly/blocked_operator.py b/bempp/api/assembly/blocked_operator.py index 67544a88..06907b91 100644 --- a/bempp/api/assembly/blocked_operator.py +++ b/bempp/api/assembly/blocked_operator.py @@ -156,7 +156,7 @@ def __init__(self, m, n): """Construct an (m x n) blocked boundary operator.""" super().__init__() - self._operators = _np.empty((m, n), dtype=_np.object) + self._operators = _np.empty((m, n), dtype=object) self._rows = m * [False] self._cols = n * [False] @@ -592,7 +592,7 @@ def __init__(self, ops): self._ndims = (rows, cols) - self._operators = _np.empty((rows, cols), dtype=_np.object) + self._operators = _np.empty((rows, cols), dtype=object) self._rows = -_np.ones(rows, dtype=int) self._cols = -_np.ones(cols, dtype=int) diff --git a/bempp/api/utils/remote_operator.py b/bempp/api/utils/remote_operator.py index f2f48ad3..36763d90 100644 --- a/bempp/api/utils/remote_operator.py +++ b/bempp/api/utils/remote_operator.py @@ -272,7 +272,7 @@ def __init__(self, ops): self._ndims = (rows, cols) - self._operators = _np.empty((rows, cols), dtype=_np.object) + self._operators = _np.empty((rows, cols), dtype=object) self._tags = _np.empty((rows, cols), dtype=_np.int) self._rows = -_np.ones(rows, dtype=int) self._cols = -_np.ones(cols, dtype=int)