Changes: 3.18#

Changes you should make for main and version 3.18 so that it is portable to previous versions of PETSc

Changes you can make for main and version 3.18 so that is not portable to previous versions of PETSc. This will remove all deprecation warnings when you build. In addition to the changes above

  • Change PetscOptionsHead() and PetscOptionsTail() to PetscOptionsHeadBegin() and PetscOptionsHeadEnd()

  • Change MatPreallocateInitialize() and MatPreallocateFinalize() to MatPreallocateBegin() and MatPreallocateEnd()

  • Change uses of MatGetOption() with MAT_SYMMETRIC, MAT_STRUCTURALLY_SYMMETRIC, MAT_HERMITIAN, MAT_SPD to calls to MatIsSymmetric(), MatIsSymmetricKnown() etc.

  • Whenever you call MatSetOption() with one of the above options and it is intended to stay with the matrix through calls to MatSetValues() etc add a call to MatSetOption() with MAT_SYMMETRY_ETERNAL etc


  • Add native PETSc/HIP backend for AMD GPUs

  • Add PETSC_ERR_RETURN to signal when an error handler returns 0 in PetscError()

  • Change behavior of SETERRQ() when PetscError() returns 0 via user-set error handler. In such cases SETERRQ() now returns PETSC_ERR_RETURN (a nonzero value) instead. Previously the value (0) would be propagated as-is. Note that while returning 0 from error handlers in PetscError() is supported, doing so is discouraged

  • Change PetscOptionsBegin(), PetscOptionsEnd(), and PetscObjectOptionsBegin() to not return an error code

  • Change PetscOptionsHead(), PetscOptionsTail(), to PetscOptionsHeadBegin() and PetscOptionsHeadEnd() and to not return an error code

  • Enable MPI_Datatype type-checking to ensure that the type of the pointer passed to communication routines (e.g. PetscSFBcastBegin()) matches the corresponding MPI_Datatype argument. Compilers supporting this feature will emit a warning in case of mismatch. These may be disabled by defining PETSC_SKIP_ATTRIBUTE_MPI_TYPE_TAG prior to all PETSc header-file inclusions

  • Add PETSC_ATTRIBUTE_FORMAT() to enable compile-time printf()-style format specifier checking and apply it any PETSc functions taking a format string

  • Deprecate the use of %D for printing PetscInt in favor of %" PetscInt_FMT ". Compilers may now emit warnings when using %D as a result of applying PETSC_ATTRIBUTE_FORMAT. Users that need to support older versions of PETSc may do one of two things:

    1. Recommended Insert the following code block after all PETSc header-file inclusions

      #if !defined(PetscInt_FMT)
      #  if defined(PETSC_USE_64BIT_INDICES)
      #    if !defined(PetscInt64_FMT)
      #      if defined(PETSC_HAVE_STDINT_H) && defined(PETSC_HAVE_INTTYPES_H) && defined(PETSC_HAVE_MPI_INT64_T)
      #        include <inttypes.h>
      #        define PetscInt64_FMT PRId64
      #      elif (PETSC_SIZEOF_LONG_LONG == 8)
      #        define PetscInt64_FMT "lld"
      #      elif defined(PETSC_HAVE___INT64)
      #        define PetscInt64_FMT "ld"
      #      else
      #        error "cannot determine PetscInt64 type"
      #      endif
      #    endif
      #    define PetscInt_FMT PetscInt64_FMT
      #  else
      #    define PetscInt_FMT "d"
      #  endif

      This will ensure that the appropriate format specifiers are defined regardless of PETSc version.

    2. Not Recommended Compilers warnings can be permanently suppressed by defining PETSC_SKIP_ATTRIBUTE_FORMAT prior to all PETSc header-file inclusions


  • Remove python2 support, python-3.4+ is now required


Event Logging:

Add NVIDIA NVTX sections to Default event logging. This tags code sections, like stages, with nvtxRangePushA(char name[]) and nvtxRangePop(), which can be visualized after the run with the NVIDIA Nsight GUI tool. To generate a data file, run code with nsys profile -f true -o file-name exec-name.





VecScatter / PetscSF:







  • Add MISK coarsening type. Distance-k maximal independent set (MIS) C-F coarsening with a greedy, MIS based aggregation algorithm


  • Add PC type of mpi which can be used in conjunction with -mpi_linear_solver_server to use MPI parallelism to solve a system created on a single MPI rank

  • Add PCHYPREAMSSetInteriorNodes() to set interior nodes for HYPRE AMS

  • Add PCAMGX, a PC interface for NVIDIA’s AMGx AMG solver

  • Remove PCGAMGSetSymGraph() and -pc_gamg_sym_graph. The user should now indicate symmetry and structural symmetry using MatSetOptions() and GAMG will symmetrize the graph if a symmetric options is not set

  • Change -pc_gamg_reuse_interpolation default from false to true.











  • Add DMNetworkFinalizeComponents() to setup the internal data structures for components on a network. Previously this could only be done by calling DMSetUp