Skip to content

Commit 8064abc

Browse files
committed
misc/compiler: Rename/separate files, clean up and add lower_petsc_symbols
1 parent a19f136 commit 8064abc

17 files changed

Lines changed: 2529 additions & 2214 deletions

File tree

devito/core/cpu.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
check_stability, PetscTarget)
1515
from devito.tools import timed_pass
1616

17+
from devito.petsc.iet.passes import lower_petsc_symbols
18+
1719
__all__ = ['Cpu64NoopCOperator', 'Cpu64NoopOmpOperator', 'Cpu64AdvCOperator',
1820
'Cpu64AdvOmpOperator', 'Cpu64FsgCOperator', 'Cpu64FsgOmpOperator',
1921
'Cpu64CustomOperator', 'Cpu64CustomCXXOperator', 'Cpu64AdvCXXOperator',
@@ -143,6 +145,9 @@ def _specialize_iet(cls, graph, **kwargs):
143145
# Symbol definitions
144146
cls._Target.DataManager(**kwargs).process(graph)
145147

148+
# Lower PETSc symbols
149+
lower_petsc_symbols(graph, **kwargs)
150+
146151
return graph
147152

148153

@@ -222,6 +227,9 @@ def _specialize_iet(cls, graph, **kwargs):
222227
# Symbol definitions
223228
cls._Target.DataManager(**kwargs).process(graph)
224229

230+
# Lower PETSc symbols
231+
lower_petsc_symbols(graph, **kwargs)
232+
225233
# Linearize n-dimensional Indexeds
226234
linearize(graph, **kwargs)
227235

devito/ir/iet/visitors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1068,7 +1068,7 @@ class FindSymbols(LazyVisitor[Any, list[Any], None]):
10681068
Drive the search. Accepted:
10691069
- `symbolics`: Collect all AbstractFunction objects, default
10701070
- `basics`: Collect all Basic objects
1071-
- `abstractsymbols`: Collect all AbstractSymbol objects
1071+
- `symbols`: Collect all AbstractSymbol objects
10721072
- `dimensions`: Collect all Dimensions
10731073
- `indexeds`: Collect all Indexed objects
10741074
- `indexedbases`: Collect all IndexedBase objects

devito/passes/iet/languages/C.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from devito.passes.iet.langbase import LangBB
88
from devito.symbolics import c_complex, c_double_complex
99
from devito.tools import dtype_to_cstr
10+
1011
from devito.petsc.utils import petsc_type_mappings
1112

1213
__all__ = ['CBB', 'CDataManager', 'COrchestrator']
@@ -82,3 +83,6 @@ class PetscCPrinter(CPrinter):
8283
_restrict_keyword = ''
8384

8485
type_mappings = {**CPrinter.type_mappings, **petsc_type_mappings}
86+
87+
def _print_Pi(self, expr):
88+
return 'PETSC_PI'

0 commit comments

Comments
 (0)