Commit 87f5cfdd authored by Markus Holzer's avatar Markus Holzer
Browse files

Replaced all format strings with f-strings in test cases

parent bced838a
...@@ -19,7 +19,7 @@ def check_equivalence(assignments, src_arr): ...@@ -19,7 +19,7 @@ def check_equivalence(assignments, src_arr):
with_blocking = ps.create_kernel(assignments, cpu_blocking=(8, 16, 4), cpu_openmp=openmp, with_blocking = ps.create_kernel(assignments, cpu_blocking=(8, 16, 4), cpu_openmp=openmp,
cpu_vectorize_info=vectorization).compile() cpu_vectorize_info=vectorization).compile()
without_blocking = ps.create_kernel(assignments).compile() without_blocking = ps.create_kernel(assignments).compile()
print(" openmp {}, vectorization {}".format(openmp, vectorization)) print(f" openmp {openmp}, vectorization {vectorization}")
dst_arr = np.zeros_like(src_arr) dst_arr = np.zeros_like(src_arr)
ref_arr = np.zeros_like(src_arr) ref_arr = np.zeros_like(src_arr)
np.copyto(src_arr, np.random.rand(*src_arr.shape)) np.copyto(src_arr, np.random.rand(*src_arr.shape))
......
...@@ -125,7 +125,7 @@ def test_rotate_interpolation_gpu(dtype, address_mode, use_textures): ...@@ -125,7 +125,7 @@ def test_rotate_interpolation_gpu(dtype, address_mode, use_textures):
else: else:
lenna_gpu = gpuarray.to_gpu( lenna_gpu = gpuarray.to_gpu(
np.ascontiguousarray(lenna, dtype)) np.ascontiguousarray(lenna, dtype))
x_f, y_f = pystencils.fields('x,y: %s [2d]' % type_map[dtype], ghost_layers=0) x_f, y_f = pystencils.fields(f'x,y: {type_map[dtype]} [2d]', ghost_layers=0)
transformed = scale * \ transformed = scale * \
sympy.rot_axis3(rotation_angle)[:2, :2] * sympy.Matrix((x_, y_)) - sympy.Matrix([2, 2]) sympy.rot_axis3(rotation_angle)[:2, :2] * sympy.Matrix((x_, y_)) - sympy.Matrix([2, 2])
...@@ -173,7 +173,7 @@ def test_shift_interpolation_gpu(address_mode, dtype, use_textures): ...@@ -173,7 +173,7 @@ def test_shift_interpolation_gpu(address_mode, dtype, use_textures):
lenna_gpu = gpuarray.to_gpu( lenna_gpu = gpuarray.to_gpu(
np.ascontiguousarray(lenna, dtype)) np.ascontiguousarray(lenna, dtype))
x_f, y_f = pystencils.fields('x,y: %s [2d]' % type_map[dtype], ghost_layers=0) x_f, y_f = pystencils.fields(f'x,y: {type_map[dtype]} [2d]', ghost_layers=0)
if use_textures: if use_textures:
transformed = scale * sympy.rot_axis3(rotation_angle)[:2, :2] * sympy.Matrix((x_, y_)) + shift transformed = scale * sympy.rot_axis3(rotation_angle)[:2, :2] * sympy.Matrix((x_, y_)) + shift
......
...@@ -112,7 +112,7 @@ def test_staggered_iteration_manual(): ...@@ -112,7 +112,7 @@ def test_staggered_iteration_manual():
def test_staggered_gpu(): def test_staggered_gpu():
dim = 2 dim = 2
f = ps.fields("f: double[{dim}D]".format(dim=dim)) f = ps.fields(f"f: double[{dim}D]")
s = ps.fields("s({dim}): double[{dim}D]".format(dim=dim), field_type=FieldType.STAGGERED) s = ps.fields("s({dim}): double[{dim}D]".format(dim=dim), field_type=FieldType.STAGGERED)
expressions = [(f[0, 0] + f[-1, 0]) / 2, expressions = [(f[0, 0] + f[-1, 0]) / 2,
(f[0, 0] + f[0, -1]) / 2] (f[0, 0] + f[0, -1]) / 2]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment