Skip to content

Commit

Permalink
ci: switch innerproduct tests to inner
Browse files Browse the repository at this point in the history
  • Loading branch information
mloubout committed Oct 6, 2023
1 parent 51be20c commit d628f54
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion devito/passes/iet/parpragma.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ def _make_reductions(self, partree):
# The opposite corner case (most outer loop atomic)
# should be detected before this pass
nc = len(partree.collapsed)
if all(i.is_ParallelNoAtomic for i in partree.collapsed[:nc-1]):
if nc > 1 and all(i.is_ParallelNoAtomic for i in partree.collapsed[:nc-1]):
mapper = {partree.root: partree.root._rebuild(ncollapsed=nc-1)}
return Transformer(mapper).visit(partree)

Expand Down
8 changes: 4 additions & 4 deletions tests/test_adjoint.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import numpy as np
import pytest

from devito import Operator, norm, Function, Grid, SparseFunction
from devito import Operator, norm, Function, Grid, SparseFunction, inner
from devito.logger import info
from examples.seismic import demo_model, Receiver
from examples.seismic.acoustic import acoustic_setup
Expand Down Expand Up @@ -114,7 +114,7 @@ def test_adjoint_F(self, mkey, shape, kernel, space_order, time_order, setup_fun
solver.adjoint(rec=rec, srca=srca)

# Adjoint test: Verify <Ax,y> matches <x, A^Ty> closely
term1 = np.dot(srca.data.reshape(-1), solver.geometry.src.data)
term1 = inner(srca, solver.geometry.src)
term2 = norm(rec) ** 2
info('<x, A^Ty>: %f, <Ax,y>: %f, difference: %4.4e, ratio: %f'
% (term1, term2, (term1 - term2)/term1, term1 / term2))
Expand Down Expand Up @@ -231,6 +231,6 @@ def test_adjoint_inject_interpolate(self, shape, coords, npoints=19):
# y => p
# x => c
# P^T y => a
term1 = np.dot(p2.data.reshape(-1), p.data.reshape(-1))
term2 = np.dot(c.data.reshape(-1), a.data.reshape(-1))
term1 = inner(p2, p)
term2 = inner(c, a)
assert np.isclose((term1-term2) / term1, 0., atol=1.e-6)
3 changes: 1 addition & 2 deletions tests/test_dle.py
Original file line number Diff line number Diff line change
Expand Up @@ -888,9 +888,8 @@ def test_incr_perfect_outer(self):

summation = Inc(w, u*v)

op0 = Operator([summation])
op0 = Operator([summation], opt=('advanced', {'openmp': True}))
assert 'reduction' not in str(op0)
assert 'collapse(2)' in str(op0)
assert 'omp for' in str(op0)

op0()
Expand Down

0 comments on commit d628f54

Please sign in to comment.