Newer
Older
Andreas Klöckner
committed
knl = lp.tag_inames(knl, dict(j="ilp"))
for k in lp.generate_loop_schedules(knl):
assert k.temporary_variables["a"].shape == (16,)
# }}}
Andreas Klöckner
committed
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
def test_write_parameter(ctx_factory):
dtype = np.float32
ctx = ctx_factory()
knl = lp.make_kernel(ctx.devices[0], [
"{[i,j]: 0<=i,j<n }",
],
"""
a = sum((i,j), i*j)
b = sum(i, sum(j, i*j))
n = 15
""",
[
lp.GlobalArg("a", dtype, shape=()),
lp.GlobalArg("b", dtype, shape=()),
lp.ValueArg("n", np.int32, approximately=1000),
],
assumptions="n>=1")
try:
lp.CompiledKernel(ctx, knl).get_code()
except RuntimeError, e:
assert "may not be written" in str(e)
pass # expected!
else:
assert False # expecting an error
if __name__ == "__main__":
import sys
if len(sys.argv) > 1:
exec(sys.argv[1])
else:
from py.test.cmdline import main
main([__file__])
# vim: foldmethod=marker