petsc4py.PETSc.Log#

class petsc4py.PETSc.Log#

Bases: object

Logging support.

Methods Summary

Class(name)

Create a log class.

Event(name[, klass])

Create a log event.

EventDecorator([name, klass])

Decorate a function with a PETSc event.

Stage(name)

Create a log stage.

addFlops(flops)

Add floating point operations to the current event.

begin()

Turn on logging of objects and events.

getCPUTime()

Return the CPU time.

getFlops()

Return the number of flops used on this processor since the program began.

getTime()

Return the current time of day in seconds.

isActive()

Return whether logging is currently in progress.

logFlops(flops)

Add floating point operations to the current event.

view([viewer])

Print the log.

Methods Documentation

classmethod Class(name)#

Create a log class.

Not collective.

Parameters:

name (str) – Class name.

Returns:

klass – The log class. If a class already exists with name name then it is reused.

Return type:

LogClass

Source code at petsc4py/PETSc/Log.pyx:45

classmethod Event(name, klass=None)#

Create a log event.

Not collective.

Parameters:
  • name (str) – Event name.

  • klass (LogClass | None) – Log class. If None, defaults to PETSC_OBJECT_CLASSID.

Returns:

event – The log event. If an event already exists with name name then it is reused.

Return type:

LogEvent

Source code at petsc4py/PETSc/Log.pyx:79

classmethod EventDecorator(name=None, klass=None)#

Decorate a function with a PETSc event.

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

Return type:

Any

classmethod Stage(name)#

Create a log stage.

Not collective.

Parameters:

name (str) – Stage name.

Returns:

stage – The log stage. If a stage already exists with name name then it is reused.

Return type:

LogStage

Source code at petsc4py/PETSc/Log.pyx:11

classmethod addFlops(flops)#

Add floating point operations to the current event.

Not collective.

Parameters:

flops (float) – The number of flops to log.

Return type:

None

Notes

This method exists for backward compatibility.

Source code at petsc4py/PETSc/Log.pyx:170

classmethod begin()#

Turn on logging of objects and events.

Collective.

Source code at petsc4py/PETSc/Log.pyx:117

Return type:

None

classmethod getCPUTime()#

Return the CPU time.

Source code at petsc4py/PETSc/Log.pyx:233

Return type:

float

classmethod getFlops()#

Return the number of flops used on this processor since the program began.

Not collective.

Returns:

Number of floating point operations.

Return type:

float

See also

PetscGetFlops

Source code at petsc4py/PETSc/Log.pyx:193

classmethod getTime()#

Return the current time of day in seconds.

Collective.

Returns:

wctime – Current time.

Return type:

float

See also

PetscTime

Source code at petsc4py/PETSc/Log.pyx:213

classmethod isActive()#

Return whether logging is currently in progress.

Not collective.

See also

PetscLogIsActive

Source code at petsc4py/PETSc/Log.pyx:255

Return type:

bool

classmethod logFlops(flops)#

Add floating point operations to the current event.

Not collective.

Parameters:

flops (float) – The number of flops to log.

Return type:

None

See also

PetscLogFlops

Source code at petsc4py/PETSc/Log.pyx:151

classmethod view(viewer=None)#

Print the log.

Collective.

Parameters:

viewer (Viewer | None) – A Viewer instance or None for the default viewer.

Return type:

None

Source code at petsc4py/PETSc/Log.pyx:130