From de8dfe28019ced5b83c427ca93d5471fdf6ae71a Mon Sep 17 00:00:00 2001 From: Umberto Zerbinati Date: Mon, 25 Sep 2023 12:55:44 +0100 Subject: [PATCH] Fix Dicker file and test Signed-off-by: Umberto Zerbinati --- Dockerfile | 15 +++++++++++---- tests/test_pc.py | 5 +++-- tests/test_snes.py | 5 +++-- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index c3ed2f4..27717d2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,14 @@ ENV SLEPC_DIR /root/slepc ENV SLEPC_ARCH linux_debug #Installing dependencies using aptitude RUN apt-get update \ - && apt-get -y install git libopenmpi-dev build-essential cmake python3 python3-distutils python3-tk libpython3-dev libxmu-dev tk-dev tcl-dev g++ libglu1-mesa-dev liblapacke-dev libblas-dev liblapack-dev + && apt-get -y install git libopenmpi-dev build-essential cmake wget libssl-dev python3 python3-distutils python3-tk libpython3-dev libxmu-dev tk-dev tcl-dev g++ libglu1-mesa-dev liblapacke-dev libblas-dev liblapack-dev +#Building cmake +RUN cd ~ && wget https://github.com/Kitware/CMake/releases/download/v3.27.6/cmake-3.27.6.tar.gz \ + && tar -zxvf cmake-3.27.6.tar.gz \ + && cd cmake-3.27.6 \ + && ./configure \ + && make -j 2 \ + && make install #Installing python dependencies using pip RUN pip install numpy cython mpi4py pytest pytest-mpi #Configure PETSc @@ -41,7 +48,7 @@ RUN cd ~/slepc \ --with-slepc4py=1 \ && make #Building ngsolve -ENV LD_LIBRARY_PATH /root/petsc/linux_debug/lib:/root/slepc/linux_debug/lib +ENV LD_LIBRARY_PATH /root/petsc/linux_debug/lib RUN mkdir -p ~/ngsuite \ && cd ~/ngsuite \ && git clone https://github.com/NGSolve/ngsolve.git ngsolve-src \ @@ -50,7 +57,7 @@ RUN mkdir -p ~/ngsuite \ && mkdir ~/ngsuite/ngsolve-build \ && mkdir ~/ngsuite/ngsolve-install \ && cd ~/ngsuite/ngsolve-build \ - && LD_LIBRARY_PATH=/root/petsc/linux_debug/lib:/root/slepc/linux_debug/lib cmake -DCMAKE_INSTALL_PREFIX=~/ngsuite/ngsolve-install ~/ngsuite/ngsolve-src -DUSE_MPI=ON -DUSE_MPI4PY=ON\ - && LD_LIBRARY_PATH=/root/petsc/linux_debug/lib:/root/slepc/linux_debug/lib make && LD_LIBRARY_PATH=/root/petsc/linux_debug/lib:/root/slepc/linux_debug/lib make install + && cmake -DCMAKE_INSTALL_PREFIX=~/ngsuite/ngsolve-install ~/ngsuite/ngsolve-src -DUSE_MPI=ON -DUSE_OCC=OFF\ + && make && make install #Adding NGS to PYTHONPATH ENV PYTHONPATH /root/petsc/linux_debug/lib:/root/slepc/linux_debug/lib:/root/ngsuite/ngsolve-install/lib/python3.10/site-packages diff --git a/tests/test_pc.py b/tests/test_pc.py index ebf9973..3da5117 100644 --- a/tests/test_pc.py +++ b/tests/test_pc.py @@ -229,5 +229,6 @@ def tang(u): return u-(u*n)*n if __name__ == '__main__': test_pc() test_pc_gamg() - test_pc_hiptmaier_xu_sor() - test_pc_hiptmaier_xu_bjacobi() \ No newline at end of file + test_pc_hiptmaier_xu_bjacobi() + if COMM_WORLD.size == 1: + test_pc_hiptmaier_xu_sor() \ No newline at end of file diff --git a/tests/test_snes.py b/tests/test_snes.py index 35a1117..f238591 100644 --- a/tests/test_snes.py +++ b/tests/test_snes.py @@ -92,7 +92,7 @@ def NeoHook (C): a = BilinearForm(fes, symmetric=True) a += Variation(NeoHook (C).Compile() * dx -factor * (InnerProduct(force,u) ).Compile() * dx) - solver = NonLinearSolver(fes, a=a, objective=False, + solver = NonLinearSolver(fes, a=a, solverParameters={"snes_type": "newtonls", "snes_max_it": 10, "snes_monitor": ""}) @@ -105,4 +105,5 @@ def NeoHook (C): if __name__ == '__main__': test_snes_toy_lbfgs() test_snes_toy_newtonls() - test_snes_elastic_beam_newtonls() + if COMM_WORLD.size == 1: + test_snes_elastic_beam_newtonls()