Skip to content

Commit fe12fdb

Browse files
committed
compiler: fix division printing
1 parent fa87cf2 commit fe12fdb

3 files changed

Lines changed: 14 additions & 2 deletions

File tree

.github/workflows/pytest-core-nompi.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ jobs:
172172
173173
- name: Test with pytest
174174
run: |
175-
${{ env.RUN_CMD }} pytest -k "${{ matrix.test-set }}" -m "not parallel" --cov --cov-config=.coveragerc --cov-report=xml ${{ env.TESTS }}
175+
${{ env.RUN_CMD }} pytest -k "${{ matrix.test-set }}" -m "not parallel" --cov --cov-config=.coveragerc --cov-report=xml tests/
176176
177177
- name: Upload coverage to Codecov
178178
if: "!contains(matrix.name, 'docker')"

devito/symbolics/extended_sympy.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,10 @@ def __new__(cls, name, arguments=None, template=None, **kwargs):
622622

623623
return obj
624624

625+
def _eval_is_commutative(self):
626+
# DefFunction is always commutative
627+
return True
628+
625629
@property
626630
def name(self):
627631
return self._name

tests/test_symbolics.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
CallFromPointer, Cast, DefFunction, FieldFromPointer,
1515
INT, FieldFromComposite, IntDiv, Namespace, Rvalue,
1616
ReservedWord, ListInitializer, uxreplace, pow_to_mul,
17-
retrieve_derivatives, BaseCast)
17+
retrieve_derivatives, BaseCast, SizeOf)
1818
from devito.tools import as_tuple
1919
from devito.types import (Array, Bundle, FIndexed, LocalObject, Object,
2020
ComponentAccess, StencilDimension, Symbol as dSymbol)
@@ -906,3 +906,11 @@ def define(self, dimensions):
906906

907907
op = Operator(eq_u)
908908
assert '--' not in str(op.ccode)
909+
910+
911+
def test_print_div():
912+
a = SizeOf(np.int32)
913+
b = SizeOf(np.int64)
914+
cstr = ccode(a / b)
915+
print(cstr)
916+
assert cstr == 'sizeof(int)/sizeof(long)'

0 commit comments

Comments
 (0)