Changes: 3.17#


  • PETSc now requires a C99 compliant C compiler in all cases. Previously C99 was only required when building PETSc, but this now extends to public interfaces and header-files

  • PETSc now requires a C++11 compliant C++ compiler. Note this requirement is only enforced if C++ is used; it is acceptable to have a compiler that does not support C++11 if you only ever build C source

  • PETSc now requires at least Microsoft Visual Studio 2015 when using the Microsoft Visual C/C++ Compiler

  • Change MPIU_Allreduce() to always returns a PETSc error code that should be checked with CHKERRQ(ierr) or PetscCall()


  • Change minimum value of --with-cxx-dialect argument from “03” to “11”

  • C++ dialect will now also be inferred from compiler flags, although users will be warned that they should let PETSc auto-detect the flag when setting the dialect this way

  • Change C++ dialect flag option to be consistent with compiler flags; --with-cxx-dialect=gnu++14 means you want -std=gnu++14, no more, no less

  • Fix for requesting no C++ dialect flag via --with-cxx-dialect=0. Previously configure would bail out immediately without running the tests and therefore wouldn’t set any of the capability defines. configure now runs all tests, just doesn’t add the flag in the end

  • Fix a number of corner-cases when handling C++ dialect detection

  • Remove deprecated PETSC_VERSION_PATCH so as to not have confusion with patch releases where the subminor version changes



  • Enable HYPRE GPU for 64bit indices build (using HYPRE’s mixed-int configuration)

  • Reuse PETSc-installed hwloc when installing OpenMPI


  • Add MPI_Comm_get_name() and MPI_Comm_set_name() to MPIUNI

  • Remove petsccublas.h and petschipblas.h

  • Remove -petsc_use_default_null_stream and -[cuda|hip]_synchronize options

  • Remove PetscCUDASynchronize and PetscHIPSynchronize. Their operation is now managed by PetscDeviceContext via its PetscStreamType attribute

  • Remove PetscCUDAInitialize(), PetscCUDAInitializeCheck(), PetscHIPInitialize(), and PetscHIPInitializeCheck(). Their function is now handled by PetscDeviceInitialize() and PetscDeviceInitialized()

  • Remove PetscCUBLASInitializeHandle(), PetscCUSOLVERDnInitializeHandle(), PetscHIPBLASInitializeHandle(), and PetscHIPSOLVERInitializeHandle(). Their function is now handled implicitly by PetscDeviceContext

  • Remove petsc_gputimer_begin and petsc_gputimer_begin

  • Add -device_enable, -device_select and -device_view startup-options to control coarse-grained device initialization strategy

  • Replace -[cuda|hip]_device with split options -device_enable_[cuda|hip] and -device_select_[cuda|hip] to enable fine-grained control of device selection and initialization strategy

  • Replace -[cuda|hip]_view with -device_view_[cuda|hip]

  • Add PetscDeviceInitType to enumerate PETSc device initialization strategies

  • Add PetscDeviceInitialize() to eagerly initialize a PetscDeviceType, and PetscDeviceInitialized() to query the corresponding initialization state

  • Change PetscDeviceCreate() to also accept a PetscInt devid, to create a PetscDevice for a specific device

  • Add PetscDeviceView()

  • Move PetscInt64_FMT and MPIU_INT64 definitions to petscsystypes.h

  • Add PetscBLASInt_FMT, PETSC_MPI_COMM_FMT, and PETSC_MPI_WIN_FMT format specifiers

  • Add petscmacros.h header to house common PETSc preprocessor macros

  • Add PetscUnreachable() to indicate unreachable code section to compiler

  • Add PetscHasAttribute() macro to query for existence of an __attribute__ specifier

  • Add PetscCommGetComm() and PetscCommRestoreComm() to allow reuse of MPI communicator with external packages, as some MPI implementations have broken MPI_Comm_free()

  • Add PetscExpand(), PetscConcat(), PetscCompl(), and PetscExpandToNothing()


  • Add PetscSizeT as a language-agnostic equivalent of size_t from <stddef.h>

  • Add PetscCount as a signed datatype for counts, equivalent to ptrdiff_t from <stddef.h>.

  • Add PetscCountCast, PetscSortIntWithCountArray(), and PetscSortIntWithIntCountArrayPair()

  • Deprecate SETERRQ1() - SETERRQ9() in favor of SETERRQ() which is now variadic

  • Deprecate PetscInfo1() - PetscInfo9() in favor of PetscInfo() which is now variadic

  • Deprecate PETSC_INLINE, inline is a standard keyword since C99 and C++11

  • Deprecate PETSC_STATIC_INLINE, as both static and inline are standard keywords since C99 and C++11

  • Remove PETSC_C_RESTRICT, restrict is a standard keyword since C99

  • Change SETERRMPI() to be variadic

  • Change SETERRABORT() to be variadic

  • Add PetscCheck() and PetscAssert() for checking a boolean condition is true. The former is always enabled, while the latter is enabled only in debug builds.

  • PetscDevice initialization for CUDA and HIP will now respect CUDA_VISIBILE_DEVICES and HIP_VISIBLE_DEVICES environment variables respectively

  • Add PETSC_ATTRIBUTE_COLD to inform compilers that a function is unlikely to be called

  • Add PetscCall(), PetscCallVoid(), PetscCallMPI(), PetscCallAbort(), PetscCallContinue(), PetscCallThrow(), and PetscCallCXX(). These supersede CHKERRQ(), CHKERRV(), CHKERRMPI(), CHKERRABORT(), CHKERRCONTINUE(), CHKERRXX(), and CHKERRCXX() respectively

  • Add PetscCallCUDA(), PetscCallCUBLAS(), PetscCallCUSPARSE(), PetscCallCUSOLVER(), PetscCallCUFFT(), and PetscCallCURAND(). These supersede CHKERRCUDA(), CHKERRCUBLAS(), CHKERRCUSPARSE(), CHKERRCUSOLVER(), CHKERRCUFFT(), and CHKERRCURAND() respectively

  • Add PetscCallHIP(), PetscCallHIPBLAS(), and PetscCallHIPSOLVER(). These supersede CHKERRHIP(), CHKERRHIPBLAS(), and CHKERRHIPSOLVER() respectively

  • Add PetscCallCEED() which supersedes CHKERRQ_CEED()

  • Soft-deprecate CHKERR variants listed above in C/C++ sources. New code should prefer the PetscCall variants though no compiler diagnostics will be emitted if the old versions are used. One may use ${PETSC_DIR}/share/petsc/ to perform the conversions automatically, though users should note that this script is considered “beta” software. It was used to facilitate the CHKERR changes during development and is being exposed to users in order to smooth the transition – while every reasonable effort was made to ensure correctness, we provide no guarantee of it.





