Feature-request : use --download-mpich on Ubuntu

Dear FreeFEM developpers

After most struggle to compile FreeFEM on Ubuntu 20.04, I found that many problems can be avoided if PETSc is compiled beforehand as suggested by Compiling with your own PETSc and SLEPc builds and by http://jolivet.perso.enseeiht.fr/FreeFem-tutorial/#pfc0.

It seems that the mpich or openmpi available from the ubuntu public repositories are somehow broken or hard to configure properly for the compilation. I also attempted to install from the provided .deb but I have an issue with the version of gfortran.

However everything seems to run fine if we follow these steps:

  • Install and compile PETSc first with
PREFIX="/usr/local/ff-petsc/r/"
sudo ./configure --with-cc=gcc --with-cxx=g++ --with-fc=gfortran \
    --download-mumps --download-parmetis --download-mpich --download-fblaslapack \
    --download-metis --download-hypre --download-slepc \
    --download-hpddm --download-ptscotch \
    --download-suitesparse \
    --download-scalapack \
    --with-fortran-bindings=no \
    --with-scalar-type=real \
    --with-debugging=no \
    --prefix=$PREFIX

This automatically install a working mpich. Note that on my environment “–download-fblaslapack” is needed because the MUMPS of the ubuntu repository is too old and its libraries will create conflict when compiling FreeFEM.

  • One should need to do the same for PETSc complex and adapting to use the mpich of PETSc real
  • Then set the mpi compilers to be those of PETSc:
export MPIPREFIX="/usr/local/ff-petsc/r/bin"
export MPICC="$MPIPREFIX/mpicc"
export MPICXX="$MPIPREFIX/mpicxx"
export MPIF77="$MPIPREFIX/mpif77"
export MPIFC="$MPIPREFIX/mpif90"
export MPIRUN="$MPIPREFIX/mpirun"
  • Finally run configure and compile:
./configure --enable-download --enable-optim -with-mpi=mpich
./3rdparty/getall -a
make
sudo make install

I made a script which attempts to do all this (verified on kubuntu 20.04) which is maintained here:

I suspect it could help many ubuntu users if there would be an option to use --download-mpich of PETSc on the FreeFEM configure which would reproduce my suggestion, or if these instructions would be clearly suggested on the FreeFEM doc page.

Many thanks for all the work you are doing

Best

Dear Florian,
I’ve just pushed a new commit in the develop branch so that if no MPI implementation is detected during ./configure, the flag --download-mpich will automatically be added for you when running make petsc-slepc. Then, during ./reconfigure, FreeFEM will pick up the PETSc-generated wrappers mpirun, mpic++, mpic, and mpif90 if you have Fortran installed. Having MPI installed is not a requirement anymore for using PETSc/SLEPc.

Thank you for the feature request :slight_smile:

PS: I still do prefer and recommend to power users to have their PETSc installation on the side, like you are doing in your post, since it’s easier to update and adapt, e.g., specific downloaded libraries and such.