Tackle many warnings #118
8131 tests run, 5879 passed, 673 skipped, 1579 failed.
Annotations
Check failure on line 218 in tests/firedrake/vertexonly/test_interpolation_from_parent.py
github-actions / Firedrake real
test_interpolation_from_parent.test_vector_function_interpolation[squarequads-mesh-100-coords-VectorFunctionSpace(CG2)]
TypeError: PyOP2KernelCallable.__init__() missing 1 required positional argument: 'parameters'
Raw output
self = Mesh(VectorElement(FiniteElement('Q', quadrilateral, 1), dim=2), 38)
tolerance = 0.5
def _c_locator(self, tolerance=None):
from pyop2 import compilation
from pyop2.utils import get_petsc_dir
import firedrake.function as function
import firedrake.pointquery_utils as pq_utils
cache = self.__dict__.setdefault("_c_locator_cache", {})
try:
> return cache[tolerance]
E KeyError: 0.5
firedrake/mesh.py:2651: KeyError
During handling of the above exception, another exception occurred:
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=16)
key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
def fetch(self, key: K) -> V:
keyhash = self.key_builder(key)
try:
> stored_key, value = self._fetch(keyhash)
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:750:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=16)
keyhash = 'cee770130a90b34511d0dd9423c998f3dc879af68e344b62fed67b26af42fc7f'
def _fetch_uncached(self, keyhash: str) -> tuple[K, V]:
# This method is separate from fetch() to allow for LRU caching
def fetch_inner() -> tuple[Any] | None:
assert self.conn is not None
# This is separate from fetch() so that the mutex covers the
# fetchone() call
c = self.conn.execute("SELECT key_value FROM dict WHERE keyhash=?",
(keyhash,))
res = c.fetchone()
assert res is None or isinstance(res, tuple)
return res
row = self._exec_sql_fn(fetch_inner)
if row is None:
> raise KeyError
E KeyError
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:741: KeyError
The above exception was the direct cause of the following exception:
args = (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCallable(arg_id_to_dtype=None, arg_id_to_descr=N...et=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),)
kwargs = {}, CACHING_ENABLED = True
cache_key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
proc_log_str = "preprocess_program on 'wrap_to_reference_coords'"
entrypoints_str = 'wrap_to_reference_coords'
@wraps(func)
def wrapper(*args, **kwargs):
from loopy import CACHING_ENABLED
if (not CACHING_ENABLED
or kwargs.pop("_no_memoize_on_disk", False)):
return func(*args, **kwargs)
cache_key = (func.__qualname__, func.__name__, args, kwargs)
try:
> result = transform_cache[cache_key]
../firedrake_venv/src/loopy/loopy/tools.py:877:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:597: in __getitem__
return self.fetch(key)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=16)
key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
def fetch(self, key: K) -> V:
keyhash = self.key_builder(key)
try:
stored_key, value = self._fetch(keyhash)
except KeyError as err:
> raise NoSuchEntryError(key) from err
E pytools.persistent_dict.NoSuchEntryError: ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='MatSetValues', name_in_target=None), 'wrap_to_reference_coords': CallableKernel(arg_id_to_dtype=None, arg_id_to_descr=None, subkernel=LoopKernel(domains=[BasicSet("[end, start] -> { [n] : n = start and start < end }"), BasicSet("{ [i1] : i1 = 0 }"), BasicSet("{ [i0] : 0 <= i0 <= 3 }"), BasicSet("{ [i2] : 0 <= i2 <= 1 }"), BasicSet("{ [i3] : i3 = 0 }"), BasicSet("{ [i4] : 0 <= i4 <= 3 }"), BasicSet("{ [i5] : 0 <= i5 <= 1 }")], instructions=[CallInstruction(assignees=(), conflicts_with_groups=frozenset(), depends_on_is_final=True, expression=Call(Variable('to_reference_coords_kernel'), (Variable('farg0'), Variable('farg1'), Variable('farg2'), SubArrayRef((Variable('i1'), Variable('i0'), Variable('i2')), Subscript(Variable('t0'), (Variable('i1'), Variable('i0'), Variable('i2')))))), groups=frozenset(), happens_after=immutabledict({'statement0': HappensAfter(variable_name=None, instances_rel=None)}), id='statement1', no_sync_with=frozenset(), predicates=frozenset(), priority=0, tags=frozenset(), temp_var_types=(), within_inames=frozenset({'n'}), within_inames_is_final=True), Assignment(assignee=Subscript(Variable('t0'), (Variable('i3'), Variable('i4'), Variable('i5'))), atomicity=(), conflicts_with_groups=frozenset(), depends_on_is_final=True, expression=Subscript(Variable('dat0'), (Subscript(Variable('map0'), (Variable('n'), Variable('i4'))), Variable('i5'))), groups=frozenset(), happens_after=immutabledict({}), id='statement0', no_sync_with=frozenset(), predicates=frozenset(), priority=0, tags=frozenset(), temp_var_type=Optional(), within_inames=frozenset({'n', 'i3', 'i5', 'i4'}), within_inames_is_final=True)], args=[<farg0: ValueArg, type: <loopy.types.OpaqueType object at 0x7f255140b8c0>>, <farg1: ValueArg, type: <loopy.types.OpaqueType object at 0x7f255140b110>>, <farg2: ValueArg, type: <loopy.types.OpaqueType object at 0x7f25514bce30>>, <start: ValueArg, type: np:dtype('int32')>, <end: ValueArg, type: np:dtype('int32')>, <dat0: type: np:dtype('float64'), shape: (None, 2), dim_tags: (N1:stride:2, N0:stride:1) in aspace: global>, <map0: type: np:dtype('int32'), shape: (None, 4), dim_tags: (N1:stride:4, N0:stride:1) in aspace: global>], assumptions=BasicSet("[end, start] -> { : 0 <= start < end }"), temporary_variables={'t0': <t0: type: np:dtype('float64'), shape: (1, 4, 2), dim_tags: (N2:stride:8, N1:stride:2, N0:stride:1) aspace: auto>}, inames={'i2': Iname(name='i2', tags=frozenset()), 'n': Iname(name='n', tags=frozenset()), 'i0': Iname(name='i0', tags=frozenset()), 'i3': Iname(name='i3', tags=frozenset()), 'i1': Iname(name='i1', tags=frozenset()), 'i5': Iname(name='i5', tags=frozenset()), 'i4': Iname(name='i4', tags=frozenset())}, substitutions={}, options=Options(allow_fp_reordering=True, allow_terminal_colors=True, annotate_inames=False, build_options=[], check_dep_resolution=True, cl_exec_manage_array_events=True, disable_global_barriers=False, edit_code=False, enforce_array_accesses_within_bounds=True, enforce_variable_access_ordered=True, insert_gbarriers=False, no_numpy=False, return_dict=False, skip_arg_checks=False, trace_assignment_values=False, trace_assignments=False, write_code=False, write_wrapper=False), target=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, tags=frozenset(), state=<KernelState.INITIAL: 0>, name='wrap_to_reference_coords', preambles=(), preamble_generators=(_PreambleGen(preamble='#include <complex.h>\n#include <math.h>\n#include <petsc.h>\n'),), symbol_manglers=[<function symbol_mangler at 0x7f2577675a80>], linearization=None, iname_slab_increments=immutables.Map({}), loop_priority=frozenset(), applied_iname_rewrites=(), index_dtype=np:dtype('int32'), silenced_warnings=[], overridden_get_grid_sizes_for_insn_ids=None)), 'to_reference_coords_kernel': PyOP2KernelCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='to_reference_coords_kernel', name_in_target=None)}), target=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:752: NoSuchEntryError
During handling of the above exception, another exception occurred:
parentmesh = Mesh(VectorElement(FiniteElement('Q', quadrilateral, 1), dim=2), 38)
vertexcoords = array([[ 0.59762701, 0.93037873],
[ 0.70552675, 0.58976637],
[ 0.3473096 , 0.79178823],
[ 0.37... 1.38874478],
[ 0.97910159, 0.48091762],
[-0.04517074, 0.00871296],
[-0.38394168, 0.36883325]])
vfs = ('CG', 2, <cyfunction VectorFunctionSpace at 0x7f25775b01e0>)
def test_vector_function_interpolation(parentmesh, vertexcoords, vfs):
if parentmesh.name == "immersedsphere":
vertexcoords = immersed_sphere_vertexcoords(parentmesh, vertexcoords)
vfs_fam, vfs_deg, vfs_typ = vfs
> vm = VertexOnlyMesh(parentmesh, vertexcoords, missing_points_behaviour=None)
tests/firedrake/vertexonly/test_interpolation_from_parent.py:218:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
firedrake/mesh.py:3364: in VertexOnlyMesh
swarm, input_ordering_swarm, n_missing_points = _pic_swarm_in_mesh(
firedrake/mesh.py:3585: in _pic_swarm_in_mesh
) = _parent_mesh_embedding(
firedrake/mesh.py:4151: in _parent_mesh_embedding
) = parent_mesh.locate_cells_ref_coords_and_dists(coords_global, tolerance)
firedrake/mesh.py:2633: in locate_cells_ref_coords_and_dists
self._c_locator(tolerance=tolerance)(self.coordinates._ctypes,
firedrake/mesh.py:2654: in _c_locator
src = pq_utils.src_locate_cell(self, tolerance=tolerance)
firedrake/pointquery_utils.py:39: in src_locate_cell
src.append(make_wrapper(mesh.coordinates,
firedrake/pointquery_utils.py:33: in make_wrapper
return generate_single_cell_wrapper(function.cell_set, args, **kwargs)
pyop2/parloop.py:797: in generate_single_cell_wrapper
code = lp.generate_code_v2(wrapper)
../firedrake_venv/src/loopy/loopy/codegen/__init__.py:616: in generate_code_v2
t_unit = preprocess_program(t_unit)
../firedrake_venv/src/loopy/loopy/tools.py:893: in wrapper
result = func(*args, **kwargs)
../firedrake_venv/src/loopy/loopy/preprocess.py:827: in preprocess_program
t_unit = infer_unknown_types(t_unit, expect_completion=False)
../firedrake_venv/src/loopy/loopy/type_inference.py:1061: in infer_unknown_types
new_callable, clbl_inf_ctx = t_unit.callables_table[e].with_types(
../firedrake_venv/src/loopy/loopy/kernel/function_interface.py:761: in with_types
infer_unknown_types_for_a_single_kernel(
../firedrake_venv/src/loopy/loopy/type_inference.py:994: in infer_unknown_types_for_a_single_kernel
type_inf_mapper(insn.expression,
../firedrake_venv/src/loopy/loopy/type_inference.py:211: in __call__
result = super().__call__(
../firedrake_venv/lib/python3.12/site-packages/pymbolic/mapper/__init__.py:436: in __call__
result = method(expr, *args, **kwargs)
../firedrake_venv/src/loopy/loopy/type_inference.py:443: in map_call
.with_types(arg_id_to_dtype,
pyop2/codegen/rep2loopy.py:223: in with_types
return self.copy(
../firedrake_venv/src/loopy/loopy/kernel/function_interface.py:372: in copy
return replace(self, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = PyOP2KernelCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='to_reference_coords_kernel', name_in_target=None)
changes = {'arg_id_to_descr': None, 'arg_id_to_dtype': {0: <loopy.types.OpaqueType object at 0x7f255140b8c0>, 1: <loopy.types.Op...4bce30>, 3: np:dtype('float64')}, 'name': 'to_reference_coords_kernel', 'name_in_target': 'to_reference_coords_kernel'}
f = Field(name='name_in_target',type='str | None',default=<dataclasses._MISSING_TYPE object at 0x7f2599ddf5f0>,default_fac... 0x7f2599ddf5f0>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD)
def replace(obj, /, **changes):
"""Return a new object replacing specified fields with new values.
This is especially useful for frozen classes. Example usage::
@dataclass(frozen=True)
class C:
x: int
y: int
c = C(1, 2)
c1 = replace(c, x=3)
assert c1.x == 3 and c1.y == 2
"""
# We're going to mutate 'changes', but that's okay because it's a
# new dict, even if called with 'replace(obj, **my_changes)'.
if not _is_dataclass_instance(obj):
raise TypeError("replace() should be called on dataclass instances")
# It's an error to have init=False fields in 'changes'.
# If a field is not in 'changes', read its value from the provided obj.
for f in getattr(obj, _FIELDS).values():
# Only consider normal fields or InitVars.
if f._field_type is _FIELD_CLASSVAR:
continue
if not f.init:
# Error if this field is specified in changes.
if f.name in changes:
raise ValueError(f'field {f.name} is declared with '
'init=False, it cannot be specified with '
'replace()')
continue
if f.name not in changes:
if f._field_type is _FIELD_INITVAR and f.default is MISSING:
raise ValueError(f"InitVar {f.name!r} "
'must be specified with replace()')
changes[f.name] = getattr(obj, f.name)
# Create the new object, which calls __init__() and
# __post_init__() (if defined), using all of the init fields we've
# added and/or left in 'changes'. If there are values supplied in
# changes that aren't fields, this will correctly raise a
# TypeError.
> return obj.__class__(**changes)
E TypeError: PyOP2KernelCallable.__init__() missing 1 required positional argument: 'parameters'
/usr/lib/python3.12/dataclasses.py:1581: TypeError
Check failure on line 218 in tests/firedrake/vertexonly/test_interpolation_from_parent.py
github-actions / Firedrake real
test_interpolation_from_parent.test_vector_function_interpolation[squarequads-mesh-100-coords-FunctionSpace(RTCE2)]
TypeError: PyOP2KernelCallable.__init__() missing 1 required positional argument: 'parameters'
Raw output
self = Mesh(VectorElement(FiniteElement('Q', quadrilateral, 1), dim=2), 45)
tolerance = 0.5
def _c_locator(self, tolerance=None):
from pyop2 import compilation
from pyop2.utils import get_petsc_dir
import firedrake.function as function
import firedrake.pointquery_utils as pq_utils
cache = self.__dict__.setdefault("_c_locator_cache", {})
try:
> return cache[tolerance]
E KeyError: 0.5
firedrake/mesh.py:2651: KeyError
During handling of the above exception, another exception occurred:
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=22)
key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
def fetch(self, key: K) -> V:
keyhash = self.key_builder(key)
try:
> stored_key, value = self._fetch(keyhash)
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:750:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=22)
keyhash = 'cee770130a90b34511d0dd9423c998f3dc879af68e344b62fed67b26af42fc7f'
def _fetch_uncached(self, keyhash: str) -> tuple[K, V]:
# This method is separate from fetch() to allow for LRU caching
def fetch_inner() -> tuple[Any] | None:
assert self.conn is not None
# This is separate from fetch() so that the mutex covers the
# fetchone() call
c = self.conn.execute("SELECT key_value FROM dict WHERE keyhash=?",
(keyhash,))
res = c.fetchone()
assert res is None or isinstance(res, tuple)
return res
row = self._exec_sql_fn(fetch_inner)
if row is None:
> raise KeyError
E KeyError
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:741: KeyError
The above exception was the direct cause of the following exception:
args = (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCallable(arg_id_to_dtype=None, arg_id_to_descr=N...et=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),)
kwargs = {}, CACHING_ENABLED = True
cache_key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
proc_log_str = "preprocess_program on 'wrap_to_reference_coords'"
entrypoints_str = 'wrap_to_reference_coords'
@wraps(func)
def wrapper(*args, **kwargs):
from loopy import CACHING_ENABLED
if (not CACHING_ENABLED
or kwargs.pop("_no_memoize_on_disk", False)):
return func(*args, **kwargs)
cache_key = (func.__qualname__, func.__name__, args, kwargs)
try:
> result = transform_cache[cache_key]
../firedrake_venv/src/loopy/loopy/tools.py:877:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:597: in __getitem__
return self.fetch(key)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=22)
key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
def fetch(self, key: K) -> V:
keyhash = self.key_builder(key)
try:
stored_key, value = self._fetch(keyhash)
except KeyError as err:
> raise NoSuchEntryError(key) from err
E pytools.persistent_dict.NoSuchEntryError: ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='MatSetValues', name_in_target=None), 'wrap_to_reference_coords': CallableKernel(arg_id_to_dtype=None, arg_id_to_descr=None, subkernel=LoopKernel(domains=[BasicSet("[end, start] -> { [n] : n = start and start < end }"), BasicSet("{ [i1] : i1 = 0 }"), BasicSet("{ [i0] : 0 <= i0 <= 3 }"), BasicSet("{ [i2] : 0 <= i2 <= 1 }"), BasicSet("{ [i3] : i3 = 0 }"), BasicSet("{ [i4] : 0 <= i4 <= 3 }"), BasicSet("{ [i5] : 0 <= i5 <= 1 }")], instructions=[CallInstruction(assignees=(), conflicts_with_groups=frozenset(), depends_on_is_final=True, expression=Call(Variable('to_reference_coords_kernel'), (Variable('farg0'), Variable('farg1'), Variable('farg2'), SubArrayRef((Variable('i1'), Variable('i0'), Variable('i2')), Subscript(Variable('t0'), (Variable('i1'), Variable('i0'), Variable('i2')))))), groups=frozenset(), happens_after=immutabledict({'statement0': HappensAfter(variable_name=None, instances_rel=None)}), id='statement1', no_sync_with=frozenset(), predicates=frozenset(), priority=0, tags=frozenset(), temp_var_types=(), within_inames=frozenset({'n'}), within_inames_is_final=True), Assignment(assignee=Subscript(Variable('t0'), (Variable('i3'), Variable('i4'), Variable('i5'))), atomicity=(), conflicts_with_groups=frozenset(), depends_on_is_final=True, expression=Subscript(Variable('dat0'), (Subscript(Variable('map0'), (Variable('n'), Variable('i4'))), Variable('i5'))), groups=frozenset(), happens_after=immutabledict({}), id='statement0', no_sync_with=frozenset(), predicates=frozenset(), priority=0, tags=frozenset(), temp_var_type=Optional(), within_inames=frozenset({'n', 'i3', 'i5', 'i4'}), within_inames_is_final=True)], args=[<farg0: ValueArg, type: <loopy.types.OpaqueType object at 0x7f256f7e20c0>>, <farg1: ValueArg, type: <loopy.types.OpaqueType object at 0x7f256f7e22d0>>, <farg2: ValueArg, type: <loopy.types.OpaqueType object at 0x7f25573384d0>>, <start: ValueArg, type: np:dtype('int32')>, <end: ValueArg, type: np:dtype('int32')>, <dat0: type: np:dtype('float64'), shape: (None, 2), dim_tags: (N1:stride:2, N0:stride:1) in aspace: global>, <map0: type: np:dtype('int32'), shape: (None, 4), dim_tags: (N1:stride:4, N0:stride:1) in aspace: global>], assumptions=BasicSet("[end, start] -> { : 0 <= start < end }"), temporary_variables={'t0': <t0: type: np:dtype('float64'), shape: (1, 4, 2), dim_tags: (N2:stride:8, N1:stride:2, N0:stride:1) aspace: auto>}, inames={'i2': Iname(name='i2', tags=frozenset()), 'n': Iname(name='n', tags=frozenset()), 'i0': Iname(name='i0', tags=frozenset()), 'i3': Iname(name='i3', tags=frozenset()), 'i1': Iname(name='i1', tags=frozenset()), 'i5': Iname(name='i5', tags=frozenset()), 'i4': Iname(name='i4', tags=frozenset())}, substitutions={}, options=Options(allow_fp_reordering=True, allow_terminal_colors=True, annotate_inames=False, build_options=[], check_dep_resolution=True, cl_exec_manage_array_events=True, disable_global_barriers=False, edit_code=False, enforce_array_accesses_within_bounds=True, enforce_variable_access_ordered=True, insert_gbarriers=False, no_numpy=False, return_dict=False, skip_arg_checks=False, trace_assignment_values=False, trace_assignments=False, write_code=False, write_wrapper=False), target=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, tags=frozenset(), state=<KernelState.INITIAL: 0>, name='wrap_to_reference_coords', preambles=(), preamble_generators=(_PreambleGen(preamble='#include <complex.h>\n#include <math.h>\n#include <petsc.h>\n'),), symbol_manglers=[<function symbol_mangler at 0x7f2577675a80>], linearization=None, iname_slab_increments=immutables.Map({}), loop_priority=frozenset(), applied_iname_rewrites=(), index_dtype=np:dtype('int32'), silenced_warnings=[], overridden_get_grid_sizes_for_insn_ids=None)), 'to_reference_coords_kernel': PyOP2KernelCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='to_reference_coords_kernel', name_in_target=None)}), target=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:752: NoSuchEntryError
During handling of the above exception, another exception occurred:
parentmesh = Mesh(VectorElement(FiniteElement('Q', quadrilateral, 1), dim=2), 45)
vertexcoords = array([[ 0.59762701, 0.93037873],
[ 0.70552675, 0.58976637],
[ 0.3473096 , 0.79178823],
[ 0.37... 1.38874478],
[ 0.97910159, 0.48091762],
[-0.04517074, 0.00871296],
[-0.38394168, 0.36883325]])
vfs = ('RTCE', 2, <cyfunction FunctionSpace at 0x7f25775b0040>)
def test_vector_function_interpolation(parentmesh, vertexcoords, vfs):
if parentmesh.name == "immersedsphere":
vertexcoords = immersed_sphere_vertexcoords(parentmesh, vertexcoords)
vfs_fam, vfs_deg, vfs_typ = vfs
> vm = VertexOnlyMesh(parentmesh, vertexcoords, missing_points_behaviour=None)
tests/firedrake/vertexonly/test_interpolation_from_parent.py:218:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
firedrake/mesh.py:3364: in VertexOnlyMesh
swarm, input_ordering_swarm, n_missing_points = _pic_swarm_in_mesh(
firedrake/mesh.py:3585: in _pic_swarm_in_mesh
) = _parent_mesh_embedding(
firedrake/mesh.py:4151: in _parent_mesh_embedding
) = parent_mesh.locate_cells_ref_coords_and_dists(coords_global, tolerance)
firedrake/mesh.py:2633: in locate_cells_ref_coords_and_dists
self._c_locator(tolerance=tolerance)(self.coordinates._ctypes,
firedrake/mesh.py:2654: in _c_locator
src = pq_utils.src_locate_cell(self, tolerance=tolerance)
firedrake/pointquery_utils.py:39: in src_locate_cell
src.append(make_wrapper(mesh.coordinates,
firedrake/pointquery_utils.py:33: in make_wrapper
return generate_single_cell_wrapper(function.cell_set, args, **kwargs)
pyop2/parloop.py:797: in generate_single_cell_wrapper
code = lp.generate_code_v2(wrapper)
../firedrake_venv/src/loopy/loopy/codegen/__init__.py:616: in generate_code_v2
t_unit = preprocess_program(t_unit)
../firedrake_venv/src/loopy/loopy/tools.py:893: in wrapper
result = func(*args, **kwargs)
../firedrake_venv/src/loopy/loopy/preprocess.py:827: in preprocess_program
t_unit = infer_unknown_types(t_unit, expect_completion=False)
../firedrake_venv/src/loopy/loopy/type_inference.py:1061: in infer_unknown_types
new_callable, clbl_inf_ctx = t_unit.callables_table[e].with_types(
../firedrake_venv/src/loopy/loopy/kernel/function_interface.py:761: in with_types
infer_unknown_types_for_a_single_kernel(
../firedrake_venv/src/loopy/loopy/type_inference.py:994: in infer_unknown_types_for_a_single_kernel
type_inf_mapper(insn.expression,
../firedrake_venv/src/loopy/loopy/type_inference.py:211: in __call__
result = super().__call__(
../firedrake_venv/lib/python3.12/site-packages/pymbolic/mapper/__init__.py:436: in __call__
result = method(expr, *args, **kwargs)
../firedrake_venv/src/loopy/loopy/type_inference.py:443: in map_call
.with_types(arg_id_to_dtype,
pyop2/codegen/rep2loopy.py:223: in with_types
return self.copy(
../firedrake_venv/src/loopy/loopy/kernel/function_interface.py:372: in copy
return replace(self, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = PyOP2KernelCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='to_reference_coords_kernel', name_in_target=None)
changes = {'arg_id_to_descr': None, 'arg_id_to_dtype': {0: <loopy.types.OpaqueType object at 0x7f256f7e20c0>, 1: <loopy.types.Op...3384d0>, 3: np:dtype('float64')}, 'name': 'to_reference_coords_kernel', 'name_in_target': 'to_reference_coords_kernel'}
f = Field(name='name_in_target',type='str | None',default=<dataclasses._MISSING_TYPE object at 0x7f2599ddf5f0>,default_fac... 0x7f2599ddf5f0>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD)
def replace(obj, /, **changes):
"""Return a new object replacing specified fields with new values.
This is especially useful for frozen classes. Example usage::
@dataclass(frozen=True)
class C:
x: int
y: int
c = C(1, 2)
c1 = replace(c, x=3)
assert c1.x == 3 and c1.y == 2
"""
# We're going to mutate 'changes', but that's okay because it's a
# new dict, even if called with 'replace(obj, **my_changes)'.
if not _is_dataclass_instance(obj):
raise TypeError("replace() should be called on dataclass instances")
# It's an error to have init=False fields in 'changes'.
# If a field is not in 'changes', read its value from the provided obj.
for f in getattr(obj, _FIELDS).values():
# Only consider normal fields or InitVars.
if f._field_type is _FIELD_CLASSVAR:
continue
if not f.init:
# Error if this field is specified in changes.
if f.name in changes:
raise ValueError(f'field {f.name} is declared with '
'init=False, it cannot be specified with '
'replace()')
continue
if f.name not in changes:
if f._field_type is _FIELD_INITVAR and f.default is MISSING:
raise ValueError(f"InitVar {f.name!r} "
'must be specified with replace()')
changes[f.name] = getattr(obj, f.name)
# Create the new object, which calls __init__() and
# __post_init__() (if defined), using all of the init fields we've
# added and/or left in 'changes'. If there are values supplied in
# changes that aren't fields, this will correctly raise a
# TypeError.
> return obj.__class__(**changes)
E TypeError: PyOP2KernelCallable.__init__() missing 1 required positional argument: 'parameters'
/usr/lib/python3.12/dataclasses.py:1581: TypeError
Check failure on line 218 in tests/firedrake/vertexonly/test_interpolation_from_parent.py
github-actions / Firedrake real
test_interpolation_from_parent.test_vector_function_interpolation[squarequads-mesh-100-coords-FunctionSpace(RTCF2)]
TypeError: PyOP2KernelCallable.__init__() missing 1 required positional argument: 'parameters'
Raw output
self = Mesh(VectorElement(FiniteElement('Q', quadrilateral, 1), dim=2), 48)
tolerance = 0.5
def _c_locator(self, tolerance=None):
from pyop2 import compilation
from pyop2.utils import get_petsc_dir
import firedrake.function as function
import firedrake.pointquery_utils as pq_utils
cache = self.__dict__.setdefault("_c_locator_cache", {})
try:
> return cache[tolerance]
E KeyError: 0.5
firedrake/mesh.py:2651: KeyError
During handling of the above exception, another exception occurred:
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=27)
key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
def fetch(self, key: K) -> V:
keyhash = self.key_builder(key)
try:
> stored_key, value = self._fetch(keyhash)
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:750:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=27)
keyhash = 'cee770130a90b34511d0dd9423c998f3dc879af68e344b62fed67b26af42fc7f'
def _fetch_uncached(self, keyhash: str) -> tuple[K, V]:
# This method is separate from fetch() to allow for LRU caching
def fetch_inner() -> tuple[Any] | None:
assert self.conn is not None
# This is separate from fetch() so that the mutex covers the
# fetchone() call
c = self.conn.execute("SELECT key_value FROM dict WHERE keyhash=?",
(keyhash,))
res = c.fetchone()
assert res is None or isinstance(res, tuple)
return res
row = self._exec_sql_fn(fetch_inner)
if row is None:
> raise KeyError
E KeyError
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:741: KeyError
The above exception was the direct cause of the following exception:
args = (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCallable(arg_id_to_dtype=None, arg_id_to_descr=N...et=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),)
kwargs = {}, CACHING_ENABLED = True
cache_key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
proc_log_str = "preprocess_program on 'wrap_to_reference_coords'"
entrypoints_str = 'wrap_to_reference_coords'
@wraps(func)
def wrapper(*args, **kwargs):
from loopy import CACHING_ENABLED
if (not CACHING_ENABLED
or kwargs.pop("_no_memoize_on_disk", False)):
return func(*args, **kwargs)
cache_key = (func.__qualname__, func.__name__, args, kwargs)
try:
> result = transform_cache[cache_key]
../firedrake_venv/src/loopy/loopy/tools.py:877:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:597: in __getitem__
return self.fetch(key)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=26)
key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
def fetch(self, key: K) -> V:
keyhash = self.key_builder(key)
try:
stored_key, value = self._fetch(keyhash)
except KeyError as err:
> raise NoSuchEntryError(key) from err
E pytools.persistent_dict.NoSuchEntryError: ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='MatSetValues', name_in_target=None), 'wrap_to_reference_coords': CallableKernel(arg_id_to_dtype=None, arg_id_to_descr=None, subkernel=LoopKernel(domains=[BasicSet("[end, start] -> { [n] : n = start and start < end }"), BasicSet("{ [i1] : i1 = 0 }"), BasicSet("{ [i0] : 0 <= i0 <= 3 }"), BasicSet("{ [i2] : 0 <= i2 <= 1 }"), BasicSet("{ [i3] : i3 = 0 }"), BasicSet("{ [i4] : 0 <= i4 <= 3 }"), BasicSet("{ [i5] : 0 <= i5 <= 1 }")], instructions=[CallInstruction(assignees=(), conflicts_with_groups=frozenset(), depends_on_is_final=True, expression=Call(Variable('to_reference_coords_kernel'), (Variable('farg0'), Variable('farg1'), Variable('farg2'), SubArrayRef((Variable('i1'), Variable('i0'), Variable('i2')), Subscript(Variable('t0'), (Variable('i1'), Variable('i0'), Variable('i2')))))), groups=frozenset(), happens_after=immutabledict({'statement0': HappensAfter(variable_name=None, instances_rel=None)}), id='statement1', no_sync_with=frozenset(), predicates=frozenset(), priority=0, tags=frozenset(), temp_var_types=(), within_inames=frozenset({'n'}), within_inames_is_final=True), Assignment(assignee=Subscript(Variable('t0'), (Variable('i3'), Variable('i4'), Variable('i5'))), atomicity=(), conflicts_with_groups=frozenset(), depends_on_is_final=True, expression=Subscript(Variable('dat0'), (Subscript(Variable('map0'), (Variable('n'), Variable('i4'))), Variable('i5'))), groups=frozenset(), happens_after=immutabledict({}), id='statement0', no_sync_with=frozenset(), predicates=frozenset(), priority=0, tags=frozenset(), temp_var_type=Optional(), within_inames=frozenset({'n', 'i3', 'i5', 'i4'}), within_inames_is_final=True)], args=[<farg0: ValueArg, type: <loopy.types.OpaqueType object at 0x7f254be8e690>>, <farg1: ValueArg, type: <loopy.types.OpaqueType object at 0x7f254be8f770>>, <farg2: ValueArg, type: <loopy.types.OpaqueType object at 0x7f254be8e7e0>>, <start: ValueArg, type: np:dtype('int32')>, <end: ValueArg, type: np:dtype('int32')>, <dat0: type: np:dtype('float64'), shape: (None, 2), dim_tags: (N1:stride:2, N0:stride:1) in aspace: global>, <map0: type: np:dtype('int32'), shape: (None, 4), dim_tags: (N1:stride:4, N0:stride:1) in aspace: global>], assumptions=BasicSet("[end, start] -> { : 0 <= start < end }"), temporary_variables={'t0': <t0: type: np:dtype('float64'), shape: (1, 4, 2), dim_tags: (N2:stride:8, N1:stride:2, N0:stride:1) aspace: auto>}, inames={'i2': Iname(name='i2', tags=frozenset()), 'n': Iname(name='n', tags=frozenset()), 'i0': Iname(name='i0', tags=frozenset()), 'i3': Iname(name='i3', tags=frozenset()), 'i1': Iname(name='i1', tags=frozenset()), 'i5': Iname(name='i5', tags=frozenset()), 'i4': Iname(name='i4', tags=frozenset())}, substitutions={}, options=Options(allow_fp_reordering=True, allow_terminal_colors=True, annotate_inames=False, build_options=[], check_dep_resolution=True, cl_exec_manage_array_events=True, disable_global_barriers=False, edit_code=False, enforce_array_accesses_within_bounds=True, enforce_variable_access_ordered=True, insert_gbarriers=False, no_numpy=False, return_dict=False, skip_arg_checks=False, trace_assignment_values=False, trace_assignments=False, write_code=False, write_wrapper=False), target=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, tags=frozenset(), state=<KernelState.INITIAL: 0>, name='wrap_to_reference_coords', preambles=(), preamble_generators=(_PreambleGen(preamble='#include <complex.h>\n#include <math.h>\n#include <petsc.h>\n'),), symbol_manglers=[<function symbol_mangler at 0x7f2577675a80>], linearization=None, iname_slab_increments=immutables.Map({}), loop_priority=frozenset(), applied_iname_rewrites=(), index_dtype=np:dtype('int32'), silenced_warnings=[], overridden_get_grid_sizes_for_insn_ids=None)), 'to_reference_coords_kernel': PyOP2KernelCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='to_reference_coords_kernel', name_in_target=None)}), target=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:752: NoSuchEntryError
During handling of the above exception, another exception occurred:
parentmesh = Mesh(VectorElement(FiniteElement('Q', quadrilateral, 1), dim=2), 48)
vertexcoords = array([[ 0.59762701, 0.93037873],
[ 0.70552675, 0.58976637],
[ 0.3473096 , 0.79178823],
[ 0.37... 1.38874478],
[ 0.97910159, 0.48091762],
[-0.04517074, 0.00871296],
[-0.38394168, 0.36883325]])
vfs = ('RTCF', 2, <cyfunction FunctionSpace at 0x7f25775b0040>)
def test_vector_function_interpolation(parentmesh, vertexcoords, vfs):
if parentmesh.name == "immersedsphere":
vertexcoords = immersed_sphere_vertexcoords(parentmesh, vertexcoords)
vfs_fam, vfs_deg, vfs_typ = vfs
> vm = VertexOnlyMesh(parentmesh, vertexcoords, missing_points_behaviour=None)
tests/firedrake/vertexonly/test_interpolation_from_parent.py:218:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
firedrake/mesh.py:3364: in VertexOnlyMesh
swarm, input_ordering_swarm, n_missing_points = _pic_swarm_in_mesh(
firedrake/mesh.py:3585: in _pic_swarm_in_mesh
) = _parent_mesh_embedding(
firedrake/mesh.py:4151: in _parent_mesh_embedding
) = parent_mesh.locate_cells_ref_coords_and_dists(coords_global, tolerance)
firedrake/mesh.py:2633: in locate_cells_ref_coords_and_dists
self._c_locator(tolerance=tolerance)(self.coordinates._ctypes,
firedrake/mesh.py:2654: in _c_locator
src = pq_utils.src_locate_cell(self, tolerance=tolerance)
firedrake/pointquery_utils.py:39: in src_locate_cell
src.append(make_wrapper(mesh.coordinates,
firedrake/pointquery_utils.py:33: in make_wrapper
return generate_single_cell_wrapper(function.cell_set, args, **kwargs)
pyop2/parloop.py:797: in generate_single_cell_wrapper
code = lp.generate_code_v2(wrapper)
../firedrake_venv/src/loopy/loopy/codegen/__init__.py:616: in generate_code_v2
t_unit = preprocess_program(t_unit)
../firedrake_venv/src/loopy/loopy/tools.py:893: in wrapper
result = func(*args, **kwargs)
../firedrake_venv/src/loopy/loopy/preprocess.py:827: in preprocess_program
t_unit = infer_unknown_types(t_unit, expect_completion=False)
../firedrake_venv/src/loopy/loopy/type_inference.py:1061: in infer_unknown_types
new_callable, clbl_inf_ctx = t_unit.callables_table[e].with_types(
../firedrake_venv/src/loopy/loopy/kernel/function_interface.py:761: in with_types
infer_unknown_types_for_a_single_kernel(
../firedrake_venv/src/loopy/loopy/type_inference.py:994: in infer_unknown_types_for_a_single_kernel
type_inf_mapper(insn.expression,
../firedrake_venv/src/loopy/loopy/type_inference.py:211: in __call__
result = super().__call__(
../firedrake_venv/lib/python3.12/site-packages/pymbolic/mapper/__init__.py:436: in __call__
result = method(expr, *args, **kwargs)
../firedrake_venv/src/loopy/loopy/type_inference.py:443: in map_call
.with_types(arg_id_to_dtype,
pyop2/codegen/rep2loopy.py:223: in with_types
return self.copy(
../firedrake_venv/src/loopy/loopy/kernel/function_interface.py:372: in copy
return replace(self, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = PyOP2KernelCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='to_reference_coords_kernel', name_in_target=None)
changes = {'arg_id_to_descr': None, 'arg_id_to_dtype': {0: <loopy.types.OpaqueType object at 0x7f254be8e690>, 1: <loopy.types.Op...e8e7e0>, 3: np:dtype('float64')}, 'name': 'to_reference_coords_kernel', 'name_in_target': 'to_reference_coords_kernel'}
f = Field(name='name_in_target',type='str | None',default=<dataclasses._MISSING_TYPE object at 0x7f2599ddf5f0>,default_fac... 0x7f2599ddf5f0>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD)
def replace(obj, /, **changes):
"""Return a new object replacing specified fields with new values.
This is especially useful for frozen classes. Example usage::
@dataclass(frozen=True)
class C:
x: int
y: int
c = C(1, 2)
c1 = replace(c, x=3)
assert c1.x == 3 and c1.y == 2
"""
# We're going to mutate 'changes', but that's okay because it's a
# new dict, even if called with 'replace(obj, **my_changes)'.
if not _is_dataclass_instance(obj):
raise TypeError("replace() should be called on dataclass instances")
# It's an error to have init=False fields in 'changes'.
# If a field is not in 'changes', read its value from the provided obj.
for f in getattr(obj, _FIELDS).values():
# Only consider normal fields or InitVars.
if f._field_type is _FIELD_CLASSVAR:
continue
if not f.init:
# Error if this field is specified in changes.
if f.name in changes:
raise ValueError(f'field {f.name} is declared with '
'init=False, it cannot be specified with '
'replace()')
continue
if f.name not in changes:
if f._field_type is _FIELD_INITVAR and f.default is MISSING:
raise ValueError(f"InitVar {f.name!r} "
'must be specified with replace()')
changes[f.name] = getattr(obj, f.name)
# Create the new object, which calls __init__() and
# __post_init__() (if defined), using all of the init fields we've
# added and/or left in 'changes'. If there are values supplied in
# changes that aren't fields, this will correctly raise a
# TypeError.
> return obj.__class__(**changes)
E TypeError: PyOP2KernelCallable.__init__() missing 1 required positional argument: 'parameters'
/usr/lib/python3.12/dataclasses.py:1581: TypeError
Check failure on line 218 in tests/firedrake/vertexonly/test_interpolation_from_parent.py
github-actions / Firedrake real
test_interpolation_from_parent.test_vector_function_interpolation[extruded-mesh-0-coords-VectorFunctionSpace(CG2)]
TypeError: PyOP2KernelCallable.__init__() missing 1 required positional argument: 'parameters'
Raw output
self = Mesh(VectorElement(TensorProductElement(FiniteElement('Lagrange', triangle, 1), FiniteElement('Lagrange', interval, 1), cell=TensorProductCell(triangle, interval)), dim=3), 54)
tolerance = 0.5
def _c_locator(self, tolerance=None):
from pyop2 import compilation
from pyop2.utils import get_petsc_dir
import firedrake.function as function
import firedrake.pointquery_utils as pq_utils
cache = self.__dict__.setdefault("_c_locator_cache", {})
try:
> return cache[tolerance]
E KeyError: 0.5
firedrake/mesh.py:2651: KeyError
During handling of the above exception, another exception occurred:
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=46)
key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
def fetch(self, key: K) -> V:
keyhash = self.key_builder(key)
try:
> stored_key, value = self._fetch(keyhash)
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:750:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=46)
keyhash = 'bcf9a1d34c9e4de160752ff17742eb932d579b48f964a1394b6341d6e7d42903'
def _fetch_uncached(self, keyhash: str) -> tuple[K, V]:
# This method is separate from fetch() to allow for LRU caching
def fetch_inner() -> tuple[Any] | None:
assert self.conn is not None
# This is separate from fetch() so that the mutex covers the
# fetchone() call
c = self.conn.execute("SELECT key_value FROM dict WHERE keyhash=?",
(keyhash,))
res = c.fetchone()
assert res is None or isinstance(res, tuple)
return res
row = self._exec_sql_fn(fetch_inner)
if row is None:
> raise KeyError
E KeyError
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:741: KeyError
The above exception was the direct cause of the following exception:
args = (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCallable(arg_id_to_dtype=None, arg_id_to_descr=N...et=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),)
kwargs = {}, CACHING_ENABLED = True
cache_key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
proc_log_str = "preprocess_program on 'wrap_to_reference_coords'"
entrypoints_str = 'wrap_to_reference_coords'
@wraps(func)
def wrapper(*args, **kwargs):
from loopy import CACHING_ENABLED
if (not CACHING_ENABLED
or kwargs.pop("_no_memoize_on_disk", False)):
return func(*args, **kwargs)
cache_key = (func.__qualname__, func.__name__, args, kwargs)
try:
> result = transform_cache[cache_key]
../firedrake_venv/src/loopy/loopy/tools.py:877:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:597: in __getitem__
return self.fetch(key)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=46)
key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
def fetch(self, key: K) -> V:
keyhash = self.key_builder(key)
try:
stored_key, value = self._fetch(keyhash)
except KeyError as err:
> raise NoSuchEntryError(key) from err
E pytools.persistent_dict.NoSuchEntryError: ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='MatSetValues', name_in_target=None), 'wrap_to_reference_coords': CallableKernel(arg_id_to_dtype=None, arg_id_to_descr=None, subkernel=LoopKernel(domains=[BasicSet("[end, start] -> { [n] : n = start and start < end }"), BasicSet("[t1, t0] -> { [layer] : layer = -1 + t1 and t0 < t1 }"), BasicSet("{ [i2] : i2 = 0 }"), BasicSet("{ [i1] : 0 <= i1 <= 5 }"), BasicSet("{ [i0] : 0 <= i0 <= 2 }"), BasicSet("{ [i3] : 0 <= i3 <= 5 }"), BasicSet("{ [i4] : i4 = 0 }"), BasicSet("{ [i5] : 0 <= i5 <= 5 }"), BasicSet("{ [i6] : i6 = 0 }"), BasicSet("{ [i7] : 0 <= i7 <= 5 }"), BasicSet("{ [i8] : 0 <= i8 <= 2 }")], instructions=[CallInstruction(assignees=(), conflicts_with_groups=frozenset(), depends_on_is_final=True, expression=Call(Variable('to_reference_coords_kernel'), (Variable('farg0'), Variable('farg1'), Variable('farg2'), SubArrayRef((Variable('i2'), Variable('i1'), Variable('i0')), Subscript(Variable('t2'), (Variable('i2'), Variable('i1'), Variable('i0')))))), groups=frozenset(), happens_after=immutabledict({'statement1': HappensAfter(variable_name=None, instances_rel=None), 'statement2': HappensAfter(variable_name=None, instances_rel=None), 'statement0': HappensAfter(variable_name=None, instances_rel=None), 'statement3': HappensAfter(variable_name=None, instances_rel=None), 'statement4': HappensAfter(variable_name=None, instances_rel=None)}), id='statement5', no_sync_with=frozenset(), predicates=frozenset(), priority=0, tags=frozenset(), temp_var_types=(), within_inames=frozenset({'n', 'layer'}), within_inames_is_final=True), Assignment(assignee=Subscript(Variable('t0'), ()), atomicity=(), conflicts_with_groups=frozenset(), depends_on_is_final=True, expression=Subscript(Variable('layers'), (np.int32(0), np.int32(0))), groups=frozenset(), happens_after=immutabledict({}), id='statement4', no_sync_with=frozenset(), predicates=frozenset(), priority=0, tags=frozenset(), temp_var_type=Optional(), within_inames=frozenset(), within_inames_is_final=True), Assignment(assignee=Subscript(Variable('t1'), ()), atomicity=(), conflicts_with_groups=frozenset(), depends_on_is_final=True, expression=Sum((Subscript(Variable('layers'), (np.int32(0), np.int32(1))), TypeCast('int32', np.int32(-1)))), groups=frozenset(), happens_after=immutabledict({}), id='statement3', no_sync_with=frozenset(), predicates=frozenset(), priority=0, tags=frozenset(), temp_var_type=Optional(), within_inames=frozenset(), within_inames_is_final=True), Assignment(assignee=Subscript(Variable('t3'), (Variable('i3'),)), atomicity=(), conflicts_with_groups=frozenset(), depends_on_is_final=True, expression=Subscript(Variable('map0'), (Variable('n'), Variable('i3'))), groups=frozenset(), happens_after=immutabledict({}), id='statement2', no_sync_with=frozenset(), predicates=frozenset(), priority=0, tags=frozenset(), temp_var_type=Optional(), within_inames=frozenset({'n', 'i3'}), within_inames_is_final=True), Assignment(assignee=Subscript(Variable('t4'), (Variable('i4'), Variable('i5'))), atomicity=(), conflicts_with_groups=frozenset(), depends_on_is_final=True, expression=Sum((Subscript(Variable('t3'), (Variable('i5'),)), Product((TypeCast('int32', np.int32(1)), Sum((Sum((..., ...)), Variable('i4'))))))), groups=frozenset(), happens_after=immutabledict({'statement2': HappensAfter(variable_name=None, instances_rel=None), 'statement4': HappensAfter(variable_name=None, instances_rel=None), 'statement3': HappensAfter(variable_name=None, instances_rel=None)}), id='statement1', no_sync_with=frozenset(), predicates=frozenset(), priority=0, tags=frozenset(), temp_var_type=Optional(), within_inames=frozenset({'n', 'layer', 'i5', 'i4'}), within_inames_is_final=True), Assignment(assignee=Subscript(Variable('t2'), (Variable('i6'), Variable('i7'), Variable('i8'))), atomicity=(), conflicts_with_groups=frozenset(), depends_on_is_final=True, expression=Subscript(Variable('dat0'), (Subscript(Variable('t4'), (Variable('i6'), Variable('i7'))), Variable('i8'))), groups=frozenset(), happens_after=immutabledict({'statement1': HappensAfter(variable_name=None, instances_rel=None)}), id='statement0', no_sync_with=frozenset(), predicates=frozenset(), priority=0, tags=frozenset(), temp_var_type=Optional(), within_inames=frozenset({'n', 'layer', 'i8', 'i6', 'i7'}), within_inames_is_final=True)], args=[<farg0: ValueArg, type: <loopy.types.OpaqueType object at 0x7f2551467d10>>, <farg1: ValueArg, type: <loopy.types.OpaqueType object at 0x7f254be1d340>>, <farg2: ValueArg, type: <loopy.types.OpaqueType object at 0x7f254be1e2a0>>, <start: ValueArg, type: np:dtype('int32')>, <end: ValueArg, type: np:dtype('int32')>, <layers: type: np:dtype('int32'), shape: (1, 2), dim_tags: (N1:stride:2, N0:stride:1) in aspace: global>, <dat0: type: np:dtype('float64'), shape: (None, 3), dim_tags: (N1:stride:3, N0:stride:1) in aspace: global>, <map0: type: np:dtype('int32'), shape: (None, 6), dim_tags: (N1:stride:6, N0:stride:1) in aspace: global>], assumptions=BasicSet("[t1, t0, end, start] -> { : 0 <= t0 <= t1 and 0 <= start < end }"), temporary_variables={'t2': <t2: type: np:dtype('float64'), shape: (1, 6, 3), dim_tags: (N2:stride:18, N1:stride:3, N0:stride:1) aspace: auto>, 't0': <t0: type: np:dtype('int32'), shape: () aspace: auto>, 't1': <t1: type: np:dtype('int32'), shape: () aspace: auto>, 't3': <t3: type: np:dtype('int32'), shape: (6), dim_tags: (N0:stride:1) aspace: auto>, 't4': <t4: type: np:dtype('int32'), shape: (1, 6), dim_tags: (N1:stride:6, N0:stride:1) aspace: auto>}, inames={'i8': Iname(name='i8', tags=frozenset()), 'layer': Iname(name='layer', tags=frozenset()), 'i3': Iname(name='i3', tags=frozenset()), 'i6': Iname(name='i6', tags=frozenset()), 'i5': Iname(name='i5', tags=frozenset()), 'i1': Iname(name='i1', tags=frozenset()), 'i2': Iname(name='i2', tags=frozenset()), 'n': Iname(name='n', tags=frozenset()), 'i0': Iname(name='i0', tags=frozenset()), 'i7': Iname(name='i7', tags=frozenset()), 'i4': Iname(name='i4', tags=frozenset())}, substitutions={}, options=Options(allow_fp_reordering=True, allow_terminal_colors=True, annotate_inames=False, build_options=[], check_dep_resolution=True, cl_exec_manage_array_events=True, disable_global_barriers=False, edit_code=False, enforce_array_accesses_within_bounds=True, enforce_variable_access_ordered=True, insert_gbarriers=False, no_numpy=False, return_dict=False, skip_arg_checks=False, trace_assignment_values=False, trace_assignments=False, write_code=False, write_wrapper=False), target=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, tags=frozenset(), state=<KernelState.INITIAL: 0>, name='wrap_to_reference_coords', preambles=(), preamble_generators=(_PreambleGen(preamble='#include <complex.h>\n#include <math.h>\n#include <petsc.h>\n'),), symbol_manglers=[<function symbol_mangler at 0x7f2577675a80>], linearization=None, iname_slab_increments=immutables.Map({}), loop_priority=frozenset({('n', 'layer'), ('layer', 'n')}), applied_iname_rewrites=(), index_dtype=np:dtype('int32'), silenced_warnings=[], overridden_get_grid_sizes_for_insn_ids=None)), 'to_reference_coords_kernel': PyOP2KernelCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='to_reference_coords_kernel', name_in_target=None)}), target=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:752: NoSuchEntryError
During handling of the above exception, another exception occurred:
parentmesh = Mesh(VectorElement(TensorProductElement(FiniteElement('Lagrange', triangle, 1), FiniteElement('Lagrange', interval, 1), cell=TensorProductCell(triangle, interval)), dim=3), 54)
vertexcoords = array([], shape=(0, 3), dtype=float64)
vfs = ('CG', 2, <cyfunction VectorFunctionSpace at 0x7f25775b01e0>)
def test_vector_function_interpolation(parentmesh, vertexcoords, vfs):
if parentmesh.name == "immersedsphere":
vertexcoords = immersed_sphere_vertexcoords(parentmesh, vertexcoords)
vfs_fam, vfs_deg, vfs_typ = vfs
> vm = VertexOnlyMesh(parentmesh, vertexcoords, missing_points_behaviour=None)
tests/firedrake/vertexonly/test_interpolation_from_parent.py:218:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
firedrake/mesh.py:3364: in VertexOnlyMesh
swarm, input_ordering_swarm, n_missing_points = _pic_swarm_in_mesh(
firedrake/mesh.py:3585: in _pic_swarm_in_mesh
) = _parent_mesh_embedding(
firedrake/mesh.py:4151: in _parent_mesh_embedding
) = parent_mesh.locate_cells_ref_coords_and_dists(coords_global, tolerance)
firedrake/mesh.py:2633: in locate_cells_ref_coords_and_dists
self._c_locator(tolerance=tolerance)(self.coordinates._ctypes,
firedrake/mesh.py:2654: in _c_locator
src = pq_utils.src_locate_cell(self, tolerance=tolerance)
firedrake/pointquery_utils.py:39: in src_locate_cell
src.append(make_wrapper(mesh.coordinates,
firedrake/pointquery_utils.py:33: in make_wrapper
return generate_single_cell_wrapper(function.cell_set, args, **kwargs)
pyop2/parloop.py:797: in generate_single_cell_wrapper
code = lp.generate_code_v2(wrapper)
../firedrake_venv/src/loopy/loopy/codegen/__init__.py:616: in generate_code_v2
t_unit = preprocess_program(t_unit)
../firedrake_venv/src/loopy/loopy/tools.py:893: in wrapper
result = func(*args, **kwargs)
../firedrake_venv/src/loopy/loopy/preprocess.py:827: in preprocess_program
t_unit = infer_unknown_types(t_unit, expect_completion=False)
../firedrake_venv/src/loopy/loopy/type_inference.py:1061: in infer_unknown_types
new_callable, clbl_inf_ctx = t_unit.callables_table[e].with_types(
../firedrake_venv/src/loopy/loopy/kernel/function_interface.py:761: in with_types
infer_unknown_types_for_a_single_kernel(
../firedrake_venv/src/loopy/loopy/type_inference.py:994: in infer_unknown_types_for_a_single_kernel
type_inf_mapper(insn.expression,
../firedrake_venv/src/loopy/loopy/type_inference.py:211: in __call__
result = super().__call__(
../firedrake_venv/lib/python3.12/site-packages/pymbolic/mapper/__init__.py:436: in __call__
result = method(expr, *args, **kwargs)
../firedrake_venv/src/loopy/loopy/type_inference.py:443: in map_call
.with_types(arg_id_to_dtype,
pyop2/codegen/rep2loopy.py:223: in with_types
return self.copy(
../firedrake_venv/src/loopy/loopy/kernel/function_interface.py:372: in copy
return replace(self, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = PyOP2KernelCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='to_reference_coords_kernel', name_in_target=None)
changes = {'arg_id_to_descr': None, 'arg_id_to_dtype': {0: <loopy.types.OpaqueType object at 0x7f2551467d10>, 1: <loopy.types.Op...e1e2a0>, 3: np:dtype('float64')}, 'name': 'to_reference_coords_kernel', 'name_in_target': 'to_reference_coords_kernel'}
f = Field(name='name_in_target',type='str | None',default=<dataclasses._MISSING_TYPE object at 0x7f2599ddf5f0>,default_fac... 0x7f2599ddf5f0>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD)
def replace(obj, /, **changes):
"""Return a new object replacing specified fields with new values.
This is especially useful for frozen classes. Example usage::
@dataclass(frozen=True)
class C:
x: int
y: int
c = C(1, 2)
c1 = replace(c, x=3)
assert c1.x == 3 and c1.y == 2
"""
# We're going to mutate 'changes', but that's okay because it's a
# new dict, even if called with 'replace(obj, **my_changes)'.
if not _is_dataclass_instance(obj):
raise TypeError("replace() should be called on dataclass instances")
# It's an error to have init=False fields in 'changes'.
# If a field is not in 'changes', read its value from the provided obj.
for f in getattr(obj, _FIELDS).values():
# Only consider normal fields or InitVars.
if f._field_type is _FIELD_CLASSVAR:
continue
if not f.init:
# Error if this field is specified in changes.
if f.name in changes:
raise ValueError(f'field {f.name} is declared with '
'init=False, it cannot be specified with '
'replace()')
continue
if f.name not in changes:
if f._field_type is _FIELD_INITVAR and f.default is MISSING:
raise ValueError(f"InitVar {f.name!r} "
'must be specified with replace()')
changes[f.name] = getattr(obj, f.name)
# Create the new object, which calls __init__() and
# __post_init__() (if defined), using all of the init fields we've
# added and/or left in 'changes'. If there are values supplied in
# changes that aren't fields, this will correctly raise a
# TypeError.
> return obj.__class__(**changes)
E TypeError: PyOP2KernelCallable.__init__() missing 1 required positional argument: 'parameters'
/usr/lib/python3.12/dataclasses.py:1581: TypeError
Check failure on line 218 in tests/firedrake/vertexonly/test_interpolation_from_parent.py
github-actions / Firedrake real
test_interpolation_from_parent.test_vector_function_interpolation[extruded-mesh-1-coords-VectorFunctionSpace(CG2)]
TypeError: PyOP2KernelCallable.__init__() missing 1 required positional argument: 'parameters'
Raw output
self = Mesh(VectorElement(TensorProductElement(FiniteElement('Lagrange', triangle, 1), FiniteElement('Lagrange', interval, 1), cell=TensorProductCell(triangle, interval)), dim=3), 83)
tolerance = 0.5
def _c_locator(self, tolerance=None):
from pyop2 import compilation
from pyop2.utils import get_petsc_dir
import firedrake.function as function
import firedrake.pointquery_utils as pq_utils
cache = self.__dict__.setdefault("_c_locator_cache", {})
try:
> return cache[tolerance]
E KeyError: 0.5
firedrake/mesh.py:2651: KeyError
During handling of the above exception, another exception occurred:
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=54)
key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
def fetch(self, key: K) -> V:
keyhash = self.key_builder(key)
try:
> stored_key, value = self._fetch(keyhash)
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:750:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=54)
keyhash = 'bcf9a1d34c9e4de160752ff17742eb932d579b48f964a1394b6341d6e7d42903'
def _fetch_uncached(self, keyhash: str) -> tuple[K, V]:
# This method is separate from fetch() to allow for LRU caching
def fetch_inner() -> tuple[Any] | None:
assert self.conn is not None
# This is separate from fetch() so that the mutex covers the
# fetchone() call
c = self.conn.execute("SELECT key_value FROM dict WHERE keyhash=?",
(keyhash,))
res = c.fetchone()
assert res is None or isinstance(res, tuple)
return res
row = self._exec_sql_fn(fetch_inner)
if row is None:
> raise KeyError
E KeyError
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:741: KeyError
The above exception was the direct cause of the following exception:
args = (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCallable(arg_id_to_dtype=None, arg_id_to_descr=N...et=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),)
kwargs = {}, CACHING_ENABLED = True
cache_key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
proc_log_str = "preprocess_program on 'wrap_to_reference_coords'"
entrypoints_str = 'wrap_to_reference_coords'
@wraps(func)
def wrapper(*args, **kwargs):
from loopy import CACHING_ENABLED
if (not CACHING_ENABLED
or kwargs.pop("_no_memoize_on_disk", False)):
return func(*args, **kwargs)
cache_key = (func.__qualname__, func.__name__, args, kwargs)
try:
> result = transform_cache[cache_key]
../firedrake_venv/src/loopy/loopy/tools.py:877:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:597: in __getitem__
return self.fetch(key)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=54)
key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
def fetch(self, key: K) -> V:
keyhash = self.key_builder(key)
try:
stored_key, value = self._fetch(keyhash)
except KeyError as err:
> raise NoSuchEntryError(key) from err
E pytools.persistent_dict.NoSuchEntryError: ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='MatSetValues', name_in_target=None), 'wrap_to_reference_coords': CallableKernel(arg_id_to_dtype=None, arg_id_to_descr=None, subkernel=LoopKernel(domains=[BasicSet("[end, start] -> { [n] : n = start and start < end }"), BasicSet("[t1, t0] -> { [layer] : layer = -1 + t1 and t0 < t1 }"), BasicSet("{ [i2] : i2 = 0 }"), BasicSet("{ [i1] : 0 <= i1 <= 5 }"), BasicSet("{ [i0] : 0 <= i0 <= 2 }"), BasicSet("{ [i3] : 0 <= i3 <= 5 }"), BasicSet("{ [i4] : i4 = 0 }"), BasicSet("{ [i5] : 0 <= i5 <= 5 }"), BasicSet("{ [i6] : i6 = 0 }"), BasicSet("{ [i7] : 0 <= i7 <= 5 }"), BasicSet("{ [i8] : 0 <= i8 <= 2 }")], instructions=[CallInstruction(assignees=(), conflicts_with_groups=frozenset(), depends_on_is_final=True, expression=Call(Variable('to_reference_coords_kernel'), (Variable('farg0'), Variable('farg1'), Variable('farg2'), SubArrayRef((Variable('i2'), Variable('i1'), Variable('i0')), Subscript(Variable('t2'), (Variable('i2'), Variable('i1'), Variable('i0')))))), groups=frozenset(), happens_after=immutabledict({'statement1': HappensAfter(variable_name=None, instances_rel=None), 'statement2': HappensAfter(variable_name=None, instances_rel=None), 'statement0': HappensAfter(variable_name=None, instances_rel=None), 'statement3': HappensAfter(variable_name=None, instances_rel=None), 'statement4': HappensAfter(variable_name=None, instances_rel=None)}), id='statement5', no_sync_with=frozenset(), predicates=frozenset(), priority=0, tags=frozenset(), temp_var_types=(), within_inames=frozenset({'n', 'layer'}), within_inames_is_final=True), Assignment(assignee=Subscript(Variable('t0'), ()), atomicity=(), conflicts_with_groups=frozenset(), depends_on_is_final=True, expression=Subscript(Variable('layers'), (np.int32(0), np.int32(0))), groups=frozenset(), happens_after=immutabledict({}), id='statement4', no_sync_with=frozenset(), predicates=frozenset(), priority=0, tags=frozenset(), temp_var_type=Optional(), within_inames=frozenset(), within_inames_is_final=True), Assignment(assignee=Subscript(Variable('t1'), ()), atomicity=(), conflicts_with_groups=frozenset(), depends_on_is_final=True, expression=Sum((Subscript(Variable('layers'), (np.int32(0), np.int32(1))), TypeCast('int32', np.int32(-1)))), groups=frozenset(), happens_after=immutabledict({}), id='statement3', no_sync_with=frozenset(), predicates=frozenset(), priority=0, tags=frozenset(), temp_var_type=Optional(), within_inames=frozenset(), within_inames_is_final=True), Assignment(assignee=Subscript(Variable('t3'), (Variable('i3'),)), atomicity=(), conflicts_with_groups=frozenset(), depends_on_is_final=True, expression=Subscript(Variable('map0'), (Variable('n'), Variable('i3'))), groups=frozenset(), happens_after=immutabledict({}), id='statement2', no_sync_with=frozenset(), predicates=frozenset(), priority=0, tags=frozenset(), temp_var_type=Optional(), within_inames=frozenset({'n', 'i3'}), within_inames_is_final=True), Assignment(assignee=Subscript(Variable('t4'), (Variable('i4'), Variable('i5'))), atomicity=(), conflicts_with_groups=frozenset(), depends_on_is_final=True, expression=Sum((Subscript(Variable('t3'), (Variable('i5'),)), Product((TypeCast('int32', np.int32(1)), Sum((Sum((..., ...)), Variable('i4'))))))), groups=frozenset(), happens_after=immutabledict({'statement2': HappensAfter(variable_name=None, instances_rel=None), 'statement4': HappensAfter(variable_name=None, instances_rel=None), 'statement3': HappensAfter(variable_name=None, instances_rel=None)}), id='statement1', no_sync_with=frozenset(), predicates=frozenset(), priority=0, tags=frozenset(), temp_var_type=Optional(), within_inames=frozenset({'n', 'layer', 'i5', 'i4'}), within_inames_is_final=True), Assignment(assignee=Subscript(Variable('t2'), (Variable('i6'), Variable('i7'), Variable('i8'))), atomicity=(), conflicts_with_groups=frozenset(), depends_on_is_final=True, expression=Subscript(Variable('dat0'), (Subscript(Variable('t4'), (Variable('i6'), Variable('i7'))), Variable('i8'))), groups=frozenset(), happens_after=immutabledict({'statement1': HappensAfter(variable_name=None, instances_rel=None)}), id='statement0', no_sync_with=frozenset(), predicates=frozenset(), priority=0, tags=frozenset(), temp_var_type=Optional(), within_inames=frozenset({'n', 'layer', 'i8', 'i6', 'i7'}), within_inames_is_final=True)], args=[<farg0: ValueArg, type: <loopy.types.OpaqueType object at 0x7f256f821af0>>, <farg1: ValueArg, type: <loopy.types.OpaqueType object at 0x7f256f821cd0>>, <farg2: ValueArg, type: <loopy.types.OpaqueType object at 0x7f254bf9f5f0>>, <start: ValueArg, type: np:dtype('int32')>, <end: ValueArg, type: np:dtype('int32')>, <layers: type: np:dtype('int32'), shape: (1, 2), dim_tags: (N1:stride:2, N0:stride:1) in aspace: global>, <dat0: type: np:dtype('float64'), shape: (None, 3), dim_tags: (N1:stride:3, N0:stride:1) in aspace: global>, <map0: type: np:dtype('int32'), shape: (None, 6), dim_tags: (N1:stride:6, N0:stride:1) in aspace: global>], assumptions=BasicSet("[t1, t0, end, start] -> { : 0 <= t0 <= t1 and 0 <= start < end }"), temporary_variables={'t2': <t2: type: np:dtype('float64'), shape: (1, 6, 3), dim_tags: (N2:stride:18, N1:stride:3, N0:stride:1) aspace: auto>, 't0': <t0: type: np:dtype('int32'), shape: () aspace: auto>, 't1': <t1: type: np:dtype('int32'), shape: () aspace: auto>, 't3': <t3: type: np:dtype('int32'), shape: (6), dim_tags: (N0:stride:1) aspace: auto>, 't4': <t4: type: np:dtype('int32'), shape: (1, 6), dim_tags: (N1:stride:6, N0:stride:1) aspace: auto>}, inames={'i8': Iname(name='i8', tags=frozenset()), 'layer': Iname(name='layer', tags=frozenset()), 'i3': Iname(name='i3', tags=frozenset()), 'i6': Iname(name='i6', tags=frozenset()), 'i5': Iname(name='i5', tags=frozenset()), 'i1': Iname(name='i1', tags=frozenset()), 'i2': Iname(name='i2', tags=frozenset()), 'n': Iname(name='n', tags=frozenset()), 'i0': Iname(name='i0', tags=frozenset()), 'i7': Iname(name='i7', tags=frozenset()), 'i4': Iname(name='i4', tags=frozenset())}, substitutions={}, options=Options(allow_fp_reordering=True, allow_terminal_colors=True, annotate_inames=False, build_options=[], check_dep_resolution=True, cl_exec_manage_array_events=True, disable_global_barriers=False, edit_code=False, enforce_array_accesses_within_bounds=True, enforce_variable_access_ordered=True, insert_gbarriers=False, no_numpy=False, return_dict=False, skip_arg_checks=False, trace_assignment_values=False, trace_assignments=False, write_code=False, write_wrapper=False), target=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, tags=frozenset(), state=<KernelState.INITIAL: 0>, name='wrap_to_reference_coords', preambles=(), preamble_generators=(_PreambleGen(preamble='#include <complex.h>\n#include <math.h>\n#include <petsc.h>\n'),), symbol_manglers=[<function symbol_mangler at 0x7f2577675a80>], linearization=None, iname_slab_increments=immutables.Map({}), loop_priority=frozenset({('n', 'layer'), ('layer', 'n')}), applied_iname_rewrites=(), index_dtype=np:dtype('int32'), silenced_warnings=[], overridden_get_grid_sizes_for_insn_ids=None)), 'to_reference_coords_kernel': PyOP2KernelCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='to_reference_coords_kernel', name_in_target=None)}), target=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:752: NoSuchEntryError
During handling of the above exception, another exception occurred:
parentmesh = Mesh(VectorElement(TensorProductElement(FiniteElement('Lagrange', triangle, 1), FiniteElement('Lagrange', interval, 1), cell=TensorProductCell(triangle, interval)), dim=3), 83)
vertexcoords = array([[0.59762701, 0.93037873, 0.70552675]])
vfs = ('CG', 2, <cyfunction VectorFunctionSpace at 0x7f25775b01e0>)
def test_vector_function_interpolation(parentmesh, vertexcoords, vfs):
if parentmesh.name == "immersedsphere":
vertexcoords = immersed_sphere_vertexcoords(parentmesh, vertexcoords)
vfs_fam, vfs_deg, vfs_typ = vfs
> vm = VertexOnlyMesh(parentmesh, vertexcoords, missing_points_behaviour=None)
tests/firedrake/vertexonly/test_interpolation_from_parent.py:218:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
firedrake/mesh.py:3364: in VertexOnlyMesh
swarm, input_ordering_swarm, n_missing_points = _pic_swarm_in_mesh(
firedrake/mesh.py:3585: in _pic_swarm_in_mesh
) = _parent_mesh_embedding(
firedrake/mesh.py:4151: in _parent_mesh_embedding
) = parent_mesh.locate_cells_ref_coords_and_dists(coords_global, tolerance)
firedrake/mesh.py:2633: in locate_cells_ref_coords_and_dists
self._c_locator(tolerance=tolerance)(self.coordinates._ctypes,
firedrake/mesh.py:2654: in _c_locator
src = pq_utils.src_locate_cell(self, tolerance=tolerance)
firedrake/pointquery_utils.py:39: in src_locate_cell
src.append(make_wrapper(mesh.coordinates,
firedrake/pointquery_utils.py:33: in make_wrapper
return generate_single_cell_wrapper(function.cell_set, args, **kwargs)
pyop2/parloop.py:797: in generate_single_cell_wrapper
code = lp.generate_code_v2(wrapper)
../firedrake_venv/src/loopy/loopy/codegen/__init__.py:616: in generate_code_v2
t_unit = preprocess_program(t_unit)
../firedrake_venv/src/loopy/loopy/tools.py:893: in wrapper
result = func(*args, **kwargs)
../firedrake_venv/src/loopy/loopy/preprocess.py:827: in preprocess_program
t_unit = infer_unknown_types(t_unit, expect_completion=False)
../firedrake_venv/src/loopy/loopy/type_inference.py:1061: in infer_unknown_types
new_callable, clbl_inf_ctx = t_unit.callables_table[e].with_types(
../firedrake_venv/src/loopy/loopy/kernel/function_interface.py:761: in with_types
infer_unknown_types_for_a_single_kernel(
../firedrake_venv/src/loopy/loopy/type_inference.py:994: in infer_unknown_types_for_a_single_kernel
type_inf_mapper(insn.expression,
../firedrake_venv/src/loopy/loopy/type_inference.py:211: in __call__
result = super().__call__(
../firedrake_venv/lib/python3.12/site-packages/pymbolic/mapper/__init__.py:436: in __call__
result = method(expr, *args, **kwargs)
../firedrake_venv/src/loopy/loopy/type_inference.py:443: in map_call
.with_types(arg_id_to_dtype,
pyop2/codegen/rep2loopy.py:223: in with_types
return self.copy(
../firedrake_venv/src/loopy/loopy/kernel/function_interface.py:372: in copy
return replace(self, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = PyOP2KernelCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='to_reference_coords_kernel', name_in_target=None)
changes = {'arg_id_to_descr': None, 'arg_id_to_dtype': {0: <loopy.types.OpaqueType object at 0x7f256f821af0>, 1: <loopy.types.Op...f9f5f0>, 3: np:dtype('float64')}, 'name': 'to_reference_coords_kernel', 'name_in_target': 'to_reference_coords_kernel'}
f = Field(name='name_in_target',type='str | None',default=<dataclasses._MISSING_TYPE object at 0x7f2599ddf5f0>,default_fac... 0x7f2599ddf5f0>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD)
def replace(obj, /, **changes):
"""Return a new object replacing specified fields with new values.
This is especially useful for frozen classes. Example usage::
@dataclass(frozen=True)
class C:
x: int
y: int
c = C(1, 2)
c1 = replace(c, x=3)
assert c1.x == 3 and c1.y == 2
"""
# We're going to mutate 'changes', but that's okay because it's a
# new dict, even if called with 'replace(obj, **my_changes)'.
if not _is_dataclass_instance(obj):
raise TypeError("replace() should be called on dataclass instances")
# It's an error to have init=False fields in 'changes'.
# If a field is not in 'changes', read its value from the provided obj.
for f in getattr(obj, _FIELDS).values():
# Only consider normal fields or InitVars.
if f._field_type is _FIELD_CLASSVAR:
continue
if not f.init:
# Error if this field is specified in changes.
if f.name in changes:
raise ValueError(f'field {f.name} is declared with '
'init=False, it cannot be specified with '
'replace()')
continue
if f.name not in changes:
if f._field_type is _FIELD_INITVAR and f.default is MISSING:
raise ValueError(f"InitVar {f.name!r} "
'must be specified with replace()')
changes[f.name] = getattr(obj, f.name)
# Create the new object, which calls __init__() and
# __post_init__() (if defined), using all of the init fields we've
# added and/or left in 'changes'. If there are values supplied in
# changes that aren't fields, this will correctly raise a
# TypeError.
> return obj.__class__(**changes)
E TypeError: PyOP2KernelCallable.__init__() missing 1 required positional argument: 'parameters'
/usr/lib/python3.12/dataclasses.py:1581: TypeError
Check failure on line 218 in tests/firedrake/vertexonly/test_interpolation_from_parent.py
github-actions / Firedrake real
test_interpolation_from_parent.test_vector_function_interpolation[extruded-mesh-100-coords-VectorFunctionSpace(CG2)]
TypeError: PyOP2KernelCallable.__init__() missing 1 required positional argument: 'parameters'
Raw output
self = Mesh(VectorElement(TensorProductElement(FiniteElement('Lagrange', triangle, 1), FiniteElement('Lagrange', interval, 1), cell=TensorProductCell(triangle, interval)), dim=3), 112)
tolerance = 0.5
def _c_locator(self, tolerance=None):
from pyop2 import compilation
from pyop2.utils import get_petsc_dir
import firedrake.function as function
import firedrake.pointquery_utils as pq_utils
cache = self.__dict__.setdefault("_c_locator_cache", {})
try:
> return cache[tolerance]
E KeyError: 0.5
firedrake/mesh.py:2651: KeyError
During handling of the above exception, another exception occurred:
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=63)
key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
def fetch(self, key: K) -> V:
keyhash = self.key_builder(key)
try:
> stored_key, value = self._fetch(keyhash)
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:750:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=63)
keyhash = 'bcf9a1d34c9e4de160752ff17742eb932d579b48f964a1394b6341d6e7d42903'
def _fetch_uncached(self, keyhash: str) -> tuple[K, V]:
# This method is separate from fetch() to allow for LRU caching
def fetch_inner() -> tuple[Any] | None:
assert self.conn is not None
# This is separate from fetch() so that the mutex covers the
# fetchone() call
c = self.conn.execute("SELECT key_value FROM dict WHERE keyhash=?",
(keyhash,))
res = c.fetchone()
assert res is None or isinstance(res, tuple)
return res
row = self._exec_sql_fn(fetch_inner)
if row is None:
> raise KeyError
E KeyError
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:741: KeyError
The above exception was the direct cause of the following exception:
args = (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCallable(arg_id_to_dtype=None, arg_id_to_descr=N...et=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),)
kwargs = {}, CACHING_ENABLED = True
cache_key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
proc_log_str = "preprocess_program on 'wrap_to_reference_coords'"
entrypoints_str = 'wrap_to_reference_coords'
@wraps(func)
def wrapper(*args, **kwargs):
from loopy import CACHING_ENABLED
if (not CACHING_ENABLED
or kwargs.pop("_no_memoize_on_disk", False)):
return func(*args, **kwargs)
cache_key = (func.__qualname__, func.__name__, args, kwargs)
try:
> result = transform_cache[cache_key]
../firedrake_venv/src/loopy/loopy/tools.py:877:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:597: in __getitem__
return self.fetch(key)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=63)
key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
def fetch(self, key: K) -> V:
keyhash = self.key_builder(key)
try:
stored_key, value = self._fetch(keyhash)
except KeyError as err:
> raise NoSuchEntryError(key) from err
E pytools.persistent_dict.NoSuchEntryError: ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='MatSetValues', name_in_target=None), 'wrap_to_reference_coords': CallableKernel(arg_id_to_dtype=None, arg_id_to_descr=None, subkernel=LoopKernel(domains=[BasicSet("[end, start] -> { [n] : n = start and start < end }"), BasicSet("[t1, t0] -> { [layer] : layer = -1 + t1 and t0 < t1 }"), BasicSet("{ [i2] : i2 = 0 }"), BasicSet("{ [i1] : 0 <= i1 <= 5 }"), BasicSet("{ [i0] : 0 <= i0 <= 2 }"), BasicSet("{ [i3] : 0 <= i3 <= 5 }"), BasicSet("{ [i4] : i4 = 0 }"), BasicSet("{ [i5] : 0 <= i5 <= 5 }"), BasicSet("{ [i6] : i6 = 0 }"), BasicSet("{ [i7] : 0 <= i7 <= 5 }"), BasicSet("{ [i8] : 0 <= i8 <= 2 }")], instructions=[CallInstruction(assignees=(), conflicts_with_groups=frozenset(), depends_on_is_final=True, expression=Call(Variable('to_reference_coords_kernel'), (Variable('farg0'), Variable('farg1'), Variable('farg2'), SubArrayRef((Variable('i2'), Variable('i1'), Variable('i0')), Subscript(Variable('t2'), (Variable('i2'), Variable('i1'), Variable('i0')))))), groups=frozenset(), happens_after=immutabledict({'statement1': HappensAfter(variable_name=None, instances_rel=None), 'statement2': HappensAfter(variable_name=None, instances_rel=None), 'statement0': HappensAfter(variable_name=None, instances_rel=None), 'statement3': HappensAfter(variable_name=None, instances_rel=None), 'statement4': HappensAfter(variable_name=None, instances_rel=None)}), id='statement5', no_sync_with=frozenset(), predicates=frozenset(), priority=0, tags=frozenset(), temp_var_types=(), within_inames=frozenset({'n', 'layer'}), within_inames_is_final=True), Assignment(assignee=Subscript(Variable('t0'), ()), atomicity=(), conflicts_with_groups=frozenset(), depends_on_is_final=True, expression=Subscript(Variable('layers'), (np.int32(0), np.int32(0))), groups=frozenset(), happens_after=immutabledict({}), id='statement4', no_sync_with=frozenset(), predicates=frozenset(), priority=0, tags=frozenset(), temp_var_type=Optional(), within_inames=frozenset(), within_inames_is_final=True), Assignment(assignee=Subscript(Variable('t1'), ()), atomicity=(), conflicts_with_groups=frozenset(), depends_on_is_final=True, expression=Sum((Subscript(Variable('layers'), (np.int32(0), np.int32(1))), TypeCast('int32', np.int32(-1)))), groups=frozenset(), happens_after=immutabledict({}), id='statement3', no_sync_with=frozenset(), predicates=frozenset(), priority=0, tags=frozenset(), temp_var_type=Optional(), within_inames=frozenset(), within_inames_is_final=True), Assignment(assignee=Subscript(Variable('t3'), (Variable('i3'),)), atomicity=(), conflicts_with_groups=frozenset(), depends_on_is_final=True, expression=Subscript(Variable('map0'), (Variable('n'), Variable('i3'))), groups=frozenset(), happens_after=immutabledict({}), id='statement2', no_sync_with=frozenset(), predicates=frozenset(), priority=0, tags=frozenset(), temp_var_type=Optional(), within_inames=frozenset({'n', 'i3'}), within_inames_is_final=True), Assignment(assignee=Subscript(Variable('t4'), (Variable('i4'), Variable('i5'))), atomicity=(), conflicts_with_groups=frozenset(), depends_on_is_final=True, expression=Sum((Subscript(Variable('t3'), (Variable('i5'),)), Product((TypeCast('int32', np.int32(1)), Sum((Sum((..., ...)), Variable('i4'))))))), groups=frozenset(), happens_after=immutabledict({'statement2': HappensAfter(variable_name=None, instances_rel=None), 'statement4': HappensAfter(variable_name=None, instances_rel=None), 'statement3': HappensAfter(variable_name=None, instances_rel=None)}), id='statement1', no_sync_with=frozenset(), predicates=frozenset(), priority=0, tags=frozenset(), temp_var_type=Optional(), within_inames=frozenset({'n', 'layer', 'i5', 'i4'}), within_inames_is_final=True), Assignment(assignee=Subscript(Variable('t2'), (Variable('i6'), Variable('i7'), Variable('i8'))), atomicity=(), conflicts_with_groups=frozenset(), depends_on_is_final=True, expression=Subscript(Variable('dat0'), (Subscript(Variable('t4'), (Variable('i6'), Variable('i7'))), Variable('i8'))), groups=frozenset(), happens_after=immutabledict({'statement1': HappensAfter(variable_name=None, instances_rel=None)}), id='statement0', no_sync_with=frozenset(), predicates=frozenset(), priority=0, tags=frozenset(), temp_var_type=Optional(), within_inames=frozenset({'n', 'layer', 'i8', 'i6', 'i7'}), within_inames_is_final=True)], args=[<farg0: ValueArg, type: <loopy.types.OpaqueType object at 0x7f25514136b0>>, <farg1: ValueArg, type: <loopy.types.OpaqueType object at 0x7f2551411af0>>, <farg2: ValueArg, type: <loopy.types.OpaqueType object at 0x7f25501ff7d0>>, <start: ValueArg, type: np:dtype('int32')>, <end: ValueArg, type: np:dtype('int32')>, <layers: type: np:dtype('int32'), shape: (1, 2), dim_tags: (N1:stride:2, N0:stride:1) in aspace: global>, <dat0: type: np:dtype('float64'), shape: (None, 3), dim_tags: (N1:stride:3, N0:stride:1) in aspace: global>, <map0: type: np:dtype('int32'), shape: (None, 6), dim_tags: (N1:stride:6, N0:stride:1) in aspace: global>], assumptions=BasicSet("[t1, t0, end, start] -> { : 0 <= t0 <= t1 and 0 <= start < end }"), temporary_variables={'t2': <t2: type: np:dtype('float64'), shape: (1, 6, 3), dim_tags: (N2:stride:18, N1:stride:3, N0:stride:1) aspace: auto>, 't0': <t0: type: np:dtype('int32'), shape: () aspace: auto>, 't1': <t1: type: np:dtype('int32'), shape: () aspace: auto>, 't3': <t3: type: np:dtype('int32'), shape: (6), dim_tags: (N0:stride:1) aspace: auto>, 't4': <t4: type: np:dtype('int32'), shape: (1, 6), dim_tags: (N1:stride:6, N0:stride:1) aspace: auto>}, inames={'i8': Iname(name='i8', tags=frozenset()), 'layer': Iname(name='layer', tags=frozenset()), 'i3': Iname(name='i3', tags=frozenset()), 'i6': Iname(name='i6', tags=frozenset()), 'i5': Iname(name='i5', tags=frozenset()), 'i1': Iname(name='i1', tags=frozenset()), 'i2': Iname(name='i2', tags=frozenset()), 'n': Iname(name='n', tags=frozenset()), 'i0': Iname(name='i0', tags=frozenset()), 'i7': Iname(name='i7', tags=frozenset()), 'i4': Iname(name='i4', tags=frozenset())}, substitutions={}, options=Options(allow_fp_reordering=True, allow_terminal_colors=True, annotate_inames=False, build_options=[], check_dep_resolution=True, cl_exec_manage_array_events=True, disable_global_barriers=False, edit_code=False, enforce_array_accesses_within_bounds=True, enforce_variable_access_ordered=True, insert_gbarriers=False, no_numpy=False, return_dict=False, skip_arg_checks=False, trace_assignment_values=False, trace_assignments=False, write_code=False, write_wrapper=False), target=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, tags=frozenset(), state=<KernelState.INITIAL: 0>, name='wrap_to_reference_coords', preambles=(), preamble_generators=(_PreambleGen(preamble='#include <complex.h>\n#include <math.h>\n#include <petsc.h>\n'),), symbol_manglers=[<function symbol_mangler at 0x7f2577675a80>], linearization=None, iname_slab_increments=immutables.Map({}), loop_priority=frozenset({('n', 'layer'), ('layer', 'n')}), applied_iname_rewrites=(), index_dtype=np:dtype('int32'), silenced_warnings=[], overridden_get_grid_sizes_for_insn_ids=None)), 'to_reference_coords_kernel': PyOP2KernelCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='to_reference_coords_kernel', name_in_target=None)}), target=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:752: NoSuchEntryError
During handling of the above exception, another exception occurred:
parentmesh = Mesh(VectorElement(TensorProductElement(FiniteElement('Lagrange', triangle, 1), FiniteElement('Lagrange', interval, 1), cell=TensorProductCell(triangle, interval)), dim=3), 112)
vertexcoords = array([[ 0.59762701, 0.93037873, 0.70552675],
[ 0.58976637, 0.3473096 , 0.79178823],
[ 0.37517442, ...4423547, -0.12030418],
[ 0.52263797, -0.05136594, -0.30431103],
[ 1.22438303, 1.44583898, 1.42166932]])
vfs = ('CG', 2, <cyfunction VectorFunctionSpace at 0x7f25775b01e0>)
def test_vector_function_interpolation(parentmesh, vertexcoords, vfs):
if parentmesh.name == "immersedsphere":
vertexcoords = immersed_sphere_vertexcoords(parentmesh, vertexcoords)
vfs_fam, vfs_deg, vfs_typ = vfs
> vm = VertexOnlyMesh(parentmesh, vertexcoords, missing_points_behaviour=None)
tests/firedrake/vertexonly/test_interpolation_from_parent.py:218:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
firedrake/mesh.py:3364: in VertexOnlyMesh
swarm, input_ordering_swarm, n_missing_points = _pic_swarm_in_mesh(
firedrake/mesh.py:3585: in _pic_swarm_in_mesh
) = _parent_mesh_embedding(
firedrake/mesh.py:4151: in _parent_mesh_embedding
) = parent_mesh.locate_cells_ref_coords_and_dists(coords_global, tolerance)
firedrake/mesh.py:2633: in locate_cells_ref_coords_and_dists
self._c_locator(tolerance=tolerance)(self.coordinates._ctypes,
firedrake/mesh.py:2654: in _c_locator
src = pq_utils.src_locate_cell(self, tolerance=tolerance)
firedrake/pointquery_utils.py:39: in src_locate_cell
src.append(make_wrapper(mesh.coordinates,
firedrake/pointquery_utils.py:33: in make_wrapper
return generate_single_cell_wrapper(function.cell_set, args, **kwargs)
pyop2/parloop.py:797: in generate_single_cell_wrapper
code = lp.generate_code_v2(wrapper)
../firedrake_venv/src/loopy/loopy/codegen/__init__.py:616: in generate_code_v2
t_unit = preprocess_program(t_unit)
../firedrake_venv/src/loopy/loopy/tools.py:893: in wrapper
result = func(*args, **kwargs)
../firedrake_venv/src/loopy/loopy/preprocess.py:827: in preprocess_program
t_unit = infer_unknown_types(t_unit, expect_completion=False)
../firedrake_venv/src/loopy/loopy/type_inference.py:1061: in infer_unknown_types
new_callable, clbl_inf_ctx = t_unit.callables_table[e].with_types(
../firedrake_venv/src/loopy/loopy/kernel/function_interface.py:761: in with_types
infer_unknown_types_for_a_single_kernel(
../firedrake_venv/src/loopy/loopy/type_inference.py:994: in infer_unknown_types_for_a_single_kernel
type_inf_mapper(insn.expression,
../firedrake_venv/src/loopy/loopy/type_inference.py:211: in __call__
result = super().__call__(
../firedrake_venv/lib/python3.12/site-packages/pymbolic/mapper/__init__.py:436: in __call__
result = method(expr, *args, **kwargs)
../firedrake_venv/src/loopy/loopy/type_inference.py:443: in map_call
.with_types(arg_id_to_dtype,
pyop2/codegen/rep2loopy.py:223: in with_types
return self.copy(
../firedrake_venv/src/loopy/loopy/kernel/function_interface.py:372: in copy
return replace(self, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = PyOP2KernelCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='to_reference_coords_kernel', name_in_target=None)
changes = {'arg_id_to_descr': None, 'arg_id_to_dtype': {0: <loopy.types.OpaqueType object at 0x7f25514136b0>, 1: <loopy.types.Op...1ff7d0>, 3: np:dtype('float64')}, 'name': 'to_reference_coords_kernel', 'name_in_target': 'to_reference_coords_kernel'}
f = Field(name='name_in_target',type='str | None',default=<dataclasses._MISSING_TYPE object at 0x7f2599ddf5f0>,default_fac... 0x7f2599ddf5f0>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD)
def replace(obj, /, **changes):
"""Return a new object replacing specified fields with new values.
This is especially useful for frozen classes. Example usage::
@dataclass(frozen=True)
class C:
x: int
y: int
c = C(1, 2)
c1 = replace(c, x=3)
assert c1.x == 3 and c1.y == 2
"""
# We're going to mutate 'changes', but that's okay because it's a
# new dict, even if called with 'replace(obj, **my_changes)'.
if not _is_dataclass_instance(obj):
raise TypeError("replace() should be called on dataclass instances")
# It's an error to have init=False fields in 'changes'.
# If a field is not in 'changes', read its value from the provided obj.
for f in getattr(obj, _FIELDS).values():
# Only consider normal fields or InitVars.
if f._field_type is _FIELD_CLASSVAR:
continue
if not f.init:
# Error if this field is specified in changes.
if f.name in changes:
raise ValueError(f'field {f.name} is declared with '
'init=False, it cannot be specified with '
'replace()')
continue
if f.name not in changes:
if f._field_type is _FIELD_INITVAR and f.default is MISSING:
raise ValueError(f"InitVar {f.name!r} "
'must be specified with replace()')
changes[f.name] = getattr(obj, f.name)
# Create the new object, which calls __init__() and
# __post_init__() (if defined), using all of the init fields we've
# added and/or left in 'changes'. If there are values supplied in
# changes that aren't fields, this will correctly raise a
# TypeError.
> return obj.__class__(**changes)
E TypeError: PyOP2KernelCallable.__init__() missing 1 required positional argument: 'parameters'
/usr/lib/python3.12/dataclasses.py:1581: TypeError
Check failure on line 218 in tests/firedrake/vertexonly/test_interpolation_from_parent.py
github-actions / Firedrake real
test_interpolation_from_parent.test_vector_function_interpolation[cube-mesh-0-coords-VectorFunctionSpace(CG2)]
TypeError: PyOP2KernelCallable.__init__() missing 1 required positional argument: 'parameters'
Raw output
self = Mesh(VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3), 138)
tolerance = 0.5
def _c_locator(self, tolerance=None):
from pyop2 import compilation
from pyop2.utils import get_petsc_dir
import firedrake.function as function
import firedrake.pointquery_utils as pq_utils
cache = self.__dict__.setdefault("_c_locator_cache", {})
try:
> return cache[tolerance]
E KeyError: 0.5
firedrake/mesh.py:2651: KeyError
During handling of the above exception, another exception occurred:
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=76)
key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
def fetch(self, key: K) -> V:
keyhash = self.key_builder(key)
try:
> stored_key, value = self._fetch(keyhash)
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:750:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=76)
keyhash = 'd1d95918a1efeba628f9ed0db75eac691ef71788cea69537df3016c77227a261'
def _fetch_uncached(self, keyhash: str) -> tuple[K, V]:
# This method is separate from fetch() to allow for LRU caching
def fetch_inner() -> tuple[Any] | None:
assert self.conn is not None
# This is separate from fetch() so that the mutex covers the
# fetchone() call
c = self.conn.execute("SELECT key_value FROM dict WHERE keyhash=?",
(keyhash,))
res = c.fetchone()
assert res is None or isinstance(res, tuple)
return res
row = self._exec_sql_fn(fetch_inner)
if row is None:
> raise KeyError
E KeyError
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:741: KeyError
The above exception was the direct cause of the following exception:
args = (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCallable(arg_id_to_dtype=None, arg_id_to_descr=N...et=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),)
kwargs = {}, CACHING_ENABLED = True
cache_key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
proc_log_str = "preprocess_program on 'wrap_to_reference_coords'"
entrypoints_str = 'wrap_to_reference_coords'
@wraps(func)
def wrapper(*args, **kwargs):
from loopy import CACHING_ENABLED
if (not CACHING_ENABLED
or kwargs.pop("_no_memoize_on_disk", False)):
return func(*args, **kwargs)
cache_key = (func.__qualname__, func.__name__, args, kwargs)
try:
> result = transform_cache[cache_key]
../firedrake_venv/src/loopy/loopy/tools.py:877:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:597: in __getitem__
return self.fetch(key)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=76)
key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
def fetch(self, key: K) -> V:
keyhash = self.key_builder(key)
try:
stored_key, value = self._fetch(keyhash)
except KeyError as err:
> raise NoSuchEntryError(key) from err
E pytools.persistent_dict.NoSuchEntryError: ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='MatSetValues', name_in_target=None), 'wrap_to_reference_coords': CallableKernel(arg_id_to_dtype=None, arg_id_to_descr=None, subkernel=LoopKernel(domains=[BasicSet("[end, start] -> { [n] : n = start and start < end }"), BasicSet("{ [i2] : i2 = 0 }"), BasicSet("{ [i0] : 0 <= i0 <= 3 }"), BasicSet("{ [i1] : 0 <= i1 <= 2 }"), BasicSet("{ [i3] : i3 = 0 }"), BasicSet("{ [i4] : 0 <= i4 <= 3 }"), BasicSet("{ [i5] : 0 <= i5 <= 2 }")], instructions=[CallInstruction(assignees=(), conflicts_with_groups=frozenset(), depends_on_is_final=True, expression=Call(Variable('to_reference_coords_kernel'), (Variable('farg0'), Variable('farg1'), Variable('farg2'), SubArrayRef((Variable('i2'), Variable('i0'), Variable('i1')), Subscript(Variable('t0'), (Variable('i2'), Variable('i0'), Variable('i1')))))), groups=frozenset(), happens_after=immutabledict({'statement0': HappensAfter(variable_name=None, instances_rel=None)}), id='statement1', no_sync_with=frozenset(), predicates=frozenset(), priority=0, tags=frozenset(), temp_var_types=(), within_inames=frozenset({'n'}), within_inames_is_final=True), Assignment(assignee=Subscript(Variable('t0'), (Variable('i3'), Variable('i4'), Variable('i5'))), atomicity=(), conflicts_with_groups=frozenset(), depends_on_is_final=True, expression=Subscript(Variable('dat0'), (Subscript(Variable('map0'), (Variable('n'), Variable('i4'))), Variable('i5'))), groups=frozenset(), happens_after=immutabledict({}), id='statement0', no_sync_with=frozenset(), predicates=frozenset(), priority=0, tags=frozenset(), temp_var_type=Optional(), within_inames=frozenset({'n', 'i3', 'i5', 'i4'}), within_inames_is_final=True)], args=[<farg0: ValueArg, type: <loopy.types.OpaqueType object at 0x7f254be1ce90>>, <farg1: ValueArg, type: <loopy.types.OpaqueType object at 0x7f254be1e2d0>>, <farg2: ValueArg, type: <loopy.types.OpaqueType object at 0x7f254be1e1e0>>, <start: ValueArg, type: np:dtype('int32')>, <end: ValueArg, type: np:dtype('int32')>, <dat0: type: np:dtype('float64'), shape: (None, 3), dim_tags: (N1:stride:3, N0:stride:1) in aspace: global>, <map0: type: np:dtype('int32'), shape: (None, 4), dim_tags: (N1:stride:4, N0:stride:1) in aspace: global>], assumptions=BasicSet("[end, start] -> { : 0 <= start < end }"), temporary_variables={'t0': <t0: type: np:dtype('float64'), shape: (1, 4, 3), dim_tags: (N2:stride:12, N1:stride:3, N0:stride:1) aspace: auto>}, inames={'i2': Iname(name='i2', tags=frozenset()), 'n': Iname(name='n', tags=frozenset()), 'i3': Iname(name='i3', tags=frozenset()), 'i0': Iname(name='i0', tags=frozenset()), 'i5': Iname(name='i5', tags=frozenset()), 'i1': Iname(name='i1', tags=frozenset()), 'i4': Iname(name='i4', tags=frozenset())}, substitutions={}, options=Options(allow_fp_reordering=True, allow_terminal_colors=True, annotate_inames=False, build_options=[], check_dep_resolution=True, cl_exec_manage_array_events=True, disable_global_barriers=False, edit_code=False, enforce_array_accesses_within_bounds=True, enforce_variable_access_ordered=True, insert_gbarriers=False, no_numpy=False, return_dict=False, skip_arg_checks=False, trace_assignment_values=False, trace_assignments=False, write_code=False, write_wrapper=False), target=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, tags=frozenset(), state=<KernelState.INITIAL: 0>, name='wrap_to_reference_coords', preambles=(), preamble_generators=(_PreambleGen(preamble='#include <complex.h>\n#include <math.h>\n#include <petsc.h>\n'),), symbol_manglers=[<function symbol_mangler at 0x7f2577675a80>], linearization=None, iname_slab_increments=immutables.Map({}), loop_priority=frozenset(), applied_iname_rewrites=(), index_dtype=np:dtype('int32'), silenced_warnings=[], overridden_get_grid_sizes_for_insn_ids=None)), 'to_reference_coords_kernel': PyOP2KernelCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='to_reference_coords_kernel', name_in_target=None)}), target=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:752: NoSuchEntryError
During handling of the above exception, another exception occurred:
parentmesh = Mesh(VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3), 138)
vertexcoords = array([], shape=(0, 3), dtype=float64)
vfs = ('CG', 2, <cyfunction VectorFunctionSpace at 0x7f25775b01e0>)
def test_vector_function_interpolation(parentmesh, vertexcoords, vfs):
if parentmesh.name == "immersedsphere":
vertexcoords = immersed_sphere_vertexcoords(parentmesh, vertexcoords)
vfs_fam, vfs_deg, vfs_typ = vfs
> vm = VertexOnlyMesh(parentmesh, vertexcoords, missing_points_behaviour=None)
tests/firedrake/vertexonly/test_interpolation_from_parent.py:218:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
firedrake/mesh.py:3364: in VertexOnlyMesh
swarm, input_ordering_swarm, n_missing_points = _pic_swarm_in_mesh(
firedrake/mesh.py:3585: in _pic_swarm_in_mesh
) = _parent_mesh_embedding(
firedrake/mesh.py:4151: in _parent_mesh_embedding
) = parent_mesh.locate_cells_ref_coords_and_dists(coords_global, tolerance)
firedrake/mesh.py:2633: in locate_cells_ref_coords_and_dists
self._c_locator(tolerance=tolerance)(self.coordinates._ctypes,
firedrake/mesh.py:2654: in _c_locator
src = pq_utils.src_locate_cell(self, tolerance=tolerance)
firedrake/pointquery_utils.py:39: in src_locate_cell
src.append(make_wrapper(mesh.coordinates,
firedrake/pointquery_utils.py:33: in make_wrapper
return generate_single_cell_wrapper(function.cell_set, args, **kwargs)
pyop2/parloop.py:797: in generate_single_cell_wrapper
code = lp.generate_code_v2(wrapper)
../firedrake_venv/src/loopy/loopy/codegen/__init__.py:616: in generate_code_v2
t_unit = preprocess_program(t_unit)
../firedrake_venv/src/loopy/loopy/tools.py:893: in wrapper
result = func(*args, **kwargs)
../firedrake_venv/src/loopy/loopy/preprocess.py:827: in preprocess_program
t_unit = infer_unknown_types(t_unit, expect_completion=False)
../firedrake_venv/src/loopy/loopy/type_inference.py:1061: in infer_unknown_types
new_callable, clbl_inf_ctx = t_unit.callables_table[e].with_types(
../firedrake_venv/src/loopy/loopy/kernel/function_interface.py:761: in with_types
infer_unknown_types_for_a_single_kernel(
../firedrake_venv/src/loopy/loopy/type_inference.py:994: in infer_unknown_types_for_a_single_kernel
type_inf_mapper(insn.expression,
../firedrake_venv/src/loopy/loopy/type_inference.py:211: in __call__
result = super().__call__(
../firedrake_venv/lib/python3.12/site-packages/pymbolic/mapper/__init__.py:436: in __call__
result = method(expr, *args, **kwargs)
../firedrake_venv/src/loopy/loopy/type_inference.py:443: in map_call
.with_types(arg_id_to_dtype,
pyop2/codegen/rep2loopy.py:223: in with_types
return self.copy(
../firedrake_venv/src/loopy/loopy/kernel/function_interface.py:372: in copy
return replace(self, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = PyOP2KernelCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='to_reference_coords_kernel', name_in_target=None)
changes = {'arg_id_to_descr': None, 'arg_id_to_dtype': {0: <loopy.types.OpaqueType object at 0x7f254be1ce90>, 1: <loopy.types.Op...e1e1e0>, 3: np:dtype('float64')}, 'name': 'to_reference_coords_kernel', 'name_in_target': 'to_reference_coords_kernel'}
f = Field(name='name_in_target',type='str | None',default=<dataclasses._MISSING_TYPE object at 0x7f2599ddf5f0>,default_fac... 0x7f2599ddf5f0>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD)
def replace(obj, /, **changes):
"""Return a new object replacing specified fields with new values.
This is especially useful for frozen classes. Example usage::
@dataclass(frozen=True)
class C:
x: int
y: int
c = C(1, 2)
c1 = replace(c, x=3)
assert c1.x == 3 and c1.y == 2
"""
# We're going to mutate 'changes', but that's okay because it's a
# new dict, even if called with 'replace(obj, **my_changes)'.
if not _is_dataclass_instance(obj):
raise TypeError("replace() should be called on dataclass instances")
# It's an error to have init=False fields in 'changes'.
# If a field is not in 'changes', read its value from the provided obj.
for f in getattr(obj, _FIELDS).values():
# Only consider normal fields or InitVars.
if f._field_type is _FIELD_CLASSVAR:
continue
if not f.init:
# Error if this field is specified in changes.
if f.name in changes:
raise ValueError(f'field {f.name} is declared with '
'init=False, it cannot be specified with '
'replace()')
continue
if f.name not in changes:
if f._field_type is _FIELD_INITVAR and f.default is MISSING:
raise ValueError(f"InitVar {f.name!r} "
'must be specified with replace()')
changes[f.name] = getattr(obj, f.name)
# Create the new object, which calls __init__() and
# __post_init__() (if defined), using all of the init fields we've
# added and/or left in 'changes'. If there are values supplied in
# changes that aren't fields, this will correctly raise a
# TypeError.
> return obj.__class__(**changes)
E TypeError: PyOP2KernelCallable.__init__() missing 1 required positional argument: 'parameters'
/usr/lib/python3.12/dataclasses.py:1581: TypeError
Check failure on line 1 in tests/firedrake/vertexonly/test_interpolation_from_parent.py
github-actions / Firedrake real
test_interpolation_from_parent.test_vector_function_interpolation_parallel[tetrahedron-mesh-100-coords-VectorFunctionSpace(CG2)]
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_interpolation_from_parent.py::test_vector_function_interpolation_parallel[tetrahedron-mesh-100-coords-VectorFunctionSpace(CG2)]', ':', '-n', '2', '/__w/firedrake/firedrake_venv/bin/python', '-m', 'pytest', '--runxfail', '-s', '-q', '/__w/firedrake/firedrake/tests/firedrake/vertexonly/test_interpolation_from_parent.py::test_vector_function_interpolation_parallel[tetrahedron-mesh-100-coords-VectorFunctionSpace(CG2)]', '--tb=no', '--no-summary', '--no-header', '--disable-warnings', '--show-capture=no']' returned non-zero exit status 1.
Raw output
args = ()
kwargs = {'parentmesh': Mesh(VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3), 39), 'vertexcoords': array([[ 0.5... [ 1.22438303, 1.44583898, 1.42166932]]), 'vfs': ('CG', 2, <cyfunction VectorFunctionSpace at 0x7feaa00e41e0>)}
def parallel_callback(*args, **kwargs):
> subprocess.run(cmd, check=True)
../firedrake_venv/src/pytest-mpi/pytest_mpi.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_interpolation_from_parent.py::test_vector_function_interpolation_parallel[tetrahedron-mesh-100-coords-VectorFunctionSpace(CG2)]', ':', '-n', '2', '/__w/firedrake/firedrake_venv/bin/python', '-m', 'pytest', '--runxfail', '-s', '-q', '/__w/firedrake/firedrake/tests/firedrake/vertexonly/test_interpolation_from_parent.py::test_vector_function_interpolation_parallel[tetrahedron-mesh-100-coords-VectorFunctionSpace(CG2)]', '--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 218 in tests/firedrake/vertexonly/test_interpolation_from_parent.py
github-actions / Firedrake real
test_interpolation_from_parent.test_vector_function_interpolation[cube-mesh-0-coords-FunctionSpace(N1curl2)]
TypeError: PyOP2KernelCallable.__init__() missing 1 required positional argument: 'parameters'
Raw output
self = Mesh(VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3), 141)
tolerance = 0.5
def _c_locator(self, tolerance=None):
from pyop2 import compilation
from pyop2.utils import get_petsc_dir
import firedrake.function as function
import firedrake.pointquery_utils as pq_utils
cache = self.__dict__.setdefault("_c_locator_cache", {})
try:
> return cache[tolerance]
E KeyError: 0.5
firedrake/mesh.py:2651: KeyError
During handling of the above exception, another exception occurred:
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=82)
key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
def fetch(self, key: K) -> V:
keyhash = self.key_builder(key)
try:
> stored_key, value = self._fetch(keyhash)
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:750:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=82)
keyhash = 'd1d95918a1efeba628f9ed0db75eac691ef71788cea69537df3016c77227a261'
def _fetch_uncached(self, keyhash: str) -> tuple[K, V]:
# This method is separate from fetch() to allow for LRU caching
def fetch_inner() -> tuple[Any] | None:
assert self.conn is not None
# This is separate from fetch() so that the mutex covers the
# fetchone() call
c = self.conn.execute("SELECT key_value FROM dict WHERE keyhash=?",
(keyhash,))
res = c.fetchone()
assert res is None or isinstance(res, tuple)
return res
row = self._exec_sql_fn(fetch_inner)
if row is None:
> raise KeyError
E KeyError
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:741: KeyError
The above exception was the direct cause of the following exception:
args = (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCallable(arg_id_to_dtype=None, arg_id_to_descr=N...et=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),)
kwargs = {}, CACHING_ENABLED = True
cache_key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
proc_log_str = "preprocess_program on 'wrap_to_reference_coords'"
entrypoints_str = 'wrap_to_reference_coords'
@wraps(func)
def wrapper(*args, **kwargs):
from loopy import CACHING_ENABLED
if (not CACHING_ENABLED
or kwargs.pop("_no_memoize_on_disk", False)):
return func(*args, **kwargs)
cache_key = (func.__qualname__, func.__name__, args, kwargs)
try:
> result = transform_cache[cache_key]
../firedrake_venv/src/loopy/loopy/tools.py:877:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:597: in __getitem__
return self.fetch(key)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=81)
key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
def fetch(self, key: K) -> V:
keyhash = self.key_builder(key)
try:
stored_key, value = self._fetch(keyhash)
except KeyError as err:
> raise NoSuchEntryError(key) from err
E pytools.persistent_dict.NoSuchEntryError: ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='MatSetValues', name_in_target=None), 'wrap_to_reference_coords': CallableKernel(arg_id_to_dtype=None, arg_id_to_descr=None, subkernel=LoopKernel(domains=[BasicSet("[end, start] -> { [n] : n = start and start < end }"), BasicSet("{ [i2] : i2 = 0 }"), BasicSet("{ [i0] : 0 <= i0 <= 3 }"), BasicSet("{ [i1] : 0 <= i1 <= 2 }"), BasicSet("{ [i3] : i3 = 0 }"), BasicSet("{ [i4] : 0 <= i4 <= 3 }"), BasicSet("{ [i5] : 0 <= i5 <= 2 }")], instructions=[CallInstruction(assignees=(), conflicts_with_groups=frozenset(), depends_on_is_final=True, expression=Call(Variable('to_reference_coords_kernel'), (Variable('farg0'), Variable('farg1'), Variable('farg2'), SubArrayRef((Variable('i2'), Variable('i0'), Variable('i1')), Subscript(Variable('t0'), (Variable('i2'), Variable('i0'), Variable('i1')))))), groups=frozenset(), happens_after=immutabledict({'statement0': HappensAfter(variable_name=None, instances_rel=None)}), id='statement1', no_sync_with=frozenset(), predicates=frozenset(), priority=0, tags=frozenset(), temp_var_types=(), within_inames=frozenset({'n'}), within_inames_is_final=True), Assignment(assignee=Subscript(Variable('t0'), (Variable('i3'), Variable('i4'), Variable('i5'))), atomicity=(), conflicts_with_groups=frozenset(), depends_on_is_final=True, expression=Subscript(Variable('dat0'), (Subscript(Variable('map0'), (Variable('n'), Variable('i4'))), Variable('i5'))), groups=frozenset(), happens_after=immutabledict({}), id='statement0', no_sync_with=frozenset(), predicates=frozenset(), priority=0, tags=frozenset(), temp_var_type=Optional(), within_inames=frozenset({'n', 'i3', 'i5', 'i4'}), within_inames_is_final=True)], args=[<farg0: ValueArg, type: <loopy.types.OpaqueType object at 0x7f254bc40f50>>, <farg1: ValueArg, type: <loopy.types.OpaqueType object at 0x7f254bc43e60>>, <farg2: ValueArg, type: <loopy.types.OpaqueType object at 0x7f254bc43e00>>, <start: ValueArg, type: np:dtype('int32')>, <end: ValueArg, type: np:dtype('int32')>, <dat0: type: np:dtype('float64'), shape: (None, 3), dim_tags: (N1:stride:3, N0:stride:1) in aspace: global>, <map0: type: np:dtype('int32'), shape: (None, 4), dim_tags: (N1:stride:4, N0:stride:1) in aspace: global>], assumptions=BasicSet("[end, start] -> { : 0 <= start < end }"), temporary_variables={'t0': <t0: type: np:dtype('float64'), shape: (1, 4, 3), dim_tags: (N2:stride:12, N1:stride:3, N0:stride:1) aspace: auto>}, inames={'i2': Iname(name='i2', tags=frozenset()), 'n': Iname(name='n', tags=frozenset()), 'i3': Iname(name='i3', tags=frozenset()), 'i0': Iname(name='i0', tags=frozenset()), 'i5': Iname(name='i5', tags=frozenset()), 'i1': Iname(name='i1', tags=frozenset()), 'i4': Iname(name='i4', tags=frozenset())}, substitutions={}, options=Options(allow_fp_reordering=True, allow_terminal_colors=True, annotate_inames=False, build_options=[], check_dep_resolution=True, cl_exec_manage_array_events=True, disable_global_barriers=False, edit_code=False, enforce_array_accesses_within_bounds=True, enforce_variable_access_ordered=True, insert_gbarriers=False, no_numpy=False, return_dict=False, skip_arg_checks=False, trace_assignment_values=False, trace_assignments=False, write_code=False, write_wrapper=False), target=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, tags=frozenset(), state=<KernelState.INITIAL: 0>, name='wrap_to_reference_coords', preambles=(), preamble_generators=(_PreambleGen(preamble='#include <complex.h>\n#include <math.h>\n#include <petsc.h>\n'),), symbol_manglers=[<function symbol_mangler at 0x7f2577675a80>], linearization=None, iname_slab_increments=immutables.Map({}), loop_priority=frozenset(), applied_iname_rewrites=(), index_dtype=np:dtype('int32'), silenced_warnings=[], overridden_get_grid_sizes_for_insn_ids=None)), 'to_reference_coords_kernel': PyOP2KernelCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='to_reference_coords_kernel', name_in_target=None)}), target=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:752: NoSuchEntryError
During handling of the above exception, another exception occurred:
parentmesh = Mesh(VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3), 141)
vertexcoords = array([], shape=(0, 3), dtype=float64)
vfs = ('N1curl', 2, <cyfunction FunctionSpace at 0x7f25775b0040>)
def test_vector_function_interpolation(parentmesh, vertexcoords, vfs):
if parentmesh.name == "immersedsphere":
vertexcoords = immersed_sphere_vertexcoords(parentmesh, vertexcoords)
vfs_fam, vfs_deg, vfs_typ = vfs
> vm = VertexOnlyMesh(parentmesh, vertexcoords, missing_points_behaviour=None)
tests/firedrake/vertexonly/test_interpolation_from_parent.py:218:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
firedrake/mesh.py:3364: in VertexOnlyMesh
swarm, input_ordering_swarm, n_missing_points = _pic_swarm_in_mesh(
firedrake/mesh.py:3585: in _pic_swarm_in_mesh
) = _parent_mesh_embedding(
firedrake/mesh.py:4151: in _parent_mesh_embedding
) = parent_mesh.locate_cells_ref_coords_and_dists(coords_global, tolerance)
firedrake/mesh.py:2633: in locate_cells_ref_coords_and_dists
self._c_locator(tolerance=tolerance)(self.coordinates._ctypes,
firedrake/mesh.py:2654: in _c_locator
src = pq_utils.src_locate_cell(self, tolerance=tolerance)
firedrake/pointquery_utils.py:39: in src_locate_cell
src.append(make_wrapper(mesh.coordinates,
firedrake/pointquery_utils.py:33: in make_wrapper
return generate_single_cell_wrapper(function.cell_set, args, **kwargs)
pyop2/parloop.py:797: in generate_single_cell_wrapper
code = lp.generate_code_v2(wrapper)
../firedrake_venv/src/loopy/loopy/codegen/__init__.py:616: in generate_code_v2
t_unit = preprocess_program(t_unit)
../firedrake_venv/src/loopy/loopy/tools.py:893: in wrapper
result = func(*args, **kwargs)
../firedrake_venv/src/loopy/loopy/preprocess.py:827: in preprocess_program
t_unit = infer_unknown_types(t_unit, expect_completion=False)
../firedrake_venv/src/loopy/loopy/type_inference.py:1061: in infer_unknown_types
new_callable, clbl_inf_ctx = t_unit.callables_table[e].with_types(
../firedrake_venv/src/loopy/loopy/kernel/function_interface.py:761: in with_types
infer_unknown_types_for_a_single_kernel(
../firedrake_venv/src/loopy/loopy/type_inference.py:994: in infer_unknown_types_for_a_single_kernel
type_inf_mapper(insn.expression,
../firedrake_venv/src/loopy/loopy/type_inference.py:211: in __call__
result = super().__call__(
../firedrake_venv/lib/python3.12/site-packages/pymbolic/mapper/__init__.py:436: in __call__
result = method(expr, *args, **kwargs)
../firedrake_venv/src/loopy/loopy/type_inference.py:443: in map_call
.with_types(arg_id_to_dtype,
pyop2/codegen/rep2loopy.py:223: in with_types
return self.copy(
../firedrake_venv/src/loopy/loopy/kernel/function_interface.py:372: in copy
return replace(self, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = PyOP2KernelCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='to_reference_coords_kernel', name_in_target=None)
changes = {'arg_id_to_descr': None, 'arg_id_to_dtype': {0: <loopy.types.OpaqueType object at 0x7f254bc40f50>, 1: <loopy.types.Op...c43e00>, 3: np:dtype('float64')}, 'name': 'to_reference_coords_kernel', 'name_in_target': 'to_reference_coords_kernel'}
f = Field(name='name_in_target',type='str | None',default=<dataclasses._MISSING_TYPE object at 0x7f2599ddf5f0>,default_fac... 0x7f2599ddf5f0>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD)
def replace(obj, /, **changes):
"""Return a new object replacing specified fields with new values.
This is especially useful for frozen classes. Example usage::
@dataclass(frozen=True)
class C:
x: int
y: int
c = C(1, 2)
c1 = replace(c, x=3)
assert c1.x == 3 and c1.y == 2
"""
# We're going to mutate 'changes', but that's okay because it's a
# new dict, even if called with 'replace(obj, **my_changes)'.
if not _is_dataclass_instance(obj):
raise TypeError("replace() should be called on dataclass instances")
# It's an error to have init=False fields in 'changes'.
# If a field is not in 'changes', read its value from the provided obj.
for f in getattr(obj, _FIELDS).values():
# Only consider normal fields or InitVars.
if f._field_type is _FIELD_CLASSVAR:
continue
if not f.init:
# Error if this field is specified in changes.
if f.name in changes:
raise ValueError(f'field {f.name} is declared with '
'init=False, it cannot be specified with '
'replace()')
continue
if f.name not in changes:
if f._field_type is _FIELD_INITVAR and f.default is MISSING:
raise ValueError(f"InitVar {f.name!r} "
'must be specified with replace()')
changes[f.name] = getattr(obj, f.name)
# Create the new object, which calls __init__() and
# __post_init__() (if defined), using all of the init fields we've
# added and/or left in 'changes'. If there are values supplied in
# changes that aren't fields, this will correctly raise a
# TypeError.
> return obj.__class__(**changes)
E TypeError: PyOP2KernelCallable.__init__() missing 1 required positional argument: 'parameters'
/usr/lib/python3.12/dataclasses.py:1581: TypeError
Check failure on line 218 in tests/firedrake/vertexonly/test_interpolation_from_parent.py
github-actions / Firedrake real
test_interpolation_from_parent.test_vector_function_interpolation[cube-mesh-0-coords-FunctionSpace(N2curl2)]
TypeError: PyOP2KernelCallable.__init__() missing 1 required positional argument: 'parameters'
Raw output
self = Mesh(VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3), 144)
tolerance = 0.5
def _c_locator(self, tolerance=None):
from pyop2 import compilation
from pyop2.utils import get_petsc_dir
import firedrake.function as function
import firedrake.pointquery_utils as pq_utils
cache = self.__dict__.setdefault("_c_locator_cache", {})
try:
> return cache[tolerance]
E KeyError: 0.5
firedrake/mesh.py:2651: KeyError
During handling of the above exception, another exception occurred:
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=87)
key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
def fetch(self, key: K) -> V:
keyhash = self.key_builder(key)
try:
> stored_key, value = self._fetch(keyhash)
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:750:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=87)
keyhash = 'd1d95918a1efeba628f9ed0db75eac691ef71788cea69537df3016c77227a261'
def _fetch_uncached(self, keyhash: str) -> tuple[K, V]:
# This method is separate from fetch() to allow for LRU caching
def fetch_inner() -> tuple[Any] | None:
assert self.conn is not None
# This is separate from fetch() so that the mutex covers the
# fetchone() call
c = self.conn.execute("SELECT key_value FROM dict WHERE keyhash=?",
(keyhash,))
res = c.fetchone()
assert res is None or isinstance(res, tuple)
return res
row = self._exec_sql_fn(fetch_inner)
if row is None:
> raise KeyError
E KeyError
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:741: KeyError
The above exception was the direct cause of the following exception:
args = (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCallable(arg_id_to_dtype=None, arg_id_to_descr=N...et=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),)
kwargs = {}, CACHING_ENABLED = True
cache_key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
proc_log_str = "preprocess_program on 'wrap_to_reference_coords'"
entrypoints_str = 'wrap_to_reference_coords'
@wraps(func)
def wrapper(*args, **kwargs):
from loopy import CACHING_ENABLED
if (not CACHING_ENABLED
or kwargs.pop("_no_memoize_on_disk", False)):
return func(*args, **kwargs)
cache_key = (func.__qualname__, func.__name__, args, kwargs)
try:
> result = transform_cache[cache_key]
../firedrake_venv/src/loopy/loopy/tools.py:877:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:597: in __getitem__
return self.fetch(key)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=87)
key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
def fetch(self, key: K) -> V:
keyhash = self.key_builder(key)
try:
stored_key, value = self._fetch(keyhash)
except KeyError as err:
> raise NoSuchEntryError(key) from err
E pytools.persistent_dict.NoSuchEntryError: ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='MatSetValues', name_in_target=None), 'wrap_to_reference_coords': CallableKernel(arg_id_to_dtype=None, arg_id_to_descr=None, subkernel=LoopKernel(domains=[BasicSet("[end, start] -> { [n] : n = start and start < end }"), BasicSet("{ [i2] : i2 = 0 }"), BasicSet("{ [i0] : 0 <= i0 <= 3 }"), BasicSet("{ [i1] : 0 <= i1 <= 2 }"), BasicSet("{ [i3] : i3 = 0 }"), BasicSet("{ [i4] : 0 <= i4 <= 3 }"), BasicSet("{ [i5] : 0 <= i5 <= 2 }")], instructions=[CallInstruction(assignees=(), conflicts_with_groups=frozenset(), depends_on_is_final=True, expression=Call(Variable('to_reference_coords_kernel'), (Variable('farg0'), Variable('farg1'), Variable('farg2'), SubArrayRef((Variable('i2'), Variable('i0'), Variable('i1')), Subscript(Variable('t0'), (Variable('i2'), Variable('i0'), Variable('i1')))))), groups=frozenset(), happens_after=immutabledict({'statement0': HappensAfter(variable_name=None, instances_rel=None)}), id='statement1', no_sync_with=frozenset(), predicates=frozenset(), priority=0, tags=frozenset(), temp_var_types=(), within_inames=frozenset({'n'}), within_inames_is_final=True), Assignment(assignee=Subscript(Variable('t0'), (Variable('i3'), Variable('i4'), Variable('i5'))), atomicity=(), conflicts_with_groups=frozenset(), depends_on_is_final=True, expression=Subscript(Variable('dat0'), (Subscript(Variable('map0'), (Variable('n'), Variable('i4'))), Variable('i5'))), groups=frozenset(), happens_after=immutabledict({}), id='statement0', no_sync_with=frozenset(), predicates=frozenset(), priority=0, tags=frozenset(), temp_var_type=Optional(), within_inames=frozenset({'n', 'i3', 'i5', 'i4'}), within_inames_is_final=True)], args=[<farg0: ValueArg, type: <loopy.types.OpaqueType object at 0x7f254ab84a40>>, <farg1: ValueArg, type: <loopy.types.OpaqueType object at 0x7f254bd58260>>, <farg2: ValueArg, type: <loopy.types.OpaqueType object at 0x7f254ab69220>>, <start: ValueArg, type: np:dtype('int32')>, <end: ValueArg, type: np:dtype('int32')>, <dat0: type: np:dtype('float64'), shape: (None, 3), dim_tags: (N1:stride:3, N0:stride:1) in aspace: global>, <map0: type: np:dtype('int32'), shape: (None, 4), dim_tags: (N1:stride:4, N0:stride:1) in aspace: global>], assumptions=BasicSet("[end, start] -> { : 0 <= start < end }"), temporary_variables={'t0': <t0: type: np:dtype('float64'), shape: (1, 4, 3), dim_tags: (N2:stride:12, N1:stride:3, N0:stride:1) aspace: auto>}, inames={'i2': Iname(name='i2', tags=frozenset()), 'n': Iname(name='n', tags=frozenset()), 'i3': Iname(name='i3', tags=frozenset()), 'i0': Iname(name='i0', tags=frozenset()), 'i5': Iname(name='i5', tags=frozenset()), 'i1': Iname(name='i1', tags=frozenset()), 'i4': Iname(name='i4', tags=frozenset())}, substitutions={}, options=Options(allow_fp_reordering=True, allow_terminal_colors=True, annotate_inames=False, build_options=[], check_dep_resolution=True, cl_exec_manage_array_events=True, disable_global_barriers=False, edit_code=False, enforce_array_accesses_within_bounds=True, enforce_variable_access_ordered=True, insert_gbarriers=False, no_numpy=False, return_dict=False, skip_arg_checks=False, trace_assignment_values=False, trace_assignments=False, write_code=False, write_wrapper=False), target=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, tags=frozenset(), state=<KernelState.INITIAL: 0>, name='wrap_to_reference_coords', preambles=(), preamble_generators=(_PreambleGen(preamble='#include <complex.h>\n#include <math.h>\n#include <petsc.h>\n'),), symbol_manglers=[<function symbol_mangler at 0x7f2577675a80>], linearization=None, iname_slab_increments=immutables.Map({}), loop_priority=frozenset(), applied_iname_rewrites=(), index_dtype=np:dtype('int32'), silenced_warnings=[], overridden_get_grid_sizes_for_insn_ids=None)), 'to_reference_coords_kernel': PyOP2KernelCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='to_reference_coords_kernel', name_in_target=None)}), target=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:752: NoSuchEntryError
During handling of the above exception, another exception occurred:
parentmesh = Mesh(VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3), 144)
vertexcoords = array([], shape=(0, 3), dtype=float64)
vfs = ('N2curl', 2, <cyfunction FunctionSpace at 0x7f25775b0040>)
def test_vector_function_interpolation(parentmesh, vertexcoords, vfs):
if parentmesh.name == "immersedsphere":
vertexcoords = immersed_sphere_vertexcoords(parentmesh, vertexcoords)
vfs_fam, vfs_deg, vfs_typ = vfs
> vm = VertexOnlyMesh(parentmesh, vertexcoords, missing_points_behaviour=None)
tests/firedrake/vertexonly/test_interpolation_from_parent.py:218:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
firedrake/mesh.py:3364: in VertexOnlyMesh
swarm, input_ordering_swarm, n_missing_points = _pic_swarm_in_mesh(
firedrake/mesh.py:3585: in _pic_swarm_in_mesh
) = _parent_mesh_embedding(
firedrake/mesh.py:4151: in _parent_mesh_embedding
) = parent_mesh.locate_cells_ref_coords_and_dists(coords_global, tolerance)
firedrake/mesh.py:2633: in locate_cells_ref_coords_and_dists
self._c_locator(tolerance=tolerance)(self.coordinates._ctypes,
firedrake/mesh.py:2654: in _c_locator
src = pq_utils.src_locate_cell(self, tolerance=tolerance)
firedrake/pointquery_utils.py:39: in src_locate_cell
src.append(make_wrapper(mesh.coordinates,
firedrake/pointquery_utils.py:33: in make_wrapper
return generate_single_cell_wrapper(function.cell_set, args, **kwargs)
pyop2/parloop.py:797: in generate_single_cell_wrapper
code = lp.generate_code_v2(wrapper)
../firedrake_venv/src/loopy/loopy/codegen/__init__.py:616: in generate_code_v2
t_unit = preprocess_program(t_unit)
../firedrake_venv/src/loopy/loopy/tools.py:893: in wrapper
result = func(*args, **kwargs)
../firedrake_venv/src/loopy/loopy/preprocess.py:827: in preprocess_program
t_unit = infer_unknown_types(t_unit, expect_completion=False)
../firedrake_venv/src/loopy/loopy/type_inference.py:1061: in infer_unknown_types
new_callable, clbl_inf_ctx = t_unit.callables_table[e].with_types(
../firedrake_venv/src/loopy/loopy/kernel/function_interface.py:761: in with_types
infer_unknown_types_for_a_single_kernel(
../firedrake_venv/src/loopy/loopy/type_inference.py:994: in infer_unknown_types_for_a_single_kernel
type_inf_mapper(insn.expression,
../firedrake_venv/src/loopy/loopy/type_inference.py:211: in __call__
result = super().__call__(
../firedrake_venv/lib/python3.12/site-packages/pymbolic/mapper/__init__.py:436: in __call__
result = method(expr, *args, **kwargs)
../firedrake_venv/src/loopy/loopy/type_inference.py:443: in map_call
.with_types(arg_id_to_dtype,
pyop2/codegen/rep2loopy.py:223: in with_types
return self.copy(
../firedrake_venv/src/loopy/loopy/kernel/function_interface.py:372: in copy
return replace(self, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = PyOP2KernelCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='to_reference_coords_kernel', name_in_target=None)
changes = {'arg_id_to_descr': None, 'arg_id_to_dtype': {0: <loopy.types.OpaqueType object at 0x7f254ab84a40>, 1: <loopy.types.Op...b69220>, 3: np:dtype('float64')}, 'name': 'to_reference_coords_kernel', 'name_in_target': 'to_reference_coords_kernel'}
f = Field(name='name_in_target',type='str | None',default=<dataclasses._MISSING_TYPE object at 0x7f2599ddf5f0>,default_fac... 0x7f2599ddf5f0>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD)
def replace(obj, /, **changes):
"""Return a new object replacing specified fields with new values.
This is especially useful for frozen classes. Example usage::
@dataclass(frozen=True)
class C:
x: int
y: int
c = C(1, 2)
c1 = replace(c, x=3)
assert c1.x == 3 and c1.y == 2
"""
# We're going to mutate 'changes', but that's okay because it's a
# new dict, even if called with 'replace(obj, **my_changes)'.
if not _is_dataclass_instance(obj):
raise TypeError("replace() should be called on dataclass instances")
# It's an error to have init=False fields in 'changes'.
# If a field is not in 'changes', read its value from the provided obj.
for f in getattr(obj, _FIELDS).values():
# Only consider normal fields or InitVars.
if f._field_type is _FIELD_CLASSVAR:
continue
if not f.init:
# Error if this field is specified in changes.
if f.name in changes:
raise ValueError(f'field {f.name} is declared with '
'init=False, it cannot be specified with '
'replace()')
continue
if f.name not in changes:
if f._field_type is _FIELD_INITVAR and f.default is MISSING:
raise ValueError(f"InitVar {f.name!r} "
'must be specified with replace()')
changes[f.name] = getattr(obj, f.name)
# Create the new object, which calls __init__() and
# __post_init__() (if defined), using all of the init fields we've
# added and/or left in 'changes'. If there are values supplied in
# changes that aren't fields, this will correctly raise a
# TypeError.
> return obj.__class__(**changes)
E TypeError: PyOP2KernelCallable.__init__() missing 1 required positional argument: 'parameters'
/usr/lib/python3.12/dataclasses.py:1581: TypeError
Check failure on line 218 in tests/firedrake/vertexonly/test_interpolation_from_parent.py
github-actions / Firedrake real
test_interpolation_from_parent.test_vector_function_interpolation[cube-mesh-0-coords-FunctionSpace(N1div2)]
TypeError: PyOP2KernelCallable.__init__() missing 1 required positional argument: 'parameters'
Raw output
self = Mesh(VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3), 147)
tolerance = 0.5
def _c_locator(self, tolerance=None):
from pyop2 import compilation
from pyop2.utils import get_petsc_dir
import firedrake.function as function
import firedrake.pointquery_utils as pq_utils
cache = self.__dict__.setdefault("_c_locator_cache", {})
try:
> return cache[tolerance]
E KeyError: 0.5
firedrake/mesh.py:2651: KeyError
During handling of the above exception, another exception occurred:
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=94)
key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
def fetch(self, key: K) -> V:
keyhash = self.key_builder(key)
try:
> stored_key, value = self._fetch(keyhash)
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:750:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=94)
keyhash = 'd1d95918a1efeba628f9ed0db75eac691ef71788cea69537df3016c77227a261'
def _fetch_uncached(self, keyhash: str) -> tuple[K, V]:
# This method is separate from fetch() to allow for LRU caching
def fetch_inner() -> tuple[Any] | None:
assert self.conn is not None
# This is separate from fetch() so that the mutex covers the
# fetchone() call
c = self.conn.execute("SELECT key_value FROM dict WHERE keyhash=?",
(keyhash,))
res = c.fetchone()
assert res is None or isinstance(res, tuple)
return res
row = self._exec_sql_fn(fetch_inner)
if row is None:
> raise KeyError
E KeyError
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:741: KeyError
The above exception was the direct cause of the following exception:
args = (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCallable(arg_id_to_dtype=None, arg_id_to_descr=N...et=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),)
kwargs = {}, CACHING_ENABLED = True
cache_key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
proc_log_str = "preprocess_program on 'wrap_to_reference_coords'"
entrypoints_str = 'wrap_to_reference_coords'
@wraps(func)
def wrapper(*args, **kwargs):
from loopy import CACHING_ENABLED
if (not CACHING_ENABLED
or kwargs.pop("_no_memoize_on_disk", False)):
return func(*args, **kwargs)
cache_key = (func.__qualname__, func.__name__, args, kwargs)
try:
> result = transform_cache[cache_key]
../firedrake_venv/src/loopy/loopy/tools.py:877:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:597: in __getitem__
return self.fetch(key)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=94)
key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
def fetch(self, key: K) -> V:
keyhash = self.key_builder(key)
try:
stored_key, value = self._fetch(keyhash)
except KeyError as err:
> raise NoSuchEntryError(key) from err
E pytools.persistent_dict.NoSuchEntryError: ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='MatSetValues', name_in_target=None), 'wrap_to_reference_coords': CallableKernel(arg_id_to_dtype=None, arg_id_to_descr=None, subkernel=LoopKernel(domains=[BasicSet("[end, start] -> { [n] : n = start and start < end }"), BasicSet("{ [i2] : i2 = 0 }"), BasicSet("{ [i0] : 0 <= i0 <= 3 }"), BasicSet("{ [i1] : 0 <= i1 <= 2 }"), BasicSet("{ [i3] : i3 = 0 }"), BasicSet("{ [i4] : 0 <= i4 <= 3 }"), BasicSet("{ [i5] : 0 <= i5 <= 2 }")], instructions=[CallInstruction(assignees=(), conflicts_with_groups=frozenset(), depends_on_is_final=True, expression=Call(Variable('to_reference_coords_kernel'), (Variable('farg0'), Variable('farg1'), Variable('farg2'), SubArrayRef((Variable('i2'), Variable('i0'), Variable('i1')), Subscript(Variable('t0'), (Variable('i2'), Variable('i0'), Variable('i1')))))), groups=frozenset(), happens_after=immutabledict({'statement0': HappensAfter(variable_name=None, instances_rel=None)}), id='statement1', no_sync_with=frozenset(), predicates=frozenset(), priority=0, tags=frozenset(), temp_var_types=(), within_inames=frozenset({'n'}), within_inames_is_final=True), Assignment(assignee=Subscript(Variable('t0'), (Variable('i3'), Variable('i4'), Variable('i5'))), atomicity=(), conflicts_with_groups=frozenset(), depends_on_is_final=True, expression=Subscript(Variable('dat0'), (Subscript(Variable('map0'), (Variable('n'), Variable('i4'))), Variable('i5'))), groups=frozenset(), happens_after=immutabledict({}), id='statement0', no_sync_with=frozenset(), predicates=frozenset(), priority=0, tags=frozenset(), temp_var_type=Optional(), within_inames=frozenset({'n', 'i3', 'i5', 'i4'}), within_inames_is_final=True)], args=[<farg0: ValueArg, type: <loopy.types.OpaqueType object at 0x7f254be4b4d0>>, <farg1: ValueArg, type: <loopy.types.OpaqueType object at 0x7f254ab02000>>, <farg2: ValueArg, type: <loopy.types.OpaqueType object at 0x7f254ab02b40>>, <start: ValueArg, type: np:dtype('int32')>, <end: ValueArg, type: np:dtype('int32')>, <dat0: type: np:dtype('float64'), shape: (None, 3), dim_tags: (N1:stride:3, N0:stride:1) in aspace: global>, <map0: type: np:dtype('int32'), shape: (None, 4), dim_tags: (N1:stride:4, N0:stride:1) in aspace: global>], assumptions=BasicSet("[end, start] -> { : 0 <= start < end }"), temporary_variables={'t0': <t0: type: np:dtype('float64'), shape: (1, 4, 3), dim_tags: (N2:stride:12, N1:stride:3, N0:stride:1) aspace: auto>}, inames={'i2': Iname(name='i2', tags=frozenset()), 'n': Iname(name='n', tags=frozenset()), 'i3': Iname(name='i3', tags=frozenset()), 'i0': Iname(name='i0', tags=frozenset()), 'i5': Iname(name='i5', tags=frozenset()), 'i1': Iname(name='i1', tags=frozenset()), 'i4': Iname(name='i4', tags=frozenset())}, substitutions={}, options=Options(allow_fp_reordering=True, allow_terminal_colors=True, annotate_inames=False, build_options=[], check_dep_resolution=True, cl_exec_manage_array_events=True, disable_global_barriers=False, edit_code=False, enforce_array_accesses_within_bounds=True, enforce_variable_access_ordered=True, insert_gbarriers=False, no_numpy=False, return_dict=False, skip_arg_checks=False, trace_assignment_values=False, trace_assignments=False, write_code=False, write_wrapper=False), target=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, tags=frozenset(), state=<KernelState.INITIAL: 0>, name='wrap_to_reference_coords', preambles=(), preamble_generators=(_PreambleGen(preamble='#include <complex.h>\n#include <math.h>\n#include <petsc.h>\n'),), symbol_manglers=[<function symbol_mangler at 0x7f2577675a80>], linearization=None, iname_slab_increments=immutables.Map({}), loop_priority=frozenset(), applied_iname_rewrites=(), index_dtype=np:dtype('int32'), silenced_warnings=[], overridden_get_grid_sizes_for_insn_ids=None)), 'to_reference_coords_kernel': PyOP2KernelCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='to_reference_coords_kernel', name_in_target=None)}), target=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:752: NoSuchEntryError
During handling of the above exception, another exception occurred:
parentmesh = Mesh(VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3), 147)
vertexcoords = array([], shape=(0, 3), dtype=float64)
vfs = ('N1div', 2, <cyfunction FunctionSpace at 0x7f25775b0040>)
def test_vector_function_interpolation(parentmesh, vertexcoords, vfs):
if parentmesh.name == "immersedsphere":
vertexcoords = immersed_sphere_vertexcoords(parentmesh, vertexcoords)
vfs_fam, vfs_deg, vfs_typ = vfs
> vm = VertexOnlyMesh(parentmesh, vertexcoords, missing_points_behaviour=None)
tests/firedrake/vertexonly/test_interpolation_from_parent.py:218:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
firedrake/mesh.py:3364: in VertexOnlyMesh
swarm, input_ordering_swarm, n_missing_points = _pic_swarm_in_mesh(
firedrake/mesh.py:3585: in _pic_swarm_in_mesh
) = _parent_mesh_embedding(
firedrake/mesh.py:4151: in _parent_mesh_embedding
) = parent_mesh.locate_cells_ref_coords_and_dists(coords_global, tolerance)
firedrake/mesh.py:2633: in locate_cells_ref_coords_and_dists
self._c_locator(tolerance=tolerance)(self.coordinates._ctypes,
firedrake/mesh.py:2654: in _c_locator
src = pq_utils.src_locate_cell(self, tolerance=tolerance)
firedrake/pointquery_utils.py:39: in src_locate_cell
src.append(make_wrapper(mesh.coordinates,
firedrake/pointquery_utils.py:33: in make_wrapper
return generate_single_cell_wrapper(function.cell_set, args, **kwargs)
pyop2/parloop.py:797: in generate_single_cell_wrapper
code = lp.generate_code_v2(wrapper)
../firedrake_venv/src/loopy/loopy/codegen/__init__.py:616: in generate_code_v2
t_unit = preprocess_program(t_unit)
../firedrake_venv/src/loopy/loopy/tools.py:893: in wrapper
result = func(*args, **kwargs)
../firedrake_venv/src/loopy/loopy/preprocess.py:827: in preprocess_program
t_unit = infer_unknown_types(t_unit, expect_completion=False)
../firedrake_venv/src/loopy/loopy/type_inference.py:1061: in infer_unknown_types
new_callable, clbl_inf_ctx = t_unit.callables_table[e].with_types(
../firedrake_venv/src/loopy/loopy/kernel/function_interface.py:761: in with_types
infer_unknown_types_for_a_single_kernel(
../firedrake_venv/src/loopy/loopy/type_inference.py:994: in infer_unknown_types_for_a_single_kernel
type_inf_mapper(insn.expression,
../firedrake_venv/src/loopy/loopy/type_inference.py:211: in __call__
result = super().__call__(
../firedrake_venv/lib/python3.12/site-packages/pymbolic/mapper/__init__.py:436: in __call__
result = method(expr, *args, **kwargs)
../firedrake_venv/src/loopy/loopy/type_inference.py:443: in map_call
.with_types(arg_id_to_dtype,
pyop2/codegen/rep2loopy.py:223: in with_types
return self.copy(
../firedrake_venv/src/loopy/loopy/kernel/function_interface.py:372: in copy
return replace(self, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = PyOP2KernelCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='to_reference_coords_kernel', name_in_target=None)
changes = {'arg_id_to_descr': None, 'arg_id_to_dtype': {0: <loopy.types.OpaqueType object at 0x7f254be4b4d0>, 1: <loopy.types.Op...b02b40>, 3: np:dtype('float64')}, 'name': 'to_reference_coords_kernel', 'name_in_target': 'to_reference_coords_kernel'}
f = Field(name='name_in_target',type='str | None',default=<dataclasses._MISSING_TYPE object at 0x7f2599ddf5f0>,default_fac... 0x7f2599ddf5f0>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD)
def replace(obj, /, **changes):
"""Return a new object replacing specified fields with new values.
This is especially useful for frozen classes. Example usage::
@dataclass(frozen=True)
class C:
x: int
y: int
c = C(1, 2)
c1 = replace(c, x=3)
assert c1.x == 3 and c1.y == 2
"""
# We're going to mutate 'changes', but that's okay because it's a
# new dict, even if called with 'replace(obj, **my_changes)'.
if not _is_dataclass_instance(obj):
raise TypeError("replace() should be called on dataclass instances")
# It's an error to have init=False fields in 'changes'.
# If a field is not in 'changes', read its value from the provided obj.
for f in getattr(obj, _FIELDS).values():
# Only consider normal fields or InitVars.
if f._field_type is _FIELD_CLASSVAR:
continue
if not f.init:
# Error if this field is specified in changes.
if f.name in changes:
raise ValueError(f'field {f.name} is declared with '
'init=False, it cannot be specified with '
'replace()')
continue
if f.name not in changes:
if f._field_type is _FIELD_INITVAR and f.default is MISSING:
raise ValueError(f"InitVar {f.name!r} "
'must be specified with replace()')
changes[f.name] = getattr(obj, f.name)
# Create the new object, which calls __init__() and
# __post_init__() (if defined), using all of the init fields we've
# added and/or left in 'changes'. If there are values supplied in
# changes that aren't fields, this will correctly raise a
# TypeError.
> return obj.__class__(**changes)
E TypeError: PyOP2KernelCallable.__init__() missing 1 required positional argument: 'parameters'
/usr/lib/python3.12/dataclasses.py:1581: TypeError
Check failure on line 218 in tests/firedrake/vertexonly/test_interpolation_from_parent.py
github-actions / Firedrake real
test_interpolation_from_parent.test_vector_function_interpolation[cube-mesh-0-coords-FunctionSpace(N2div2)]
TypeError: PyOP2KernelCallable.__init__() missing 1 required positional argument: 'parameters'
Raw output
self = Mesh(VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3), 150)
tolerance = 0.5
def _c_locator(self, tolerance=None):
from pyop2 import compilation
from pyop2.utils import get_petsc_dir
import firedrake.function as function
import firedrake.pointquery_utils as pq_utils
cache = self.__dict__.setdefault("_c_locator_cache", {})
try:
> return cache[tolerance]
E KeyError: 0.5
firedrake/mesh.py:2651: KeyError
During handling of the above exception, another exception occurred:
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=102)
key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
def fetch(self, key: K) -> V:
keyhash = self.key_builder(key)
try:
> stored_key, value = self._fetch(keyhash)
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:750:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=103)
keyhash = 'd1d95918a1efeba628f9ed0db75eac691ef71788cea69537df3016c77227a261'
def _fetch_uncached(self, keyhash: str) -> tuple[K, V]:
# This method is separate from fetch() to allow for LRU caching
def fetch_inner() -> tuple[Any] | None:
assert self.conn is not None
# This is separate from fetch() so that the mutex covers the
# fetchone() call
c = self.conn.execute("SELECT key_value FROM dict WHERE keyhash=?",
(keyhash,))
res = c.fetchone()
assert res is None or isinstance(res, tuple)
return res
row = self._exec_sql_fn(fetch_inner)
if row is None:
> raise KeyError
E KeyError
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:741: KeyError
The above exception was the direct cause of the following exception:
args = (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCallable(arg_id_to_dtype=None, arg_id_to_descr=N...et=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),)
kwargs = {}, CACHING_ENABLED = True
cache_key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
proc_log_str = "preprocess_program on 'wrap_to_reference_coords'"
entrypoints_str = 'wrap_to_reference_coords'
@wraps(func)
def wrapper(*args, **kwargs):
from loopy import CACHING_ENABLED
if (not CACHING_ENABLED
or kwargs.pop("_no_memoize_on_disk", False)):
return func(*args, **kwargs)
cache_key = (func.__qualname__, func.__name__, args, kwargs)
try:
> result = transform_cache[cache_key]
../firedrake_venv/src/loopy/loopy/tools.py:877:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:597: in __getitem__
return self.fetch(key)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=102)
key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
def fetch(self, key: K) -> V:
keyhash = self.key_builder(key)
try:
stored_key, value = self._fetch(keyhash)
except KeyError as err:
> raise NoSuchEntryError(key) from err
E pytools.persistent_dict.NoSuchEntryError: ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='MatSetValues', name_in_target=None), 'wrap_to_reference_coords': CallableKernel(arg_id_to_dtype=None, arg_id_to_descr=None, subkernel=LoopKernel(domains=[BasicSet("[end, start] -> { [n] : n = start and start < end }"), BasicSet("{ [i2] : i2 = 0 }"), BasicSet("{ [i0] : 0 <= i0 <= 3 }"), BasicSet("{ [i1] : 0 <= i1 <= 2 }"), BasicSet("{ [i3] : i3 = 0 }"), BasicSet("{ [i4] : 0 <= i4 <= 3 }"), BasicSet("{ [i5] : 0 <= i5 <= 2 }")], instructions=[CallInstruction(assignees=(), conflicts_with_groups=frozenset(), depends_on_is_final=True, expression=Call(Variable('to_reference_coords_kernel'), (Variable('farg0'), Variable('farg1'), Variable('farg2'), SubArrayRef((Variable('i2'), Variable('i0'), Variable('i1')), Subscript(Variable('t0'), (Variable('i2'), Variable('i0'), Variable('i1')))))), groups=frozenset(), happens_after=immutabledict({'statement0': HappensAfter(variable_name=None, instances_rel=None)}), id='statement1', no_sync_with=frozenset(), predicates=frozenset(), priority=0, tags=frozenset(), temp_var_types=(), within_inames=frozenset({'n'}), within_inames_is_final=True), Assignment(assignee=Subscript(Variable('t0'), (Variable('i3'), Variable('i4'), Variable('i5'))), atomicity=(), conflicts_with_groups=frozenset(), depends_on_is_final=True, expression=Subscript(Variable('dat0'), (Subscript(Variable('map0'), (Variable('n'), Variable('i4'))), Variable('i5'))), groups=frozenset(), happens_after=immutabledict({}), id='statement0', no_sync_with=frozenset(), predicates=frozenset(), priority=0, tags=frozenset(), temp_var_type=Optional(), within_inames=frozenset({'n', 'i3', 'i5', 'i4'}), within_inames_is_final=True)], args=[<farg0: ValueArg, type: <loopy.types.OpaqueType object at 0x7f254bcd41d0>>, <farg1: ValueArg, type: <loopy.types.OpaqueType object at 0x7f254bcd74d0>>, <farg2: ValueArg, type: <loopy.types.OpaqueType object at 0x7f254bcd4110>>, <start: ValueArg, type: np:dtype('int32')>, <end: ValueArg, type: np:dtype('int32')>, <dat0: type: np:dtype('float64'), shape: (None, 3), dim_tags: (N1:stride:3, N0:stride:1) in aspace: global>, <map0: type: np:dtype('int32'), shape: (None, 4), dim_tags: (N1:stride:4, N0:stride:1) in aspace: global>], assumptions=BasicSet("[end, start] -> { : 0 <= start < end }"), temporary_variables={'t0': <t0: type: np:dtype('float64'), shape: (1, 4, 3), dim_tags: (N2:stride:12, N1:stride:3, N0:stride:1) aspace: auto>}, inames={'i2': Iname(name='i2', tags=frozenset()), 'n': Iname(name='n', tags=frozenset()), 'i3': Iname(name='i3', tags=frozenset()), 'i0': Iname(name='i0', tags=frozenset()), 'i5': Iname(name='i5', tags=frozenset()), 'i1': Iname(name='i1', tags=frozenset()), 'i4': Iname(name='i4', tags=frozenset())}, substitutions={}, options=Options(allow_fp_reordering=True, allow_terminal_colors=True, annotate_inames=False, build_options=[], check_dep_resolution=True, cl_exec_manage_array_events=True, disable_global_barriers=False, edit_code=False, enforce_array_accesses_within_bounds=True, enforce_variable_access_ordered=True, insert_gbarriers=False, no_numpy=False, return_dict=False, skip_arg_checks=False, trace_assignment_values=False, trace_assignments=False, write_code=False, write_wrapper=False), target=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, tags=frozenset(), state=<KernelState.INITIAL: 0>, name='wrap_to_reference_coords', preambles=(), preamble_generators=(_PreambleGen(preamble='#include <complex.h>\n#include <math.h>\n#include <petsc.h>\n'),), symbol_manglers=[<function symbol_mangler at 0x7f2577675a80>], linearization=None, iname_slab_increments=immutables.Map({}), loop_priority=frozenset(), applied_iname_rewrites=(), index_dtype=np:dtype('int32'), silenced_warnings=[], overridden_get_grid_sizes_for_insn_ids=None)), 'to_reference_coords_kernel': PyOP2KernelCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='to_reference_coords_kernel', name_in_target=None)}), target=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:752: NoSuchEntryError
During handling of the above exception, another exception occurred:
parentmesh = Mesh(VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3), 150)
vertexcoords = array([], shape=(0, 3), dtype=float64)
vfs = ('N2div', 2, <cyfunction FunctionSpace at 0x7f25775b0040>)
def test_vector_function_interpolation(parentmesh, vertexcoords, vfs):
if parentmesh.name == "immersedsphere":
vertexcoords = immersed_sphere_vertexcoords(parentmesh, vertexcoords)
vfs_fam, vfs_deg, vfs_typ = vfs
> vm = VertexOnlyMesh(parentmesh, vertexcoords, missing_points_behaviour=None)
tests/firedrake/vertexonly/test_interpolation_from_parent.py:218:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
firedrake/mesh.py:3364: in VertexOnlyMesh
swarm, input_ordering_swarm, n_missing_points = _pic_swarm_in_mesh(
firedrake/mesh.py:3585: in _pic_swarm_in_mesh
) = _parent_mesh_embedding(
firedrake/mesh.py:4151: in _parent_mesh_embedding
) = parent_mesh.locate_cells_ref_coords_and_dists(coords_global, tolerance)
firedrake/mesh.py:2633: in locate_cells_ref_coords_and_dists
self._c_locator(tolerance=tolerance)(self.coordinates._ctypes,
firedrake/mesh.py:2654: in _c_locator
src = pq_utils.src_locate_cell(self, tolerance=tolerance)
firedrake/pointquery_utils.py:39: in src_locate_cell
src.append(make_wrapper(mesh.coordinates,
firedrake/pointquery_utils.py:33: in make_wrapper
return generate_single_cell_wrapper(function.cell_set, args, **kwargs)
pyop2/parloop.py:797: in generate_single_cell_wrapper
code = lp.generate_code_v2(wrapper)
../firedrake_venv/src/loopy/loopy/codegen/__init__.py:616: in generate_code_v2
t_unit = preprocess_program(t_unit)
../firedrake_venv/src/loopy/loopy/tools.py:893: in wrapper
result = func(*args, **kwargs)
../firedrake_venv/src/loopy/loopy/preprocess.py:827: in preprocess_program
t_unit = infer_unknown_types(t_unit, expect_completion=False)
../firedrake_venv/src/loopy/loopy/type_inference.py:1061: in infer_unknown_types
new_callable, clbl_inf_ctx = t_unit.callables_table[e].with_types(
../firedrake_venv/src/loopy/loopy/kernel/function_interface.py:761: in with_types
infer_unknown_types_for_a_single_kernel(
../firedrake_venv/src/loopy/loopy/type_inference.py:994: in infer_unknown_types_for_a_single_kernel
type_inf_mapper(insn.expression,
../firedrake_venv/src/loopy/loopy/type_inference.py:211: in __call__
result = super().__call__(
../firedrake_venv/lib/python3.12/site-packages/pymbolic/mapper/__init__.py:436: in __call__
result = method(expr, *args, **kwargs)
../firedrake_venv/src/loopy/loopy/type_inference.py:443: in map_call
.with_types(arg_id_to_dtype,
pyop2/codegen/rep2loopy.py:223: in with_types
return self.copy(
../firedrake_venv/src/loopy/loopy/kernel/function_interface.py:372: in copy
return replace(self, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = PyOP2KernelCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='to_reference_coords_kernel', name_in_target=None)
changes = {'arg_id_to_descr': None, 'arg_id_to_dtype': {0: <loopy.types.OpaqueType object at 0x7f254bcd41d0>, 1: <loopy.types.Op...cd4110>, 3: np:dtype('float64')}, 'name': 'to_reference_coords_kernel', 'name_in_target': 'to_reference_coords_kernel'}
f = Field(name='name_in_target',type='str | None',default=<dataclasses._MISSING_TYPE object at 0x7f2599ddf5f0>,default_fac... 0x7f2599ddf5f0>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD)
def replace(obj, /, **changes):
"""Return a new object replacing specified fields with new values.
This is especially useful for frozen classes. Example usage::
@dataclass(frozen=True)
class C:
x: int
y: int
c = C(1, 2)
c1 = replace(c, x=3)
assert c1.x == 3 and c1.y == 2
"""
# We're going to mutate 'changes', but that's okay because it's a
# new dict, even if called with 'replace(obj, **my_changes)'.
if not _is_dataclass_instance(obj):
raise TypeError("replace() should be called on dataclass instances")
# It's an error to have init=False fields in 'changes'.
# If a field is not in 'changes', read its value from the provided obj.
for f in getattr(obj, _FIELDS).values():
# Only consider normal fields or InitVars.
if f._field_type is _FIELD_CLASSVAR:
continue
if not f.init:
# Error if this field is specified in changes.
if f.name in changes:
raise ValueError(f'field {f.name} is declared with '
'init=False, it cannot be specified with '
'replace()')
continue
if f.name not in changes:
if f._field_type is _FIELD_INITVAR and f.default is MISSING:
raise ValueError(f"InitVar {f.name!r} "
'must be specified with replace()')
changes[f.name] = getattr(obj, f.name)
# Create the new object, which calls __init__() and
# __post_init__() (if defined), using all of the init fields we've
# added and/or left in 'changes'. If there are values supplied in
# changes that aren't fields, this will correctly raise a
# TypeError.
> return obj.__class__(**changes)
E TypeError: PyOP2KernelCallable.__init__() missing 1 required positional argument: 'parameters'
/usr/lib/python3.12/dataclasses.py:1581: TypeError
Check failure on line 218 in tests/firedrake/vertexonly/test_interpolation_from_parent.py
github-actions / Firedrake real
test_interpolation_from_parent.test_vector_function_interpolation[cube-mesh-1-coords-VectorFunctionSpace(CG2)]
TypeError: PyOP2KernelCallable.__init__() missing 1 required positional argument: 'parameters'
Raw output
self = Mesh(VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3), 155)
tolerance = 0.5
def _c_locator(self, tolerance=None):
from pyop2 import compilation
from pyop2.utils import get_petsc_dir
import firedrake.function as function
import firedrake.pointquery_utils as pq_utils
cache = self.__dict__.setdefault("_c_locator_cache", {})
try:
> return cache[tolerance]
E KeyError: 0.5
firedrake/mesh.py:2651: KeyError
During handling of the above exception, another exception occurred:
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=110)
key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
def fetch(self, key: K) -> V:
keyhash = self.key_builder(key)
try:
> stored_key, value = self._fetch(keyhash)
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:750:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=110)
keyhash = 'd1d95918a1efeba628f9ed0db75eac691ef71788cea69537df3016c77227a261'
def _fetch_uncached(self, keyhash: str) -> tuple[K, V]:
# This method is separate from fetch() to allow for LRU caching
def fetch_inner() -> tuple[Any] | None:
assert self.conn is not None
# This is separate from fetch() so that the mutex covers the
# fetchone() call
c = self.conn.execute("SELECT key_value FROM dict WHERE keyhash=?",
(keyhash,))
res = c.fetchone()
assert res is None or isinstance(res, tuple)
return res
row = self._exec_sql_fn(fetch_inner)
if row is None:
> raise KeyError
E KeyError
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:741: KeyError
The above exception was the direct cause of the following exception:
args = (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCallable(arg_id_to_dtype=None, arg_id_to_descr=N...et=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),)
kwargs = {}, CACHING_ENABLED = True
cache_key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
proc_log_str = "preprocess_program on 'wrap_to_reference_coords'"
entrypoints_str = 'wrap_to_reference_coords'
@wraps(func)
def wrapper(*args, **kwargs):
from loopy import CACHING_ENABLED
if (not CACHING_ENABLED
or kwargs.pop("_no_memoize_on_disk", False)):
return func(*args, **kwargs)
cache_key = (func.__qualname__, func.__name__, args, kwargs)
try:
> result = transform_cache[cache_key]
../firedrake_venv/src/loopy/loopy/tools.py:877:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:597: in __getitem__
return self.fetch(key)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=109)
key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
def fetch(self, key: K) -> V:
keyhash = self.key_builder(key)
try:
stored_key, value = self._fetch(keyhash)
except KeyError as err:
> raise NoSuchEntryError(key) from err
E pytools.persistent_dict.NoSuchEntryError: ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='MatSetValues', name_in_target=None), 'wrap_to_reference_coords': CallableKernel(arg_id_to_dtype=None, arg_id_to_descr=None, subkernel=LoopKernel(domains=[BasicSet("[end, start] -> { [n] : n = start and start < end }"), BasicSet("{ [i2] : i2 = 0 }"), BasicSet("{ [i0] : 0 <= i0 <= 3 }"), BasicSet("{ [i1] : 0 <= i1 <= 2 }"), BasicSet("{ [i3] : i3 = 0 }"), BasicSet("{ [i4] : 0 <= i4 <= 3 }"), BasicSet("{ [i5] : 0 <= i5 <= 2 }")], instructions=[CallInstruction(assignees=(), conflicts_with_groups=frozenset(), depends_on_is_final=True, expression=Call(Variable('to_reference_coords_kernel'), (Variable('farg0'), Variable('farg1'), Variable('farg2'), SubArrayRef((Variable('i2'), Variable('i0'), Variable('i1')), Subscript(Variable('t0'), (Variable('i2'), Variable('i0'), Variable('i1')))))), groups=frozenset(), happens_after=immutabledict({'statement0': HappensAfter(variable_name=None, instances_rel=None)}), id='statement1', no_sync_with=frozenset(), predicates=frozenset(), priority=0, tags=frozenset(), temp_var_types=(), within_inames=frozenset({'n'}), within_inames_is_final=True), Assignment(assignee=Subscript(Variable('t0'), (Variable('i3'), Variable('i4'), Variable('i5'))), atomicity=(), conflicts_with_groups=frozenset(), depends_on_is_final=True, expression=Subscript(Variable('dat0'), (Subscript(Variable('map0'), (Variable('n'), Variable('i4'))), Variable('i5'))), groups=frozenset(), happens_after=immutabledict({}), id='statement0', no_sync_with=frozenset(), predicates=frozenset(), priority=0, tags=frozenset(), temp_var_type=Optional(), within_inames=frozenset({'n', 'i3', 'i5', 'i4'}), within_inames_is_final=True)], args=[<farg0: ValueArg, type: <loopy.types.OpaqueType object at 0x7f254bec8bc0>>, <farg1: ValueArg, type: <loopy.types.OpaqueType object at 0x7f254becbdd0>>, <farg2: ValueArg, type: <loopy.types.OpaqueType object at 0x7f254bec8740>>, <start: ValueArg, type: np:dtype('int32')>, <end: ValueArg, type: np:dtype('int32')>, <dat0: type: np:dtype('float64'), shape: (None, 3), dim_tags: (N1:stride:3, N0:stride:1) in aspace: global>, <map0: type: np:dtype('int32'), shape: (None, 4), dim_tags: (N1:stride:4, N0:stride:1) in aspace: global>], assumptions=BasicSet("[end, start] -> { : 0 <= start < end }"), temporary_variables={'t0': <t0: type: np:dtype('float64'), shape: (1, 4, 3), dim_tags: (N2:stride:12, N1:stride:3, N0:stride:1) aspace: auto>}, inames={'i2': Iname(name='i2', tags=frozenset()), 'n': Iname(name='n', tags=frozenset()), 'i3': Iname(name='i3', tags=frozenset()), 'i0': Iname(name='i0', tags=frozenset()), 'i5': Iname(name='i5', tags=frozenset()), 'i1': Iname(name='i1', tags=frozenset()), 'i4': Iname(name='i4', tags=frozenset())}, substitutions={}, options=Options(allow_fp_reordering=True, allow_terminal_colors=True, annotate_inames=False, build_options=[], check_dep_resolution=True, cl_exec_manage_array_events=True, disable_global_barriers=False, edit_code=False, enforce_array_accesses_within_bounds=True, enforce_variable_access_ordered=True, insert_gbarriers=False, no_numpy=False, return_dict=False, skip_arg_checks=False, trace_assignment_values=False, trace_assignments=False, write_code=False, write_wrapper=False), target=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, tags=frozenset(), state=<KernelState.INITIAL: 0>, name='wrap_to_reference_coords', preambles=(), preamble_generators=(_PreambleGen(preamble='#include <complex.h>\n#include <math.h>\n#include <petsc.h>\n'),), symbol_manglers=[<function symbol_mangler at 0x7f2577675a80>], linearization=None, iname_slab_increments=immutables.Map({}), loop_priority=frozenset(), applied_iname_rewrites=(), index_dtype=np:dtype('int32'), silenced_warnings=[], overridden_get_grid_sizes_for_insn_ids=None)), 'to_reference_coords_kernel': PyOP2KernelCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='to_reference_coords_kernel', name_in_target=None)}), target=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:752: NoSuchEntryError
During handling of the above exception, another exception occurred:
parentmesh = Mesh(VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3), 155)
vertexcoords = array([[0.59762701, 0.93037873, 0.70552675]])
vfs = ('CG', 2, <cyfunction VectorFunctionSpace at 0x7f25775b01e0>)
def test_vector_function_interpolation(parentmesh, vertexcoords, vfs):
if parentmesh.name == "immersedsphere":
vertexcoords = immersed_sphere_vertexcoords(parentmesh, vertexcoords)
vfs_fam, vfs_deg, vfs_typ = vfs
> vm = VertexOnlyMesh(parentmesh, vertexcoords, missing_points_behaviour=None)
tests/firedrake/vertexonly/test_interpolation_from_parent.py:218:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
firedrake/mesh.py:3364: in VertexOnlyMesh
swarm, input_ordering_swarm, n_missing_points = _pic_swarm_in_mesh(
firedrake/mesh.py:3585: in _pic_swarm_in_mesh
) = _parent_mesh_embedding(
firedrake/mesh.py:4151: in _parent_mesh_embedding
) = parent_mesh.locate_cells_ref_coords_and_dists(coords_global, tolerance)
firedrake/mesh.py:2633: in locate_cells_ref_coords_and_dists
self._c_locator(tolerance=tolerance)(self.coordinates._ctypes,
firedrake/mesh.py:2654: in _c_locator
src = pq_utils.src_locate_cell(self, tolerance=tolerance)
firedrake/pointquery_utils.py:39: in src_locate_cell
src.append(make_wrapper(mesh.coordinates,
firedrake/pointquery_utils.py:33: in make_wrapper
return generate_single_cell_wrapper(function.cell_set, args, **kwargs)
pyop2/parloop.py:797: in generate_single_cell_wrapper
code = lp.generate_code_v2(wrapper)
../firedrake_venv/src/loopy/loopy/codegen/__init__.py:616: in generate_code_v2
t_unit = preprocess_program(t_unit)
../firedrake_venv/src/loopy/loopy/tools.py:893: in wrapper
result = func(*args, **kwargs)
../firedrake_venv/src/loopy/loopy/preprocess.py:827: in preprocess_program
t_unit = infer_unknown_types(t_unit, expect_completion=False)
../firedrake_venv/src/loopy/loopy/type_inference.py:1061: in infer_unknown_types
new_callable, clbl_inf_ctx = t_unit.callables_table[e].with_types(
../firedrake_venv/src/loopy/loopy/kernel/function_interface.py:761: in with_types
infer_unknown_types_for_a_single_kernel(
../firedrake_venv/src/loopy/loopy/type_inference.py:994: in infer_unknown_types_for_a_single_kernel
type_inf_mapper(insn.expression,
../firedrake_venv/src/loopy/loopy/type_inference.py:211: in __call__
result = super().__call__(
../firedrake_venv/lib/python3.12/site-packages/pymbolic/mapper/__init__.py:436: in __call__
result = method(expr, *args, **kwargs)
../firedrake_venv/src/loopy/loopy/type_inference.py:443: in map_call
.with_types(arg_id_to_dtype,
pyop2/codegen/rep2loopy.py:223: in with_types
return self.copy(
../firedrake_venv/src/loopy/loopy/kernel/function_interface.py:372: in copy
return replace(self, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = PyOP2KernelCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='to_reference_coords_kernel', name_in_target=None)
changes = {'arg_id_to_descr': None, 'arg_id_to_dtype': {0: <loopy.types.OpaqueType object at 0x7f254bec8bc0>, 1: <loopy.types.Op...ec8740>, 3: np:dtype('float64')}, 'name': 'to_reference_coords_kernel', 'name_in_target': 'to_reference_coords_kernel'}
f = Field(name='name_in_target',type='str | None',default=<dataclasses._MISSING_TYPE object at 0x7f2599ddf5f0>,default_fac... 0x7f2599ddf5f0>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD)
def replace(obj, /, **changes):
"""Return a new object replacing specified fields with new values.
This is especially useful for frozen classes. Example usage::
@dataclass(frozen=True)
class C:
x: int
y: int
c = C(1, 2)
c1 = replace(c, x=3)
assert c1.x == 3 and c1.y == 2
"""
# We're going to mutate 'changes', but that's okay because it's a
# new dict, even if called with 'replace(obj, **my_changes)'.
if not _is_dataclass_instance(obj):
raise TypeError("replace() should be called on dataclass instances")
# It's an error to have init=False fields in 'changes'.
# If a field is not in 'changes', read its value from the provided obj.
for f in getattr(obj, _FIELDS).values():
# Only consider normal fields or InitVars.
if f._field_type is _FIELD_CLASSVAR:
continue
if not f.init:
# Error if this field is specified in changes.
if f.name in changes:
raise ValueError(f'field {f.name} is declared with '
'init=False, it cannot be specified with '
'replace()')
continue
if f.name not in changes:
if f._field_type is _FIELD_INITVAR and f.default is MISSING:
raise ValueError(f"InitVar {f.name!r} "
'must be specified with replace()')
changes[f.name] = getattr(obj, f.name)
# Create the new object, which calls __init__() and
# __post_init__() (if defined), using all of the init fields we've
# added and/or left in 'changes'. If there are values supplied in
# changes that aren't fields, this will correctly raise a
# TypeError.
> return obj.__class__(**changes)
E TypeError: PyOP2KernelCallable.__init__() missing 1 required positional argument: 'parameters'
/usr/lib/python3.12/dataclasses.py:1581: TypeError
Check failure on line 218 in tests/firedrake/vertexonly/test_interpolation_from_parent.py
github-actions / Firedrake real
test_interpolation_from_parent.test_vector_function_interpolation[cube-mesh-1-coords-FunctionSpace(N1curl2)]
TypeError: PyOP2KernelCallable.__init__() missing 1 required positional argument: 'parameters'
Raw output
self = Mesh(VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3), 158)
tolerance = 0.5
def _c_locator(self, tolerance=None):
from pyop2 import compilation
from pyop2.utils import get_petsc_dir
import firedrake.function as function
import firedrake.pointquery_utils as pq_utils
cache = self.__dict__.setdefault("_c_locator_cache", {})
try:
> return cache[tolerance]
E KeyError: 0.5
firedrake/mesh.py:2651: KeyError
During handling of the above exception, another exception occurred:
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=113)
key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
def fetch(self, key: K) -> V:
keyhash = self.key_builder(key)
try:
> stored_key, value = self._fetch(keyhash)
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:750:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=113)
keyhash = 'd1d95918a1efeba628f9ed0db75eac691ef71788cea69537df3016c77227a261'
def _fetch_uncached(self, keyhash: str) -> tuple[K, V]:
# This method is separate from fetch() to allow for LRU caching
def fetch_inner() -> tuple[Any] | None:
assert self.conn is not None
# This is separate from fetch() so that the mutex covers the
# fetchone() call
c = self.conn.execute("SELECT key_value FROM dict WHERE keyhash=?",
(keyhash,))
res = c.fetchone()
assert res is None or isinstance(res, tuple)
return res
row = self._exec_sql_fn(fetch_inner)
if row is None:
> raise KeyError
E KeyError
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:741: KeyError
The above exception was the direct cause of the following exception:
args = (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCallable(arg_id_to_dtype=None, arg_id_to_descr=N...et=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),)
kwargs = {}, CACHING_ENABLED = True
cache_key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
proc_log_str = "preprocess_program on 'wrap_to_reference_coords'"
entrypoints_str = 'wrap_to_reference_coords'
@wraps(func)
def wrapper(*args, **kwargs):
from loopy import CACHING_ENABLED
if (not CACHING_ENABLED
or kwargs.pop("_no_memoize_on_disk", False)):
return func(*args, **kwargs)
cache_key = (func.__qualname__, func.__name__, args, kwargs)
try:
> result = transform_cache[cache_key]
../firedrake_venv/src/loopy/loopy/tools.py:877:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:597: in __getitem__
return self.fetch(key)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=113)
key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
def fetch(self, key: K) -> V:
keyhash = self.key_builder(key)
try:
stored_key, value = self._fetch(keyhash)
except KeyError as err:
> raise NoSuchEntryError(key) from err
E pytools.persistent_dict.NoSuchEntryError: ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='MatSetValues', name_in_target=None), 'wrap_to_reference_coords': CallableKernel(arg_id_to_dtype=None, arg_id_to_descr=None, subkernel=LoopKernel(domains=[BasicSet("[end, start] -> { [n] : n = start and start < end }"), BasicSet("{ [i2] : i2 = 0 }"), BasicSet("{ [i0] : 0 <= i0 <= 3 }"), BasicSet("{ [i1] : 0 <= i1 <= 2 }"), BasicSet("{ [i3] : i3 = 0 }"), BasicSet("{ [i4] : 0 <= i4 <= 3 }"), BasicSet("{ [i5] : 0 <= i5 <= 2 }")], instructions=[CallInstruction(assignees=(), conflicts_with_groups=frozenset(), depends_on_is_final=True, expression=Call(Variable('to_reference_coords_kernel'), (Variable('farg0'), Variable('farg1'), Variable('farg2'), SubArrayRef((Variable('i2'), Variable('i0'), Variable('i1')), Subscript(Variable('t0'), (Variable('i2'), Variable('i0'), Variable('i1')))))), groups=frozenset(), happens_after=immutabledict({'statement0': HappensAfter(variable_name=None, instances_rel=None)}), id='statement1', no_sync_with=frozenset(), predicates=frozenset(), priority=0, tags=frozenset(), temp_var_types=(), within_inames=frozenset({'n'}), within_inames_is_final=True), Assignment(assignee=Subscript(Variable('t0'), (Variable('i3'), Variable('i4'), Variable('i5'))), atomicity=(), conflicts_with_groups=frozenset(), depends_on_is_final=True, expression=Subscript(Variable('dat0'), (Subscript(Variable('map0'), (Variable('n'), Variable('i4'))), Variable('i5'))), groups=frozenset(), happens_after=immutabledict({}), id='statement0', no_sync_with=frozenset(), predicates=frozenset(), priority=0, tags=frozenset(), temp_var_type=Optional(), within_inames=frozenset({'n', 'i3', 'i5', 'i4'}), within_inames_is_final=True)], args=[<farg0: ValueArg, type: <loopy.types.OpaqueType object at 0x7f254ab69160>>, <farg1: ValueArg, type: <loopy.types.OpaqueType object at 0x7f254ab69f70>>, <farg2: ValueArg, type: <loopy.types.OpaqueType object at 0x7f254ab6a3c0>>, <start: ValueArg, type: np:dtype('int32')>, <end: ValueArg, type: np:dtype('int32')>, <dat0: type: np:dtype('float64'), shape: (None, 3), dim_tags: (N1:stride:3, N0:stride:1) in aspace: global>, <map0: type: np:dtype('int32'), shape: (None, 4), dim_tags: (N1:stride:4, N0:stride:1) in aspace: global>], assumptions=BasicSet("[end, start] -> { : 0 <= start < end }"), temporary_variables={'t0': <t0: type: np:dtype('float64'), shape: (1, 4, 3), dim_tags: (N2:stride:12, N1:stride:3, N0:stride:1) aspace: auto>}, inames={'i2': Iname(name='i2', tags=frozenset()), 'n': Iname(name='n', tags=frozenset()), 'i3': Iname(name='i3', tags=frozenset()), 'i0': Iname(name='i0', tags=frozenset()), 'i5': Iname(name='i5', tags=frozenset()), 'i1': Iname(name='i1', tags=frozenset()), 'i4': Iname(name='i4', tags=frozenset())}, substitutions={}, options=Options(allow_fp_reordering=True, allow_terminal_colors=True, annotate_inames=False, build_options=[], check_dep_resolution=True, cl_exec_manage_array_events=True, disable_global_barriers=False, edit_code=False, enforce_array_accesses_within_bounds=True, enforce_variable_access_ordered=True, insert_gbarriers=False, no_numpy=False, return_dict=False, skip_arg_checks=False, trace_assignment_values=False, trace_assignments=False, write_code=False, write_wrapper=False), target=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, tags=frozenset(), state=<KernelState.INITIAL: 0>, name='wrap_to_reference_coords', preambles=(), preamble_generators=(_PreambleGen(preamble='#include <complex.h>\n#include <math.h>\n#include <petsc.h>\n'),), symbol_manglers=[<function symbol_mangler at 0x7f2577675a80>], linearization=None, iname_slab_increments=immutables.Map({}), loop_priority=frozenset(), applied_iname_rewrites=(), index_dtype=np:dtype('int32'), silenced_warnings=[], overridden_get_grid_sizes_for_insn_ids=None)), 'to_reference_coords_kernel': PyOP2KernelCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='to_reference_coords_kernel', name_in_target=None)}), target=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:752: NoSuchEntryError
During handling of the above exception, another exception occurred:
parentmesh = Mesh(VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3), 158)
vertexcoords = array([[0.59762701, 0.93037873, 0.70552675]])
vfs = ('N1curl', 2, <cyfunction FunctionSpace at 0x7f25775b0040>)
def test_vector_function_interpolation(parentmesh, vertexcoords, vfs):
if parentmesh.name == "immersedsphere":
vertexcoords = immersed_sphere_vertexcoords(parentmesh, vertexcoords)
vfs_fam, vfs_deg, vfs_typ = vfs
> vm = VertexOnlyMesh(parentmesh, vertexcoords, missing_points_behaviour=None)
tests/firedrake/vertexonly/test_interpolation_from_parent.py:218:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
firedrake/mesh.py:3364: in VertexOnlyMesh
swarm, input_ordering_swarm, n_missing_points = _pic_swarm_in_mesh(
firedrake/mesh.py:3585: in _pic_swarm_in_mesh
) = _parent_mesh_embedding(
firedrake/mesh.py:4151: in _parent_mesh_embedding
) = parent_mesh.locate_cells_ref_coords_and_dists(coords_global, tolerance)
firedrake/mesh.py:2633: in locate_cells_ref_coords_and_dists
self._c_locator(tolerance=tolerance)(self.coordinates._ctypes,
firedrake/mesh.py:2654: in _c_locator
src = pq_utils.src_locate_cell(self, tolerance=tolerance)
firedrake/pointquery_utils.py:39: in src_locate_cell
src.append(make_wrapper(mesh.coordinates,
firedrake/pointquery_utils.py:33: in make_wrapper
return generate_single_cell_wrapper(function.cell_set, args, **kwargs)
pyop2/parloop.py:797: in generate_single_cell_wrapper
code = lp.generate_code_v2(wrapper)
../firedrake_venv/src/loopy/loopy/codegen/__init__.py:616: in generate_code_v2
t_unit = preprocess_program(t_unit)
../firedrake_venv/src/loopy/loopy/tools.py:893: in wrapper
result = func(*args, **kwargs)
../firedrake_venv/src/loopy/loopy/preprocess.py:827: in preprocess_program
t_unit = infer_unknown_types(t_unit, expect_completion=False)
../firedrake_venv/src/loopy/loopy/type_inference.py:1061: in infer_unknown_types
new_callable, clbl_inf_ctx = t_unit.callables_table[e].with_types(
../firedrake_venv/src/loopy/loopy/kernel/function_interface.py:761: in with_types
infer_unknown_types_for_a_single_kernel(
../firedrake_venv/src/loopy/loopy/type_inference.py:994: in infer_unknown_types_for_a_single_kernel
type_inf_mapper(insn.expression,
../firedrake_venv/src/loopy/loopy/type_inference.py:211: in __call__
result = super().__call__(
../firedrake_venv/lib/python3.12/site-packages/pymbolic/mapper/__init__.py:436: in __call__
result = method(expr, *args, **kwargs)
../firedrake_venv/src/loopy/loopy/type_inference.py:443: in map_call
.with_types(arg_id_to_dtype,
pyop2/codegen/rep2loopy.py:223: in with_types
return self.copy(
../firedrake_venv/src/loopy/loopy/kernel/function_interface.py:372: in copy
return replace(self, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = PyOP2KernelCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='to_reference_coords_kernel', name_in_target=None)
changes = {'arg_id_to_descr': None, 'arg_id_to_dtype': {0: <loopy.types.OpaqueType object at 0x7f254ab69160>, 1: <loopy.types.Op...b6a3c0>, 3: np:dtype('float64')}, 'name': 'to_reference_coords_kernel', 'name_in_target': 'to_reference_coords_kernel'}
f = Field(name='name_in_target',type='str | None',default=<dataclasses._MISSING_TYPE object at 0x7f2599ddf5f0>,default_fac... 0x7f2599ddf5f0>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD)
def replace(obj, /, **changes):
"""Return a new object replacing specified fields with new values.
This is especially useful for frozen classes. Example usage::
@dataclass(frozen=True)
class C:
x: int
y: int
c = C(1, 2)
c1 = replace(c, x=3)
assert c1.x == 3 and c1.y == 2
"""
# We're going to mutate 'changes', but that's okay because it's a
# new dict, even if called with 'replace(obj, **my_changes)'.
if not _is_dataclass_instance(obj):
raise TypeError("replace() should be called on dataclass instances")
# It's an error to have init=False fields in 'changes'.
# If a field is not in 'changes', read its value from the provided obj.
for f in getattr(obj, _FIELDS).values():
# Only consider normal fields or InitVars.
if f._field_type is _FIELD_CLASSVAR:
continue
if not f.init:
# Error if this field is specified in changes.
if f.name in changes:
raise ValueError(f'field {f.name} is declared with '
'init=False, it cannot be specified with '
'replace()')
continue
if f.name not in changes:
if f._field_type is _FIELD_INITVAR and f.default is MISSING:
raise ValueError(f"InitVar {f.name!r} "
'must be specified with replace()')
changes[f.name] = getattr(obj, f.name)
# Create the new object, which calls __init__() and
# __post_init__() (if defined), using all of the init fields we've
# added and/or left in 'changes'. If there are values supplied in
# changes that aren't fields, this will correctly raise a
# TypeError.
> return obj.__class__(**changes)
E TypeError: PyOP2KernelCallable.__init__() missing 1 required positional argument: 'parameters'
/usr/lib/python3.12/dataclasses.py:1581: TypeError
Check failure on line 218 in tests/firedrake/vertexonly/test_interpolation_from_parent.py
github-actions / Firedrake real
test_interpolation_from_parent.test_vector_function_interpolation[cube-mesh-1-coords-FunctionSpace(N2curl2)]
TypeError: PyOP2KernelCallable.__init__() missing 1 required positional argument: 'parameters'
Raw output
self = Mesh(VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3), 161)
tolerance = 0.5
def _c_locator(self, tolerance=None):
from pyop2 import compilation
from pyop2.utils import get_petsc_dir
import firedrake.function as function
import firedrake.pointquery_utils as pq_utils
cache = self.__dict__.setdefault("_c_locator_cache", {})
try:
> return cache[tolerance]
E KeyError: 0.5
firedrake/mesh.py:2651: KeyError
During handling of the above exception, another exception occurred:
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=117)
key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
def fetch(self, key: K) -> V:
keyhash = self.key_builder(key)
try:
> stored_key, value = self._fetch(keyhash)
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:750:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=117)
keyhash = 'd1d95918a1efeba628f9ed0db75eac691ef71788cea69537df3016c77227a261'
def _fetch_uncached(self, keyhash: str) -> tuple[K, V]:
# This method is separate from fetch() to allow for LRU caching
def fetch_inner() -> tuple[Any] | None:
assert self.conn is not None
# This is separate from fetch() so that the mutex covers the
# fetchone() call
c = self.conn.execute("SELECT key_value FROM dict WHERE keyhash=?",
(keyhash,))
res = c.fetchone()
assert res is None or isinstance(res, tuple)
return res
row = self._exec_sql_fn(fetch_inner)
if row is None:
> raise KeyError
E KeyError
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:741: KeyError
The above exception was the direct cause of the following exception:
args = (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCallable(arg_id_to_dtype=None, arg_id_to_descr=N...et=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),)
kwargs = {}, CACHING_ENABLED = True
cache_key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
proc_log_str = "preprocess_program on 'wrap_to_reference_coords'"
entrypoints_str = 'wrap_to_reference_coords'
@wraps(func)
def wrapper(*args, **kwargs):
from loopy import CACHING_ENABLED
if (not CACHING_ENABLED
or kwargs.pop("_no_memoize_on_disk", False)):
return func(*args, **kwargs)
cache_key = (func.__qualname__, func.__name__, args, kwargs)
try:
> result = transform_cache[cache_key]
../firedrake_venv/src/loopy/loopy/tools.py:877:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:597: in __getitem__
return self.fetch(key)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=117)
key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
def fetch(self, key: K) -> V:
keyhash = self.key_builder(key)
try:
stored_key, value = self._fetch(keyhash)
except KeyError as err:
> raise NoSuchEntryError(key) from err
E pytools.persistent_dict.NoSuchEntryError: ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='MatSetValues', name_in_target=None), 'wrap_to_reference_coords': CallableKernel(arg_id_to_dtype=None, arg_id_to_descr=None, subkernel=LoopKernel(domains=[BasicSet("[end, start] -> { [n] : n = start and start < end }"), BasicSet("{ [i2] : i2 = 0 }"), BasicSet("{ [i0] : 0 <= i0 <= 3 }"), BasicSet("{ [i1] : 0 <= i1 <= 2 }"), BasicSet("{ [i3] : i3 = 0 }"), BasicSet("{ [i4] : 0 <= i4 <= 3 }"), BasicSet("{ [i5] : 0 <= i5 <= 2 }")], instructions=[CallInstruction(assignees=(), conflicts_with_groups=frozenset(), depends_on_is_final=True, expression=Call(Variable('to_reference_coords_kernel'), (Variable('farg0'), Variable('farg1'), Variable('farg2'), SubArrayRef((Variable('i2'), Variable('i0'), Variable('i1')), Subscript(Variable('t0'), (Variable('i2'), Variable('i0'), Variable('i1')))))), groups=frozenset(), happens_after=immutabledict({'statement0': HappensAfter(variable_name=None, instances_rel=None)}), id='statement1', no_sync_with=frozenset(), predicates=frozenset(), priority=0, tags=frozenset(), temp_var_types=(), within_inames=frozenset({'n'}), within_inames_is_final=True), Assignment(assignee=Subscript(Variable('t0'), (Variable('i3'), Variable('i4'), Variable('i5'))), atomicity=(), conflicts_with_groups=frozenset(), depends_on_is_final=True, expression=Subscript(Variable('dat0'), (Subscript(Variable('map0'), (Variable('n'), Variable('i4'))), Variable('i5'))), groups=frozenset(), happens_after=immutabledict({}), id='statement0', no_sync_with=frozenset(), predicates=frozenset(), priority=0, tags=frozenset(), temp_var_type=Optional(), within_inames=frozenset({'n', 'i3', 'i5', 'i4'}), within_inames_is_final=True)], args=[<farg0: ValueArg, type: <loopy.types.OpaqueType object at 0x7f254bcd7410>>, <farg1: ValueArg, type: <loopy.types.OpaqueType object at 0x7f254bcd7440>>, <farg2: ValueArg, type: <loopy.types.OpaqueType object at 0x7f254bcd6960>>, <start: ValueArg, type: np:dtype('int32')>, <end: ValueArg, type: np:dtype('int32')>, <dat0: type: np:dtype('float64'), shape: (None, 3), dim_tags: (N1:stride:3, N0:stride:1) in aspace: global>, <map0: type: np:dtype('int32'), shape: (None, 4), dim_tags: (N1:stride:4, N0:stride:1) in aspace: global>], assumptions=BasicSet("[end, start] -> { : 0 <= start < end }"), temporary_variables={'t0': <t0: type: np:dtype('float64'), shape: (1, 4, 3), dim_tags: (N2:stride:12, N1:stride:3, N0:stride:1) aspace: auto>}, inames={'i2': Iname(name='i2', tags=frozenset()), 'n': Iname(name='n', tags=frozenset()), 'i3': Iname(name='i3', tags=frozenset()), 'i0': Iname(name='i0', tags=frozenset()), 'i5': Iname(name='i5', tags=frozenset()), 'i1': Iname(name='i1', tags=frozenset()), 'i4': Iname(name='i4', tags=frozenset())}, substitutions={}, options=Options(allow_fp_reordering=True, allow_terminal_colors=True, annotate_inames=False, build_options=[], check_dep_resolution=True, cl_exec_manage_array_events=True, disable_global_barriers=False, edit_code=False, enforce_array_accesses_within_bounds=True, enforce_variable_access_ordered=True, insert_gbarriers=False, no_numpy=False, return_dict=False, skip_arg_checks=False, trace_assignment_values=False, trace_assignments=False, write_code=False, write_wrapper=False), target=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, tags=frozenset(), state=<KernelState.INITIAL: 0>, name='wrap_to_reference_coords', preambles=(), preamble_generators=(_PreambleGen(preamble='#include <complex.h>\n#include <math.h>\n#include <petsc.h>\n'),), symbol_manglers=[<function symbol_mangler at 0x7f2577675a80>], linearization=None, iname_slab_increments=immutables.Map({}), loop_priority=frozenset(), applied_iname_rewrites=(), index_dtype=np:dtype('int32'), silenced_warnings=[], overridden_get_grid_sizes_for_insn_ids=None)), 'to_reference_coords_kernel': PyOP2KernelCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='to_reference_coords_kernel', name_in_target=None)}), target=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:752: NoSuchEntryError
During handling of the above exception, another exception occurred:
parentmesh = Mesh(VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3), 161)
vertexcoords = array([[0.59762701, 0.93037873, 0.70552675]])
vfs = ('N2curl', 2, <cyfunction FunctionSpace at 0x7f25775b0040>)
def test_vector_function_interpolation(parentmesh, vertexcoords, vfs):
if parentmesh.name == "immersedsphere":
vertexcoords = immersed_sphere_vertexcoords(parentmesh, vertexcoords)
vfs_fam, vfs_deg, vfs_typ = vfs
> vm = VertexOnlyMesh(parentmesh, vertexcoords, missing_points_behaviour=None)
tests/firedrake/vertexonly/test_interpolation_from_parent.py:218:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
firedrake/mesh.py:3364: in VertexOnlyMesh
swarm, input_ordering_swarm, n_missing_points = _pic_swarm_in_mesh(
firedrake/mesh.py:3585: in _pic_swarm_in_mesh
) = _parent_mesh_embedding(
firedrake/mesh.py:4151: in _parent_mesh_embedding
) = parent_mesh.locate_cells_ref_coords_and_dists(coords_global, tolerance)
firedrake/mesh.py:2633: in locate_cells_ref_coords_and_dists
self._c_locator(tolerance=tolerance)(self.coordinates._ctypes,
firedrake/mesh.py:2654: in _c_locator
src = pq_utils.src_locate_cell(self, tolerance=tolerance)
firedrake/pointquery_utils.py:39: in src_locate_cell
src.append(make_wrapper(mesh.coordinates,
firedrake/pointquery_utils.py:33: in make_wrapper
return generate_single_cell_wrapper(function.cell_set, args, **kwargs)
pyop2/parloop.py:797: in generate_single_cell_wrapper
code = lp.generate_code_v2(wrapper)
../firedrake_venv/src/loopy/loopy/codegen/__init__.py:616: in generate_code_v2
t_unit = preprocess_program(t_unit)
../firedrake_venv/src/loopy/loopy/tools.py:893: in wrapper
result = func(*args, **kwargs)
../firedrake_venv/src/loopy/loopy/preprocess.py:827: in preprocess_program
t_unit = infer_unknown_types(t_unit, expect_completion=False)
../firedrake_venv/src/loopy/loopy/type_inference.py:1061: in infer_unknown_types
new_callable, clbl_inf_ctx = t_unit.callables_table[e].with_types(
../firedrake_venv/src/loopy/loopy/kernel/function_interface.py:761: in with_types
infer_unknown_types_for_a_single_kernel(
../firedrake_venv/src/loopy/loopy/type_inference.py:994: in infer_unknown_types_for_a_single_kernel
type_inf_mapper(insn.expression,
../firedrake_venv/src/loopy/loopy/type_inference.py:211: in __call__
result = super().__call__(
../firedrake_venv/lib/python3.12/site-packages/pymbolic/mapper/__init__.py:436: in __call__
result = method(expr, *args, **kwargs)
../firedrake_venv/src/loopy/loopy/type_inference.py:443: in map_call
.with_types(arg_id_to_dtype,
pyop2/codegen/rep2loopy.py:223: in with_types
return self.copy(
../firedrake_venv/src/loopy/loopy/kernel/function_interface.py:372: in copy
return replace(self, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = PyOP2KernelCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='to_reference_coords_kernel', name_in_target=None)
changes = {'arg_id_to_descr': None, 'arg_id_to_dtype': {0: <loopy.types.OpaqueType object at 0x7f254bcd7410>, 1: <loopy.types.Op...cd6960>, 3: np:dtype('float64')}, 'name': 'to_reference_coords_kernel', 'name_in_target': 'to_reference_coords_kernel'}
f = Field(name='name_in_target',type='str | None',default=<dataclasses._MISSING_TYPE object at 0x7f2599ddf5f0>,default_fac... 0x7f2599ddf5f0>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD)
def replace(obj, /, **changes):
"""Return a new object replacing specified fields with new values.
This is especially useful for frozen classes. Example usage::
@dataclass(frozen=True)
class C:
x: int
y: int
c = C(1, 2)
c1 = replace(c, x=3)
assert c1.x == 3 and c1.y == 2
"""
# We're going to mutate 'changes', but that's okay because it's a
# new dict, even if called with 'replace(obj, **my_changes)'.
if not _is_dataclass_instance(obj):
raise TypeError("replace() should be called on dataclass instances")
# It's an error to have init=False fields in 'changes'.
# If a field is not in 'changes', read its value from the provided obj.
for f in getattr(obj, _FIELDS).values():
# Only consider normal fields or InitVars.
if f._field_type is _FIELD_CLASSVAR:
continue
if not f.init:
# Error if this field is specified in changes.
if f.name in changes:
raise ValueError(f'field {f.name} is declared with '
'init=False, it cannot be specified with '
'replace()')
continue
if f.name not in changes:
if f._field_type is _FIELD_INITVAR and f.default is MISSING:
raise ValueError(f"InitVar {f.name!r} "
'must be specified with replace()')
changes[f.name] = getattr(obj, f.name)
# Create the new object, which calls __init__() and
# __post_init__() (if defined), using all of the init fields we've
# added and/or left in 'changes'. If there are values supplied in
# changes that aren't fields, this will correctly raise a
# TypeError.
> return obj.__class__(**changes)
E TypeError: PyOP2KernelCallable.__init__() missing 1 required positional argument: 'parameters'
/usr/lib/python3.12/dataclasses.py:1581: TypeError
Check failure on line 218 in tests/firedrake/vertexonly/test_interpolation_from_parent.py
github-actions / Firedrake real
test_interpolation_from_parent.test_vector_function_interpolation[cube-mesh-1-coords-FunctionSpace(N1div2)]
TypeError: PyOP2KernelCallable.__init__() missing 1 required positional argument: 'parameters'
Raw output
self = Mesh(VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3), 164)
tolerance = 0.5
def _c_locator(self, tolerance=None):
from pyop2 import compilation
from pyop2.utils import get_petsc_dir
import firedrake.function as function
import firedrake.pointquery_utils as pq_utils
cache = self.__dict__.setdefault("_c_locator_cache", {})
try:
> return cache[tolerance]
E KeyError: 0.5
firedrake/mesh.py:2651: KeyError
During handling of the above exception, another exception occurred:
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=125)
key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
def fetch(self, key: K) -> V:
keyhash = self.key_builder(key)
try:
> stored_key, value = self._fetch(keyhash)
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:750:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=125)
keyhash = 'd1d95918a1efeba628f9ed0db75eac691ef71788cea69537df3016c77227a261'
def _fetch_uncached(self, keyhash: str) -> tuple[K, V]:
# This method is separate from fetch() to allow for LRU caching
def fetch_inner() -> tuple[Any] | None:
assert self.conn is not None
# This is separate from fetch() so that the mutex covers the
# fetchone() call
c = self.conn.execute("SELECT key_value FROM dict WHERE keyhash=?",
(keyhash,))
res = c.fetchone()
assert res is None or isinstance(res, tuple)
return res
row = self._exec_sql_fn(fetch_inner)
if row is None:
> raise KeyError
E KeyError
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:741: KeyError
The above exception was the direct cause of the following exception:
args = (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCallable(arg_id_to_dtype=None, arg_id_to_descr=N...et=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),)
kwargs = {}, CACHING_ENABLED = True
cache_key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
proc_log_str = "preprocess_program on 'wrap_to_reference_coords'"
entrypoints_str = 'wrap_to_reference_coords'
@wraps(func)
def wrapper(*args, **kwargs):
from loopy import CACHING_ENABLED
if (not CACHING_ENABLED
or kwargs.pop("_no_memoize_on_disk", False)):
return func(*args, **kwargs)
cache_key = (func.__qualname__, func.__name__, args, kwargs)
try:
> result = transform_cache[cache_key]
../firedrake_venv/src/loopy/loopy/tools.py:877:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:597: in __getitem__
return self.fetch(key)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=125)
key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
def fetch(self, key: K) -> V:
keyhash = self.key_builder(key)
try:
stored_key, value = self._fetch(keyhash)
except KeyError as err:
> raise NoSuchEntryError(key) from err
E pytools.persistent_dict.NoSuchEntryError: ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='MatSetValues', name_in_target=None), 'wrap_to_reference_coords': CallableKernel(arg_id_to_dtype=None, arg_id_to_descr=None, subkernel=LoopKernel(domains=[BasicSet("[end, start] -> { [n] : n = start and start < end }"), BasicSet("{ [i2] : i2 = 0 }"), BasicSet("{ [i0] : 0 <= i0 <= 3 }"), BasicSet("{ [i1] : 0 <= i1 <= 2 }"), BasicSet("{ [i3] : i3 = 0 }"), BasicSet("{ [i4] : 0 <= i4 <= 3 }"), BasicSet("{ [i5] : 0 <= i5 <= 2 }")], instructions=[CallInstruction(assignees=(), conflicts_with_groups=frozenset(), depends_on_is_final=True, expression=Call(Variable('to_reference_coords_kernel'), (Variable('farg0'), Variable('farg1'), Variable('farg2'), SubArrayRef((Variable('i2'), Variable('i0'), Variable('i1')), Subscript(Variable('t0'), (Variable('i2'), Variable('i0'), Variable('i1')))))), groups=frozenset(), happens_after=immutabledict({'statement0': HappensAfter(variable_name=None, instances_rel=None)}), id='statement1', no_sync_with=frozenset(), predicates=frozenset(), priority=0, tags=frozenset(), temp_var_types=(), within_inames=frozenset({'n'}), within_inames_is_final=True), Assignment(assignee=Subscript(Variable('t0'), (Variable('i3'), Variable('i4'), Variable('i5'))), atomicity=(), conflicts_with_groups=frozenset(), depends_on_is_final=True, expression=Subscript(Variable('dat0'), (Subscript(Variable('map0'), (Variable('n'), Variable('i4'))), Variable('i5'))), groups=frozenset(), happens_after=immutabledict({}), id='statement0', no_sync_with=frozenset(), predicates=frozenset(), priority=0, tags=frozenset(), temp_var_type=Optional(), within_inames=frozenset({'n', 'i3', 'i5', 'i4'}), within_inames_is_final=True)], args=[<farg0: ValueArg, type: <loopy.types.OpaqueType object at 0x7f254ab0a870>>, <farg1: ValueArg, type: <loopy.types.OpaqueType object at 0x7f254ab0bce0>>, <farg2: ValueArg, type: <loopy.types.OpaqueType object at 0x7f254ab0b200>>, <start: ValueArg, type: np:dtype('int32')>, <end: ValueArg, type: np:dtype('int32')>, <dat0: type: np:dtype('float64'), shape: (None, 3), dim_tags: (N1:stride:3, N0:stride:1) in aspace: global>, <map0: type: np:dtype('int32'), shape: (None, 4), dim_tags: (N1:stride:4, N0:stride:1) in aspace: global>], assumptions=BasicSet("[end, start] -> { : 0 <= start < end }"), temporary_variables={'t0': <t0: type: np:dtype('float64'), shape: (1, 4, 3), dim_tags: (N2:stride:12, N1:stride:3, N0:stride:1) aspace: auto>}, inames={'i2': Iname(name='i2', tags=frozenset()), 'n': Iname(name='n', tags=frozenset()), 'i3': Iname(name='i3', tags=frozenset()), 'i0': Iname(name='i0', tags=frozenset()), 'i5': Iname(name='i5', tags=frozenset()), 'i1': Iname(name='i1', tags=frozenset()), 'i4': Iname(name='i4', tags=frozenset())}, substitutions={}, options=Options(allow_fp_reordering=True, allow_terminal_colors=True, annotate_inames=False, build_options=[], check_dep_resolution=True, cl_exec_manage_array_events=True, disable_global_barriers=False, edit_code=False, enforce_array_accesses_within_bounds=True, enforce_variable_access_ordered=True, insert_gbarriers=False, no_numpy=False, return_dict=False, skip_arg_checks=False, trace_assignment_values=False, trace_assignments=False, write_code=False, write_wrapper=False), target=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, tags=frozenset(), state=<KernelState.INITIAL: 0>, name='wrap_to_reference_coords', preambles=(), preamble_generators=(_PreambleGen(preamble='#include <complex.h>\n#include <math.h>\n#include <petsc.h>\n'),), symbol_manglers=[<function symbol_mangler at 0x7f2577675a80>], linearization=None, iname_slab_increments=immutables.Map({}), loop_priority=frozenset(), applied_iname_rewrites=(), index_dtype=np:dtype('int32'), silenced_warnings=[], overridden_get_grid_sizes_for_insn_ids=None)), 'to_reference_coords_kernel': PyOP2KernelCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='to_reference_coords_kernel', name_in_target=None)}), target=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:752: NoSuchEntryError
During handling of the above exception, another exception occurred:
parentmesh = Mesh(VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3), 164)
vertexcoords = array([[0.59762701, 0.93037873, 0.70552675]])
vfs = ('N1div', 2, <cyfunction FunctionSpace at 0x7f25775b0040>)
def test_vector_function_interpolation(parentmesh, vertexcoords, vfs):
if parentmesh.name == "immersedsphere":
vertexcoords = immersed_sphere_vertexcoords(parentmesh, vertexcoords)
vfs_fam, vfs_deg, vfs_typ = vfs
> vm = VertexOnlyMesh(parentmesh, vertexcoords, missing_points_behaviour=None)
tests/firedrake/vertexonly/test_interpolation_from_parent.py:218:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
firedrake/mesh.py:3364: in VertexOnlyMesh
swarm, input_ordering_swarm, n_missing_points = _pic_swarm_in_mesh(
firedrake/mesh.py:3585: in _pic_swarm_in_mesh
) = _parent_mesh_embedding(
firedrake/mesh.py:4151: in _parent_mesh_embedding
) = parent_mesh.locate_cells_ref_coords_and_dists(coords_global, tolerance)
firedrake/mesh.py:2633: in locate_cells_ref_coords_and_dists
self._c_locator(tolerance=tolerance)(self.coordinates._ctypes,
firedrake/mesh.py:2654: in _c_locator
src = pq_utils.src_locate_cell(self, tolerance=tolerance)
firedrake/pointquery_utils.py:39: in src_locate_cell
src.append(make_wrapper(mesh.coordinates,
firedrake/pointquery_utils.py:33: in make_wrapper
return generate_single_cell_wrapper(function.cell_set, args, **kwargs)
pyop2/parloop.py:797: in generate_single_cell_wrapper
code = lp.generate_code_v2(wrapper)
../firedrake_venv/src/loopy/loopy/codegen/__init__.py:616: in generate_code_v2
t_unit = preprocess_program(t_unit)
../firedrake_venv/src/loopy/loopy/tools.py:893: in wrapper
result = func(*args, **kwargs)
../firedrake_venv/src/loopy/loopy/preprocess.py:827: in preprocess_program
t_unit = infer_unknown_types(t_unit, expect_completion=False)
../firedrake_venv/src/loopy/loopy/type_inference.py:1061: in infer_unknown_types
new_callable, clbl_inf_ctx = t_unit.callables_table[e].with_types(
../firedrake_venv/src/loopy/loopy/kernel/function_interface.py:761: in with_types
infer_unknown_types_for_a_single_kernel(
../firedrake_venv/src/loopy/loopy/type_inference.py:994: in infer_unknown_types_for_a_single_kernel
type_inf_mapper(insn.expression,
../firedrake_venv/src/loopy/loopy/type_inference.py:211: in __call__
result = super().__call__(
../firedrake_venv/lib/python3.12/site-packages/pymbolic/mapper/__init__.py:436: in __call__
result = method(expr, *args, **kwargs)
../firedrake_venv/src/loopy/loopy/type_inference.py:443: in map_call
.with_types(arg_id_to_dtype,
pyop2/codegen/rep2loopy.py:223: in with_types
return self.copy(
../firedrake_venv/src/loopy/loopy/kernel/function_interface.py:372: in copy
return replace(self, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = PyOP2KernelCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='to_reference_coords_kernel', name_in_target=None)
changes = {'arg_id_to_descr': None, 'arg_id_to_dtype': {0: <loopy.types.OpaqueType object at 0x7f254ab0a870>, 1: <loopy.types.Op...b0b200>, 3: np:dtype('float64')}, 'name': 'to_reference_coords_kernel', 'name_in_target': 'to_reference_coords_kernel'}
f = Field(name='name_in_target',type='str | None',default=<dataclasses._MISSING_TYPE object at 0x7f2599ddf5f0>,default_fac... 0x7f2599ddf5f0>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD)
def replace(obj, /, **changes):
"""Return a new object replacing specified fields with new values.
This is especially useful for frozen classes. Example usage::
@dataclass(frozen=True)
class C:
x: int
y: int
c = C(1, 2)
c1 = replace(c, x=3)
assert c1.x == 3 and c1.y == 2
"""
# We're going to mutate 'changes', but that's okay because it's a
# new dict, even if called with 'replace(obj, **my_changes)'.
if not _is_dataclass_instance(obj):
raise TypeError("replace() should be called on dataclass instances")
# It's an error to have init=False fields in 'changes'.
# If a field is not in 'changes', read its value from the provided obj.
for f in getattr(obj, _FIELDS).values():
# Only consider normal fields or InitVars.
if f._field_type is _FIELD_CLASSVAR:
continue
if not f.init:
# Error if this field is specified in changes.
if f.name in changes:
raise ValueError(f'field {f.name} is declared with '
'init=False, it cannot be specified with '
'replace()')
continue
if f.name not in changes:
if f._field_type is _FIELD_INITVAR and f.default is MISSING:
raise ValueError(f"InitVar {f.name!r} "
'must be specified with replace()')
changes[f.name] = getattr(obj, f.name)
# Create the new object, which calls __init__() and
# __post_init__() (if defined), using all of the init fields we've
# added and/or left in 'changes'. If there are values supplied in
# changes that aren't fields, this will correctly raise a
# TypeError.
> return obj.__class__(**changes)
E TypeError: PyOP2KernelCallable.__init__() missing 1 required positional argument: 'parameters'
/usr/lib/python3.12/dataclasses.py:1581: TypeError
Check failure on line 218 in tests/firedrake/vertexonly/test_interpolation_from_parent.py
github-actions / Firedrake real
test_interpolation_from_parent.test_vector_function_interpolation[cube-mesh-1-coords-FunctionSpace(N2div2)]
TypeError: PyOP2KernelCallable.__init__() missing 1 required positional argument: 'parameters'
Raw output
self = Mesh(VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3), 167)
tolerance = 0.5
def _c_locator(self, tolerance=None):
from pyop2 import compilation
from pyop2.utils import get_petsc_dir
import firedrake.function as function
import firedrake.pointquery_utils as pq_utils
cache = self.__dict__.setdefault("_c_locator_cache", {})
try:
> return cache[tolerance]
E KeyError: 0.5
firedrake/mesh.py:2651: KeyError
During handling of the above exception, another exception occurred:
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=129)
key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
def fetch(self, key: K) -> V:
keyhash = self.key_builder(key)
try:
> stored_key, value = self._fetch(keyhash)
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:750:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=129)
keyhash = 'd1d95918a1efeba628f9ed0db75eac691ef71788cea69537df3016c77227a261'
def _fetch_uncached(self, keyhash: str) -> tuple[K, V]:
# This method is separate from fetch() to allow for LRU caching
def fetch_inner() -> tuple[Any] | None:
assert self.conn is not None
# This is separate from fetch() so that the mutex covers the
# fetchone() call
c = self.conn.execute("SELECT key_value FROM dict WHERE keyhash=?",
(keyhash,))
res = c.fetchone()
assert res is None or isinstance(res, tuple)
return res
row = self._exec_sql_fn(fetch_inner)
if row is None:
> raise KeyError
E KeyError
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:741: KeyError
The above exception was the direct cause of the following exception:
args = (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCallable(arg_id_to_dtype=None, arg_id_to_descr=N...et=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),)
kwargs = {}, CACHING_ENABLED = True
cache_key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
proc_log_str = "preprocess_program on 'wrap_to_reference_coords'"
entrypoints_str = 'wrap_to_reference_coords'
@wraps(func)
def wrapper(*args, **kwargs):
from loopy import CACHING_ENABLED
if (not CACHING_ENABLED
or kwargs.pop("_no_memoize_on_disk", False)):
return func(*args, **kwargs)
cache_key = (func.__qualname__, func.__name__, args, kwargs)
try:
> result = transform_cache[cache_key]
../firedrake_venv/src/loopy/loopy/tools.py:877:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:597: in __getitem__
return self.fetch(key)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=129)
key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
def fetch(self, key: K) -> V:
keyhash = self.key_builder(key)
try:
stored_key, value = self._fetch(keyhash)
except KeyError as err:
> raise NoSuchEntryError(key) from err
E pytools.persistent_dict.NoSuchEntryError: ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='MatSetValues', name_in_target=None), 'wrap_to_reference_coords': CallableKernel(arg_id_to_dtype=None, arg_id_to_descr=None, subkernel=LoopKernel(domains=[BasicSet("[end, start] -> { [n] : n = start and start < end }"), BasicSet("{ [i2] : i2 = 0 }"), BasicSet("{ [i0] : 0 <= i0 <= 3 }"), BasicSet("{ [i1] : 0 <= i1 <= 2 }"), BasicSet("{ [i3] : i3 = 0 }"), BasicSet("{ [i4] : 0 <= i4 <= 3 }"), BasicSet("{ [i5] : 0 <= i5 <= 2 }")], instructions=[CallInstruction(assignees=(), conflicts_with_groups=frozenset(), depends_on_is_final=True, expression=Call(Variable('to_reference_coords_kernel'), (Variable('farg0'), Variable('farg1'), Variable('farg2'), SubArrayRef((Variable('i2'), Variable('i0'), Variable('i1')), Subscript(Variable('t0'), (Variable('i2'), Variable('i0'), Variable('i1')))))), groups=frozenset(), happens_after=immutabledict({'statement0': HappensAfter(variable_name=None, instances_rel=None)}), id='statement1', no_sync_with=frozenset(), predicates=frozenset(), priority=0, tags=frozenset(), temp_var_types=(), within_inames=frozenset({'n'}), within_inames_is_final=True), Assignment(assignee=Subscript(Variable('t0'), (Variable('i3'), Variable('i4'), Variable('i5'))), atomicity=(), conflicts_with_groups=frozenset(), depends_on_is_final=True, expression=Subscript(Variable('dat0'), (Subscript(Variable('map0'), (Variable('n'), Variable('i4'))), Variable('i5'))), groups=frozenset(), happens_after=immutabledict({}), id='statement0', no_sync_with=frozenset(), predicates=frozenset(), priority=0, tags=frozenset(), temp_var_type=Optional(), within_inames=frozenset({'n', 'i3', 'i5', 'i4'}), within_inames_is_final=True)], args=[<farg0: ValueArg, type: <loopy.types.OpaqueType object at 0x7f254ab891c0>>, <farg1: ValueArg, type: <loopy.types.OpaqueType object at 0x7f254ab8bbc0>>, <farg2: ValueArg, type: <loopy.types.OpaqueType object at 0x7f254ab8a120>>, <start: ValueArg, type: np:dtype('int32')>, <end: ValueArg, type: np:dtype('int32')>, <dat0: type: np:dtype('float64'), shape: (None, 3), dim_tags: (N1:stride:3, N0:stride:1) in aspace: global>, <map0: type: np:dtype('int32'), shape: (None, 4), dim_tags: (N1:stride:4, N0:stride:1) in aspace: global>], assumptions=BasicSet("[end, start] -> { : 0 <= start < end }"), temporary_variables={'t0': <t0: type: np:dtype('float64'), shape: (1, 4, 3), dim_tags: (N2:stride:12, N1:stride:3, N0:stride:1) aspace: auto>}, inames={'i2': Iname(name='i2', tags=frozenset()), 'n': Iname(name='n', tags=frozenset()), 'i3': Iname(name='i3', tags=frozenset()), 'i0': Iname(name='i0', tags=frozenset()), 'i5': Iname(name='i5', tags=frozenset()), 'i1': Iname(name='i1', tags=frozenset()), 'i4': Iname(name='i4', tags=frozenset())}, substitutions={}, options=Options(allow_fp_reordering=True, allow_terminal_colors=True, annotate_inames=False, build_options=[], check_dep_resolution=True, cl_exec_manage_array_events=True, disable_global_barriers=False, edit_code=False, enforce_array_accesses_within_bounds=True, enforce_variable_access_ordered=True, insert_gbarriers=False, no_numpy=False, return_dict=False, skip_arg_checks=False, trace_assignment_values=False, trace_assignments=False, write_code=False, write_wrapper=False), target=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, tags=frozenset(), state=<KernelState.INITIAL: 0>, name='wrap_to_reference_coords', preambles=(), preamble_generators=(_PreambleGen(preamble='#include <complex.h>\n#include <math.h>\n#include <petsc.h>\n'),), symbol_manglers=[<function symbol_mangler at 0x7f2577675a80>], linearization=None, iname_slab_increments=immutables.Map({}), loop_priority=frozenset(), applied_iname_rewrites=(), index_dtype=np:dtype('int32'), silenced_warnings=[], overridden_get_grid_sizes_for_insn_ids=None)), 'to_reference_coords_kernel': PyOP2KernelCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='to_reference_coords_kernel', name_in_target=None)}), target=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:752: NoSuchEntryError
During handling of the above exception, another exception occurred:
parentmesh = Mesh(VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3), 167)
vertexcoords = array([[0.59762701, 0.93037873, 0.70552675]])
vfs = ('N2div', 2, <cyfunction FunctionSpace at 0x7f25775b0040>)
def test_vector_function_interpolation(parentmesh, vertexcoords, vfs):
if parentmesh.name == "immersedsphere":
vertexcoords = immersed_sphere_vertexcoords(parentmesh, vertexcoords)
vfs_fam, vfs_deg, vfs_typ = vfs
> vm = VertexOnlyMesh(parentmesh, vertexcoords, missing_points_behaviour=None)
tests/firedrake/vertexonly/test_interpolation_from_parent.py:218:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
firedrake/mesh.py:3364: in VertexOnlyMesh
swarm, input_ordering_swarm, n_missing_points = _pic_swarm_in_mesh(
firedrake/mesh.py:3585: in _pic_swarm_in_mesh
) = _parent_mesh_embedding(
firedrake/mesh.py:4151: in _parent_mesh_embedding
) = parent_mesh.locate_cells_ref_coords_and_dists(coords_global, tolerance)
firedrake/mesh.py:2633: in locate_cells_ref_coords_and_dists
self._c_locator(tolerance=tolerance)(self.coordinates._ctypes,
firedrake/mesh.py:2654: in _c_locator
src = pq_utils.src_locate_cell(self, tolerance=tolerance)
firedrake/pointquery_utils.py:39: in src_locate_cell
src.append(make_wrapper(mesh.coordinates,
firedrake/pointquery_utils.py:33: in make_wrapper
return generate_single_cell_wrapper(function.cell_set, args, **kwargs)
pyop2/parloop.py:797: in generate_single_cell_wrapper
code = lp.generate_code_v2(wrapper)
../firedrake_venv/src/loopy/loopy/codegen/__init__.py:616: in generate_code_v2
t_unit = preprocess_program(t_unit)
../firedrake_venv/src/loopy/loopy/tools.py:893: in wrapper
result = func(*args, **kwargs)
../firedrake_venv/src/loopy/loopy/preprocess.py:827: in preprocess_program
t_unit = infer_unknown_types(t_unit, expect_completion=False)
../firedrake_venv/src/loopy/loopy/type_inference.py:1061: in infer_unknown_types
new_callable, clbl_inf_ctx = t_unit.callables_table[e].with_types(
../firedrake_venv/src/loopy/loopy/kernel/function_interface.py:761: in with_types
infer_unknown_types_for_a_single_kernel(
../firedrake_venv/src/loopy/loopy/type_inference.py:994: in infer_unknown_types_for_a_single_kernel
type_inf_mapper(insn.expression,
../firedrake_venv/src/loopy/loopy/type_inference.py:211: in __call__
result = super().__call__(
../firedrake_venv/lib/python3.12/site-packages/pymbolic/mapper/__init__.py:436: in __call__
result = method(expr, *args, **kwargs)
../firedrake_venv/src/loopy/loopy/type_inference.py:443: in map_call
.with_types(arg_id_to_dtype,
pyop2/codegen/rep2loopy.py:223: in with_types
return self.copy(
../firedrake_venv/src/loopy/loopy/kernel/function_interface.py:372: in copy
return replace(self, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = PyOP2KernelCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='to_reference_coords_kernel', name_in_target=None)
changes = {'arg_id_to_descr': None, 'arg_id_to_dtype': {0: <loopy.types.OpaqueType object at 0x7f254ab891c0>, 1: <loopy.types.Op...b8a120>, 3: np:dtype('float64')}, 'name': 'to_reference_coords_kernel', 'name_in_target': 'to_reference_coords_kernel'}
f = Field(name='name_in_target',type='str | None',default=<dataclasses._MISSING_TYPE object at 0x7f2599ddf5f0>,default_fac... 0x7f2599ddf5f0>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD)
def replace(obj, /, **changes):
"""Return a new object replacing specified fields with new values.
This is especially useful for frozen classes. Example usage::
@dataclass(frozen=True)
class C:
x: int
y: int
c = C(1, 2)
c1 = replace(c, x=3)
assert c1.x == 3 and c1.y == 2
"""
# We're going to mutate 'changes', but that's okay because it's a
# new dict, even if called with 'replace(obj, **my_changes)'.
if not _is_dataclass_instance(obj):
raise TypeError("replace() should be called on dataclass instances")
# It's an error to have init=False fields in 'changes'.
# If a field is not in 'changes', read its value from the provided obj.
for f in getattr(obj, _FIELDS).values():
# Only consider normal fields or InitVars.
if f._field_type is _FIELD_CLASSVAR:
continue
if not f.init:
# Error if this field is specified in changes.
if f.name in changes:
raise ValueError(f'field {f.name} is declared with '
'init=False, it cannot be specified with '
'replace()')
continue
if f.name not in changes:
if f._field_type is _FIELD_INITVAR and f.default is MISSING:
raise ValueError(f"InitVar {f.name!r} "
'must be specified with replace()')
changes[f.name] = getattr(obj, f.name)
# Create the new object, which calls __init__() and
# __post_init__() (if defined), using all of the init fields we've
# added and/or left in 'changes'. If there are values supplied in
# changes that aren't fields, this will correctly raise a
# TypeError.
> return obj.__class__(**changes)
E TypeError: PyOP2KernelCallable.__init__() missing 1 required positional argument: 'parameters'
/usr/lib/python3.12/dataclasses.py:1581: TypeError
Check failure on line 218 in tests/firedrake/vertexonly/test_interpolation_from_parent.py
github-actions / Firedrake real
test_interpolation_from_parent.test_vector_function_interpolation[cube-mesh-100-coords-VectorFunctionSpace(CG2)]
TypeError: PyOP2KernelCallable.__init__() missing 1 required positional argument: 'parameters'
Raw output
self = Mesh(VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3), 172)
tolerance = 0.5
def _c_locator(self, tolerance=None):
from pyop2 import compilation
from pyop2.utils import get_petsc_dir
import firedrake.function as function
import firedrake.pointquery_utils as pq_utils
cache = self.__dict__.setdefault("_c_locator_cache", {})
try:
> return cache[tolerance]
E KeyError: 0.5
firedrake/mesh.py:2651: KeyError
During handling of the above exception, another exception occurred:
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=136)
key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
def fetch(self, key: K) -> V:
keyhash = self.key_builder(key)
try:
> stored_key, value = self._fetch(keyhash)
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:750:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=136)
keyhash = 'd1d95918a1efeba628f9ed0db75eac691ef71788cea69537df3016c77227a261'
def _fetch_uncached(self, keyhash: str) -> tuple[K, V]:
# This method is separate from fetch() to allow for LRU caching
def fetch_inner() -> tuple[Any] | None:
assert self.conn is not None
# This is separate from fetch() so that the mutex covers the
# fetchone() call
c = self.conn.execute("SELECT key_value FROM dict WHERE keyhash=?",
(keyhash,))
res = c.fetchone()
assert res is None or isinstance(res, tuple)
return res
row = self._exec_sql_fn(fetch_inner)
if row is None:
> raise KeyError
E KeyError
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:741: KeyError
The above exception was the direct cause of the following exception:
args = (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCallable(arg_id_to_dtype=None, arg_id_to_descr=N...et=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),)
kwargs = {}, CACHING_ENABLED = True
cache_key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
proc_log_str = "preprocess_program on 'wrap_to_reference_coords'"
entrypoints_str = 'wrap_to_reference_coords'
@wraps(func)
def wrapper(*args, **kwargs):
from loopy import CACHING_ENABLED
if (not CACHING_ENABLED
or kwargs.pop("_no_memoize_on_disk", False)):
return func(*args, **kwargs)
cache_key = (func.__qualname__, func.__name__, args, kwargs)
try:
> result = transform_cache[cache_key]
../firedrake_venv/src/loopy/loopy/tools.py:877:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:597: in __getitem__
return self.fetch(key)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=136)
key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
def fetch(self, key: K) -> V:
keyhash = self.key_builder(key)
try:
stored_key, value = self._fetch(keyhash)
except KeyError as err:
> raise NoSuchEntryError(key) from err
E pytools.persistent_dict.NoSuchEntryError: ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='MatSetValues', name_in_target=None), 'wrap_to_reference_coords': CallableKernel(arg_id_to_dtype=None, arg_id_to_descr=None, subkernel=LoopKernel(domains=[BasicSet("[end, start] -> { [n] : n = start and start < end }"), BasicSet("{ [i2] : i2 = 0 }"), BasicSet("{ [i0] : 0 <= i0 <= 3 }"), BasicSet("{ [i1] : 0 <= i1 <= 2 }"), BasicSet("{ [i3] : i3 = 0 }"), BasicSet("{ [i4] : 0 <= i4 <= 3 }"), BasicSet("{ [i5] : 0 <= i5 <= 2 }")], instructions=[CallInstruction(assignees=(), conflicts_with_groups=frozenset(), depends_on_is_final=True, expression=Call(Variable('to_reference_coords_kernel'), (Variable('farg0'), Variable('farg1'), Variable('farg2'), SubArrayRef((Variable('i2'), Variable('i0'), Variable('i1')), Subscript(Variable('t0'), (Variable('i2'), Variable('i0'), Variable('i1')))))), groups=frozenset(), happens_after=immutabledict({'statement0': HappensAfter(variable_name=None, instances_rel=None)}), id='statement1', no_sync_with=frozenset(), predicates=frozenset(), priority=0, tags=frozenset(), temp_var_types=(), within_inames=frozenset({'n'}), within_inames_is_final=True), Assignment(assignee=Subscript(Variable('t0'), (Variable('i3'), Variable('i4'), Variable('i5'))), atomicity=(), conflicts_with_groups=frozenset(), depends_on_is_final=True, expression=Subscript(Variable('dat0'), (Subscript(Variable('map0'), (Variable('n'), Variable('i4'))), Variable('i5'))), groups=frozenset(), happens_after=immutabledict({}), id='statement0', no_sync_with=frozenset(), predicates=frozenset(), priority=0, tags=frozenset(), temp_var_type=Optional(), within_inames=frozenset({'n', 'i3', 'i5', 'i4'}), within_inames_is_final=True)], args=[<farg0: ValueArg, type: <loopy.types.OpaqueType object at 0x7f254ab81460>>, <farg1: ValueArg, type: <loopy.types.OpaqueType object at 0x7f254ab83740>>, <farg2: ValueArg, type: <loopy.types.OpaqueType object at 0x7f254ab80f20>>, <start: ValueArg, type: np:dtype('int32')>, <end: ValueArg, type: np:dtype('int32')>, <dat0: type: np:dtype('float64'), shape: (None, 3), dim_tags: (N1:stride:3, N0:stride:1) in aspace: global>, <map0: type: np:dtype('int32'), shape: (None, 4), dim_tags: (N1:stride:4, N0:stride:1) in aspace: global>], assumptions=BasicSet("[end, start] -> { : 0 <= start < end }"), temporary_variables={'t0': <t0: type: np:dtype('float64'), shape: (1, 4, 3), dim_tags: (N2:stride:12, N1:stride:3, N0:stride:1) aspace: auto>}, inames={'i2': Iname(name='i2', tags=frozenset()), 'n': Iname(name='n', tags=frozenset()), 'i3': Iname(name='i3', tags=frozenset()), 'i0': Iname(name='i0', tags=frozenset()), 'i5': Iname(name='i5', tags=frozenset()), 'i1': Iname(name='i1', tags=frozenset()), 'i4': Iname(name='i4', tags=frozenset())}, substitutions={}, options=Options(allow_fp_reordering=True, allow_terminal_colors=True, annotate_inames=False, build_options=[], check_dep_resolution=True, cl_exec_manage_array_events=True, disable_global_barriers=False, edit_code=False, enforce_array_accesses_within_bounds=True, enforce_variable_access_ordered=True, insert_gbarriers=False, no_numpy=False, return_dict=False, skip_arg_checks=False, trace_assignment_values=False, trace_assignments=False, write_code=False, write_wrapper=False), target=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, tags=frozenset(), state=<KernelState.INITIAL: 0>, name='wrap_to_reference_coords', preambles=(), preamble_generators=(_PreambleGen(preamble='#include <complex.h>\n#include <math.h>\n#include <petsc.h>\n'),), symbol_manglers=[<function symbol_mangler at 0x7f2577675a80>], linearization=None, iname_slab_increments=immutables.Map({}), loop_priority=frozenset(), applied_iname_rewrites=(), index_dtype=np:dtype('int32'), silenced_warnings=[], overridden_get_grid_sizes_for_insn_ids=None)), 'to_reference_coords_kernel': PyOP2KernelCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='to_reference_coords_kernel', name_in_target=None)}), target=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:752: NoSuchEntryError
During handling of the above exception, another exception occurred:
parentmesh = Mesh(VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3), 172)
vertexcoords = array([[ 0.59762701, 0.93037873, 0.70552675],
[ 0.58976637, 0.3473096 , 0.79178823],
[ 0.37517442, ...4423547, -0.12030418],
[ 0.52263797, -0.05136594, -0.30431103],
[ 1.22438303, 1.44583898, 1.42166932]])
vfs = ('CG', 2, <cyfunction VectorFunctionSpace at 0x7f25775b01e0>)
def test_vector_function_interpolation(parentmesh, vertexcoords, vfs):
if parentmesh.name == "immersedsphere":
vertexcoords = immersed_sphere_vertexcoords(parentmesh, vertexcoords)
vfs_fam, vfs_deg, vfs_typ = vfs
> vm = VertexOnlyMesh(parentmesh, vertexcoords, missing_points_behaviour=None)
tests/firedrake/vertexonly/test_interpolation_from_parent.py:218:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
firedrake/mesh.py:3364: in VertexOnlyMesh
swarm, input_ordering_swarm, n_missing_points = _pic_swarm_in_mesh(
firedrake/mesh.py:3585: in _pic_swarm_in_mesh
) = _parent_mesh_embedding(
firedrake/mesh.py:4151: in _parent_mesh_embedding
) = parent_mesh.locate_cells_ref_coords_and_dists(coords_global, tolerance)
firedrake/mesh.py:2633: in locate_cells_ref_coords_and_dists
self._c_locator(tolerance=tolerance)(self.coordinates._ctypes,
firedrake/mesh.py:2654: in _c_locator
src = pq_utils.src_locate_cell(self, tolerance=tolerance)
firedrake/pointquery_utils.py:39: in src_locate_cell
src.append(make_wrapper(mesh.coordinates,
firedrake/pointquery_utils.py:33: in make_wrapper
return generate_single_cell_wrapper(function.cell_set, args, **kwargs)
pyop2/parloop.py:797: in generate_single_cell_wrapper
code = lp.generate_code_v2(wrapper)
../firedrake_venv/src/loopy/loopy/codegen/__init__.py:616: in generate_code_v2
t_unit = preprocess_program(t_unit)
../firedrake_venv/src/loopy/loopy/tools.py:893: in wrapper
result = func(*args, **kwargs)
../firedrake_venv/src/loopy/loopy/preprocess.py:827: in preprocess_program
t_unit = infer_unknown_types(t_unit, expect_completion=False)
../firedrake_venv/src/loopy/loopy/type_inference.py:1061: in infer_unknown_types
new_callable, clbl_inf_ctx = t_unit.callables_table[e].with_types(
../firedrake_venv/src/loopy/loopy/kernel/function_interface.py:761: in with_types
infer_unknown_types_for_a_single_kernel(
../firedrake_venv/src/loopy/loopy/type_inference.py:994: in infer_unknown_types_for_a_single_kernel
type_inf_mapper(insn.expression,
../firedrake_venv/src/loopy/loopy/type_inference.py:211: in __call__
result = super().__call__(
../firedrake_venv/lib/python3.12/site-packages/pymbolic/mapper/__init__.py:436: in __call__
result = method(expr, *args, **kwargs)
../firedrake_venv/src/loopy/loopy/type_inference.py:443: in map_call
.with_types(arg_id_to_dtype,
pyop2/codegen/rep2loopy.py:223: in with_types
return self.copy(
../firedrake_venv/src/loopy/loopy/kernel/function_interface.py:372: in copy
return replace(self, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = PyOP2KernelCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='to_reference_coords_kernel', name_in_target=None)
changes = {'arg_id_to_descr': None, 'arg_id_to_dtype': {0: <loopy.types.OpaqueType object at 0x7f254ab81460>, 1: <loopy.types.Op...b80f20>, 3: np:dtype('float64')}, 'name': 'to_reference_coords_kernel', 'name_in_target': 'to_reference_coords_kernel'}
f = Field(name='name_in_target',type='str | None',default=<dataclasses._MISSING_TYPE object at 0x7f2599ddf5f0>,default_fac... 0x7f2599ddf5f0>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD)
def replace(obj, /, **changes):
"""Return a new object replacing specified fields with new values.
This is especially useful for frozen classes. Example usage::
@dataclass(frozen=True)
class C:
x: int
y: int
c = C(1, 2)
c1 = replace(c, x=3)
assert c1.x == 3 and c1.y == 2
"""
# We're going to mutate 'changes', but that's okay because it's a
# new dict, even if called with 'replace(obj, **my_changes)'.
if not _is_dataclass_instance(obj):
raise TypeError("replace() should be called on dataclass instances")
# It's an error to have init=False fields in 'changes'.
# If a field is not in 'changes', read its value from the provided obj.
for f in getattr(obj, _FIELDS).values():
# Only consider normal fields or InitVars.
if f._field_type is _FIELD_CLASSVAR:
continue
if not f.init:
# Error if this field is specified in changes.
if f.name in changes:
raise ValueError(f'field {f.name} is declared with '
'init=False, it cannot be specified with '
'replace()')
continue
if f.name not in changes:
if f._field_type is _FIELD_INITVAR and f.default is MISSING:
raise ValueError(f"InitVar {f.name!r} "
'must be specified with replace()')
changes[f.name] = getattr(obj, f.name)
# Create the new object, which calls __init__() and
# __post_init__() (if defined), using all of the init fields we've
# added and/or left in 'changes'. If there are values supplied in
# changes that aren't fields, this will correctly raise a
# TypeError.
> return obj.__class__(**changes)
E TypeError: PyOP2KernelCallable.__init__() missing 1 required positional argument: 'parameters'
/usr/lib/python3.12/dataclasses.py:1581: TypeError
Check failure on line 218 in tests/firedrake/vertexonly/test_interpolation_from_parent.py
github-actions / Firedrake real
test_interpolation_from_parent.test_vector_function_interpolation[cube-mesh-100-coords-FunctionSpace(N1curl2)]
TypeError: PyOP2KernelCallable.__init__() missing 1 required positional argument: 'parameters'
Raw output
self = Mesh(VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3), 175)
tolerance = 0.5
def _c_locator(self, tolerance=None):
from pyop2 import compilation
from pyop2.utils import get_petsc_dir
import firedrake.function as function
import firedrake.pointquery_utils as pq_utils
cache = self.__dict__.setdefault("_c_locator_cache", {})
try:
> return cache[tolerance]
E KeyError: 0.5
firedrake/mesh.py:2651: KeyError
During handling of the above exception, another exception occurred:
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=141)
key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
def fetch(self, key: K) -> V:
keyhash = self.key_builder(key)
try:
> stored_key, value = self._fetch(keyhash)
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:750:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=141)
keyhash = 'd1d95918a1efeba628f9ed0db75eac691ef71788cea69537df3016c77227a261'
def _fetch_uncached(self, keyhash: str) -> tuple[K, V]:
# This method is separate from fetch() to allow for LRU caching
def fetch_inner() -> tuple[Any] | None:
assert self.conn is not None
# This is separate from fetch() so that the mutex covers the
# fetchone() call
c = self.conn.execute("SELECT key_value FROM dict WHERE keyhash=?",
(keyhash,))
res = c.fetchone()
assert res is None or isinstance(res, tuple)
return res
row = self._exec_sql_fn(fetch_inner)
if row is None:
> raise KeyError
E KeyError
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:741: KeyError
The above exception was the direct cause of the following exception:
args = (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCallable(arg_id_to_dtype=None, arg_id_to_descr=N...et=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),)
kwargs = {}, CACHING_ENABLED = True
cache_key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
proc_log_str = "preprocess_program on 'wrap_to_reference_coords'"
entrypoints_str = 'wrap_to_reference_coords'
@wraps(func)
def wrapper(*args, **kwargs):
from loopy import CACHING_ENABLED
if (not CACHING_ENABLED
or kwargs.pop("_no_memoize_on_disk", False)):
return func(*args, **kwargs)
cache_key = (func.__qualname__, func.__name__, args, kwargs)
try:
> result = transform_cache[cache_key]
../firedrake_venv/src/loopy/loopy/tools.py:877:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:597: in __getitem__
return self.fetch(key)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=141)
key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
def fetch(self, key: K) -> V:
keyhash = self.key_builder(key)
try:
stored_key, value = self._fetch(keyhash)
except KeyError as err:
> raise NoSuchEntryError(key) from err
E pytools.persistent_dict.NoSuchEntryError: ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='MatSetValues', name_in_target=None), 'wrap_to_reference_coords': CallableKernel(arg_id_to_dtype=None, arg_id_to_descr=None, subkernel=LoopKernel(domains=[BasicSet("[end, start] -> { [n] : n = start and start < end }"), BasicSet("{ [i2] : i2 = 0 }"), BasicSet("{ [i0] : 0 <= i0 <= 3 }"), BasicSet("{ [i1] : 0 <= i1 <= 2 }"), BasicSet("{ [i3] : i3 = 0 }"), BasicSet("{ [i4] : 0 <= i4 <= 3 }"), BasicSet("{ [i5] : 0 <= i5 <= 2 }")], instructions=[CallInstruction(assignees=(), conflicts_with_groups=frozenset(), depends_on_is_final=True, expression=Call(Variable('to_reference_coords_kernel'), (Variable('farg0'), Variable('farg1'), Variable('farg2'), SubArrayRef((Variable('i2'), Variable('i0'), Variable('i1')), Subscript(Variable('t0'), (Variable('i2'), Variable('i0'), Variable('i1')))))), groups=frozenset(), happens_after=immutabledict({'statement0': HappensAfter(variable_name=None, instances_rel=None)}), id='statement1', no_sync_with=frozenset(), predicates=frozenset(), priority=0, tags=frozenset(), temp_var_types=(), within_inames=frozenset({'n'}), within_inames_is_final=True), Assignment(assignee=Subscript(Variable('t0'), (Variable('i3'), Variable('i4'), Variable('i5'))), atomicity=(), conflicts_with_groups=frozenset(), depends_on_is_final=True, expression=Subscript(Variable('dat0'), (Subscript(Variable('map0'), (Variable('n'), Variable('i4'))), Variable('i5'))), groups=frozenset(), happens_after=immutabledict({}), id='statement0', no_sync_with=frozenset(), predicates=frozenset(), priority=0, tags=frozenset(), temp_var_type=Optional(), within_inames=frozenset({'n', 'i3', 'i5', 'i4'}), within_inames_is_final=True)], args=[<farg0: ValueArg, type: <loopy.types.OpaqueType object at 0x7f254bc1d4f0>>, <farg1: ValueArg, type: <loopy.types.OpaqueType object at 0x7f254bc1e2d0>>, <farg2: ValueArg, type: <loopy.types.OpaqueType object at 0x7f254bc1d010>>, <start: ValueArg, type: np:dtype('int32')>, <end: ValueArg, type: np:dtype('int32')>, <dat0: type: np:dtype('float64'), shape: (None, 3), dim_tags: (N1:stride:3, N0:stride:1) in aspace: global>, <map0: type: np:dtype('int32'), shape: (None, 4), dim_tags: (N1:stride:4, N0:stride:1) in aspace: global>], assumptions=BasicSet("[end, start] -> { : 0 <= start < end }"), temporary_variables={'t0': <t0: type: np:dtype('float64'), shape: (1, 4, 3), dim_tags: (N2:stride:12, N1:stride:3, N0:stride:1) aspace: auto>}, inames={'i2': Iname(name='i2', tags=frozenset()), 'n': Iname(name='n', tags=frozenset()), 'i3': Iname(name='i3', tags=frozenset()), 'i0': Iname(name='i0', tags=frozenset()), 'i5': Iname(name='i5', tags=frozenset()), 'i1': Iname(name='i1', tags=frozenset()), 'i4': Iname(name='i4', tags=frozenset())}, substitutions={}, options=Options(allow_fp_reordering=True, allow_terminal_colors=True, annotate_inames=False, build_options=[], check_dep_resolution=True, cl_exec_manage_array_events=True, disable_global_barriers=False, edit_code=False, enforce_array_accesses_within_bounds=True, enforce_variable_access_ordered=True, insert_gbarriers=False, no_numpy=False, return_dict=False, skip_arg_checks=False, trace_assignment_values=False, trace_assignments=False, write_code=False, write_wrapper=False), target=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, tags=frozenset(), state=<KernelState.INITIAL: 0>, name='wrap_to_reference_coords', preambles=(), preamble_generators=(_PreambleGen(preamble='#include <complex.h>\n#include <math.h>\n#include <petsc.h>\n'),), symbol_manglers=[<function symbol_mangler at 0x7f2577675a80>], linearization=None, iname_slab_increments=immutables.Map({}), loop_priority=frozenset(), applied_iname_rewrites=(), index_dtype=np:dtype('int32'), silenced_warnings=[], overridden_get_grid_sizes_for_insn_ids=None)), 'to_reference_coords_kernel': PyOP2KernelCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='to_reference_coords_kernel', name_in_target=None)}), target=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:752: NoSuchEntryError
During handling of the above exception, another exception occurred:
parentmesh = Mesh(VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3), 175)
vertexcoords = array([[ 0.59762701, 0.93037873, 0.70552675],
[ 0.58976637, 0.3473096 , 0.79178823],
[ 0.37517442, ...4423547, -0.12030418],
[ 0.52263797, -0.05136594, -0.30431103],
[ 1.22438303, 1.44583898, 1.42166932]])
vfs = ('N1curl', 2, <cyfunction FunctionSpace at 0x7f25775b0040>)
def test_vector_function_interpolation(parentmesh, vertexcoords, vfs):
if parentmesh.name == "immersedsphere":
vertexcoords = immersed_sphere_vertexcoords(parentmesh, vertexcoords)
vfs_fam, vfs_deg, vfs_typ = vfs
> vm = VertexOnlyMesh(parentmesh, vertexcoords, missing_points_behaviour=None)
tests/firedrake/vertexonly/test_interpolation_from_parent.py:218:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
firedrake/mesh.py:3364: in VertexOnlyMesh
swarm, input_ordering_swarm, n_missing_points = _pic_swarm_in_mesh(
firedrake/mesh.py:3585: in _pic_swarm_in_mesh
) = _parent_mesh_embedding(
firedrake/mesh.py:4151: in _parent_mesh_embedding
) = parent_mesh.locate_cells_ref_coords_and_dists(coords_global, tolerance)
firedrake/mesh.py:2633: in locate_cells_ref_coords_and_dists
self._c_locator(tolerance=tolerance)(self.coordinates._ctypes,
firedrake/mesh.py:2654: in _c_locator
src = pq_utils.src_locate_cell(self, tolerance=tolerance)
firedrake/pointquery_utils.py:39: in src_locate_cell
src.append(make_wrapper(mesh.coordinates,
firedrake/pointquery_utils.py:33: in make_wrapper
return generate_single_cell_wrapper(function.cell_set, args, **kwargs)
pyop2/parloop.py:797: in generate_single_cell_wrapper
code = lp.generate_code_v2(wrapper)
../firedrake_venv/src/loopy/loopy/codegen/__init__.py:616: in generate_code_v2
t_unit = preprocess_program(t_unit)
../firedrake_venv/src/loopy/loopy/tools.py:893: in wrapper
result = func(*args, **kwargs)
../firedrake_venv/src/loopy/loopy/preprocess.py:827: in preprocess_program
t_unit = infer_unknown_types(t_unit, expect_completion=False)
../firedrake_venv/src/loopy/loopy/type_inference.py:1061: in infer_unknown_types
new_callable, clbl_inf_ctx = t_unit.callables_table[e].with_types(
../firedrake_venv/src/loopy/loopy/kernel/function_interface.py:761: in with_types
infer_unknown_types_for_a_single_kernel(
../firedrake_venv/src/loopy/loopy/type_inference.py:994: in infer_unknown_types_for_a_single_kernel
type_inf_mapper(insn.expression,
../firedrake_venv/src/loopy/loopy/type_inference.py:211: in __call__
result = super().__call__(
../firedrake_venv/lib/python3.12/site-packages/pymbolic/mapper/__init__.py:436: in __call__
result = method(expr, *args, **kwargs)
../firedrake_venv/src/loopy/loopy/type_inference.py:443: in map_call
.with_types(arg_id_to_dtype,
pyop2/codegen/rep2loopy.py:223: in with_types
return self.copy(
../firedrake_venv/src/loopy/loopy/kernel/function_interface.py:372: in copy
return replace(self, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = PyOP2KernelCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='to_reference_coords_kernel', name_in_target=None)
changes = {'arg_id_to_descr': None, 'arg_id_to_dtype': {0: <loopy.types.OpaqueType object at 0x7f254bc1d4f0>, 1: <loopy.types.Op...c1d010>, 3: np:dtype('float64')}, 'name': 'to_reference_coords_kernel', 'name_in_target': 'to_reference_coords_kernel'}
f = Field(name='name_in_target',type='str | None',default=<dataclasses._MISSING_TYPE object at 0x7f2599ddf5f0>,default_fac... 0x7f2599ddf5f0>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD)
def replace(obj, /, **changes):
"""Return a new object replacing specified fields with new values.
This is especially useful for frozen classes. Example usage::
@dataclass(frozen=True)
class C:
x: int
y: int
c = C(1, 2)
c1 = replace(c, x=3)
assert c1.x == 3 and c1.y == 2
"""
# We're going to mutate 'changes', but that's okay because it's a
# new dict, even if called with 'replace(obj, **my_changes)'.
if not _is_dataclass_instance(obj):
raise TypeError("replace() should be called on dataclass instances")
# It's an error to have init=False fields in 'changes'.
# If a field is not in 'changes', read its value from the provided obj.
for f in getattr(obj, _FIELDS).values():
# Only consider normal fields or InitVars.
if f._field_type is _FIELD_CLASSVAR:
continue
if not f.init:
# Error if this field is specified in changes.
if f.name in changes:
raise ValueError(f'field {f.name} is declared with '
'init=False, it cannot be specified with '
'replace()')
continue
if f.name not in changes:
if f._field_type is _FIELD_INITVAR and f.default is MISSING:
raise ValueError(f"InitVar {f.name!r} "
'must be specified with replace()')
changes[f.name] = getattr(obj, f.name)
# Create the new object, which calls __init__() and
# __post_init__() (if defined), using all of the init fields we've
# added and/or left in 'changes'. If there are values supplied in
# changes that aren't fields, this will correctly raise a
# TypeError.
> return obj.__class__(**changes)
E TypeError: PyOP2KernelCallable.__init__() missing 1 required positional argument: 'parameters'
/usr/lib/python3.12/dataclasses.py:1581: TypeError
Check failure on line 218 in tests/firedrake/vertexonly/test_interpolation_from_parent.py
github-actions / Firedrake real
test_interpolation_from_parent.test_vector_function_interpolation[cube-mesh-100-coords-FunctionSpace(N2curl2)]
TypeError: PyOP2KernelCallable.__init__() missing 1 required positional argument: 'parameters'
Raw output
self = Mesh(VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3), 178)
tolerance = 0.5
def _c_locator(self, tolerance=None):
from pyop2 import compilation
from pyop2.utils import get_petsc_dir
import firedrake.function as function
import firedrake.pointquery_utils as pq_utils
cache = self.__dict__.setdefault("_c_locator_cache", {})
try:
> return cache[tolerance]
E KeyError: 0.5
firedrake/mesh.py:2651: KeyError
During handling of the above exception, another exception occurred:
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=145)
key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
def fetch(self, key: K) -> V:
keyhash = self.key_builder(key)
try:
> stored_key, value = self._fetch(keyhash)
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:750:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=145)
keyhash = 'd1d95918a1efeba628f9ed0db75eac691ef71788cea69537df3016c77227a261'
def _fetch_uncached(self, keyhash: str) -> tuple[K, V]:
# This method is separate from fetch() to allow for LRU caching
def fetch_inner() -> tuple[Any] | None:
assert self.conn is not None
# This is separate from fetch() so that the mutex covers the
# fetchone() call
c = self.conn.execute("SELECT key_value FROM dict WHERE keyhash=?",
(keyhash,))
res = c.fetchone()
assert res is None or isinstance(res, tuple)
return res
row = self._exec_sql_fn(fetch_inner)
if row is None:
> raise KeyError
E KeyError
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:741: KeyError
The above exception was the direct cause of the following exception:
args = (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCallable(arg_id_to_dtype=None, arg_id_to_descr=N...et=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),)
kwargs = {}, CACHING_ENABLED = True
cache_key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
proc_log_str = "preprocess_program on 'wrap_to_reference_coords'"
entrypoints_str = 'wrap_to_reference_coords'
@wraps(func)
def wrapper(*args, **kwargs):
from loopy import CACHING_ENABLED
if (not CACHING_ENABLED
or kwargs.pop("_no_memoize_on_disk", False)):
return func(*args, **kwargs)
cache_key = (func.__qualname__, func.__name__, args, kwargs)
try:
> result = transform_cache[cache_key]
../firedrake_venv/src/loopy/loopy/tools.py:877:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:597: in __getitem__
return self.fetch(key)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=145)
key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
def fetch(self, key: K) -> V:
keyhash = self.key_builder(key)
try:
stored_key, value = self._fetch(keyhash)
except KeyError as err:
> raise NoSuchEntryError(key) from err
E pytools.persistent_dict.NoSuchEntryError: ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='MatSetValues', name_in_target=None), 'wrap_to_reference_coords': CallableKernel(arg_id_to_dtype=None, arg_id_to_descr=None, subkernel=LoopKernel(domains=[BasicSet("[end, start] -> { [n] : n = start and start < end }"), BasicSet("{ [i2] : i2 = 0 }"), BasicSet("{ [i0] : 0 <= i0 <= 3 }"), BasicSet("{ [i1] : 0 <= i1 <= 2 }"), BasicSet("{ [i3] : i3 = 0 }"), BasicSet("{ [i4] : 0 <= i4 <= 3 }"), BasicSet("{ [i5] : 0 <= i5 <= 2 }")], instructions=[CallInstruction(assignees=(), conflicts_with_groups=frozenset(), depends_on_is_final=True, expression=Call(Variable('to_reference_coords_kernel'), (Variable('farg0'), Variable('farg1'), Variable('farg2'), SubArrayRef((Variable('i2'), Variable('i0'), Variable('i1')), Subscript(Variable('t0'), (Variable('i2'), Variable('i0'), Variable('i1')))))), groups=frozenset(), happens_after=immutabledict({'statement0': HappensAfter(variable_name=None, instances_rel=None)}), id='statement1', no_sync_with=frozenset(), predicates=frozenset(), priority=0, tags=frozenset(), temp_var_types=(), within_inames=frozenset({'n'}), within_inames_is_final=True), Assignment(assignee=Subscript(Variable('t0'), (Variable('i3'), Variable('i4'), Variable('i5'))), atomicity=(), conflicts_with_groups=frozenset(), depends_on_is_final=True, expression=Subscript(Variable('dat0'), (Subscript(Variable('map0'), (Variable('n'), Variable('i4'))), Variable('i5'))), groups=frozenset(), happens_after=immutabledict({}), id='statement0', no_sync_with=frozenset(), predicates=frozenset(), priority=0, tags=frozenset(), temp_var_type=Optional(), within_inames=frozenset({'n', 'i3', 'i5', 'i4'}), within_inames_is_final=True)], args=[<farg0: ValueArg, type: <loopy.types.OpaqueType object at 0x7f254ab81e20>>, <farg1: ValueArg, type: <loopy.types.OpaqueType object at 0x7f254ab83d10>>, <farg2: ValueArg, type: <loopy.types.OpaqueType object at 0x7f254ab82ab0>>, <start: ValueArg, type: np:dtype('int32')>, <end: ValueArg, type: np:dtype('int32')>, <dat0: type: np:dtype('float64'), shape: (None, 3), dim_tags: (N1:stride:3, N0:stride:1) in aspace: global>, <map0: type: np:dtype('int32'), shape: (None, 4), dim_tags: (N1:stride:4, N0:stride:1) in aspace: global>], assumptions=BasicSet("[end, start] -> { : 0 <= start < end }"), temporary_variables={'t0': <t0: type: np:dtype('float64'), shape: (1, 4, 3), dim_tags: (N2:stride:12, N1:stride:3, N0:stride:1) aspace: auto>}, inames={'i2': Iname(name='i2', tags=frozenset()), 'n': Iname(name='n', tags=frozenset()), 'i3': Iname(name='i3', tags=frozenset()), 'i0': Iname(name='i0', tags=frozenset()), 'i5': Iname(name='i5', tags=frozenset()), 'i1': Iname(name='i1', tags=frozenset()), 'i4': Iname(name='i4', tags=frozenset())}, substitutions={}, options=Options(allow_fp_reordering=True, allow_terminal_colors=True, annotate_inames=False, build_options=[], check_dep_resolution=True, cl_exec_manage_array_events=True, disable_global_barriers=False, edit_code=False, enforce_array_accesses_within_bounds=True, enforce_variable_access_ordered=True, insert_gbarriers=False, no_numpy=False, return_dict=False, skip_arg_checks=False, trace_assignment_values=False, trace_assignments=False, write_code=False, write_wrapper=False), target=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, tags=frozenset(), state=<KernelState.INITIAL: 0>, name='wrap_to_reference_coords', preambles=(), preamble_generators=(_PreambleGen(preamble='#include <complex.h>\n#include <math.h>\n#include <petsc.h>\n'),), symbol_manglers=[<function symbol_mangler at 0x7f2577675a80>], linearization=None, iname_slab_increments=immutables.Map({}), loop_priority=frozenset(), applied_iname_rewrites=(), index_dtype=np:dtype('int32'), silenced_warnings=[], overridden_get_grid_sizes_for_insn_ids=None)), 'to_reference_coords_kernel': PyOP2KernelCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='to_reference_coords_kernel', name_in_target=None)}), target=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:752: NoSuchEntryError
During handling of the above exception, another exception occurred:
parentmesh = Mesh(VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3), 178)
vertexcoords = array([[ 0.59762701, 0.93037873, 0.70552675],
[ 0.58976637, 0.3473096 , 0.79178823],
[ 0.37517442, ...4423547, -0.12030418],
[ 0.52263797, -0.05136594, -0.30431103],
[ 1.22438303, 1.44583898, 1.42166932]])
vfs = ('N2curl', 2, <cyfunction FunctionSpace at 0x7f25775b0040>)
def test_vector_function_interpolation(parentmesh, vertexcoords, vfs):
if parentmesh.name == "immersedsphere":
vertexcoords = immersed_sphere_vertexcoords(parentmesh, vertexcoords)
vfs_fam, vfs_deg, vfs_typ = vfs
> vm = VertexOnlyMesh(parentmesh, vertexcoords, missing_points_behaviour=None)
tests/firedrake/vertexonly/test_interpolation_from_parent.py:218:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
firedrake/mesh.py:3364: in VertexOnlyMesh
swarm, input_ordering_swarm, n_missing_points = _pic_swarm_in_mesh(
firedrake/mesh.py:3585: in _pic_swarm_in_mesh
) = _parent_mesh_embedding(
firedrake/mesh.py:4151: in _parent_mesh_embedding
) = parent_mesh.locate_cells_ref_coords_and_dists(coords_global, tolerance)
firedrake/mesh.py:2633: in locate_cells_ref_coords_and_dists
self._c_locator(tolerance=tolerance)(self.coordinates._ctypes,
firedrake/mesh.py:2654: in _c_locator
src = pq_utils.src_locate_cell(self, tolerance=tolerance)
firedrake/pointquery_utils.py:39: in src_locate_cell
src.append(make_wrapper(mesh.coordinates,
firedrake/pointquery_utils.py:33: in make_wrapper
return generate_single_cell_wrapper(function.cell_set, args, **kwargs)
pyop2/parloop.py:797: in generate_single_cell_wrapper
code = lp.generate_code_v2(wrapper)
../firedrake_venv/src/loopy/loopy/codegen/__init__.py:616: in generate_code_v2
t_unit = preprocess_program(t_unit)
../firedrake_venv/src/loopy/loopy/tools.py:893: in wrapper
result = func(*args, **kwargs)
../firedrake_venv/src/loopy/loopy/preprocess.py:827: in preprocess_program
t_unit = infer_unknown_types(t_unit, expect_completion=False)
../firedrake_venv/src/loopy/loopy/type_inference.py:1061: in infer_unknown_types
new_callable, clbl_inf_ctx = t_unit.callables_table[e].with_types(
../firedrake_venv/src/loopy/loopy/kernel/function_interface.py:761: in with_types
infer_unknown_types_for_a_single_kernel(
../firedrake_venv/src/loopy/loopy/type_inference.py:994: in infer_unknown_types_for_a_single_kernel
type_inf_mapper(insn.expression,
../firedrake_venv/src/loopy/loopy/type_inference.py:211: in __call__
result = super().__call__(
../firedrake_venv/lib/python3.12/site-packages/pymbolic/mapper/__init__.py:436: in __call__
result = method(expr, *args, **kwargs)
../firedrake_venv/src/loopy/loopy/type_inference.py:443: in map_call
.with_types(arg_id_to_dtype,
pyop2/codegen/rep2loopy.py:223: in with_types
return self.copy(
../firedrake_venv/src/loopy/loopy/kernel/function_interface.py:372: in copy
return replace(self, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = PyOP2KernelCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='to_reference_coords_kernel', name_in_target=None)
changes = {'arg_id_to_descr': None, 'arg_id_to_dtype': {0: <loopy.types.OpaqueType object at 0x7f254ab81e20>, 1: <loopy.types.Op...b82ab0>, 3: np:dtype('float64')}, 'name': 'to_reference_coords_kernel', 'name_in_target': 'to_reference_coords_kernel'}
f = Field(name='name_in_target',type='str | None',default=<dataclasses._MISSING_TYPE object at 0x7f2599ddf5f0>,default_fac... 0x7f2599ddf5f0>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD)
def replace(obj, /, **changes):
"""Return a new object replacing specified fields with new values.
This is especially useful for frozen classes. Example usage::
@dataclass(frozen=True)
class C:
x: int
y: int
c = C(1, 2)
c1 = replace(c, x=3)
assert c1.x == 3 and c1.y == 2
"""
# We're going to mutate 'changes', but that's okay because it's a
# new dict, even if called with 'replace(obj, **my_changes)'.
if not _is_dataclass_instance(obj):
raise TypeError("replace() should be called on dataclass instances")
# It's an error to have init=False fields in 'changes'.
# If a field is not in 'changes', read its value from the provided obj.
for f in getattr(obj, _FIELDS).values():
# Only consider normal fields or InitVars.
if f._field_type is _FIELD_CLASSVAR:
continue
if not f.init:
# Error if this field is specified in changes.
if f.name in changes:
raise ValueError(f'field {f.name} is declared with '
'init=False, it cannot be specified with '
'replace()')
continue
if f.name not in changes:
if f._field_type is _FIELD_INITVAR and f.default is MISSING:
raise ValueError(f"InitVar {f.name!r} "
'must be specified with replace()')
changes[f.name] = getattr(obj, f.name)
# Create the new object, which calls __init__() and
# __post_init__() (if defined), using all of the init fields we've
# added and/or left in 'changes'. If there are values supplied in
# changes that aren't fields, this will correctly raise a
# TypeError.
> return obj.__class__(**changes)
E TypeError: PyOP2KernelCallable.__init__() missing 1 required positional argument: 'parameters'
/usr/lib/python3.12/dataclasses.py:1581: TypeError
Check failure on line 1 in tests/firedrake/vertexonly/test_interpolation_from_parent.py
github-actions / Firedrake real
test_interpolation_from_parent.test_vector_function_interpolation_parallel[tetrahedron-mesh-100-coords-FunctionSpace(N1curl2)]
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_interpolation_from_parent.py::test_vector_function_interpolation_parallel[tetrahedron-mesh-100-coords-FunctionSpace(N1curl2)]', ':', '-n', '2', '/__w/firedrake/firedrake_venv/bin/python', '-m', 'pytest', '--runxfail', '-s', '-q', '/__w/firedrake/firedrake/tests/firedrake/vertexonly/test_interpolation_from_parent.py::test_vector_function_interpolation_parallel[tetrahedron-mesh-100-coords-FunctionSpace(N1curl2)]', '--tb=no', '--no-summary', '--no-header', '--disable-warnings', '--show-capture=no']' returned non-zero exit status 1.
Raw output
args = ()
kwargs = {'parentmesh': Mesh(VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3), 40), 'vertexcoords': array([[ 0.5...,
[ 1.22438303, 1.44583898, 1.42166932]]), 'vfs': ('N1curl', 2, <cyfunction FunctionSpace at 0x7feaa00e4040>)}
def parallel_callback(*args, **kwargs):
> subprocess.run(cmd, check=True)
../firedrake_venv/src/pytest-mpi/pytest_mpi.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_interpolation_from_parent.py::test_vector_function_interpolation_parallel[tetrahedron-mesh-100-coords-FunctionSpace(N1curl2)]', ':', '-n', '2', '/__w/firedrake/firedrake_venv/bin/python', '-m', 'pytest', '--runxfail', '-s', '-q', '/__w/firedrake/firedrake/tests/firedrake/vertexonly/test_interpolation_from_parent.py::test_vector_function_interpolation_parallel[tetrahedron-mesh-100-coords-FunctionSpace(N1curl2)]', '--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 218 in tests/firedrake/vertexonly/test_interpolation_from_parent.py
github-actions / Firedrake real
test_interpolation_from_parent.test_vector_function_interpolation[cube-mesh-100-coords-FunctionSpace(N1div2)]
TypeError: PyOP2KernelCallable.__init__() missing 1 required positional argument: 'parameters'
Raw output
self = Mesh(VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3), 181)
tolerance = 0.5
def _c_locator(self, tolerance=None):
from pyop2 import compilation
from pyop2.utils import get_petsc_dir
import firedrake.function as function
import firedrake.pointquery_utils as pq_utils
cache = self.__dict__.setdefault("_c_locator_cache", {})
try:
> return cache[tolerance]
E KeyError: 0.5
firedrake/mesh.py:2651: KeyError
During handling of the above exception, another exception occurred:
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=151)
key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
def fetch(self, key: K) -> V:
keyhash = self.key_builder(key)
try:
> stored_key, value = self._fetch(keyhash)
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:750:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=151)
keyhash = 'd1d95918a1efeba628f9ed0db75eac691ef71788cea69537df3016c77227a261'
def _fetch_uncached(self, keyhash: str) -> tuple[K, V]:
# This method is separate from fetch() to allow for LRU caching
def fetch_inner() -> tuple[Any] | None:
assert self.conn is not None
# This is separate from fetch() so that the mutex covers the
# fetchone() call
c = self.conn.execute("SELECT key_value FROM dict WHERE keyhash=?",
(keyhash,))
res = c.fetchone()
assert res is None or isinstance(res, tuple)
return res
row = self._exec_sql_fn(fetch_inner)
if row is None:
> raise KeyError
E KeyError
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:741: KeyError
The above exception was the direct cause of the following exception:
args = (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCallable(arg_id_to_dtype=None, arg_id_to_descr=N...et=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),)
kwargs = {}, CACHING_ENABLED = True
cache_key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
proc_log_str = "preprocess_program on 'wrap_to_reference_coords'"
entrypoints_str = 'wrap_to_reference_coords'
@wraps(func)
def wrapper(*args, **kwargs):
from loopy import CACHING_ENABLED
if (not CACHING_ENABLED
or kwargs.pop("_no_memoize_on_disk", False)):
return func(*args, **kwargs)
cache_key = (func.__qualname__, func.__name__, args, kwargs)
try:
> result = transform_cache[cache_key]
../firedrake_venv/src/loopy/loopy/tools.py:877:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:597: in __getitem__
return self.fetch(key)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=150)
key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
def fetch(self, key: K) -> V:
keyhash = self.key_builder(key)
try:
stored_key, value = self._fetch(keyhash)
except KeyError as err:
> raise NoSuchEntryError(key) from err
E pytools.persistent_dict.NoSuchEntryError: ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='MatSetValues', name_in_target=None), 'wrap_to_reference_coords': CallableKernel(arg_id_to_dtype=None, arg_id_to_descr=None, subkernel=LoopKernel(domains=[BasicSet("[end, start] -> { [n] : n = start and start < end }"), BasicSet("{ [i2] : i2 = 0 }"), BasicSet("{ [i0] : 0 <= i0 <= 3 }"), BasicSet("{ [i1] : 0 <= i1 <= 2 }"), BasicSet("{ [i3] : i3 = 0 }"), BasicSet("{ [i4] : 0 <= i4 <= 3 }"), BasicSet("{ [i5] : 0 <= i5 <= 2 }")], instructions=[CallInstruction(assignees=(), conflicts_with_groups=frozenset(), depends_on_is_final=True, expression=Call(Variable('to_reference_coords_kernel'), (Variable('farg0'), Variable('farg1'), Variable('farg2'), SubArrayRef((Variable('i2'), Variable('i0'), Variable('i1')), Subscript(Variable('t0'), (Variable('i2'), Variable('i0'), Variable('i1')))))), groups=frozenset(), happens_after=immutabledict({'statement0': HappensAfter(variable_name=None, instances_rel=None)}), id='statement1', no_sync_with=frozenset(), predicates=frozenset(), priority=0, tags=frozenset(), temp_var_types=(), within_inames=frozenset({'n'}), within_inames_is_final=True), Assignment(assignee=Subscript(Variable('t0'), (Variable('i3'), Variable('i4'), Variable('i5'))), atomicity=(), conflicts_with_groups=frozenset(), depends_on_is_final=True, expression=Subscript(Variable('dat0'), (Subscript(Variable('map0'), (Variable('n'), Variable('i4'))), Variable('i5'))), groups=frozenset(), happens_after=immutabledict({}), id='statement0', no_sync_with=frozenset(), predicates=frozenset(), priority=0, tags=frozenset(), temp_var_type=Optional(), within_inames=frozenset({'n', 'i3', 'i5', 'i4'}), within_inames_is_final=True)], args=[<farg0: ValueArg, type: <loopy.types.OpaqueType object at 0x7f254ab14710>>, <farg1: ValueArg, type: <loopy.types.OpaqueType object at 0x7f254ab14fb0>>, <farg2: ValueArg, type: <loopy.types.OpaqueType object at 0x7f254ab14c20>>, <start: ValueArg, type: np:dtype('int32')>, <end: ValueArg, type: np:dtype('int32')>, <dat0: type: np:dtype('float64'), shape: (None, 3), dim_tags: (N1:stride:3, N0:stride:1) in aspace: global>, <map0: type: np:dtype('int32'), shape: (None, 4), dim_tags: (N1:stride:4, N0:stride:1) in aspace: global>], assumptions=BasicSet("[end, start] -> { : 0 <= start < end }"), temporary_variables={'t0': <t0: type: np:dtype('float64'), shape: (1, 4, 3), dim_tags: (N2:stride:12, N1:stride:3, N0:stride:1) aspace: auto>}, inames={'i2': Iname(name='i2', tags=frozenset()), 'n': Iname(name='n', tags=frozenset()), 'i3': Iname(name='i3', tags=frozenset()), 'i0': Iname(name='i0', tags=frozenset()), 'i5': Iname(name='i5', tags=frozenset()), 'i1': Iname(name='i1', tags=frozenset()), 'i4': Iname(name='i4', tags=frozenset())}, substitutions={}, options=Options(allow_fp_reordering=True, allow_terminal_colors=True, annotate_inames=False, build_options=[], check_dep_resolution=True, cl_exec_manage_array_events=True, disable_global_barriers=False, edit_code=False, enforce_array_accesses_within_bounds=True, enforce_variable_access_ordered=True, insert_gbarriers=False, no_numpy=False, return_dict=False, skip_arg_checks=False, trace_assignment_values=False, trace_assignments=False, write_code=False, write_wrapper=False), target=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, tags=frozenset(), state=<KernelState.INITIAL: 0>, name='wrap_to_reference_coords', preambles=(), preamble_generators=(_PreambleGen(preamble='#include <complex.h>\n#include <math.h>\n#include <petsc.h>\n'),), symbol_manglers=[<function symbol_mangler at 0x7f2577675a80>], linearization=None, iname_slab_increments=immutables.Map({}), loop_priority=frozenset(), applied_iname_rewrites=(), index_dtype=np:dtype('int32'), silenced_warnings=[], overridden_get_grid_sizes_for_insn_ids=None)), 'to_reference_coords_kernel': PyOP2KernelCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='to_reference_coords_kernel', name_in_target=None)}), target=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:752: NoSuchEntryError
During handling of the above exception, another exception occurred:
parentmesh = Mesh(VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3), 181)
vertexcoords = array([[ 0.59762701, 0.93037873, 0.70552675],
[ 0.58976637, 0.3473096 , 0.79178823],
[ 0.37517442, ...4423547, -0.12030418],
[ 0.52263797, -0.05136594, -0.30431103],
[ 1.22438303, 1.44583898, 1.42166932]])
vfs = ('N1div', 2, <cyfunction FunctionSpace at 0x7f25775b0040>)
def test_vector_function_interpolation(parentmesh, vertexcoords, vfs):
if parentmesh.name == "immersedsphere":
vertexcoords = immersed_sphere_vertexcoords(parentmesh, vertexcoords)
vfs_fam, vfs_deg, vfs_typ = vfs
> vm = VertexOnlyMesh(parentmesh, vertexcoords, missing_points_behaviour=None)
tests/firedrake/vertexonly/test_interpolation_from_parent.py:218:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
firedrake/mesh.py:3364: in VertexOnlyMesh
swarm, input_ordering_swarm, n_missing_points = _pic_swarm_in_mesh(
firedrake/mesh.py:3585: in _pic_swarm_in_mesh
) = _parent_mesh_embedding(
firedrake/mesh.py:4151: in _parent_mesh_embedding
) = parent_mesh.locate_cells_ref_coords_and_dists(coords_global, tolerance)
firedrake/mesh.py:2633: in locate_cells_ref_coords_and_dists
self._c_locator(tolerance=tolerance)(self.coordinates._ctypes,
firedrake/mesh.py:2654: in _c_locator
src = pq_utils.src_locate_cell(self, tolerance=tolerance)
firedrake/pointquery_utils.py:39: in src_locate_cell
src.append(make_wrapper(mesh.coordinates,
firedrake/pointquery_utils.py:33: in make_wrapper
return generate_single_cell_wrapper(function.cell_set, args, **kwargs)
pyop2/parloop.py:797: in generate_single_cell_wrapper
code = lp.generate_code_v2(wrapper)
../firedrake_venv/src/loopy/loopy/codegen/__init__.py:616: in generate_code_v2
t_unit = preprocess_program(t_unit)
../firedrake_venv/src/loopy/loopy/tools.py:893: in wrapper
result = func(*args, **kwargs)
../firedrake_venv/src/loopy/loopy/preprocess.py:827: in preprocess_program
t_unit = infer_unknown_types(t_unit, expect_completion=False)
../firedrake_venv/src/loopy/loopy/type_inference.py:1061: in infer_unknown_types
new_callable, clbl_inf_ctx = t_unit.callables_table[e].with_types(
../firedrake_venv/src/loopy/loopy/kernel/function_interface.py:761: in with_types
infer_unknown_types_for_a_single_kernel(
../firedrake_venv/src/loopy/loopy/type_inference.py:994: in infer_unknown_types_for_a_single_kernel
type_inf_mapper(insn.expression,
../firedrake_venv/src/loopy/loopy/type_inference.py:211: in __call__
result = super().__call__(
../firedrake_venv/lib/python3.12/site-packages/pymbolic/mapper/__init__.py:436: in __call__
result = method(expr, *args, **kwargs)
../firedrake_venv/src/loopy/loopy/type_inference.py:443: in map_call
.with_types(arg_id_to_dtype,
pyop2/codegen/rep2loopy.py:223: in with_types
return self.copy(
../firedrake_venv/src/loopy/loopy/kernel/function_interface.py:372: in copy
return replace(self, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = PyOP2KernelCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='to_reference_coords_kernel', name_in_target=None)
changes = {'arg_id_to_descr': None, 'arg_id_to_dtype': {0: <loopy.types.OpaqueType object at 0x7f254ab14710>, 1: <loopy.types.Op...b14c20>, 3: np:dtype('float64')}, 'name': 'to_reference_coords_kernel', 'name_in_target': 'to_reference_coords_kernel'}
f = Field(name='name_in_target',type='str | None',default=<dataclasses._MISSING_TYPE object at 0x7f2599ddf5f0>,default_fac... 0x7f2599ddf5f0>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD)
def replace(obj, /, **changes):
"""Return a new object replacing specified fields with new values.
This is especially useful for frozen classes. Example usage::
@dataclass(frozen=True)
class C:
x: int
y: int
c = C(1, 2)
c1 = replace(c, x=3)
assert c1.x == 3 and c1.y == 2
"""
# We're going to mutate 'changes', but that's okay because it's a
# new dict, even if called with 'replace(obj, **my_changes)'.
if not _is_dataclass_instance(obj):
raise TypeError("replace() should be called on dataclass instances")
# It's an error to have init=False fields in 'changes'.
# If a field is not in 'changes', read its value from the provided obj.
for f in getattr(obj, _FIELDS).values():
# Only consider normal fields or InitVars.
if f._field_type is _FIELD_CLASSVAR:
continue
if not f.init:
# Error if this field is specified in changes.
if f.name in changes:
raise ValueError(f'field {f.name} is declared with '
'init=False, it cannot be specified with '
'replace()')
continue
if f.name not in changes:
if f._field_type is _FIELD_INITVAR and f.default is MISSING:
raise ValueError(f"InitVar {f.name!r} "
'must be specified with replace()')
changes[f.name] = getattr(obj, f.name)
# Create the new object, which calls __init__() and
# __post_init__() (if defined), using all of the init fields we've
# added and/or left in 'changes'. If there are values supplied in
# changes that aren't fields, this will correctly raise a
# TypeError.
> return obj.__class__(**changes)
E TypeError: PyOP2KernelCallable.__init__() missing 1 required positional argument: 'parameters'
/usr/lib/python3.12/dataclasses.py:1581: TypeError
Check failure on line 218 in tests/firedrake/vertexonly/test_interpolation_from_parent.py
github-actions / Firedrake real
test_interpolation_from_parent.test_vector_function_interpolation[cube-mesh-100-coords-FunctionSpace(N2div2)]
TypeError: PyOP2KernelCallable.__init__() missing 1 required positional argument: 'parameters'
Raw output
self = Mesh(VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3), 184)
tolerance = 0.5
def _c_locator(self, tolerance=None):
from pyop2 import compilation
from pyop2.utils import get_petsc_dir
import firedrake.function as function
import firedrake.pointquery_utils as pq_utils
cache = self.__dict__.setdefault("_c_locator_cache", {})
try:
> return cache[tolerance]
E KeyError: 0.5
firedrake/mesh.py:2651: KeyError
During handling of the above exception, another exception occurred:
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=156)
key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
def fetch(self, key: K) -> V:
keyhash = self.key_builder(key)
try:
> stored_key, value = self._fetch(keyhash)
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:750:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=156)
keyhash = 'd1d95918a1efeba628f9ed0db75eac691ef71788cea69537df3016c77227a261'
def _fetch_uncached(self, keyhash: str) -> tuple[K, V]:
# This method is separate from fetch() to allow for LRU caching
def fetch_inner() -> tuple[Any] | None:
assert self.conn is not None
# This is separate from fetch() so that the mutex covers the
# fetchone() call
c = self.conn.execute("SELECT key_value FROM dict WHERE keyhash=?",
(keyhash,))
res = c.fetchone()
assert res is None or isinstance(res, tuple)
return res
row = self._exec_sql_fn(fetch_inner)
if row is None:
> raise KeyError
E KeyError
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:741: KeyError
The above exception was the direct cause of the following exception:
args = (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCallable(arg_id_to_dtype=None, arg_id_to_descr=N...et=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),)
kwargs = {}, CACHING_ENABLED = True
cache_key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
proc_log_str = "preprocess_program on 'wrap_to_reference_coords'"
entrypoints_str = 'wrap_to_reference_coords'
@wraps(func)
def wrapper(*args, **kwargs):
from loopy import CACHING_ENABLED
if (not CACHING_ENABLED
or kwargs.pop("_no_memoize_on_disk", False)):
return func(*args, **kwargs)
cache_key = (func.__qualname__, func.__name__, args, kwargs)
try:
> result = transform_cache[cache_key]
../firedrake_venv/src/loopy/loopy/tools.py:877:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:597: in __getitem__
return self.fetch(key)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=156)
key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
def fetch(self, key: K) -> V:
keyhash = self.key_builder(key)
try:
stored_key, value = self._fetch(keyhash)
except KeyError as err:
> raise NoSuchEntryError(key) from err
E pytools.persistent_dict.NoSuchEntryError: ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='MatSetValues', name_in_target=None), 'wrap_to_reference_coords': CallableKernel(arg_id_to_dtype=None, arg_id_to_descr=None, subkernel=LoopKernel(domains=[BasicSet("[end, start] -> { [n] : n = start and start < end }"), BasicSet("{ [i2] : i2 = 0 }"), BasicSet("{ [i0] : 0 <= i0 <= 3 }"), BasicSet("{ [i1] : 0 <= i1 <= 2 }"), BasicSet("{ [i3] : i3 = 0 }"), BasicSet("{ [i4] : 0 <= i4 <= 3 }"), BasicSet("{ [i5] : 0 <= i5 <= 2 }")], instructions=[CallInstruction(assignees=(), conflicts_with_groups=frozenset(), depends_on_is_final=True, expression=Call(Variable('to_reference_coords_kernel'), (Variable('farg0'), Variable('farg1'), Variable('farg2'), SubArrayRef((Variable('i2'), Variable('i0'), Variable('i1')), Subscript(Variable('t0'), (Variable('i2'), Variable('i0'), Variable('i1')))))), groups=frozenset(), happens_after=immutabledict({'statement0': HappensAfter(variable_name=None, instances_rel=None)}), id='statement1', no_sync_with=frozenset(), predicates=frozenset(), priority=0, tags=frozenset(), temp_var_types=(), within_inames=frozenset({'n'}), within_inames_is_final=True), Assignment(assignee=Subscript(Variable('t0'), (Variable('i3'), Variable('i4'), Variable('i5'))), atomicity=(), conflicts_with_groups=frozenset(), depends_on_is_final=True, expression=Subscript(Variable('dat0'), (Subscript(Variable('map0'), (Variable('n'), Variable('i4'))), Variable('i5'))), groups=frozenset(), happens_after=immutabledict({}), id='statement0', no_sync_with=frozenset(), predicates=frozenset(), priority=0, tags=frozenset(), temp_var_type=Optional(), within_inames=frozenset({'n', 'i3', 'i5', 'i4'}), within_inames_is_final=True)], args=[<farg0: ValueArg, type: <loopy.types.OpaqueType object at 0x7f254bdfa840>>, <farg1: ValueArg, type: <loopy.types.OpaqueType object at 0x7f254bdfa720>>, <farg2: ValueArg, type: <loopy.types.OpaqueType object at 0x7f254bdf81a0>>, <start: ValueArg, type: np:dtype('int32')>, <end: ValueArg, type: np:dtype('int32')>, <dat0: type: np:dtype('float64'), shape: (None, 3), dim_tags: (N1:stride:3, N0:stride:1) in aspace: global>, <map0: type: np:dtype('int32'), shape: (None, 4), dim_tags: (N1:stride:4, N0:stride:1) in aspace: global>], assumptions=BasicSet("[end, start] -> { : 0 <= start < end }"), temporary_variables={'t0': <t0: type: np:dtype('float64'), shape: (1, 4, 3), dim_tags: (N2:stride:12, N1:stride:3, N0:stride:1) aspace: auto>}, inames={'i2': Iname(name='i2', tags=frozenset()), 'n': Iname(name='n', tags=frozenset()), 'i3': Iname(name='i3', tags=frozenset()), 'i0': Iname(name='i0', tags=frozenset()), 'i5': Iname(name='i5', tags=frozenset()), 'i1': Iname(name='i1', tags=frozenset()), 'i4': Iname(name='i4', tags=frozenset())}, substitutions={}, options=Options(allow_fp_reordering=True, allow_terminal_colors=True, annotate_inames=False, build_options=[], check_dep_resolution=True, cl_exec_manage_array_events=True, disable_global_barriers=False, edit_code=False, enforce_array_accesses_within_bounds=True, enforce_variable_access_ordered=True, insert_gbarriers=False, no_numpy=False, return_dict=False, skip_arg_checks=False, trace_assignment_values=False, trace_assignments=False, write_code=False, write_wrapper=False), target=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, tags=frozenset(), state=<KernelState.INITIAL: 0>, name='wrap_to_reference_coords', preambles=(), preamble_generators=(_PreambleGen(preamble='#include <complex.h>\n#include <math.h>\n#include <petsc.h>\n'),), symbol_manglers=[<function symbol_mangler at 0x7f2577675a80>], linearization=None, iname_slab_increments=immutables.Map({}), loop_priority=frozenset(), applied_iname_rewrites=(), index_dtype=np:dtype('int32'), silenced_warnings=[], overridden_get_grid_sizes_for_insn_ids=None)), 'to_reference_coords_kernel': PyOP2KernelCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='to_reference_coords_kernel', name_in_target=None)}), target=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:752: NoSuchEntryError
During handling of the above exception, another exception occurred:
parentmesh = Mesh(VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3), 184)
vertexcoords = array([[ 0.59762701, 0.93037873, 0.70552675],
[ 0.58976637, 0.3473096 , 0.79178823],
[ 0.37517442, ...4423547, -0.12030418],
[ 0.52263797, -0.05136594, -0.30431103],
[ 1.22438303, 1.44583898, 1.42166932]])
vfs = ('N2div', 2, <cyfunction FunctionSpace at 0x7f25775b0040>)
def test_vector_function_interpolation(parentmesh, vertexcoords, vfs):
if parentmesh.name == "immersedsphere":
vertexcoords = immersed_sphere_vertexcoords(parentmesh, vertexcoords)
vfs_fam, vfs_deg, vfs_typ = vfs
> vm = VertexOnlyMesh(parentmesh, vertexcoords, missing_points_behaviour=None)
tests/firedrake/vertexonly/test_interpolation_from_parent.py:218:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
firedrake/mesh.py:3364: in VertexOnlyMesh
swarm, input_ordering_swarm, n_missing_points = _pic_swarm_in_mesh(
firedrake/mesh.py:3585: in _pic_swarm_in_mesh
) = _parent_mesh_embedding(
firedrake/mesh.py:4151: in _parent_mesh_embedding
) = parent_mesh.locate_cells_ref_coords_and_dists(coords_global, tolerance)
firedrake/mesh.py:2633: in locate_cells_ref_coords_and_dists
self._c_locator(tolerance=tolerance)(self.coordinates._ctypes,
firedrake/mesh.py:2654: in _c_locator
src = pq_utils.src_locate_cell(self, tolerance=tolerance)
firedrake/pointquery_utils.py:39: in src_locate_cell
src.append(make_wrapper(mesh.coordinates,
firedrake/pointquery_utils.py:33: in make_wrapper
return generate_single_cell_wrapper(function.cell_set, args, **kwargs)
pyop2/parloop.py:797: in generate_single_cell_wrapper
code = lp.generate_code_v2(wrapper)
../firedrake_venv/src/loopy/loopy/codegen/__init__.py:616: in generate_code_v2
t_unit = preprocess_program(t_unit)
../firedrake_venv/src/loopy/loopy/tools.py:893: in wrapper
result = func(*args, **kwargs)
../firedrake_venv/src/loopy/loopy/preprocess.py:827: in preprocess_program
t_unit = infer_unknown_types(t_unit, expect_completion=False)
../firedrake_venv/src/loopy/loopy/type_inference.py:1061: in infer_unknown_types
new_callable, clbl_inf_ctx = t_unit.callables_table[e].with_types(
../firedrake_venv/src/loopy/loopy/kernel/function_interface.py:761: in with_types
infer_unknown_types_for_a_single_kernel(
../firedrake_venv/src/loopy/loopy/type_inference.py:994: in infer_unknown_types_for_a_single_kernel
type_inf_mapper(insn.expression,
../firedrake_venv/src/loopy/loopy/type_inference.py:211: in __call__
result = super().__call__(
../firedrake_venv/lib/python3.12/site-packages/pymbolic/mapper/__init__.py:436: in __call__
result = method(expr, *args, **kwargs)
../firedrake_venv/src/loopy/loopy/type_inference.py:443: in map_call
.with_types(arg_id_to_dtype,
pyop2/codegen/rep2loopy.py:223: in with_types
return self.copy(
../firedrake_venv/src/loopy/loopy/kernel/function_interface.py:372: in copy
return replace(self, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = PyOP2KernelCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='to_reference_coords_kernel', name_in_target=None)
changes = {'arg_id_to_descr': None, 'arg_id_to_dtype': {0: <loopy.types.OpaqueType object at 0x7f254bdfa840>, 1: <loopy.types.Op...df81a0>, 3: np:dtype('float64')}, 'name': 'to_reference_coords_kernel', 'name_in_target': 'to_reference_coords_kernel'}
f = Field(name='name_in_target',type='str | None',default=<dataclasses._MISSING_TYPE object at 0x7f2599ddf5f0>,default_fac... 0x7f2599ddf5f0>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD)
def replace(obj, /, **changes):
"""Return a new object replacing specified fields with new values.
This is especially useful for frozen classes. Example usage::
@dataclass(frozen=True)
class C:
x: int
y: int
c = C(1, 2)
c1 = replace(c, x=3)
assert c1.x == 3 and c1.y == 2
"""
# We're going to mutate 'changes', but that's okay because it's a
# new dict, even if called with 'replace(obj, **my_changes)'.
if not _is_dataclass_instance(obj):
raise TypeError("replace() should be called on dataclass instances")
# It's an error to have init=False fields in 'changes'.
# If a field is not in 'changes', read its value from the provided obj.
for f in getattr(obj, _FIELDS).values():
# Only consider normal fields or InitVars.
if f._field_type is _FIELD_CLASSVAR:
continue
if not f.init:
# Error if this field is specified in changes.
if f.name in changes:
raise ValueError(f'field {f.name} is declared with '
'init=False, it cannot be specified with '
'replace()')
continue
if f.name not in changes:
if f._field_type is _FIELD_INITVAR and f.default is MISSING:
raise ValueError(f"InitVar {f.name!r} "
'must be specified with replace()')
changes[f.name] = getattr(obj, f.name)
# Create the new object, which calls __init__() and
# __post_init__() (if defined), using all of the init fields we've
# added and/or left in 'changes'. If there are values supplied in
# changes that aren't fields, this will correctly raise a
# TypeError.
> return obj.__class__(**changes)
E TypeError: PyOP2KernelCallable.__init__() missing 1 required positional argument: 'parameters'
/usr/lib/python3.12/dataclasses.py:1581: TypeError
Check failure on line 218 in tests/firedrake/vertexonly/test_interpolation_from_parent.py
github-actions / Firedrake real
test_interpolation_from_parent.test_vector_function_interpolation[tetrahedron-mesh-0-coords-VectorFunctionSpace(CG2)]
TypeError: PyOP2KernelCallable.__init__() missing 1 required positional argument: 'parameters'
Raw output
self = Mesh(VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3), 189)
tolerance = 0.5
def _c_locator(self, tolerance=None):
from pyop2 import compilation
from pyop2.utils import get_petsc_dir
import firedrake.function as function
import firedrake.pointquery_utils as pq_utils
cache = self.__dict__.setdefault("_c_locator_cache", {})
try:
> return cache[tolerance]
E KeyError: 0.5
firedrake/mesh.py:2651: KeyError
During handling of the above exception, another exception occurred:
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=158)
key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
def fetch(self, key: K) -> V:
keyhash = self.key_builder(key)
try:
> stored_key, value = self._fetch(keyhash)
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:750:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=159)
keyhash = 'd1d95918a1efeba628f9ed0db75eac691ef71788cea69537df3016c77227a261'
def _fetch_uncached(self, keyhash: str) -> tuple[K, V]:
# This method is separate from fetch() to allow for LRU caching
def fetch_inner() -> tuple[Any] | None:
assert self.conn is not None
# This is separate from fetch() so that the mutex covers the
# fetchone() call
c = self.conn.execute("SELECT key_value FROM dict WHERE keyhash=?",
(keyhash,))
res = c.fetchone()
assert res is None or isinstance(res, tuple)
return res
row = self._exec_sql_fn(fetch_inner)
if row is None:
> raise KeyError
E KeyError
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:741: KeyError
The above exception was the direct cause of the following exception:
args = (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCallable(arg_id_to_dtype=None, arg_id_to_descr=N...et=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),)
kwargs = {}, CACHING_ENABLED = True
cache_key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
proc_log_str = "preprocess_program on 'wrap_to_reference_coords'"
entrypoints_str = 'wrap_to_reference_coords'
@wraps(func)
def wrapper(*args, **kwargs):
from loopy import CACHING_ENABLED
if (not CACHING_ENABLED
or kwargs.pop("_no_memoize_on_disk", False)):
return func(*args, **kwargs)
cache_key = (func.__qualname__, func.__name__, args, kwargs)
try:
> result = transform_cache[cache_key]
../firedrake_venv/src/loopy/loopy/tools.py:877:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:597: in __getitem__
return self.fetch(key)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=158)
key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
def fetch(self, key: K) -> V:
keyhash = self.key_builder(key)
try:
stored_key, value = self._fetch(keyhash)
except KeyError as err:
> raise NoSuchEntryError(key) from err
E pytools.persistent_dict.NoSuchEntryError: ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='MatSetValues', name_in_target=None), 'wrap_to_reference_coords': CallableKernel(arg_id_to_dtype=None, arg_id_to_descr=None, subkernel=LoopKernel(domains=[BasicSet("[end, start] -> { [n] : n = start and start < end }"), BasicSet("{ [i2] : i2 = 0 }"), BasicSet("{ [i0] : 0 <= i0 <= 3 }"), BasicSet("{ [i1] : 0 <= i1 <= 2 }"), BasicSet("{ [i3] : i3 = 0 }"), BasicSet("{ [i4] : 0 <= i4 <= 3 }"), BasicSet("{ [i5] : 0 <= i5 <= 2 }")], instructions=[CallInstruction(assignees=(), conflicts_with_groups=frozenset(), depends_on_is_final=True, expression=Call(Variable('to_reference_coords_kernel'), (Variable('farg0'), Variable('farg1'), Variable('farg2'), SubArrayRef((Variable('i2'), Variable('i0'), Variable('i1')), Subscript(Variable('t0'), (Variable('i2'), Variable('i0'), Variable('i1')))))), groups=frozenset(), happens_after=immutabledict({'statement0': HappensAfter(variable_name=None, instances_rel=None)}), id='statement1', no_sync_with=frozenset(), predicates=frozenset(), priority=0, tags=frozenset(), temp_var_types=(), within_inames=frozenset({'n'}), within_inames_is_final=True), Assignment(assignee=Subscript(Variable('t0'), (Variable('i3'), Variable('i4'), Variable('i5'))), atomicity=(), conflicts_with_groups=frozenset(), depends_on_is_final=True, expression=Subscript(Variable('dat0'), (Subscript(Variable('map0'), (Variable('n'), Variable('i4'))), Variable('i5'))), groups=frozenset(), happens_after=immutabledict({}), id='statement0', no_sync_with=frozenset(), predicates=frozenset(), priority=0, tags=frozenset(), temp_var_type=Optional(), within_inames=frozenset({'n', 'i3', 'i5', 'i4'}), within_inames_is_final=True)], args=[<farg0: ValueArg, type: <loopy.types.OpaqueType object at 0x7f2555990650>>, <farg1: ValueArg, type: <loopy.types.OpaqueType object at 0x7f254ab6af60>>, <farg2: ValueArg, type: <loopy.types.OpaqueType object at 0x7f254ab69220>>, <start: ValueArg, type: np:dtype('int32')>, <end: ValueArg, type: np:dtype('int32')>, <dat0: type: np:dtype('float64'), shape: (None, 3), dim_tags: (N1:stride:3, N0:stride:1) in aspace: global>, <map0: type: np:dtype('int32'), shape: (None, 4), dim_tags: (N1:stride:4, N0:stride:1) in aspace: global>], assumptions=BasicSet("[end, start] -> { : 0 <= start < end }"), temporary_variables={'t0': <t0: type: np:dtype('float64'), shape: (1, 4, 3), dim_tags: (N2:stride:12, N1:stride:3, N0:stride:1) aspace: auto>}, inames={'i2': Iname(name='i2', tags=frozenset()), 'n': Iname(name='n', tags=frozenset()), 'i3': Iname(name='i3', tags=frozenset()), 'i0': Iname(name='i0', tags=frozenset()), 'i5': Iname(name='i5', tags=frozenset()), 'i1': Iname(name='i1', tags=frozenset()), 'i4': Iname(name='i4', tags=frozenset())}, substitutions={}, options=Options(allow_fp_reordering=True, allow_terminal_colors=True, annotate_inames=False, build_options=[], check_dep_resolution=True, cl_exec_manage_array_events=True, disable_global_barriers=False, edit_code=False, enforce_array_accesses_within_bounds=True, enforce_variable_access_ordered=True, insert_gbarriers=False, no_numpy=False, return_dict=False, skip_arg_checks=False, trace_assignment_values=False, trace_assignments=False, write_code=False, write_wrapper=False), target=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, tags=frozenset(), state=<KernelState.INITIAL: 0>, name='wrap_to_reference_coords', preambles=(), preamble_generators=(_PreambleGen(preamble='#include <complex.h>\n#include <math.h>\n#include <petsc.h>\n'),), symbol_manglers=[<function symbol_mangler at 0x7f2577675a80>], linearization=None, iname_slab_increments=immutables.Map({}), loop_priority=frozenset(), applied_iname_rewrites=(), index_dtype=np:dtype('int32'), silenced_warnings=[], overridden_get_grid_sizes_for_insn_ids=None)), 'to_reference_coords_kernel': PyOP2KernelCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='to_reference_coords_kernel', name_in_target=None)}), target=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:752: NoSuchEntryError
During handling of the above exception, another exception occurred:
parentmesh = Mesh(VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3), 189)
vertexcoords = array([], shape=(0, 3), dtype=float64)
vfs = ('CG', 2, <cyfunction VectorFunctionSpace at 0x7f25775b01e0>)
def test_vector_function_interpolation(parentmesh, vertexcoords, vfs):
if parentmesh.name == "immersedsphere":
vertexcoords = immersed_sphere_vertexcoords(parentmesh, vertexcoords)
vfs_fam, vfs_deg, vfs_typ = vfs
> vm = VertexOnlyMesh(parentmesh, vertexcoords, missing_points_behaviour=None)
tests/firedrake/vertexonly/test_interpolation_from_parent.py:218:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
firedrake/mesh.py:3364: in VertexOnlyMesh
swarm, input_ordering_swarm, n_missing_points = _pic_swarm_in_mesh(
firedrake/mesh.py:3585: in _pic_swarm_in_mesh
) = _parent_mesh_embedding(
firedrake/mesh.py:4151: in _parent_mesh_embedding
) = parent_mesh.locate_cells_ref_coords_and_dists(coords_global, tolerance)
firedrake/mesh.py:2633: in locate_cells_ref_coords_and_dists
self._c_locator(tolerance=tolerance)(self.coordinates._ctypes,
firedrake/mesh.py:2654: in _c_locator
src = pq_utils.src_locate_cell(self, tolerance=tolerance)
firedrake/pointquery_utils.py:39: in src_locate_cell
src.append(make_wrapper(mesh.coordinates,
firedrake/pointquery_utils.py:33: in make_wrapper
return generate_single_cell_wrapper(function.cell_set, args, **kwargs)
pyop2/parloop.py:797: in generate_single_cell_wrapper
code = lp.generate_code_v2(wrapper)
../firedrake_venv/src/loopy/loopy/codegen/__init__.py:616: in generate_code_v2
t_unit = preprocess_program(t_unit)
../firedrake_venv/src/loopy/loopy/tools.py:893: in wrapper
result = func(*args, **kwargs)
../firedrake_venv/src/loopy/loopy/preprocess.py:827: in preprocess_program
t_unit = infer_unknown_types(t_unit, expect_completion=False)
../firedrake_venv/src/loopy/loopy/type_inference.py:1061: in infer_unknown_types
new_callable, clbl_inf_ctx = t_unit.callables_table[e].with_types(
../firedrake_venv/src/loopy/loopy/kernel/function_interface.py:761: in with_types
infer_unknown_types_for_a_single_kernel(
../firedrake_venv/src/loopy/loopy/type_inference.py:994: in infer_unknown_types_for_a_single_kernel
type_inf_mapper(insn.expression,
../firedrake_venv/src/loopy/loopy/type_inference.py:211: in __call__
result = super().__call__(
../firedrake_venv/lib/python3.12/site-packages/pymbolic/mapper/__init__.py:436: in __call__
result = method(expr, *args, **kwargs)
../firedrake_venv/src/loopy/loopy/type_inference.py:443: in map_call
.with_types(arg_id_to_dtype,
pyop2/codegen/rep2loopy.py:223: in with_types
return self.copy(
../firedrake_venv/src/loopy/loopy/kernel/function_interface.py:372: in copy
return replace(self, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = PyOP2KernelCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='to_reference_coords_kernel', name_in_target=None)
changes = {'arg_id_to_descr': None, 'arg_id_to_dtype': {0: <loopy.types.OpaqueType object at 0x7f2555990650>, 1: <loopy.types.Op...b69220>, 3: np:dtype('float64')}, 'name': 'to_reference_coords_kernel', 'name_in_target': 'to_reference_coords_kernel'}
f = Field(name='name_in_target',type='str | None',default=<dataclasses._MISSING_TYPE object at 0x7f2599ddf5f0>,default_fac... 0x7f2599ddf5f0>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD)
def replace(obj, /, **changes):
"""Return a new object replacing specified fields with new values.
This is especially useful for frozen classes. Example usage::
@dataclass(frozen=True)
class C:
x: int
y: int
c = C(1, 2)
c1 = replace(c, x=3)
assert c1.x == 3 and c1.y == 2
"""
# We're going to mutate 'changes', but that's okay because it's a
# new dict, even if called with 'replace(obj, **my_changes)'.
if not _is_dataclass_instance(obj):
raise TypeError("replace() should be called on dataclass instances")
# It's an error to have init=False fields in 'changes'.
# If a field is not in 'changes', read its value from the provided obj.
for f in getattr(obj, _FIELDS).values():
# Only consider normal fields or InitVars.
if f._field_type is _FIELD_CLASSVAR:
continue
if not f.init:
# Error if this field is specified in changes.
if f.name in changes:
raise ValueError(f'field {f.name} is declared with '
'init=False, it cannot be specified with '
'replace()')
continue
if f.name not in changes:
if f._field_type is _FIELD_INITVAR and f.default is MISSING:
raise ValueError(f"InitVar {f.name!r} "
'must be specified with replace()')
changes[f.name] = getattr(obj, f.name)
# Create the new object, which calls __init__() and
# __post_init__() (if defined), using all of the init fields we've
# added and/or left in 'changes'. If there are values supplied in
# changes that aren't fields, this will correctly raise a
# TypeError.
> return obj.__class__(**changes)
E TypeError: PyOP2KernelCallable.__init__() missing 1 required positional argument: 'parameters'
/usr/lib/python3.12/dataclasses.py:1581: TypeError
Check failure on line 218 in tests/firedrake/vertexonly/test_interpolation_from_parent.py
github-actions / Firedrake real
test_interpolation_from_parent.test_vector_function_interpolation[tetrahedron-mesh-0-coords-FunctionSpace(N1curl2)]
TypeError: PyOP2KernelCallable.__init__() missing 1 required positional argument: 'parameters'
Raw output
self = Mesh(VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3), 192)
tolerance = 0.5
def _c_locator(self, tolerance=None):
from pyop2 import compilation
from pyop2.utils import get_petsc_dir
import firedrake.function as function
import firedrake.pointquery_utils as pq_utils
cache = self.__dict__.setdefault("_c_locator_cache", {})
try:
> return cache[tolerance]
E KeyError: 0.5
firedrake/mesh.py:2651: KeyError
During handling of the above exception, another exception occurred:
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=163)
key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
def fetch(self, key: K) -> V:
keyhash = self.key_builder(key)
try:
> stored_key, value = self._fetch(keyhash)
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:750:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=163)
keyhash = 'd1d95918a1efeba628f9ed0db75eac691ef71788cea69537df3016c77227a261'
def _fetch_uncached(self, keyhash: str) -> tuple[K, V]:
# This method is separate from fetch() to allow for LRU caching
def fetch_inner() -> tuple[Any] | None:
assert self.conn is not None
# This is separate from fetch() so that the mutex covers the
# fetchone() call
c = self.conn.execute("SELECT key_value FROM dict WHERE keyhash=?",
(keyhash,))
res = c.fetchone()
assert res is None or isinstance(res, tuple)
return res
row = self._exec_sql_fn(fetch_inner)
if row is None:
> raise KeyError
E KeyError
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:741: KeyError
The above exception was the direct cause of the following exception:
args = (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCallable(arg_id_to_dtype=None, arg_id_to_descr=N...et=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),)
kwargs = {}, CACHING_ENABLED = True
cache_key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
proc_log_str = "preprocess_program on 'wrap_to_reference_coords'"
entrypoints_str = 'wrap_to_reference_coords'
@wraps(func)
def wrapper(*args, **kwargs):
from loopy import CACHING_ENABLED
if (not CACHING_ENABLED
or kwargs.pop("_no_memoize_on_disk", False)):
return func(*args, **kwargs)
cache_key = (func.__qualname__, func.__name__, args, kwargs)
try:
> result = transform_cache[cache_key]
../firedrake_venv/src/loopy/loopy/tools.py:877:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:597: in __getitem__
return self.fetch(key)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = WriteOncePersistentDict(/github/home/.cache/pytools/pdict-v5-loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.2-cgen2020.1-v13.12.3.final.0.sqlite, nitems=163)
key = ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCal...oopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
def fetch(self, key: K) -> V:
keyhash = self.key_builder(key)
try:
stored_key, value = self._fetch(keyhash)
except KeyError as err:
> raise NoSuchEntryError(key) from err
E pytools.persistent_dict.NoSuchEntryError: ('preprocess_program', 'preprocess_program', (TranslationUnit(callables_table=immutables.Map({'MatSetValues': PetscCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='MatSetValues', name_in_target=None), 'wrap_to_reference_coords': CallableKernel(arg_id_to_dtype=None, arg_id_to_descr=None, subkernel=LoopKernel(domains=[BasicSet("[end, start] -> { [n] : n = start and start < end }"), BasicSet("{ [i2] : i2 = 0 }"), BasicSet("{ [i0] : 0 <= i0 <= 3 }"), BasicSet("{ [i1] : 0 <= i1 <= 2 }"), BasicSet("{ [i3] : i3 = 0 }"), BasicSet("{ [i4] : 0 <= i4 <= 3 }"), BasicSet("{ [i5] : 0 <= i5 <= 2 }")], instructions=[CallInstruction(assignees=(), conflicts_with_groups=frozenset(), depends_on_is_final=True, expression=Call(Variable('to_reference_coords_kernel'), (Variable('farg0'), Variable('farg1'), Variable('farg2'), SubArrayRef((Variable('i2'), Variable('i0'), Variable('i1')), Subscript(Variable('t0'), (Variable('i2'), Variable('i0'), Variable('i1')))))), groups=frozenset(), happens_after=immutabledict({'statement0': HappensAfter(variable_name=None, instances_rel=None)}), id='statement1', no_sync_with=frozenset(), predicates=frozenset(), priority=0, tags=frozenset(), temp_var_types=(), within_inames=frozenset({'n'}), within_inames_is_final=True), Assignment(assignee=Subscript(Variable('t0'), (Variable('i3'), Variable('i4'), Variable('i5'))), atomicity=(), conflicts_with_groups=frozenset(), depends_on_is_final=True, expression=Subscript(Variable('dat0'), (Subscript(Variable('map0'), (Variable('n'), Variable('i4'))), Variable('i5'))), groups=frozenset(), happens_after=immutabledict({}), id='statement0', no_sync_with=frozenset(), predicates=frozenset(), priority=0, tags=frozenset(), temp_var_type=Optional(), within_inames=frozenset({'n', 'i3', 'i5', 'i4'}), within_inames_is_final=True)], args=[<farg0: ValueArg, type: <loopy.types.OpaqueType object at 0x7f254ab6be90>>, <farg1: ValueArg, type: <loopy.types.OpaqueType object at 0x7f254ab687d0>>, <farg2: ValueArg, type: <loopy.types.OpaqueType object at 0x7f254ab6aa80>>, <start: ValueArg, type: np:dtype('int32')>, <end: ValueArg, type: np:dtype('int32')>, <dat0: type: np:dtype('float64'), shape: (None, 3), dim_tags: (N1:stride:3, N0:stride:1) in aspace: global>, <map0: type: np:dtype('int32'), shape: (None, 4), dim_tags: (N1:stride:4, N0:stride:1) in aspace: global>], assumptions=BasicSet("[end, start] -> { : 0 <= start < end }"), temporary_variables={'t0': <t0: type: np:dtype('float64'), shape: (1, 4, 3), dim_tags: (N2:stride:12, N1:stride:3, N0:stride:1) aspace: auto>}, inames={'i2': Iname(name='i2', tags=frozenset()), 'n': Iname(name='n', tags=frozenset()), 'i3': Iname(name='i3', tags=frozenset()), 'i0': Iname(name='i0', tags=frozenset()), 'i5': Iname(name='i5', tags=frozenset()), 'i1': Iname(name='i1', tags=frozenset()), 'i4': Iname(name='i4', tags=frozenset())}, substitutions={}, options=Options(allow_fp_reordering=True, allow_terminal_colors=True, annotate_inames=False, build_options=[], check_dep_resolution=True, cl_exec_manage_array_events=True, disable_global_barriers=False, edit_code=False, enforce_array_accesses_within_bounds=True, enforce_variable_access_ordered=True, insert_gbarriers=False, no_numpy=False, return_dict=False, skip_arg_checks=False, trace_assignment_values=False, trace_assignments=False, write_code=False, write_wrapper=False), target=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, tags=frozenset(), state=<KernelState.INITIAL: 0>, name='wrap_to_reference_coords', preambles=(), preamble_generators=(_PreambleGen(preamble='#include <complex.h>\n#include <math.h>\n#include <petsc.h>\n'),), symbol_manglers=[<function symbol_mangler at 0x7f2577675a80>], linearization=None, iname_slab_increments=immutables.Map({}), loop_priority=frozenset(), applied_iname_rewrites=(), index_dtype=np:dtype('int32'), silenced_warnings=[], overridden_get_grid_sizes_for_insn_ids=None)), 'to_reference_coords_kernel': PyOP2KernelCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='to_reference_coords_kernel', name_in_target=None)}), target=<loopy.target.c.CWithGNULibcTarget object at 0x7f2589da6330>, entrypoints=frozenset({'wrap_to_reference_coords'})),), {})
../firedrake_venv/lib/python3.12/site-packages/pytools/persistent_dict.py:752: NoSuchEntryError
During handling of the above exception, another exception occurred:
parentmesh = Mesh(VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3), 192)
vertexcoords = array([], shape=(0, 3), dtype=float64)
vfs = ('N1curl', 2, <cyfunction FunctionSpace at 0x7f25775b0040>)
def test_vector_function_interpolation(parentmesh, vertexcoords, vfs):
if parentmesh.name == "immersedsphere":
vertexcoords = immersed_sphere_vertexcoords(parentmesh, vertexcoords)
vfs_fam, vfs_deg, vfs_typ = vfs
> vm = VertexOnlyMesh(parentmesh, vertexcoords, missing_points_behaviour=None)
tests/firedrake/vertexonly/test_interpolation_from_parent.py:218:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
firedrake/mesh.py:3364: in VertexOnlyMesh
swarm, input_ordering_swarm, n_missing_points = _pic_swarm_in_mesh(
firedrake/mesh.py:3585: in _pic_swarm_in_mesh
) = _parent_mesh_embedding(
firedrake/mesh.py:4151: in _parent_mesh_embedding
) = parent_mesh.locate_cells_ref_coords_and_dists(coords_global, tolerance)
firedrake/mesh.py:2633: in locate_cells_ref_coords_and_dists
self._c_locator(tolerance=tolerance)(self.coordinates._ctypes,
firedrake/mesh.py:2654: in _c_locator
src = pq_utils.src_locate_cell(self, tolerance=tolerance)
firedrake/pointquery_utils.py:39: in src_locate_cell
src.append(make_wrapper(mesh.coordinates,
firedrake/pointquery_utils.py:33: in make_wrapper
return generate_single_cell_wrapper(function.cell_set, args, **kwargs)
pyop2/parloop.py:797: in generate_single_cell_wrapper
code = lp.generate_code_v2(wrapper)
../firedrake_venv/src/loopy/loopy/codegen/__init__.py:616: in generate_code_v2
t_unit = preprocess_program(t_unit)
../firedrake_venv/src/loopy/loopy/tools.py:893: in wrapper
result = func(*args, **kwargs)
../firedrake_venv/src/loopy/loopy/preprocess.py:827: in preprocess_program
t_unit = infer_unknown_types(t_unit, expect_completion=False)
../firedrake_venv/src/loopy/loopy/type_inference.py:1061: in infer_unknown_types
new_callable, clbl_inf_ctx = t_unit.callables_table[e].with_types(
../firedrake_venv/src/loopy/loopy/kernel/function_interface.py:761: in with_types
infer_unknown_types_for_a_single_kernel(
../firedrake_venv/src/loopy/loopy/type_inference.py:994: in infer_unknown_types_for_a_single_kernel
type_inf_mapper(insn.expression,
../firedrake_venv/src/loopy/loopy/type_inference.py:211: in __call__
result = super().__call__(
../firedrake_venv/lib/python3.12/site-packages/pymbolic/mapper/__init__.py:436: in __call__
result = method(expr, *args, **kwargs)
../firedrake_venv/src/loopy/loopy/type_inference.py:443: in map_call
.with_types(arg_id_to_dtype,
pyop2/codegen/rep2loopy.py:223: in with_types
return self.copy(
../firedrake_venv/src/loopy/loopy/kernel/function_interface.py:372: in copy
return replace(self, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = PyOP2KernelCallable(arg_id_to_dtype=None, arg_id_to_descr=None, name='to_reference_coords_kernel', name_in_target=None)
changes = {'arg_id_to_descr': None, 'arg_id_to_dtype': {0: <loopy.types.OpaqueType object at 0x7f254ab6be90>, 1: <loopy.types.Op...b6aa80>, 3: np:dtype('float64')}, 'name': 'to_reference_coords_kernel', 'name_in_target': 'to_reference_coords_kernel'}
f = Field(name='name_in_target',type='str | None',default=<dataclasses._MISSING_TYPE object at 0x7f2599ddf5f0>,default_fac... 0x7f2599ddf5f0>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD)
def replace(obj, /, **changes):
"""Return a new object replacing specified fields with new values.
This is especially useful for frozen classes. Example usage::
@dataclass(frozen=True)
class C:
x: int
y: int
c = C(1, 2)
c1 = replace(c, x=3)
assert c1.x == 3 and c1.y == 2
"""
# We're going to mutate 'changes', but that's okay because it's a
# new dict, even if called with 'replace(obj, **my_changes)'.
if not _is_dataclass_instance(obj):
raise TypeError("replace() should be called on dataclass instances")
# It's an error to have init=False fields in 'changes'.
# If a field is not in 'changes', read its value from the provided obj.
for f in getattr(obj, _FIELDS).values():
# Only consider normal fields or InitVars.
if f._field_type is _FIELD_CLASSVAR:
continue
if not f.init:
# Error if this field is specified in changes.
if f.name in changes:
raise ValueError(f'field {f.name} is declared with '
'init=False, it cannot be specified with '
'replace()')
continue
if f.name not in changes:
if f._field_type is _FIELD_INITVAR and f.default is MISSING:
raise ValueError(f"InitVar {f.name!r} "
'must be specified with replace()')
changes[f.name] = getattr(obj, f.name)
# Create the new object, which calls __init__() and
# __post_init__() (if defined), using all of the init fields we've
# added and/or left in 'changes'. If there are values supplied in
# changes that aren't fields, this will correctly raise a
# TypeError.
> return obj.__class__(**changes)
E TypeError: PyOP2KernelCallable.__init__() missing 1 required positional argument: 'parameters'
/usr/lib/python3.12/dataclasses.py:1581: TypeError