Skip to content
Snippets Groups Projects

Fix #62

Closed Markus Holzer requested to merge holzer/pystencils:FixCasting into master
@@ -300,3 +300,26 @@ def test_issue40(*_):
code = ps.get_code_str(ast)
assert 'epi32' not in code
def test_issue62(*_):
opt = {'instruction_set': "avx", 'assume_aligned': True,
'assume_inner_stride_one': True}
field_type = "float64" # if ctx.double_accuracy else "float32"
# ----- Solving the 2D Poisson equation with rhs --------------------------
dx = sp.Symbol("dx")
dy = sp.Symbol("dy")
src, dst, rhs = ps.fields(f"src, src_tmp, rhs: {field_type}[2D]", layout='fzyx')
up = ps.Assignment(src[0, 0], ((dy ** 2 * (src[1, 0] + src[-1, 0]))
+ (dx ** 2 * (src[0, 1] + src[0, -1]))
- (rhs[0, 0] * dx ** 2 * dy ** 2)) / (2 * (dx ** 2 + dy ** 2)))
config = ps.CreateKernelConfig(data_type=field_type,
cpu_vectorize_info=opt)
ast = ps.create_kernel(up, config=config)
code = ps.get_code_str(ast)
assert 'pow' not in code
Loading