Skip to content

Commit

Permalink
change dimension values
Browse files Browse the repository at this point in the history
Otherwise Intel OpenCL gets its integer arithmetic wrong.
  • Loading branch information
kaushikcfd committed Jun 22, 2023
1 parent 98f7f1a commit b4488ba
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions test/test_arraycontext.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ def test_actx_ravel(actx_factory):
actx = actx_factory()
rng = default_rng()
ndim = rng.integers(low=1, high=6)
shape = tuple(rng.integers(2, 7, ndim))
shape = tuple(rng.integers(2, 8, ndim))

assert_close_to_numpy(actx, lambda _np, ary: _np.ravel(ary),
(rng.random(shape),))
Expand Down Expand Up @@ -716,7 +716,7 @@ def test_array_equal(actx_factory):
def test_array_context_einsum_array_manipulation(actx_factory, spec):
actx = actx_factory()

mat = actx.from_numpy(np.random.randn(10, 10))
mat = actx.from_numpy(np.random.randn(16, 16))
res = actx.to_numpy(actx.einsum(spec, mat,
tagged=(FirstAxisIsElementsTag())))
ans = np.einsum(spec, actx.to_numpy(mat))
Expand All @@ -731,8 +731,8 @@ def test_array_context_einsum_array_manipulation(actx_factory, spec):
def test_array_context_einsum_array_matmatprods(actx_factory, spec):
actx = actx_factory()

mat_a = actx.from_numpy(np.random.randn(5, 5))
mat_b = actx.from_numpy(np.random.randn(5, 5))
mat_a = actx.from_numpy(np.random.randn(16, 16))
mat_b = actx.from_numpy(np.random.randn(16, 16))
res = actx.to_numpy(actx.einsum(spec, mat_a, mat_b,
tagged=(FirstAxisIsElementsTag())))
ans = np.einsum(spec, actx.to_numpy(mat_a), actx.to_numpy(mat_b))
Expand All @@ -745,9 +745,9 @@ def test_array_context_einsum_array_matmatprods(actx_factory, spec):
def test_array_context_einsum_array_tripleprod(actx_factory, spec):
actx = actx_factory()

mat_a = actx.from_numpy(np.random.randn(7, 5))
mat_b = actx.from_numpy(np.random.randn(5, 7))
vec = actx.from_numpy(np.random.randn(7))
mat_a = actx.from_numpy(np.random.randn(16, 4))
mat_b = actx.from_numpy(np.random.randn(4, 16))
vec = actx.from_numpy(np.random.randn(16))
res = actx.to_numpy(actx.einsum(spec, mat_a, mat_b, vec,
tagged=(FirstAxisIsElementsTag())))
ans = np.einsum(spec,
Expand Down Expand Up @@ -1483,7 +1483,7 @@ def _twice(x):

actx = actx_factory()
ones = actx.thaw(actx.freeze(
actx.zeros(shape=(10, 4), dtype=np.float64) + 1
actx.zeros(shape=(16, 4), dtype=np.float64) + 1
))
np.testing.assert_allclose(actx.to_numpy(_twice(ones)),
actx.to_numpy(actx.compile(_twice)(ones)))
Expand Down Expand Up @@ -1574,11 +1574,11 @@ def test_compile_anonymous_function(actx_factory):
actx = actx_factory()
f = actx.compile(lambda x: 2*x+40)
np.testing.assert_allclose(
actx.to_numpy(f(1+actx.zeros((10, 4), "float64"))),
actx.to_numpy(f(1+actx.zeros((16, 4), "float64"))),
42)
f = actx.compile(partial(lambda x: 2*x+40))
np.testing.assert_allclose(
actx.to_numpy(f(1+actx.zeros((10, 4), "float64"))),
actx.to_numpy(f(1+actx.zeros((16, 4), "float64"))),
42)


Expand Down

0 comments on commit b4488ba

Please sign in to comment.