Forum Message

 

 

We have moved the forum to https://forum.ngsolve.org . This is an archived version of the topics until 05/05/23. All the topics were moved to the new forum and conversations can be continued there. This forum is just kept as legacy to not invalidate old links. If you want to continue a conversation just look for the topic in the new forum.

Notice

The forum is in read only mode.

ngs-petsc installation issue

More
3 years 11 months ago #2614 by Guosheng Fu
Hello,

I am trying to install ngs-petsc but with no good luck yet.
Below is what I did:
First, I build ngsolve with MPI+HYPRE+MUMPS, and it automatically build the metis/hypre/mumps for me.

Then, I have a big trouble installing petsc, I end up with using spack to install the petsc dependencies and then manually install petsc from their git repo. Here the petsc installation uses the versions of metis/hypre/zlib built by spack, not from ngsolve (This might be the issue)

Then, when I tried to build ngs-petsc, it found PETSC but claims that it was not working. I passed the flag -DPETSC_EXECUTABLE_RUNS=YES in cmake, and the installation then went through.

Next, when I run the examples in ngs-petsc, the code complains that it can not find the petsc library:
Code:
ImportError: libpetsc.so.3.13: cannot open shared object file: No such file or directory

Is there an easier approach to correctly install petsc that is compatible with ngsolve? I guess I am making things more complicated here. Attached is my ngs-petsc cmakecach.txt.

Best regards,
Guosheng
More
3 years 11 months ago - 3 years 11 months ago #2618 by Guosheng Fu
Well, I found the bug. After preloading the petsc library in ngspy, the ngs-petsc is working now. (I also did some additionally ngsolve-build modifications, not sure whether this is essential or not)

For your record, below is the steps I used to get petsc working.
(1) get spack using
Code:
git clone https://github.com/LLNL/spack
(2) use spack to install petsc, the following line produce an error message for compiling petsc as it seems the HDF5 build is somehow broken (not sure what's going on here)
Code:
spack install petsc@3.13.0
So, I searched online and found a nice way around from this link by Praveen Chandrashekar
cpraveen.github.io/comp/spack.html
The following line install all external dependencies of dealii package in spack (which is actually more than what we needed...), and it went smoothly on my pc
Code:
... spack install -j4 --only dependencies dealii
(3) In step 2, I have in particular umfpack, openmpi, mumps, parmetis, metis5, petsc installed. Then I built ngsolve with mpi using these external libraries, along with my local MKL library for blas/lapack.
(4) add PETSC_ARCH/PETSC_DIR in bashrc and build ngs-petsc (currently its the real version only), and preload petsc library in ngspy.

Hope this would be useful for ngs-petsc users.
Last edit: 3 years 11 months ago by Guosheng Fu.
More
3 years 11 months ago #2619 by lkogler
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
Time to create page: 0.115 seconds