Yes, I have had problems like that in the past myself. Unfortunately there is no really easy solution currently. You somehow have to make sure that NGSolve and PETSc use the same libraries.
I also could not make hdf5 work for some reason, but as I don't need it I did not spend any time trying to make it work.
For the other problems, first, I gave the PETSc configure-command "--with-shared-libraries" so PETSc would build dynamic libraries. I think that should be turned on by default anyways.
For mets/parmetis, what I ended up doing was configuring PETSc to use the metis and parmetis libraries built by NGSolve with "--with-metis-dir=path_to_ngsolve_build/dependencies/parmetis" and "--with-parmetis-dir=..."
For hypre, I told PETSc to download and install it's own library, but to link it statically.
"--with-hypre=1 --download-hypre=yes --download-hypre-shared=0"
Also, I explicitely gave the same MPI library NGSolve uses with "--with-mpi-dir=..." and the same blas/lapack with "--with-blaslapack=1 --with-blaslapack-dir=...".
As a note, when compiling PETSc yourself, it is very important to add
"--with-debugging=no" and to use something like COPTFLAGS='-O3 -march=native -mtune=native'.
Finally, I recommend environment modules for managing different PETSc versions. If you want to use both real and complex ones, you will have to swap between them regularely. It also helps keeping ypur .bashrc clean.
Here is my entire PETSc configure command:
Code:
./configure CPP=/usr/bin/cpp-8 COPTFLAGS='-O3 -march=native -mtune=native' CXXOPTFLAGS='-O3 -march=native -mtune=native' \
FOPTFLAGS="-O3 -march=native" \
--with-debugging=no \
--PETSC_ARCH="arch-linux2-c-opt" \
--with-fortran-bindings=0 \
--with-fortran-type-initialize=0 \
--prefix=/home/lkogler/local/petsc \
--with-shared-libraries \
--with-mpi=1 --with-mpi-dir=/home/lkogler/local/openmpi-3.1-gcc-8.1 \
--with-cxx-dialect=c++11 \
--with-metis=1 --with-metis-dir=/home/lkogler/build/ngsolve_mpi_spec/dependencies/parmetis \
--with-parmetis=1 --with-parmetis-dir=/home/lkogler/build/ngsolve_mpi_spec/dependencies/parmetis \
--with-hypre=1 --download-hypre=yes --download-hypre-shared=0 \
--with-blaslapack=1 --with-blaslapack-dir=/opt/intel/mkl \
--with-zlib=1 \
--with-ml=1 --download-ml=yes --download-ml-shared=0 \
--with-ilu=1 \
--with-cmake=1 \
--download-slepc=yes \
--with-superlu=1 --download-superlu=yes \
--download-sowing-cc=gcc-8 \
--download-sowing-cxx=g++-8 \
--download-sowing-cxxcpp=cpp-8
Best,
Lukas