Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/source/optimising.rst
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,11 @@ Caveats

.. code-block:: python

from petsctools import OptionsManager
import petsctools

# If the -log_view flag is passed you don't need to call
# PETSc.Log.begin because it is done automatically.
if "log_view" not in OptionsManager.commandline_options:
if "log_view" not in petsctools.get_commandline_options():
PETSc.Log.begin()

Common performance issues
Expand Down
2 changes: 1 addition & 1 deletion firedrake/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def init_petsc():
# Initialise PETSc events for both import and entire duration of program
import petsctools
from firedrake import petsc
_is_logging = "log_view" in petsctools.OptionsManager.commandline_options
_is_logging = "log_view" in petsctools.get_commandline_options()
if _is_logging:
_main_event = petsc.PETSc.Log.Event("firedrake")
_main_event.begin()
Expand Down
11 changes: 6 additions & 5 deletions tests/firedrake/regression/test_solvers_options_prefix.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import petsctools.options
import pytest

from firedrake import *
from firedrake.matrix import ImplicitMatrix
from firedrake.petsc import PETSc
from petsctools import OptionsManager
import pytest


@pytest.fixture(params=[None, "", "foo_"])
Expand Down Expand Up @@ -32,13 +33,13 @@ def opts(request, prefix, global_parameters):
opts[prefix + k] = v

# Pretend these came from the commandline
OptionsManager.commandline_options = frozenset(opts.getAll())
petsctools.options._commandline_options = frozenset(opts.getAll())

def finalize():
# And remove again
for k in global_parameters.keys():
del opts[prefix + k]
# And remove again
OptionsManager.commandline_options = frozenset(opts.getAll())
petsctools.options._commandline_options = frozenset(opts.getAll())

request.addfinalizer(finalize)

Expand Down
Loading