PETSc: Difference between revisions

From Arbeitsgruppe Kuiper
Jump to navigation Jump to search
m (→‎Version 3.1-p8: indentation)
m (→‎Version 3.1-p8: openmpi, opt)
Line 36: Line 36:
export PETSC_DIR=$PWD
export PETSC_DIR=$PWD


mpi=mpich
opt=-O3  # Some prefer -O2.
mpi=openmpi


python2 ./config/configure.py PETSC_ARCH=debian_$mpi \
python2 ./config/configure.py PETSC_ARCH=debian_$mpi \
      --with-cc=mpicc.$mpi --with-cxx=mpicxx.$mpi --with-fc=mpif90.$mpi --with-mpiexec=mpirun.$mpi \
        --with-cc=mpicc.$mpi --with-cxx=mpicxx.$mpi --with-fc=mpif90.$mpi --with-mpiexec=mpirun.$mpi \
         --CFLAGS=-Wno-deprecated-declarations --COPTFLAGS=-O3 --FOPTFLAGS=-O3 \
         --CFLAGS=-Wno-deprecated-declarations --COPTFLAGS=$opt --FOPTFLAGS=$opt \
      --with-x=0 --with-debugging=0 --download-hypre=1 \
        --with-x=0 --with-debugging=0 --download-hypre=1 \
         --with-mpi-include="${inc[$mpi]}" --with-mpi-lib="${lib[$mpi]}"
         --with-mpi-include="${inc[$mpi]}" --with-mpi-lib="${lib[$mpi]}"
</syntaxhighlight>
</syntaxhighlight>

Revision as of 14:56, 15 February 2024

PETSc is the Portable, Extensible Toolkit for Scientific Computation.

Version 3.1-p8

(March 25, 2010)

That's the version needed by belt. When choosing to download packages during configuration, versions are:

  • openmpi-1.4.1.tar.gz
  • mpich2-1.0.8.tar.gz
  • hypre-2.6.0b.tar.gz (uses deprecated MPI_Address(), MPI_Type_struct)

Problem when using system's MPI (more modern):

  • PETSc 3.1-p8 uses deprecated objects: MPI_Attr_get, MPI_Attr_put, MPI_Attr_delete, MPI_Keyval_create, MPI_Keyval_free, OMPI_C_MPI_NULL_COPY_FN, OMPI_C_MPI_NULL_DELETE_FN (deprecated since MPI-2.0) and MPI_Errhandler_create, MPI_Errhandler_set, MPI_Type_struct (removed in MPI-3.0)
  • Pluto4.1 itself uses deprecated objects (in Parallel/al_subarray_.c): MPI_Type_extent, MPI_Type_hvector, MPI_Type_struct (removed in MPI-3.0)

OpenMPI is (at least on Debian) hardwired to reject removed functions (#define OMPI_ENABLE_MPI1_COMPAT 0 in /usr/lib/x86_64-linux-gnu/openmpi/include/mpi.h and /usr/lib/x86_64-linux-gnu/fortran/gfortran-mod-15/openmpi/mpi.h). Changing 0 → 1 (by the admin) works, the compiler flag -Wno-deprecated-declarations is recommended, then. A script like the following for configuring PETSc is advisable:

#!/bin/bash

# L.B. 2024

declare -A inc=(["openmpi"]="/usr/lib/x86_64-linux-gnu/openmpi/include",
                ["mpich"]="/usr/include/x86_64-linux-gnu/mpich")

declare -A lib=(["openmpi"]="[/usr/lib/x86_64-linux-gnu/libmpi.so,/usr/lib/x86_64-linux-gnu/libmpi_mpifh.so]",
                ["mpich"]="[/usr/lib/x86_64-linux-gnu/libmpich.so,/usr/lib/x86_64-linux-gnu/libmpichfort.so]")

# On Debian 12, the MPICH libraries are actually called
# "libmpich.so.12" and "libmpichfort.so.12", and the standard links
# .so -> .so.12 are missing. Ask your admin to fix that. Specifying
# the suffix ".12" doesn't work, it confuses the configure.py.

export PETSC_DIR=$PWD

opt=-O3  # Some prefer -O2.
mpi=openmpi

python2 ./config/configure.py PETSC_ARCH=debian_$mpi \
        --with-cc=mpicc.$mpi --with-cxx=mpicxx.$mpi --with-fc=mpif90.$mpi --with-mpiexec=mpirun.$mpi \
        --CFLAGS=-Wno-deprecated-declarations --COPTFLAGS=$opt --FOPTFLAGS=$opt \
        --with-x=0 --with-debugging=0 --download-hypre=1 \
        --with-mpi-include="${inc[$mpi]}" --with-mpi-lib="${lib[$mpi]}"