Dham/abstract reduced functional #6645
8161 tests run, 7475 passed, 675 skipped, 11 failed.
Annotations
Check failure on line 1 in tests/firedrake/demos/test_demos_run.py
github-actions / Firedrake real
test_demos_run.test_parallel_demo[full_waveform_inversion/full_waveform_inversion]
subprocess.CalledProcessError: Command '['mpiexec', '-n', '1', '-genv', '_PYTEST_MPI_CHILD_PROCESS', '1', '/__w/firedrake/firedrake_venv/bin/python', '-m', 'pytest', '--runxfail', '-s', '-q', '/__w/firedrake/firedrake/tests/firedrake/demos/test_demos_run.py::test_parallel_demo[full_waveform_inversion/full_waveform_inversion]', ':', '-n', '1', '/__w/firedrake/firedrake_venv/bin/python', '-m', 'pytest', '--runxfail', '-s', '-q', '/__w/firedrake/firedrake/tests/firedrake/demos/test_demos_run.py::test_parallel_demo[full_waveform_inversion/full_waveform_inversion]', '--tb=no', '--no-summary', '--no-header', '--disable-warnings', '--show-capture=no']' returned non-zero exit status 1.
Raw output
args = ()
kwargs = {'demo': Demo(loc=('full_waveform_inversion', 'full_waveform_inversion'), requirements=['adjoint']), 'env': {'CI': 'tr...ect at 0x7f034039eff0>, 'tmpdir': local('/tmp/pytest-of-firedrake/pytest-0/popen-gw1/test_parallel_demo_full_wavefo0')}
def parallel_callback(*args, **kwargs):
> subprocess.run(cmd, check=True)
../firedrake_venv/src/pytest-mpi/pytest_mpi/plugin.py:240:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
input = None, capture_output = False, timeout = None, check = True
popenargs = (['mpiexec', '-n', '1', '-genv', '_PYTEST_MPI_CHILD_PROCESS', '1', ...],)
kwargs = {}
process = <Popen: returncode: 1 args: ['mpiexec', '-n', '1', '-genv', '_PYTEST_MPI_CHI...>
stdout = None, stderr = None, retcode = 1
def run(*popenargs,
input=None, capture_output=False, timeout=None, check=False, **kwargs):
"""Run command with arguments and return a CompletedProcess instance.
The returned instance will have attributes args, returncode, stdout and
stderr. By default, stdout and stderr are not captured, and those attributes
will be None. Pass stdout=PIPE and/or stderr=PIPE in order to capture them,
or pass capture_output=True to capture both.
If check is True and the exit code was non-zero, it raises a
CalledProcessError. The CalledProcessError object will have the return code
in the returncode attribute, and output & stderr attributes if those streams
were captured.
If timeout is given, and the process takes too long, a TimeoutExpired
exception will be raised.
There is an optional argument "input", allowing you to
pass bytes or a string to the subprocess's stdin. If you use this argument
you may not also use the Popen constructor's "stdin" argument, as
it will be used internally.
By default, all communication is in bytes, and therefore any "input" should
be bytes, and the stdout and stderr will be bytes. If in text mode, any
"input" should be a string, and stdout and stderr will be strings decoded
according to locale encoding, or by "encoding" if set. Text mode is
triggered by setting any of text, encoding, errors or universal_newlines.
The other arguments are the same as for the Popen constructor.
"""
if input is not None:
if kwargs.get('stdin') is not None:
raise ValueError('stdin and input arguments may not both be used.')
kwargs['stdin'] = PIPE
if capture_output:
if kwargs.get('stdout') is not None or kwargs.get('stderr') is not None:
raise ValueError('stdout and stderr arguments may not be used '
'with capture_output.')
kwargs['stdout'] = PIPE
kwargs['stderr'] = PIPE
with Popen(*popenargs, **kwargs) as process:
try:
stdout, stderr = process.communicate(input, timeout=timeout)
except TimeoutExpired as exc:
process.kill()
if _mswindows:
# Windows accumulates the output in a single blocking
# read() call run on child threads, with the timeout
# being done in a join() on those threads. communicate()
# _after_ kill() is required to collect that and add it
# to the exception.
exc.stdout, exc.stderr = process.communicate()
else:
# POSIX _communicate already populated the output so
# far into the TimeoutExpired exception.
process.wait()
raise
except: # Including KeyboardInterrupt, communicate handled that.
process.kill()
# We don't call process.wait() as .__exit__ does that for us.
raise
retcode = process.poll()
if check and retcode:
> raise CalledProcessError(retcode, process.args,
output=stdout, stderr=stderr)
E subprocess.CalledProcessError: Command '['mpiexec', '-n', '1', '-genv', '_PYTEST_MPI_CHILD_PROCESS', '1', '/__w/firedrake/firedrake_venv/bin/python', '-m', 'pytest', '--runxfail', '-s', '-q', '/__w/firedrake/firedrake/tests/firedrake/demos/test_demos_run.py::test_parallel_demo[full_waveform_inversion/full_waveform_inversion]', ':', '-n', '1', '/__w/firedrake/firedrake_venv/bin/python', '-m', 'pytest', '--runxfail', '-s', '-q', '/__w/firedrake/firedrake/tests/firedrake/demos/test_demos_run.py::test_parallel_demo[full_waveform_inversion/full_waveform_inversion]', '--tb=no', '--no-summary', '--no-header', '--disable-warnings', '--show-capture=no']' returned non-zero exit status 1.
/usr/lib/python3.12/subprocess.py:571: CalledProcessError
Check failure on line 1 in tests/firedrake/ensemble_reduced_functional/test_reduced_functional.py
github-actions / Firedrake real
test_reduced_functional.test_verification
subprocess.CalledProcessError: Command '['mpiexec', '-n', '1', '-genv', '_PYTEST_MPI_CHILD_PROCESS', '1', '/__w/firedrake/firedrake_venv/bin/python', '-m', 'pytest', '--runxfail', '-s', '-q', '/__w/firedrake/firedrake/tests/firedrake/ensemble_reduced_functional/test_reduced_functional.py::test_verification', ':', '-n', '3', '/__w/firedrake/firedrake_venv/bin/python', '-m', 'pytest', '--runxfail', '-s', '-q', '/__w/firedrake/firedrake/tests/firedrake/ensemble_reduced_functional/test_reduced_functional.py::test_verification', '--tb=no', '--no-summary', '--no-header', '--disable-warnings', '--show-capture=no']' returned non-zero exit status 1.
Raw output
args = (), kwargs = {}
def parallel_callback(*args, **kwargs):
> subprocess.run(cmd, check=True)
../firedrake_venv/src/pytest-mpi/pytest_mpi/plugin.py:240:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
input = None, capture_output = False, timeout = None, check = True
popenargs = (['mpiexec', '-n', '1', '-genv', '_PYTEST_MPI_CHILD_PROCESS', '1', ...],)
kwargs = {}
process = <Popen: returncode: 1 args: ['mpiexec', '-n', '1', '-genv', '_PYTEST_MPI_CHI...>
stdout = None, stderr = None, retcode = 1
def run(*popenargs,
input=None, capture_output=False, timeout=None, check=False, **kwargs):
"""Run command with arguments and return a CompletedProcess instance.
The returned instance will have attributes args, returncode, stdout and
stderr. By default, stdout and stderr are not captured, and those attributes
will be None. Pass stdout=PIPE and/or stderr=PIPE in order to capture them,
or pass capture_output=True to capture both.
If check is True and the exit code was non-zero, it raises a
CalledProcessError. The CalledProcessError object will have the return code
in the returncode attribute, and output & stderr attributes if those streams
were captured.
If timeout is given, and the process takes too long, a TimeoutExpired
exception will be raised.
There is an optional argument "input", allowing you to
pass bytes or a string to the subprocess's stdin. If you use this argument
you may not also use the Popen constructor's "stdin" argument, as
it will be used internally.
By default, all communication is in bytes, and therefore any "input" should
be bytes, and the stdout and stderr will be bytes. If in text mode, any
"input" should be a string, and stdout and stderr will be strings decoded
according to locale encoding, or by "encoding" if set. Text mode is
triggered by setting any of text, encoding, errors or universal_newlines.
The other arguments are the same as for the Popen constructor.
"""
if input is not None:
if kwargs.get('stdin') is not None:
raise ValueError('stdin and input arguments may not both be used.')
kwargs['stdin'] = PIPE
if capture_output:
if kwargs.get('stdout') is not None or kwargs.get('stderr') is not None:
raise ValueError('stdout and stderr arguments may not be used '
'with capture_output.')
kwargs['stdout'] = PIPE
kwargs['stderr'] = PIPE
with Popen(*popenargs, **kwargs) as process:
try:
stdout, stderr = process.communicate(input, timeout=timeout)
except TimeoutExpired as exc:
process.kill()
if _mswindows:
# Windows accumulates the output in a single blocking
# read() call run on child threads, with the timeout
# being done in a join() on those threads. communicate()
# _after_ kill() is required to collect that and add it
# to the exception.
exc.stdout, exc.stderr = process.communicate()
else:
# POSIX _communicate already populated the output so
# far into the TimeoutExpired exception.
process.wait()
raise
except: # Including KeyboardInterrupt, communicate handled that.
process.kill()
# We don't call process.wait() as .__exit__ does that for us.
raise
retcode = process.poll()
if check and retcode:
> raise CalledProcessError(retcode, process.args,
output=stdout, stderr=stderr)
E subprocess.CalledProcessError: Command '['mpiexec', '-n', '1', '-genv', '_PYTEST_MPI_CHILD_PROCESS', '1', '/__w/firedrake/firedrake_venv/bin/python', '-m', 'pytest', '--runxfail', '-s', '-q', '/__w/firedrake/firedrake/tests/firedrake/ensemble_reduced_functional/test_reduced_functional.py::test_verification', ':', '-n', '3', '/__w/firedrake/firedrake_venv/bin/python', '-m', 'pytest', '--runxfail', '-s', '-q', '/__w/firedrake/firedrake/tests/firedrake/ensemble_reduced_functional/test_reduced_functional.py::test_verification', '--tb=no', '--no-summary', '--no-header', '--disable-warnings', '--show-capture=no']' returned non-zero exit status 1.
/usr/lib/python3.12/subprocess.py:571: CalledProcessError
Check failure on line 1 in tests/firedrake/ensemble_reduced_functional/test_reduced_functional.py
github-actions / Firedrake real
test_reduced_functional.test_minimise
subprocess.CalledProcessError: Command '['mpiexec', '-n', '1', '-genv', '_PYTEST_MPI_CHILD_PROCESS', '1', '/__w/firedrake/firedrake_venv/bin/python', '-m', 'pytest', '--runxfail', '-s', '-q', '/__w/firedrake/firedrake/tests/firedrake/ensemble_reduced_functional/test_reduced_functional.py::test_minimise', ':', '-n', '5', '/__w/firedrake/firedrake_venv/bin/python', '-m', 'pytest', '--runxfail', '-s', '-q', '/__w/firedrake/firedrake/tests/firedrake/ensemble_reduced_functional/test_reduced_functional.py::test_minimise', '--tb=no', '--no-summary', '--no-header', '--disable-warnings', '--show-capture=no']' returned non-zero exit status 1.
Raw output
args = (), kwargs = {}
def parallel_callback(*args, **kwargs):
> subprocess.run(cmd, check=True)
../firedrake_venv/src/pytest-mpi/pytest_mpi/plugin.py:240:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
input = None, capture_output = False, timeout = None, check = True
popenargs = (['mpiexec', '-n', '1', '-genv', '_PYTEST_MPI_CHILD_PROCESS', '1', ...],)
kwargs = {}
process = <Popen: returncode: 1 args: ['mpiexec', '-n', '1', '-genv', '_PYTEST_MPI_CHI...>
stdout = None, stderr = None, retcode = 1
def run(*popenargs,
input=None, capture_output=False, timeout=None, check=False, **kwargs):
"""Run command with arguments and return a CompletedProcess instance.
The returned instance will have attributes args, returncode, stdout and
stderr. By default, stdout and stderr are not captured, and those attributes
will be None. Pass stdout=PIPE and/or stderr=PIPE in order to capture them,
or pass capture_output=True to capture both.
If check is True and the exit code was non-zero, it raises a
CalledProcessError. The CalledProcessError object will have the return code
in the returncode attribute, and output & stderr attributes if those streams
were captured.
If timeout is given, and the process takes too long, a TimeoutExpired
exception will be raised.
There is an optional argument "input", allowing you to
pass bytes or a string to the subprocess's stdin. If you use this argument
you may not also use the Popen constructor's "stdin" argument, as
it will be used internally.
By default, all communication is in bytes, and therefore any "input" should
be bytes, and the stdout and stderr will be bytes. If in text mode, any
"input" should be a string, and stdout and stderr will be strings decoded
according to locale encoding, or by "encoding" if set. Text mode is
triggered by setting any of text, encoding, errors or universal_newlines.
The other arguments are the same as for the Popen constructor.
"""
if input is not None:
if kwargs.get('stdin') is not None:
raise ValueError('stdin and input arguments may not both be used.')
kwargs['stdin'] = PIPE
if capture_output:
if kwargs.get('stdout') is not None or kwargs.get('stderr') is not None:
raise ValueError('stdout and stderr arguments may not be used '
'with capture_output.')
kwargs['stdout'] = PIPE
kwargs['stderr'] = PIPE
with Popen(*popenargs, **kwargs) as process:
try:
stdout, stderr = process.communicate(input, timeout=timeout)
except TimeoutExpired as exc:
process.kill()
if _mswindows:
# Windows accumulates the output in a single blocking
# read() call run on child threads, with the timeout
# being done in a join() on those threads. communicate()
# _after_ kill() is required to collect that and add it
# to the exception.
exc.stdout, exc.stderr = process.communicate()
else:
# POSIX _communicate already populated the output so
# far into the TimeoutExpired exception.
process.wait()
raise
except: # Including KeyboardInterrupt, communicate handled that.
process.kill()
# We don't call process.wait() as .__exit__ does that for us.
raise
retcode = process.poll()
if check and retcode:
> raise CalledProcessError(retcode, process.args,
output=stdout, stderr=stderr)
E subprocess.CalledProcessError: Command '['mpiexec', '-n', '1', '-genv', '_PYTEST_MPI_CHILD_PROCESS', '1', '/__w/firedrake/firedrake_venv/bin/python', '-m', 'pytest', '--runxfail', '-s', '-q', '/__w/firedrake/firedrake/tests/firedrake/ensemble_reduced_functional/test_reduced_functional.py::test_minimise', ':', '-n', '5', '/__w/firedrake/firedrake_venv/bin/python', '-m', 'pytest', '--runxfail', '-s', '-q', '/__w/firedrake/firedrake/tests/firedrake/ensemble_reduced_functional/test_reduced_functional.py::test_minimise', '--tb=no', '--no-summary', '--no-header', '--disable-warnings', '--show-capture=no']' returned non-zero exit status 1.
/usr/lib/python3.12/subprocess.py:571: CalledProcessError
Check failure on line 1 in tests/firedrake/regression/test_adv_diff_nonsplit.py
github-actions / Firedrake real
test_adv_diff_nonsplit.test_adv_diff_on_quadrilaterals_serial
failed on setup with "worker 'gw10' crashed while running 'tests/firedrake/regression/test_adv_diff_nonsplit.py::test_adv_diff_on_quadrilaterals_serial'"
Raw output
worker 'gw10' crashed while running 'tests/firedrake/regression/test_adv_diff_nonsplit.py::test_adv_diff_on_quadrilaterals_serial'
Check failure on line 115 in tests/firedrake/vertexonly/test_poisson_inverse_conductivity.py
github-actions / Firedrake real
test_poisson_inverse_conductivity.test_poisson_inverse_conductivity[sparse]
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
Raw output
num_points = 2
@pytest.mark.skipcomplex # Taping for complex-valued 0-forms not yet done
def test_poisson_inverse_conductivity(num_points):
# Have to import inside test to make sure cleanup fixtures work as intended
from firedrake.adjoint import Control, ReducedFunctional, minimize
# Use pyadjoint to estimate an unknown conductivity in a
# poisson-like forward model from point measurements
m = UnitSquareMesh(2, 2)
if m.comm.size > 1:
# lower tolerance avoids issues with .at getting different results
# across ranks
m.tolerance = 1e-10
V = FunctionSpace(m, family='CG', degree=2)
Q = FunctionSpace(m, family='CG', degree=2)
# generate random "true" conductivity with beta distribution
pcg = PCG64(seed=0)
rg = RandomGenerator(pcg)
# beta distribution
q_true = rg.beta(Q, 1.0, 2.0)
# Compute the true solution of the PDE.
u_true = Function(V)
v = TestFunction(V)
f = Constant(1.0, domain=m)
k0 = Constant(0.5, domain=m)
bc = DirichletBC(V, 0, 'on_boundary')
F = (k0 * exp(q_true) * inner(grad(u_true), grad(v)) - f * v) * dx
solve(F == 0, u_true, bc)
# Generate random point cloud
np.random.seed(0)
xs = np.random.random_sample((num_points, 2))
# we set redundant to False to ensure that we put points on all ranks
point_cloud = VertexOnlyMesh(m, xs, redundant=False)
# Check the point cloud coordinates are correct
assert (point_cloud.input_ordering.coordinates.dat.data_ro == xs).all()
# Generate "observed" data
generator = np.random.default_rng(0)
signal_to_noise = 20
U = u_true.dat.data_ro[:]
u_range = U.max() - U.min()
σ = Constant(u_range / signal_to_noise, domain=point_cloud)
ζ = generator.standard_normal(len(xs))
u_obs_vals = np.array(u_true.at(xs)) + float(σ) * ζ
# Store data on the point_cloud by setting input ordering dat
P0DG_input_ordering = FunctionSpace(point_cloud.input_ordering, 'DG', 0)
u_obs_input_ordering = Function(P0DG_input_ordering)
u_obs_input_ordering.dat.data_wo[:] = u_obs_vals
# Interpolate onto the point_cloud to get it in the right place
P0DG = FunctionSpace(point_cloud, 'DG', 0)
u_obs = Function(P0DG)
u_obs.interpolate(u_obs_input_ordering)
# Run the forward model
u = Function(V)
q = Function(Q)
bc = DirichletBC(V, 0, 'on_boundary')
F = (k0 * exp(q) * inner(grad(u), grad(v)) - f * v) * dx
solve(F == 0, u, bc)
# Two terms in the functional
misfit_expr = 0.5 * ((u_obs - assemble(interpolate(u, P0DG))) / σ)**2
α = Constant(0.5, domain=m)
regularisation_expr = 0.5 * α**2 * inner(grad(q), grad(q))
# Form functional and reduced functional
J = assemble(misfit_expr * dx) + assemble(regularisation_expr * dx)
q̂ = Control(q)
Ĵ = ReducedFunctional(J, q̂)
# Estimate q using Newton-CG which evaluates the hessian action
> minimize(Ĵ, method='Newton-CG', options={'disp': True})
tests/firedrake/vertexonly/test_poisson_inverse_conductivity.py:115:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.12/contextlib.py:81: in inner
return func(*args, **kwds)
../firedrake_venv/src/pyadjoint/pyadjoint/optimization/optimization.py:243: in minimize
opt = algorithm(rf_np, **kwargs)
../firedrake_venv/src/pyadjoint/pyadjoint/optimization/optimization.py:126: in minimize_scipy_generic
res = scipy_minimize(J, m_global, method=method, **kwargs)
../firedrake_venv/lib/python3.12/site-packages/scipy/optimize/_minimize.py:728: in minimize
res = _minimize_newtoncg(fun, x0, args, jac, hess, hessp, callback,
../firedrake_venv/lib/python3.12/site-packages/scipy/optimize/_optimize.py:2073: in _minimize_newtoncg
Ap = fhess_p(xk, psupi, *args)
/usr/lib/python3.12/contextlib.py:81: in inner
return func(*args, **kwds)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pyadjoint.reduced_functional_numpy.ReducedFunctionalNumPy object at 0x7f5edffddb50>
m_dot_array = array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0.])
apply_riesz = array([ 100.32730244, 103.89871565, 101.3436648 , -74.90593946,
255.56278029, 251.49733085, 170.31675496,... 453.29164351, 220.87680353,
1019.05285392, 463.41097504, 242.5581478 , 263.83724823,
-18.14806951])
@no_annotations
def hessian(self, m_dot_array, apply_riesz=True):
> if not apply_riesz:
E ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
../firedrake_venv/src/pyadjoint/pyadjoint/reduced_functional_numpy.py:83: ValueError
Check failure on line 115 in tests/firedrake/vertexonly/test_poisson_inverse_conductivity.py
github-actions / Firedrake real
test_poisson_inverse_conductivity.test_poisson_inverse_conductivity[per_cell]
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
Raw output
num_points = 8
@pytest.mark.skipcomplex # Taping for complex-valued 0-forms not yet done
def test_poisson_inverse_conductivity(num_points):
# Have to import inside test to make sure cleanup fixtures work as intended
from firedrake.adjoint import Control, ReducedFunctional, minimize
# Use pyadjoint to estimate an unknown conductivity in a
# poisson-like forward model from point measurements
m = UnitSquareMesh(2, 2)
if m.comm.size > 1:
# lower tolerance avoids issues with .at getting different results
# across ranks
m.tolerance = 1e-10
V = FunctionSpace(m, family='CG', degree=2)
Q = FunctionSpace(m, family='CG', degree=2)
# generate random "true" conductivity with beta distribution
pcg = PCG64(seed=0)
rg = RandomGenerator(pcg)
# beta distribution
q_true = rg.beta(Q, 1.0, 2.0)
# Compute the true solution of the PDE.
u_true = Function(V)
v = TestFunction(V)
f = Constant(1.0, domain=m)
k0 = Constant(0.5, domain=m)
bc = DirichletBC(V, 0, 'on_boundary')
F = (k0 * exp(q_true) * inner(grad(u_true), grad(v)) - f * v) * dx
solve(F == 0, u_true, bc)
# Generate random point cloud
np.random.seed(0)
xs = np.random.random_sample((num_points, 2))
# we set redundant to False to ensure that we put points on all ranks
point_cloud = VertexOnlyMesh(m, xs, redundant=False)
# Check the point cloud coordinates are correct
assert (point_cloud.input_ordering.coordinates.dat.data_ro == xs).all()
# Generate "observed" data
generator = np.random.default_rng(0)
signal_to_noise = 20
U = u_true.dat.data_ro[:]
u_range = U.max() - U.min()
σ = Constant(u_range / signal_to_noise, domain=point_cloud)
ζ = generator.standard_normal(len(xs))
u_obs_vals = np.array(u_true.at(xs)) + float(σ) * ζ
# Store data on the point_cloud by setting input ordering dat
P0DG_input_ordering = FunctionSpace(point_cloud.input_ordering, 'DG', 0)
u_obs_input_ordering = Function(P0DG_input_ordering)
u_obs_input_ordering.dat.data_wo[:] = u_obs_vals
# Interpolate onto the point_cloud to get it in the right place
P0DG = FunctionSpace(point_cloud, 'DG', 0)
u_obs = Function(P0DG)
u_obs.interpolate(u_obs_input_ordering)
# Run the forward model
u = Function(V)
q = Function(Q)
bc = DirichletBC(V, 0, 'on_boundary')
F = (k0 * exp(q) * inner(grad(u), grad(v)) - f * v) * dx
solve(F == 0, u, bc)
# Two terms in the functional
misfit_expr = 0.5 * ((u_obs - assemble(interpolate(u, P0DG))) / σ)**2
α = Constant(0.5, domain=m)
regularisation_expr = 0.5 * α**2 * inner(grad(q), grad(q))
# Form functional and reduced functional
J = assemble(misfit_expr * dx) + assemble(regularisation_expr * dx)
q̂ = Control(q)
Ĵ = ReducedFunctional(J, q̂)
# Estimate q using Newton-CG which evaluates the hessian action
> minimize(Ĵ, method='Newton-CG', options={'disp': True})
tests/firedrake/vertexonly/test_poisson_inverse_conductivity.py:115:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.12/contextlib.py:81: in inner
return func(*args, **kwds)
../firedrake_venv/src/pyadjoint/pyadjoint/optimization/optimization.py:243: in minimize
opt = algorithm(rf_np, **kwargs)
../firedrake_venv/src/pyadjoint/pyadjoint/optimization/optimization.py:126: in minimize_scipy_generic
res = scipy_minimize(J, m_global, method=method, **kwargs)
../firedrake_venv/lib/python3.12/site-packages/scipy/optimize/_minimize.py:728: in minimize
res = _minimize_newtoncg(fun, x0, args, jac, hess, hessp, callback,
../firedrake_venv/lib/python3.12/site-packages/scipy/optimize/_optimize.py:2073: in _minimize_newtoncg
Ap = fhess_p(xk, psupi, *args)
/usr/lib/python3.12/contextlib.py:81: in inner
return func(*args, **kwds)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pyadjoint.reduced_functional_numpy.ReducedFunctionalNumPy object at 0x7f5edf2be6c0>
m_dot_array = array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0.])
apply_riesz = array([ 160.21547948, 191.99501751, 173.72419667, -109.41489013,
476.06700644, 422.03213767, 273.25939416,... 899.23448284, 356.43810638,
1709.68150806, 789.49659415, 397.14713004, 429.38596189,
-3.93116974])
@no_annotations
def hessian(self, m_dot_array, apply_riesz=True):
> if not apply_riesz:
E ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
../firedrake_venv/src/pyadjoint/pyadjoint/reduced_functional_numpy.py:83: ValueError
Check failure on line 115 in tests/firedrake/vertexonly/test_poisson_inverse_conductivity.py
github-actions / Firedrake real
test_poisson_inverse_conductivity.test_poisson_inverse_conductivity[dense]
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
Raw output
num_points = 1024
@pytest.mark.skipcomplex # Taping for complex-valued 0-forms not yet done
def test_poisson_inverse_conductivity(num_points):
# Have to import inside test to make sure cleanup fixtures work as intended
from firedrake.adjoint import Control, ReducedFunctional, minimize
# Use pyadjoint to estimate an unknown conductivity in a
# poisson-like forward model from point measurements
m = UnitSquareMesh(2, 2)
if m.comm.size > 1:
# lower tolerance avoids issues with .at getting different results
# across ranks
m.tolerance = 1e-10
V = FunctionSpace(m, family='CG', degree=2)
Q = FunctionSpace(m, family='CG', degree=2)
# generate random "true" conductivity with beta distribution
pcg = PCG64(seed=0)
rg = RandomGenerator(pcg)
# beta distribution
q_true = rg.beta(Q, 1.0, 2.0)
# Compute the true solution of the PDE.
u_true = Function(V)
v = TestFunction(V)
f = Constant(1.0, domain=m)
k0 = Constant(0.5, domain=m)
bc = DirichletBC(V, 0, 'on_boundary')
F = (k0 * exp(q_true) * inner(grad(u_true), grad(v)) - f * v) * dx
solve(F == 0, u_true, bc)
# Generate random point cloud
np.random.seed(0)
xs = np.random.random_sample((num_points, 2))
# we set redundant to False to ensure that we put points on all ranks
point_cloud = VertexOnlyMesh(m, xs, redundant=False)
# Check the point cloud coordinates are correct
assert (point_cloud.input_ordering.coordinates.dat.data_ro == xs).all()
# Generate "observed" data
generator = np.random.default_rng(0)
signal_to_noise = 20
U = u_true.dat.data_ro[:]
u_range = U.max() - U.min()
σ = Constant(u_range / signal_to_noise, domain=point_cloud)
ζ = generator.standard_normal(len(xs))
u_obs_vals = np.array(u_true.at(xs)) + float(σ) * ζ
# Store data on the point_cloud by setting input ordering dat
P0DG_input_ordering = FunctionSpace(point_cloud.input_ordering, 'DG', 0)
u_obs_input_ordering = Function(P0DG_input_ordering)
u_obs_input_ordering.dat.data_wo[:] = u_obs_vals
# Interpolate onto the point_cloud to get it in the right place
P0DG = FunctionSpace(point_cloud, 'DG', 0)
u_obs = Function(P0DG)
u_obs.interpolate(u_obs_input_ordering)
# Run the forward model
u = Function(V)
q = Function(Q)
bc = DirichletBC(V, 0, 'on_boundary')
F = (k0 * exp(q) * inner(grad(u), grad(v)) - f * v) * dx
solve(F == 0, u, bc)
# Two terms in the functional
misfit_expr = 0.5 * ((u_obs - assemble(interpolate(u, P0DG))) / σ)**2
α = Constant(0.5, domain=m)
regularisation_expr = 0.5 * α**2 * inner(grad(q), grad(q))
# Form functional and reduced functional
J = assemble(misfit_expr * dx) + assemble(regularisation_expr * dx)
q̂ = Control(q)
Ĵ = ReducedFunctional(J, q̂)
# Estimate q using Newton-CG which evaluates the hessian action
> minimize(Ĵ, method='Newton-CG', options={'disp': True})
tests/firedrake/vertexonly/test_poisson_inverse_conductivity.py:115:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.12/contextlib.py:81: in inner
return func(*args, **kwds)
../firedrake_venv/src/pyadjoint/pyadjoint/optimization/optimization.py:243: in minimize
opt = algorithm(rf_np, **kwargs)
../firedrake_venv/src/pyadjoint/pyadjoint/optimization/optimization.py:126: in minimize_scipy_generic
res = scipy_minimize(J, m_global, method=method, **kwargs)
../firedrake_venv/lib/python3.12/site-packages/scipy/optimize/_minimize.py:728: in minimize
res = _minimize_newtoncg(fun, x0, args, jac, hess, hessp, callback,
../firedrake_venv/lib/python3.12/site-packages/scipy/optimize/_optimize.py:2073: in _minimize_newtoncg
Ap = fhess_p(xk, psupi, *args)
/usr/lib/python3.12/contextlib.py:81: in inner
return func(*args, **kwds)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pyadjoint.reduced_functional_numpy.ReducedFunctionalNumPy object at 0x7f5edf183230>
m_dot_array = array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0.])
apply_riesz = array([ 47224.34960746, 60502.35211873, 46687.15872903, -25162.29403086,
136424.04685438, 138572.8103681 , 2...6, 29469.68914432,
113265.20369735, 50866.77753229, 38169.10299076, 37670.48340166,
-18708.36495465])
@no_annotations
def hessian(self, m_dot_array, apply_riesz=True):
> if not apply_riesz:
E ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
../firedrake_venv/src/pyadjoint/pyadjoint/reduced_functional_numpy.py:83: ValueError
Check failure on line 1 in tests/firedrake/vertexonly/test_poisson_inverse_conductivity.py
github-actions / Firedrake real
test_poisson_inverse_conductivity.test_poisson_inverse_conductivity_parallel[sparse]
subprocess.CalledProcessError: Command '['mpiexec', '-n', '1', '-genv', '_PYTEST_MPI_CHILD_PROCESS', '1', '/__w/firedrake/firedrake_venv/bin/python', '-m', 'pytest', '--runxfail', '-s', '-q', '/__w/firedrake/firedrake/tests/firedrake/vertexonly/test_poisson_inverse_conductivity.py::test_poisson_inverse_conductivity_parallel[sparse]', ':', '-n', '2', '/__w/firedrake/firedrake_venv/bin/python', '-m', 'pytest', '--runxfail', '-s', '-q', '/__w/firedrake/firedrake/tests/firedrake/vertexonly/test_poisson_inverse_conductivity.py::test_poisson_inverse_conductivity_parallel[sparse]', '--tb=no', '--no-summary', '--no-header', '--disable-warnings', '--show-capture=no']' returned non-zero exit status 1.
Raw output
args = (), kwargs = {'num_points': 2}
def parallel_callback(*args, **kwargs):
> subprocess.run(cmd, check=True)
../firedrake_venv/src/pytest-mpi/pytest_mpi/plugin.py:240:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
input = None, capture_output = False, timeout = None, check = True
popenargs = (['mpiexec', '-n', '1', '-genv', '_PYTEST_MPI_CHILD_PROCESS', '1', ...],)
kwargs = {}
process = <Popen: returncode: 1 args: ['mpiexec', '-n', '1', '-genv', '_PYTEST_MPI_CHI...>
stdout = None, stderr = None, retcode = 1
def run(*popenargs,
input=None, capture_output=False, timeout=None, check=False, **kwargs):
"""Run command with arguments and return a CompletedProcess instance.
The returned instance will have attributes args, returncode, stdout and
stderr. By default, stdout and stderr are not captured, and those attributes
will be None. Pass stdout=PIPE and/or stderr=PIPE in order to capture them,
or pass capture_output=True to capture both.
If check is True and the exit code was non-zero, it raises a
CalledProcessError. The CalledProcessError object will have the return code
in the returncode attribute, and output & stderr attributes if those streams
were captured.
If timeout is given, and the process takes too long, a TimeoutExpired
exception will be raised.
There is an optional argument "input", allowing you to
pass bytes or a string to the subprocess's stdin. If you use this argument
you may not also use the Popen constructor's "stdin" argument, as
it will be used internally.
By default, all communication is in bytes, and therefore any "input" should
be bytes, and the stdout and stderr will be bytes. If in text mode, any
"input" should be a string, and stdout and stderr will be strings decoded
according to locale encoding, or by "encoding" if set. Text mode is
triggered by setting any of text, encoding, errors or universal_newlines.
The other arguments are the same as for the Popen constructor.
"""
if input is not None:
if kwargs.get('stdin') is not None:
raise ValueError('stdin and input arguments may not both be used.')
kwargs['stdin'] = PIPE
if capture_output:
if kwargs.get('stdout') is not None or kwargs.get('stderr') is not None:
raise ValueError('stdout and stderr arguments may not be used '
'with capture_output.')
kwargs['stdout'] = PIPE
kwargs['stderr'] = PIPE
with Popen(*popenargs, **kwargs) as process:
try:
stdout, stderr = process.communicate(input, timeout=timeout)
except TimeoutExpired as exc:
process.kill()
if _mswindows:
# Windows accumulates the output in a single blocking
# read() call run on child threads, with the timeout
# being done in a join() on those threads. communicate()
# _after_ kill() is required to collect that and add it
# to the exception.
exc.stdout, exc.stderr = process.communicate()
else:
# POSIX _communicate already populated the output so
# far into the TimeoutExpired exception.
process.wait()
raise
except: # Including KeyboardInterrupt, communicate handled that.
process.kill()
# We don't call process.wait() as .__exit__ does that for us.
raise
retcode = process.poll()
if check and retcode:
> raise CalledProcessError(retcode, process.args,
output=stdout, stderr=stderr)
E subprocess.CalledProcessError: Command '['mpiexec', '-n', '1', '-genv', '_PYTEST_MPI_CHILD_PROCESS', '1', '/__w/firedrake/firedrake_venv/bin/python', '-m', 'pytest', '--runxfail', '-s', '-q', '/__w/firedrake/firedrake/tests/firedrake/vertexonly/test_poisson_inverse_conductivity.py::test_poisson_inverse_conductivity_parallel[sparse]', ':', '-n', '2', '/__w/firedrake/firedrake_venv/bin/python', '-m', 'pytest', '--runxfail', '-s', '-q', '/__w/firedrake/firedrake/tests/firedrake/vertexonly/test_poisson_inverse_conductivity.py::test_poisson_inverse_conductivity_parallel[sparse]', '--tb=no', '--no-summary', '--no-header', '--disable-warnings', '--show-capture=no']' returned non-zero exit status 1.
/usr/lib/python3.12/subprocess.py:571: CalledProcessError
Check failure on line 1 in tests/firedrake/vertexonly/test_poisson_inverse_conductivity.py
github-actions / Firedrake real
test_poisson_inverse_conductivity.test_poisson_inverse_conductivity_parallel[per_cell]
subprocess.CalledProcessError: Command '['mpiexec', '-n', '1', '-genv', '_PYTEST_MPI_CHILD_PROCESS', '1', '/__w/firedrake/firedrake_venv/bin/python', '-m', 'pytest', '--runxfail', '-s', '-q', '/__w/firedrake/firedrake/tests/firedrake/vertexonly/test_poisson_inverse_conductivity.py::test_poisson_inverse_conductivity_parallel[per_cell]', ':', '-n', '2', '/__w/firedrake/firedrake_venv/bin/python', '-m', 'pytest', '--runxfail', '-s', '-q', '/__w/firedrake/firedrake/tests/firedrake/vertexonly/test_poisson_inverse_conductivity.py::test_poisson_inverse_conductivity_parallel[per_cell]', '--tb=no', '--no-summary', '--no-header', '--disable-warnings', '--show-capture=no']' returned non-zero exit status 1.
Raw output
args = (), kwargs = {'num_points': 8}
def parallel_callback(*args, **kwargs):
> subprocess.run(cmd, check=True)
../firedrake_venv/src/pytest-mpi/pytest_mpi/plugin.py:240:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
input = None, capture_output = False, timeout = None, check = True
popenargs = (['mpiexec', '-n', '1', '-genv', '_PYTEST_MPI_CHILD_PROCESS', '1', ...],)
kwargs = {}
process = <Popen: returncode: 1 args: ['mpiexec', '-n', '1', '-genv', '_PYTEST_MPI_CHI...>
stdout = None, stderr = None, retcode = 1
def run(*popenargs,
input=None, capture_output=False, timeout=None, check=False, **kwargs):
"""Run command with arguments and return a CompletedProcess instance.
The returned instance will have attributes args, returncode, stdout and
stderr. By default, stdout and stderr are not captured, and those attributes
will be None. Pass stdout=PIPE and/or stderr=PIPE in order to capture them,
or pass capture_output=True to capture both.
If check is True and the exit code was non-zero, it raises a
CalledProcessError. The CalledProcessError object will have the return code
in the returncode attribute, and output & stderr attributes if those streams
were captured.
If timeout is given, and the process takes too long, a TimeoutExpired
exception will be raised.
There is an optional argument "input", allowing you to
pass bytes or a string to the subprocess's stdin. If you use this argument
you may not also use the Popen constructor's "stdin" argument, as
it will be used internally.
By default, all communication is in bytes, and therefore any "input" should
be bytes, and the stdout and stderr will be bytes. If in text mode, any
"input" should be a string, and stdout and stderr will be strings decoded
according to locale encoding, or by "encoding" if set. Text mode is
triggered by setting any of text, encoding, errors or universal_newlines.
The other arguments are the same as for the Popen constructor.
"""
if input is not None:
if kwargs.get('stdin') is not None:
raise ValueError('stdin and input arguments may not both be used.')
kwargs['stdin'] = PIPE
if capture_output:
if kwargs.get('stdout') is not None or kwargs.get('stderr') is not None:
raise ValueError('stdout and stderr arguments may not be used '
'with capture_output.')
kwargs['stdout'] = PIPE
kwargs['stderr'] = PIPE
with Popen(*popenargs, **kwargs) as process:
try:
stdout, stderr = process.communicate(input, timeout=timeout)
except TimeoutExpired as exc:
process.kill()
if _mswindows:
# Windows accumulates the output in a single blocking
# read() call run on child threads, with the timeout
# being done in a join() on those threads. communicate()
# _after_ kill() is required to collect that and add it
# to the exception.
exc.stdout, exc.stderr = process.communicate()
else:
# POSIX _communicate already populated the output so
# far into the TimeoutExpired exception.
process.wait()
raise
except: # Including KeyboardInterrupt, communicate handled that.
process.kill()
# We don't call process.wait() as .__exit__ does that for us.
raise
retcode = process.poll()
if check and retcode:
> raise CalledProcessError(retcode, process.args,
output=stdout, stderr=stderr)
E subprocess.CalledProcessError: Command '['mpiexec', '-n', '1', '-genv', '_PYTEST_MPI_CHILD_PROCESS', '1', '/__w/firedrake/firedrake_venv/bin/python', '-m', 'pytest', '--runxfail', '-s', '-q', '/__w/firedrake/firedrake/tests/firedrake/vertexonly/test_poisson_inverse_conductivity.py::test_poisson_inverse_conductivity_parallel[per_cell]', ':', '-n', '2', '/__w/firedrake/firedrake_venv/bin/python', '-m', 'pytest', '--runxfail', '-s', '-q', '/__w/firedrake/firedrake/tests/firedrake/vertexonly/test_poisson_inverse_conductivity.py::test_poisson_inverse_conductivity_parallel[per_cell]', '--tb=no', '--no-summary', '--no-header', '--disable-warnings', '--show-capture=no']' returned non-zero exit status 1.
/usr/lib/python3.12/subprocess.py:571: CalledProcessError
Check failure on line 1 in tests/firedrake/vertexonly/test_poisson_inverse_conductivity.py
github-actions / Firedrake real
test_poisson_inverse_conductivity.test_poisson_inverse_conductivity_parallel[dense]
subprocess.CalledProcessError: Command '['mpiexec', '-n', '1', '-genv', '_PYTEST_MPI_CHILD_PROCESS', '1', '/__w/firedrake/firedrake_venv/bin/python', '-m', 'pytest', '--runxfail', '-s', '-q', '/__w/firedrake/firedrake/tests/firedrake/vertexonly/test_poisson_inverse_conductivity.py::test_poisson_inverse_conductivity_parallel[dense]', ':', '-n', '2', '/__w/firedrake/firedrake_venv/bin/python', '-m', 'pytest', '--runxfail', '-s', '-q', '/__w/firedrake/firedrake/tests/firedrake/vertexonly/test_poisson_inverse_conductivity.py::test_poisson_inverse_conductivity_parallel[dense]', '--tb=no', '--no-summary', '--no-header', '--disable-warnings', '--show-capture=no']' returned non-zero exit status 1.
Raw output
args = (), kwargs = {'num_points': 1024}
def parallel_callback(*args, **kwargs):
> subprocess.run(cmd, check=True)
../firedrake_venv/src/pytest-mpi/pytest_mpi/plugin.py:240:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
input = None, capture_output = False, timeout = None, check = True
popenargs = (['mpiexec', '-n', '1', '-genv', '_PYTEST_MPI_CHILD_PROCESS', '1', ...],)
kwargs = {}
process = <Popen: returncode: 1 args: ['mpiexec', '-n', '1', '-genv', '_PYTEST_MPI_CHI...>
stdout = None, stderr = None, retcode = 1
def run(*popenargs,
input=None, capture_output=False, timeout=None, check=False, **kwargs):
"""Run command with arguments and return a CompletedProcess instance.
The returned instance will have attributes args, returncode, stdout and
stderr. By default, stdout and stderr are not captured, and those attributes
will be None. Pass stdout=PIPE and/or stderr=PIPE in order to capture them,
or pass capture_output=True to capture both.
If check is True and the exit code was non-zero, it raises a
CalledProcessError. The CalledProcessError object will have the return code
in the returncode attribute, and output & stderr attributes if those streams
were captured.
If timeout is given, and the process takes too long, a TimeoutExpired
exception will be raised.
There is an optional argument "input", allowing you to
pass bytes or a string to the subprocess's stdin. If you use this argument
you may not also use the Popen constructor's "stdin" argument, as
it will be used internally.
By default, all communication is in bytes, and therefore any "input" should
be bytes, and the stdout and stderr will be bytes. If in text mode, any
"input" should be a string, and stdout and stderr will be strings decoded
according to locale encoding, or by "encoding" if set. Text mode is
triggered by setting any of text, encoding, errors or universal_newlines.
The other arguments are the same as for the Popen constructor.
"""
if input is not None:
if kwargs.get('stdin') is not None:
raise ValueError('stdin and input arguments may not both be used.')
kwargs['stdin'] = PIPE
if capture_output:
if kwargs.get('stdout') is not None or kwargs.get('stderr') is not None:
raise ValueError('stdout and stderr arguments may not be used '
'with capture_output.')
kwargs['stdout'] = PIPE
kwargs['stderr'] = PIPE
with Popen(*popenargs, **kwargs) as process:
try:
stdout, stderr = process.communicate(input, timeout=timeout)
except TimeoutExpired as exc:
process.kill()
if _mswindows:
# Windows accumulates the output in a single blocking
# read() call run on child threads, with the timeout
# being done in a join() on those threads. communicate()
# _after_ kill() is required to collect that and add it
# to the exception.
exc.stdout, exc.stderr = process.communicate()
else:
# POSIX _communicate already populated the output so
# far into the TimeoutExpired exception.
process.wait()
raise
except: # Including KeyboardInterrupt, communicate handled that.
process.kill()
# We don't call process.wait() as .__exit__ does that for us.
raise
retcode = process.poll()
if check and retcode:
> raise CalledProcessError(retcode, process.args,
output=stdout, stderr=stderr)
E subprocess.CalledProcessError: Command '['mpiexec', '-n', '1', '-genv', '_PYTEST_MPI_CHILD_PROCESS', '1', '/__w/firedrake/firedrake_venv/bin/python', '-m', 'pytest', '--runxfail', '-s', '-q', '/__w/firedrake/firedrake/tests/firedrake/vertexonly/test_poisson_inverse_conductivity.py::test_poisson_inverse_conductivity_parallel[dense]', ':', '-n', '2', '/__w/firedrake/firedrake_venv/bin/python', '-m', 'pytest', '--runxfail', '-s', '-q', '/__w/firedrake/firedrake/tests/firedrake/vertexonly/test_poisson_inverse_conductivity.py::test_poisson_inverse_conductivity_parallel[dense]', '--tb=no', '--no-summary', '--no-header', '--disable-warnings', '--show-capture=no']' returned non-zero exit status 1.
/usr/lib/python3.12/subprocess.py:571: CalledProcessError
Check failure on line 1 in tests/firedrake/regression/test_restricted_function_space.py
github-actions / Firedrake real
test_restricted_function_space.test_restricted_function_space_extrusion_stokes[16]
subprocess.CalledProcessError: Command '['mpiexec', '-n', '1', '-genv', '_PYTEST_MPI_CHILD_PROCESS', '1', '/__w/firedrake/firedrake_venv/bin/python', '-m', 'pytest', '--runxfail', '-s', '-q', '/__w/firedrake/firedrake/tests/firedrake/regression/test_restricted_function_space.py::test_restricted_function_space_extrusion_stokes[16]', ':', '-n', '3', '/__w/firedrake/firedrake_venv/bin/python', '-m', 'pytest', '--runxfail', '-s', '-q', '/__w/firedrake/firedrake/tests/firedrake/regression/test_restricted_function_space.py::test_restricted_function_space_extrusion_stokes[16]', '--tb=no', '--no-summary', '--no-header', '--disable-warnings', '--show-capture=no']' returned non-zero exit status 1.
Raw output
args = (), kwargs = {'ncells': 16}
def parallel_callback(*args, **kwargs):
> subprocess.run(cmd, check=True)
../firedrake_venv/src/pytest-mpi/pytest_mpi/plugin.py:240:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
input = None, capture_output = False, timeout = None, check = True
popenargs = (['mpiexec', '-n', '1', '-genv', '_PYTEST_MPI_CHILD_PROCESS', '1', ...],)
kwargs = {}
process = <Popen: returncode: 1 args: ['mpiexec', '-n', '1', '-genv', '_PYTEST_MPI_CHI...>
stdout = None, stderr = None, retcode = 1
def run(*popenargs,
input=None, capture_output=False, timeout=None, check=False, **kwargs):
"""Run command with arguments and return a CompletedProcess instance.
The returned instance will have attributes args, returncode, stdout and
stderr. By default, stdout and stderr are not captured, and those attributes
will be None. Pass stdout=PIPE and/or stderr=PIPE in order to capture them,
or pass capture_output=True to capture both.
If check is True and the exit code was non-zero, it raises a
CalledProcessError. The CalledProcessError object will have the return code
in the returncode attribute, and output & stderr attributes if those streams
were captured.
If timeout is given, and the process takes too long, a TimeoutExpired
exception will be raised.
There is an optional argument "input", allowing you to
pass bytes or a string to the subprocess's stdin. If you use this argument
you may not also use the Popen constructor's "stdin" argument, as
it will be used internally.
By default, all communication is in bytes, and therefore any "input" should
be bytes, and the stdout and stderr will be bytes. If in text mode, any
"input" should be a string, and stdout and stderr will be strings decoded
according to locale encoding, or by "encoding" if set. Text mode is
triggered by setting any of text, encoding, errors or universal_newlines.
The other arguments are the same as for the Popen constructor.
"""
if input is not None:
if kwargs.get('stdin') is not None:
raise ValueError('stdin and input arguments may not both be used.')
kwargs['stdin'] = PIPE
if capture_output:
if kwargs.get('stdout') is not None or kwargs.get('stderr') is not None:
raise ValueError('stdout and stderr arguments may not be used '
'with capture_output.')
kwargs['stdout'] = PIPE
kwargs['stderr'] = PIPE
with Popen(*popenargs, **kwargs) as process:
try:
stdout, stderr = process.communicate(input, timeout=timeout)
except TimeoutExpired as exc:
process.kill()
if _mswindows:
# Windows accumulates the output in a single blocking
# read() call run on child threads, with the timeout
# being done in a join() on those threads. communicate()
# _after_ kill() is required to collect that and add it
# to the exception.
exc.stdout, exc.stderr = process.communicate()
else:
# POSIX _communicate already populated the output so
# far into the TimeoutExpired exception.
process.wait()
raise
except: # Including KeyboardInterrupt, communicate handled that.
process.kill()
# We don't call process.wait() as .__exit__ does that for us.
raise
retcode = process.poll()
if check and retcode:
> raise CalledProcessError(retcode, process.args,
output=stdout, stderr=stderr)
E subprocess.CalledProcessError: Command '['mpiexec', '-n', '1', '-genv', '_PYTEST_MPI_CHILD_PROCESS', '1', '/__w/firedrake/firedrake_venv/bin/python', '-m', 'pytest', '--runxfail', '-s', '-q', '/__w/firedrake/firedrake/tests/firedrake/regression/test_restricted_function_space.py::test_restricted_function_space_extrusion_stokes[16]', ':', '-n', '3', '/__w/firedrake/firedrake_venv/bin/python', '-m', 'pytest', '--runxfail', '-s', '-q', '/__w/firedrake/firedrake/tests/firedrake/regression/test_restricted_function_space.py::test_restricted_function_space_extrusion_stokes[16]', '--tb=no', '--no-summary', '--no-header', '--disable-warnings', '--show-capture=no']' returned non-zero exit status 1.
/usr/lib/python3.12/subprocess.py:571: CalledProcessError