VecScatter / PetscSF:





  • Add -mat_bind_below option for specifying size threshold below which GPU is not used for Mat operations

  • Add MatSetBindingPropagates()

  • Add MatGetBindingPropagates()

  • Add MatSeqAIJGetArrayWrite() and MatSeqAIJRestoreArrayWrite() to get write-access to the value array of MatSeqAIJ on CPU

  • Add MatCUSPARSESetUseCPUSolve() Use CPU solve with cuSparse for LU factorization that are on the CPU.

  • Change MatCreateIS() behavior when NULL is passed for the mappings. Now a NULL map implies matching local and global spaces

  • Add support of MatSetValuesCOO() and MatSetPreallocationCOO() for matrix type AIJKOKKOS. Additionally, for AIJKOKKOS, they support negative indices and remote entries

  • Add MatMultHermitianTransposeEqual() and MatMultHermitianTransposeAddEqual()

  • Add MatSetPreallocationCOOLocal() to set preallocation for matrices using a coordinate format of the entries with local indices

  • Change MatStructures enumeration to avoid spaces and match capitalization of other enumerations

  • Change size argument of MatSetPreallocationCOO() to PetscCount

  • Add MATORDERINGMETISND use METIS for nested dissection ordering of MatSeqAIJ, with options nseps, niter, ufactor and pfactor under the common prefix -mat_ordering_metisnd_

  • Change options -matproduct_<product_type>_via to -mat_product_algorithm

  • Add -mat_superlu_dist_3d and -mat_superlu_dist_d <n> to support using SuperLU_DIST’s version 7.2 3d decomposition algorithms

  • MATIS now supports negative and repeated indices in the local-to-global map and the COO assembly routines. This allows for better integration with libceed

  • Add MatISGetLocalToGlobalMapping() to retrieve the logical map for assembled subdomain problem


  • Add MG option -pc_mg_galerkin_mat_product_algorithm [cusparse|hypre] and PCMGGalerkinSetMatProductAlgorithm() to use cuSparse or hypre’s SpGEMM for Galerkin products in hypre

  • Add PC type PCBJKOKKOS a new, experimental batch Kokkos solver -pc_type bjkokkos -pc_bjkokkos_ksp_type [tfqmr|bicg] -pc_bjkokkos_pc_type jacobi -ksp_type preonly

  • Add -pc_svd_monitor ::all option to print all the singular values instead of a maximum of ten


  • Add PCMGGetGridComplexity() to get operator and grid complexity of MG hierarchy

  • Change PCGAMG default to use PCJACOBI smoothing instead of PCSOR. This also allows the default configuration to use GPUs effectively, and to deliver equivalent convergence. For the old default, use -mg_levels_pc_type sor.

  • Change PCGAMG eigenvalue estimation to use KSPCG when MAT_SPD has been set (see MatSetOption()) and KSPCR when MAT_SYMMETRIC or MAT_HERMITIAN has been set. These are usually somewhat more accurate and reliable than the previous default of KSPGMRES, and in tune with KSPCHEBYSHEV. Note that Chebyshev will generally not be a suitable smoother for indefinite matrices.

  • Change PCGAMG to use PCGAMGSetUseSAEstEig() by default when the smoother uses Jacobi preconditioning.





  • Add TSSundialsSetUseDense() and options database option -ts_sundials_use_dense to use a dense linear solver (serial only) within CVODE, instead of the default iterative solve

  • Change timestepper type TSDISCGRAD to include additional conservation terms based on formulation from [Gonzalez 1996] for Hamiltonian systems: - Add TSDiscGradIsGonzalez() to check flag for whether to use additional conservative terms in discrete gradient formulation - Add TSDiscGradUseGonzalez() to set discrete gradient formulation with or without additional conservative terms. Without flag, the discrete gradients timestepper is just backwards euler

  • Add TSRemoveTrajectory to destroy and remove the internal TSTrajectory object from TS

  • Change TSMonitorSPSwarmSolution() to have correct axes labels and bounds