petsctools.config module

petsctools.config.get_blas_library()

Get the path to the BLAS library that PETSc links to.

petsctools.config.get_config()
petsctools.config.get_external_packages()

Return a list of PETSc external packages that are installed.

petsctools.config.get_petsc_arch()
petsctools.config.get_petsc_dir()
petsctools.config.get_petsc_dirs(*, prefix: str = '', subdir: str | None = None) → tuple[str, str]

Return $PETSC_DIR and $PETSC_DIR/$PETSC_ARCH.

This function is useful for generating compiler arguments. For example

get_petsc_dirs(subdir="include", prefix="-I")

will return

("-I/path/to/petsc/include", "-I/path/to/petsc/mypetscarch/include")
Parameters:
  • prefix – Optional prefix to prepend to the paths.

  • subdir – Optional subdirectory to include in the returned paths.

Returns:

$PETSC_DIR and $PETSC_DIR/$PETSC_ARCH with appropriate sub-directories and prefixes.

Return type:

tuple

petsctools.config.get_petscconf_h()

Get dict of PETSc include variables from the file: $PETSC_DIR/$PETSC_ARCH/include/petscconf.h

The #define and PETSC_ prefix are dropped in the dictionary key.

The result is memoized to avoid constantly reading the file.

petsctools.config.get_petscvariables()

Return PETSc’s configuration information.