2020 NODE , CELL , dimensions , configuration , TensorFunction ,
2121 TensorTimeFunction , VectorFunction , VectorTimeFunction ,
2222 div , grad , switchconfig , exp , Buffer )
23- from devito import Inc , Le , Lt , Ge , Gt # noqa
23+ from devito import Inc , Le , Lt , Ge , Gt , sin # noqa
24+ from devito .arch .archinfo import Device
2425from devito .exceptions import InvalidOperator
2526from devito .finite_differences .differentiable import diff2sympy
2627from devito .ir .equations import ClusterizedEq
@@ -2066,12 +2067,11 @@ def test_indirection(self):
20662067class TestEstimateMemory :
20672068 """Tests for the Operator.estimate_memory() utility"""
20682069
2069- _array_temp = "r0L0(x, y)" if "CXX" in configuration ['language' ] else "r0[x][y]"
2070- _devicelangs = ('openacc' ,)
2070+ _array_temp = "r0L0(" if "CXX" in configuration ['language' ] else "r0["
20712071
20722072 def parse_output (self , summary , check , arrays = 0 ):
2073- expected = (( check , check + arrays ) if configuration ['language' ]
2074- in self . _devicelangs else (check + arrays , 0 ))
2073+ device = isinstance ( configuration ['platform' ], Device )
2074+ expected = (( check , check + arrays ) if device else (check + arrays , 0 ))
20752075 assert (summary ['host' ], summary ['device' ]) == expected
20762076
20772077 def sum_sizes (self , funcs ):
@@ -2185,8 +2185,8 @@ def test_temp_array(self, caplog, override):
21852185 b = Function (name = 'b' , grid = grid , space_order = 0 )
21862186
21872187 # Reuse an expensive function to encourage generation of an array temp
2188- eq0 = Eq (f .forward , g + sympy . sin (a ))
2189- eq1 = Eq (g .forward , f + sympy . sin (a ))
2188+ eq0 = Eq (f .forward , g + sin (a ). dx )
2189+ eq1 = Eq (g .forward , f + sin (a ). dx )
21902190
21912191 with switchconfig (log_level = 'DEBUG' ), caplog .at_level (logging .DEBUG ):
21922192 op = Operator ([eq0 , eq1 ])
@@ -2201,7 +2201,9 @@ def test_temp_array(self, caplog, override):
22012201 check = self .sum_sizes (funcs )
22022202
22032203 # Factor in the temp array
2204- array_check = reduce (mul , b .shape_allocated )* np .dtype (b .dtype ).itemsize
2204+ # Note: temp array size is incremented by one in the x dimension
2205+ # due to derivative.
2206+ array_check = (b .shape_allocated [0 ]+ 1 )* b .shape_allocated [1 ]* np .dtype (b .dtype ).itemsize
22052207 self .parse_output (summary , check , arrays = array_check )
22062208
22072209 def test_overrides (self , caplog ):
0 commit comments