petsc4py.PETSc.Sys#

class petsc4py.PETSc.Sys#

Bases: object

System utilities.

Methods Summary

Print(*args[, sep, end, comm])

Print output from the first processor of a communicator.

getDefaultComm()

Get the default MPI communicator used to create PETSc objects.

getVersion([devel, date, author])

Return PETSc version information.

getVersionInfo()

Return PETSc version information.

hasExternalPackage(package)

Return whether PETSc has support for external package.

infoAllow(flag[, filename, mode])

Enables or disables PETSc info messages.

isFinalized()

Return whether PETSc has been finalized.

isInitialized()

Return whether PETSc has been initialized.

popErrorHandler()

Remove the current error handler.

popSignalHandler()

Remove the current signal handler.

pushErrorHandler(errhandler)

Set the current error handler.

registerCitation(citation)

Register BibTeX citation.

setDefaultComm(comm)

Set the default MPI communicator used to create PETSc objects.

sleep([seconds])

Sleep some number of seconds.

splitOwnership(size[, bsize, comm])

Given a global (or local) size determines a local (or global) size.

syncFlush([comm])

Flush output from previous syncPrint calls.

syncPrint(*args[, sep, end, flush, comm])

Print synchronized output from several processors of a communicator.

Methods Documentation

classmethod Print(*args, sep=' ', end='\n', comm=None, **kwargs)#

Print output from the first processor of a communicator.

Collective.

Parameters:
  • *args (Any) – Positional arguments.

  • sep (str) – String inserted between values, by default a space.

  • end (str) – String appended after the last value, by default a newline.

  • comm (Comm | None) – MPI communicator, defaults to getDefaultComm.

  • **kwargs (Any) – Keyword arguments.

Return type:

None

See also

PetscPrintf

Source code at petsc4py/PETSc/Sys.pyx:155

classmethod getDefaultComm()#

Get the default MPI communicator used to create PETSc objects.

Not collective.

See also

setDefaultComm

Source code at petsc4py/PETSc/Sys.pyx:116

Return type:

Comm

classmethod getVersion(devel=False, date=False, author=False)#

Return PETSc version information.

Not collective.

Parameters:
  • devel (bool) – Additionally, return whether using an in-development version.

  • date (bool) – Additionally, return date information.

  • author (bool) – Additionally, return author information.

Returns:

  • major (int) – Major version number.

  • minor (int) – Minor version number.

  • micro (int) – Micro (or patch) version number.

Return type:

tuple[int, int, int]

Source code at petsc4py/PETSc/Sys.pyx:7

classmethod getVersionInfo()#

Return PETSc version information.

Not collective.

Returns:

info – Dictionary with version information.

Return type:

dict

Source code at petsc4py/PETSc/Sys.pyx:62

classmethod hasExternalPackage(package)#

Return whether PETSc has support for external package.

Not collective.

Parameters:

package (str) – The external package name.

Return type:

bool

Source code at petsc4py/PETSc/Sys.pyx:449

classmethod infoAllow(flag, filename=None, mode='w')#

Enables or disables PETSc info messages.

Not collective.

Parameters:
  • flag (bool) – Whether to enable info messages.

  • filename (str | None) – Name of a file where to dump output.

  • mode (str) – Write mode for file, by default "w".

Return type:

None

Source code at petsc4py/PETSc/Sys.pyx:392

classmethod isFinalized()#

Return whether PETSc has been finalized.

Not collective.

See also

isInitialized

Source code at petsc4py/PETSc/Sys.pyx:101

Return type:

bool

classmethod isInitialized()#

Return whether PETSc has been initialized.

Not collective.

See also

isFinalized

Source code at petsc4py/PETSc/Sys.pyx:88

Return type:

bool

classmethod popErrorHandler()#

Remove the current error handler.

Logically collective.

Source code at petsc4py/PETSc/Sys.pyx:366

Return type:

None

classmethod popSignalHandler()#

Remove the current signal handler.

Logically collective.

Source code at petsc4py/PETSc/Sys.pyx:379

Return type:

None

classmethod pushErrorHandler(errhandler)#

Set the current error handler.

Logically collective.

Parameters:

errhandler (str) – The name of the error handler.

Return type:

None

Source code at petsc4py/PETSc/Sys.pyx:331

classmethod registerCitation(citation)#

Register BibTeX citation.

Not collective.

Parameters:

citation (str) – The BibTex citation entry to register.

Return type:

None

Source code at petsc4py/PETSc/Sys.pyx:426

classmethod setDefaultComm(comm)#

Set the default MPI communicator used to create PETSc objects.

Logically collective.

Parameters:

comm (Comm | None) – MPI communicator. If set to None, uses COMM_WORLD.

Return type:

None

See also

getDefaultComm

Source code at petsc4py/PETSc/Sys.pyx:131

classmethod sleep(seconds=1.0)#

Sleep some number of seconds.

Not collective.

Parameters:

seconds (float) – Time to sleep in seconds.

Return type:

None

See also

PetscSleep

Source code at petsc4py/PETSc/Sys.pyx:310

classmethod splitOwnership(size, bsize=None, comm=None)#

Given a global (or local) size determines a local (or global) size.

Collective.

Parameters:
  • size (int | tuple[int, int]) – Global size N or 2-tuple (n, N) with local and global sizes. Either of n or N (but not both) can be None.

  • bsize (int | None) – Block size, defaults to 1.

  • comm (Comm | None) – MPI communicator, defaults to getDefaultComm.

Returns:

  • n (int) – The local size.

  • N (int) – The global size.

Return type:

tuple[int, int]

Notes

The size argument corresponds to the full size of the vector. That is, an array with 10 blocks and a block size of 3 will have a size of 30, not 10.

Source code at petsc4py/PETSc/Sys.pyx:261

classmethod syncFlush(comm=None)#

Flush output from previous syncPrint calls.

Collective.

Parameters:

comm (Comm | None) – MPI communicator, defaults to getDefaultComm.

Return type:

None

Source code at petsc4py/PETSc/Sys.pyx:240

classmethod syncPrint(*args, sep=' ', end='\n', flush=False, comm=None, **kwargs)#

Print synchronized output from several processors of a communicator.

Not collective.

Parameters:
  • *args (Any) – Positional arguments.

  • sep (str) – String inserted between values, by default a space.

  • end (str) – String appended after the last value, by default a newline.

  • flush (bool) – Whether to flush output with syncFlush.

  • comm (Comm | None) – MPI communicator, defaults to getDefaultComm.

  • **kwargs (Any) – Keyword arguments.

Return type:

None

Source code at petsc4py/PETSc/Sys.pyx:197