diff --git a/contrib/c-integer-semantics.py b/contrib/c-integer-semantics.py index 62a980f0d1dcbd4ca6508d3538e39461fe1c81e3..8b30415c2674217ca7130d3aa4438bda576e3c7c 100644 --- a/contrib/c-integer-semantics.py +++ b/contrib/c-integer-semantics.py @@ -95,7 +95,6 @@ def main(): func.argtypes = [ctypes.c_longlong, ctypes.c_longlong] func.restype = ctypes.c_longlong - cdiv = int_exp.cdiv cmod = int_exp.cmod int_floor_div = int_exp.loopy_floor_div_int64 int_floor_div_pos_b = int_exp.loopy_floor_div_pos_b_int64 diff --git a/loopy/kernel/creation.py b/loopy/kernel/creation.py index 43c4a4ee43ab0273300f075fc6c9f117fa1e8242..f8f854476d45fe7fd50665eb0fb416ff480b3f2c 100644 --- a/loopy/kernel/creation.py +++ b/loopy/kernel/creation.py @@ -679,7 +679,7 @@ def _count_open_paren_symbols(s): for c in s: val = _PAREN_PAIRS.get(c) if val is not None: - increment, cls = val + increment, _cls = val result += increment return result diff --git a/loopy/kernel/function_interface.py b/loopy/kernel/function_interface.py index 33dfd73f23f7144389b2988fbf579a51fb9b1210..fa8a73c21c709b732fc69f419c5f5ffd81603160 100644 --- a/loopy/kernel/function_interface.py +++ b/loopy/kernel/function_interface.py @@ -859,7 +859,7 @@ class CallableKernel(InKernelCallable): *self.subkernel.args, ValueArg(var_name, arg_dtype, self.subkernel.target)]) - kw_to_pos, pos_to_kw = get_kw_pos_association(subknl) + kw_to_pos, _pos_to_kw = get_kw_pos_association(subknl) if self.arg_id_to_dtype is None: arg_id_to_dtype = {} @@ -887,7 +887,7 @@ class CallableKernel(InKernelCallable): def with_packing_for_args(self): from loopy.kernel.data import AddressSpace - kw_to_pos, pos_to_kw = get_kw_pos_association(self.subkernel) + _kw_to_pos, pos_to_kw = get_kw_pos_association(self.subkernel) arg_id_to_descr = {} @@ -955,7 +955,7 @@ class CallableKernel(InKernelCallable): parameters = list(parameters) par_dtypes = [self.arg_id_to_dtype[i] for i, _ in enumerate(parameters)] - kw_to_pos, pos_to_kw = get_kw_pos_association(self.subkernel) + _kw_to_pos, _pos_to_kw = get_kw_pos_association(self.subkernel) # insert the assignees at the required positions assignee_write_count = -1 diff --git a/loopy/kernel/tools.py b/loopy/kernel/tools.py index 9a14aedd58d9c665776ea16bf595dc8214529b0f..66740efc9b8205ac4c56391c6802dda9bec72b4e 100644 --- a/loopy/kernel/tools.py +++ b/loopy/kernel/tools.py @@ -100,7 +100,7 @@ def add_dtypes( def _add_dtypes_overdetermined(kernel, dtype_dict): - dtype_dict_remainder, new_args, new_temp_vars = _add_dtypes(kernel, dtype_dict) + _dtype_dict_remainder, new_args, new_temp_vars = _add_dtypes(kernel, dtype_dict) # do not throw error for unused args return kernel.copy(args=new_args, temporary_variables=new_temp_vars) diff --git a/loopy/library/reduction.py b/loopy/library/reduction.py index 445a0b86fb7587c257394aa2f568b709c4be6616..7ec4f6f8c40f4b6b20e550bcb41e975b6664cba7 100644 --- a/loopy/library/reduction.py +++ b/loopy/library/reduction.py @@ -329,7 +329,7 @@ class _SegmentedScalarReductionOperation(ReductionOperation): from loopy.library.function import MakeTupleCallable from loopy.translation_unit import add_callable_to_table - scalar_neutral_element, calables_table = ( + scalar_neutral_element, _calables_table = ( self.inner_reduction.neutral_element( scalar_dtype, callables_table, target)) diff --git a/loopy/preprocess.py b/loopy/preprocess.py index 98026fdaa3d49b319b19ae6e983d4f4710fa2c1d..254baefe1db5fdccf1b382da444edfdb7e9c15f8 100644 --- a/loopy/preprocess.py +++ b/loopy/preprocess.py @@ -697,7 +697,7 @@ def infer_arg_descr(t_unit: TranslationUnit) -> TranslationUnit: raise NotImplementedError() new_callable, clbl_inf_ctx = t_unit.callables_table[e].with_descrs( arg_id_to_descr, clbl_inf_ctx) - clbl_inf_ctx, new_name = clbl_inf_ctx.with_callable(e, new_callable, + clbl_inf_ctx, _new_name = clbl_inf_ctx.with_callable(e, new_callable, is_entrypoint=True) return clbl_inf_ctx.finish_program(t_unit) diff --git a/loopy/statistics.py b/loopy/statistics.py index 657ee9e25c3ea5a857c53352311ab9cbba3c0966..63e59eb8c522333f7668e68e0f547e8c0306cfee 100755 --- a/loopy/statistics.py +++ b/loopy/statistics.py @@ -2238,7 +2238,7 @@ def gather_access_footprint_bytes(program, ignore_uncountable=False): ignore_uncountable=ignore_uncountable) for key, var_fp in fp.items(): - vname, direction = key + vname, _direction = key var_descr = kernel.get_var_descriptor(vname) bytes_transferred = ( diff --git a/loopy/symbolic.py b/loopy/symbolic.py index 964bd4d02f0755c4d5fdbdf9eee7949dd53f6416..cf2d01425e4a1b6bc021ea179e189e0a26dfc037 100644 --- a/loopy/symbolic.py +++ b/loopy/symbolic.py @@ -1839,7 +1839,7 @@ class PwAffEvaluationMapper(EvaluationMapperBase, IdentityMapperMixin): raise TypeError("modulo non-constant in '%s' not supported " "for as-pwaff evaluation" % expr) - (s, denom_aff), = denom.get_pieces() + (_s, denom_aff), = denom.get_pieces() denom = denom_aff.get_constant_val() return num.mod_val(denom) @@ -1866,7 +1866,7 @@ def aff_from_expr(space: isl.Space, expr: Expression, vars_to_zero=None) -> isl. pieces = pwaff.get_pieces() if len(pieces) == 1: - (s, aff), = pieces + (_s, aff), = pieces return aff else: from loopy.diagnostic import ExpressionNotAffineError @@ -1970,7 +1970,7 @@ def qpolynomial_from_expr(space, expr): pieces = pw_qpoly.get_pieces() if len(pieces) == 1: - (s, qpoly), = pieces + (_s, qpoly), = pieces return qpoly else: raise RuntimeError("expression '%s' could not be converted to a " diff --git a/loopy/target/c/__init__.py b/loopy/target/c/__init__.py index e4a9bef974a768f9bc179b6cbb6bae344b3b894a..9a35207e55454805a671878f42892ab575697dea 100644 --- a/loopy/target/c/__init__.py +++ b/loopy/target/c/__init__.py @@ -945,8 +945,6 @@ class CFamilyASTBuilder(ASTBuilderBase[Generable]): sub_knl_temps | supporting_temporary_names(kernel, sub_knl_temps)) - ecm = self.get_expression_to_code_mapper(codegen_state) - for tv_name in sorted(sub_knl_temps): tv = kernel.temporary_variables[tv_name] if not tv.base_storage: diff --git a/loopy/target/c/c_execution.py b/loopy/target/c/c_execution.py index 873430904289dfc5624f34fa5c37be76d20a9625..8e946648377257ea3920a64d393a407df0d1bb21 100644 --- a/loopy/target/c/c_execution.py +++ b/loopy/target/c/c_execution.py @@ -324,7 +324,7 @@ class CCompiler: c_fname = self._tempname("code." + self.source_suffix) # build object - _, mod_name, ext_file, recompiled = \ + _, _mod_name, ext_file, recompiled = \ compile_from_string( self.toolchain.copy( cflags=self.toolchain.cflags+list(extra_build_options)), diff --git a/loopy/target/cuda.py b/loopy/target/cuda.py index 339010ee74a82783ce5f0de1f1e3a7b56e42174c..e7eb7863a8e554629511174aa12eb038077c7958 100644 --- a/loopy/target/cuda.py +++ b/loopy/target/cuda.py @@ -186,7 +186,7 @@ class CudaCallable(ScalarCallable): input_dtype = arg_id_to_dtype[0] - scalar_dtype, offset, field_name = input_dtype.fields["x"] + scalar_dtype, _offset, _field_name = input_dtype.fields["x"] return_dtype = scalar_dtype return self.copy(arg_id_to_dtype={0: input_dtype, 1: input_dtype, -1: return_dtype}) diff --git a/loopy/target/ispc.py b/loopy/target/ispc.py index cbc8b4170704aad301dbe2c0c2b839d9ef0062cb..0d171d3ea415175a44f95b43f58486166d02f762 100644 --- a/loopy/target/ispc.py +++ b/loopy/target/ispc.py @@ -114,7 +114,7 @@ class ExprToISPCExprMapper(ExpressionToCExpressionMapper): and ary.address_space == AddressSpace.PRIVATE): # generate access code for access to private-index temporaries - gsize, lsize = self.kernel.get_grid_size_upper_bounds_as_exprs() + _gsize, lsize = self.kernel.get_grid_size_upper_bounds_as_exprs() if lsize: lsize, = lsize from pymbolic import evaluate @@ -174,7 +174,7 @@ class ISPCTarget(CFamilyTarget): device_program_name_suffix = "_inner" def pre_codegen_entrypoint_check(self, kernel, callables_table): - gsize, lsize = kernel.get_grid_size_upper_bounds_as_exprs( + _gsize, lsize = kernel.get_grid_size_upper_bounds_as_exprs( callables_table) if len(lsize) > 1: for ls_i in lsize[1:]: diff --git a/loopy/target/opencl.py b/loopy/target/opencl.py index 8250436fd4958469e0a9d5b71d93a6a0e27dc980..8c8f7903defed28f1f1906055acac5c8b4d5095f 100644 --- a/loopy/target/opencl.py +++ b/loopy/target/opencl.py @@ -321,7 +321,7 @@ class OpenCLCallable(ScalarCallable): callables_table) dtype = arg_id_to_dtype[0] - scalar_dtype, offset, field_name = dtype.numpy_dtype.fields["s0"] + scalar_dtype, _offset, _field_name = dtype.numpy_dtype.fields["s0"] return ( self.copy(name_in_target=name, arg_id_to_dtype={-1: NumpyType(scalar_dtype), 0: dtype, 1: dtype}), diff --git a/loopy/tools.py b/loopy/tools.py index ff66e36bec65bb3a4c3e322e9ee05e90a56caa6e..20904a3e495833cb666aab4d9fd7ce59766db6c4 100644 --- a/loopy/tools.py +++ b/loopy/tools.py @@ -268,7 +268,7 @@ def address_from_numpy(obj): if ary_intf is None: raise RuntimeError("no array interface") - buf_base, is_read_only = ary_intf["data"] + buf_base, _is_read_only = ary_intf["data"] return buf_base + ary_intf.get("offset", 0) diff --git a/loopy/transform/callable.py b/loopy/transform/callable.py index 0210eaee2daef2446c869b3e88a79c08851ba3ce..0c0b22a284fb5fc1fd94bf2b6a47bf8c73b47faa 100644 --- a/loopy/transform/callable.py +++ b/loopy/transform/callable.py @@ -314,7 +314,7 @@ def _inline_call_instruction(caller_knl, callee_knl, call_insn): parameters = call_insn.expression.parameters # reads from loopy.kernel.function_interface import get_kw_pos_association - kw_to_pos, pos_to_kw = get_kw_pos_association(callee_knl) + _kw_to_pos, pos_to_kw = get_kw_pos_association(callee_knl) for i, par in enumerate(parameters): arg_map[pos_to_kw[i]] = par diff --git a/loopy/type_inference.py b/loopy/type_inference.py index 57548ab6ffbec399c011b0046353a710a04b4b2e..bae6e36c76c3bfac17a0753aed9b2147c56326c2 100644 --- a/loopy/type_inference.py +++ b/loopy/type_inference.py @@ -1060,7 +1060,7 @@ def infer_unknown_types( t_unit[e].args if arg.dtype not in (None, auto)} new_callable, clbl_inf_ctx = t_unit.callables_table[e].with_types( arg_id_to_dtype, clbl_inf_ctx) - clbl_inf_ctx, new_name = clbl_inf_ctx.with_callable(e, new_callable, + clbl_inf_ctx, _new_name = clbl_inf_ctx.with_callable(e, new_callable, is_entrypoint=True) if expect_completion: from loopy.types import LoopyType diff --git a/proto-tests/test_sem.py b/proto-tests/test_sem.py index acb7d34251f3bc7e02e921b7aa120158afae4ee1..b4d85411bd51472b3577a0619b31f68039e4e886 100644 --- a/proto-tests/test_sem.py +++ b/proto-tests/test_sem.py @@ -359,7 +359,6 @@ def test_advect_dealias(ctx_factory): K_sym = var("K") # noqa field_shape = (N, N, N, K_sym) - interim_field_shape = (M, M, M, K_sym) # 1. direction-by-direction similarity transform on u # 2. invert diagonal diff --git a/proto-tests/test_sem_tim.py b/proto-tests/test_sem_tim.py index 2d0c2fe7e7021fffb59f5bcd09ec2d45e9bab7cc..a42f1aa8cf7d9d41dd66aa6519c3bc437be408c2 100644 --- a/proto-tests/test_sem_tim.py +++ b/proto-tests/test_sem_tim.py @@ -367,7 +367,6 @@ def test_advect_dealias(ctx_factory): K_sym = var("K") # noqa field_shape = (N, N, N, K_sym) - interim_field_shape = (M, M, M, K_sym) # 1. direction-by-direction similarity transform on u # 2. invert diagonal diff --git a/proto-tests/test_tim.py b/proto-tests/test_tim.py index 7a519d808544fef69122c272a829931f24e58576..3926101473ea4a8ac06383650fb0b66076991fb7 100644 --- a/proto-tests/test_tim.py +++ b/proto-tests/test_tim.py @@ -46,8 +46,6 @@ def test_tim2d(ctx_factory): ], name="semlap2D", assumptions="K>=1") - unroll = 32 - seq_knl = knl knl = lp.add_prefetch(knl, "D", ["m", "j", "i", "o"], default_tag="l.auto") knl = lp.add_prefetch(knl, "u", ["i", "j", "o"], default_tag="l.auto") @@ -107,8 +105,6 @@ def test_red2d(ctx_factory): ], name="semlap2D", assumptions="K>=1") - unroll = 32 - seq_knl = knl knl = lp.add_prefetch(knl, "D", ["m", "j", "i", "o"], default_tag="l.auto") knl = lp.add_prefetch(knl, "u", ["i", "j", "o"], default_tag="l.auto") diff --git a/pyproject.toml b/pyproject.toml index b5fecda1744896f6b45b39bd15316d151667b5d2..708f02fa4460ea761c52d38c206108ce0e361651 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -112,7 +112,6 @@ extend-ignore = [ # FIXME "NPY002", # numpy rng "C408", # unnecssary dict() -> literal - "F841", # local variable unused ] [tool.ruff.lint.per-file-ignores] diff --git a/test/test_apps.py b/test/test_apps.py index ce8b97015512e7e4f7b86bbbc6ee74adf4348fe7..11422971dc82831d68520255013527e0488400eb 100644 --- a/test/test_apps.py +++ b/test/test_apps.py @@ -532,7 +532,7 @@ def test_fd_demo(): knl = lp.set_options(knl, write_code=True) knl = lp.add_and_infer_dtypes(knl, dict(u=np.float32)) - code, inf = lp.generate_code(knl) + code, _inf = lp.generate_code(knl) print(code) assert "double" not in code diff --git a/test/test_c_execution.py b/test/test_c_execution.py index 6208b9aed3fe4fb64e1fb1186bef696a45837546..9943d41df8330f765509db6339f57ef3a263a4d4 100644 --- a/test/test_c_execution.py +++ b/test/test_c_execution.py @@ -365,7 +365,7 @@ def test_one_length_loop(): def test_scalar_global_args(): n = np.random.default_rng().integers(30, 100) - evt, (out,) = lp.make_kernel( + _evt, (out,) = lp.make_kernel( "{[i]: 0<=i<n}", "res = sum(i, i)", target=lp.ExecutableCTarget())(n=n) diff --git a/test/test_callables.py b/test/test_callables.py index d7771d20cbfdf778059e1e1b0a3bbf485228bd9c..060147859ef5e1bee0397475c80f9ad1c122b41c 100644 --- a/test/test_callables.py +++ b/test/test_callables.py @@ -52,7 +52,7 @@ def test_register_function_lookup(ctx_factory): """) prog = lp.register_callable(prog, "log2", Log2Callable("log2")) - evt, (out, ) = prog(queue, x=x) + _evt, (out, ) = prog(queue, x=x) assert np.linalg.norm(np.log2(x)-out)/np.linalg.norm(np.log2(x)) < 1e-15 @@ -98,7 +98,7 @@ def test_register_knl(ctx_factory, inline): knl = lp.inline_callable_kernel(knl, "linear_combo2") knl = lp.inline_callable_kernel(knl, "linear_combo1") - evt, (out, ) = knl(queue, x=x, y=y) + _evt, (out, ) = knl(queue, x=x, y=y) assert (np.linalg.norm(2*x+3*y-out)/( np.linalg.norm(2*x+3*y))) < 1e-15 @@ -137,7 +137,7 @@ def test_slices_with_negative_step(ctx_factory, inline): if inline: knl = lp.inline_callable_kernel(knl, "linear_combo") - evt, (out, ) = knl(queue, x=x, y=y) + _evt, (out, ) = knl(queue, x=x, y=y) assert (np.linalg.norm(2*x+3*y-out[:, ::-1, :, :, :])/( np.linalg.norm(2*x+3*y))) < 1e-15 @@ -176,7 +176,7 @@ def test_register_knl_with_hw_axes(ctx_factory, inline): if inline: knl = lp.inline_callable_kernel(knl, "linear_combo") - evt, out = knl(queue, x=x_dev, y=y_dev) + _evt, out = knl(queue, x=x_dev, y=y_dev) x_host = x_dev.get() y_host = y_dev.get() @@ -231,7 +231,7 @@ def test_shape_translation_through_sub_array_ref(ctx_factory, inline): knl = lp.set_options(knl, write_code=True) knl = lp.set_options(knl, return_dict=True) - evt, out_dict = knl(queue, x1=x1, x2=x2, x3=x3) + _evt, out_dict = knl(queue, x1=x1, x2=x2, x3=x3) y1 = out_dict["y1"].get() y2 = out_dict["y2"].get() @@ -284,7 +284,7 @@ def test_multi_arg_array_call(ctx_factory): knl = lp.merge([knl, argmin_kernel]) b = np.random.randn(n) - evt, out_dict = knl(queue, b=b) + _evt, out_dict = knl(queue, b=b) tol = 1e-15 from numpy.linalg import norm assert norm(out_dict["min_val"] - np.min(b)) < tol @@ -330,7 +330,7 @@ def test_packing_unpacking(ctx_factory, inline): knl = lp.set_options(knl, write_code=True) knl = lp.set_options(knl, return_dict=True) - evt, out_dict = knl(queue, x1=x1, x2=x2) + _evt, out_dict = knl(queue, x1=x1, x2=x2) y1 = out_dict["y1"].get() y2 = out_dict["y2"].get() @@ -367,7 +367,7 @@ def test_empty_sub_array_refs(ctx_factory, inline): if inline: caller = lp.inline_callable_kernel(caller, "wence_function") - evt, (out, ) = caller(queue, x=x, y=y) + _evt, (out, ) = caller(queue, x=x, y=y) assert np.allclose(out, x-y) @@ -403,7 +403,7 @@ def test_array_inputs_to_callee_kernels(ctx_factory, inline): if inline: knl = lp.inline_callable_kernel(knl, "linear_combo") - evt, (out, ) = knl(queue, x=x, y=y) + _evt, (out, ) = knl(queue, x=x, y=y) assert (np.linalg.norm(2*x+3*y-out)/( np.linalg.norm(2*x+3*y))) < 1e-15 @@ -484,7 +484,7 @@ def test_argument_matching_for_inplace_update(ctx_factory): knl = lp.merge([knl, twice]) x = np.random.randn(10) - evt, (out, ) = knl(queue, x=np.copy(x)) + _evt, (out, ) = knl(queue, x=np.copy(x)) assert np.allclose(2*x, out) @@ -507,7 +507,7 @@ def test_non_zero_start_in_subarray_ref(ctx_factory): knl = lp.merge([knl, twice]) x = np.random.randn(10) - evt, (out, ) = knl(queue, x=np.copy(x)) + _evt, (out, ) = knl(queue, x=np.copy(x)) assert np.allclose(2*x, out) @@ -558,7 +558,7 @@ def test_callees_with_gbarriers_are_inlined(ctx_factory): """, [lp.GlobalArg("y", shape=6, dtype=None)]) t_unit = lp.merge([t_unit, ones_and_zeros]) - evt, (out,) = t_unit(queue) + _evt, (out,) = t_unit(queue) expected_out = np.array([1, 1, 1, 0, 0, 0]).astype(np.float32) @@ -593,7 +593,7 @@ def test_callees_with_gbarriers_are_inlined_with_nested_calls(ctx_factory): """, [lp.GlobalArg("y", shape=6, dtype=None)]) t_unit = lp.merge([t_unit, dummy_ones_and_zeros, ones_and_zeros]) - evt, (out,) = t_unit(queue) + _evt, (out,) = t_unit(queue) expected_out = np.array([1, 1, 1, 0, 0, 0]).astype(np.float32) @@ -626,7 +626,7 @@ def test_inlining_with_indirections(ctx_factory): map_in = np.arange(3).astype(np.int32) - evt, (out, ) = t_unit(queue, mymap=map_in) + _evt, (out, ) = t_unit(queue, mymap=map_in) expected_out = np.array([1, 1, 1, 0, 0, 0]).astype(np.float32) assert (expected_out == out).all() @@ -651,7 +651,7 @@ def test_inlining_with_callee_domain_param(ctx_factory): caller = lp.merge([caller, fill2]) caller = lp.inline_callable_kernel(caller, "fill2") - evt, (out, ) = caller(queue) + _evt, (out, ) = caller(queue) assert (out == 2).all() @@ -703,7 +703,7 @@ def test_passing_and_getting_scalar_in_clbl_knl(ctx_factory, inline): if inline: knl = lp.inline_callable_kernel(knl, "call_sin") - evt, (out,) = knl(cq, real_x=np.asarray(3.0, dtype=float)) + _evt, (_out,) = knl(cq, real_x=np.asarray(3.0, dtype=float)) @pytest.mark.parametrize("inline", [False, True]) @@ -731,7 +731,7 @@ def test_passing_scalar_as_indexed_subcript_in_clbl_knl(ctx_factory, inline): if inline: knl = lp.inline_callable_kernel(knl, "twice") - evt, (out,) = knl(cq, X=x_in) + _evt, (out,) = knl(cq, X=x_in) np.testing.assert_allclose(out.get(), 2*x_in) @@ -752,7 +752,7 @@ def test_symbol_mangler_in_call(ctx_factory): knl = lp.register_preamble_generators(knl, [preamble_for_x]) - evt, (out,) = knl(cq) + _evt, (out,) = knl(cq) np.testing.assert_allclose(out.get(), np.sin(10)) @@ -927,7 +927,7 @@ def test_non1_step_slices(ctx_factory, start, inline): if inline: t_unit = lp.inline_callable_kernel(t_unit, "squared_arange") - evt, out_dict = t_unit(cq) + _evt, out_dict = t_unit(cq) np.testing.assert_allclose(out_dict["X"].get(), expected_out1) np.testing.assert_allclose(out_dict["Y"].get(), expected_out2) @@ -1012,7 +1012,7 @@ def test_callee_with_parameter_and_grid(ctx_factory): knl = lp.split_iname(knl, "i", 2, outer_tag="g.0", within="in_kernel:arange") - evt, (out,) = knl(cq) + _evt, (out,) = knl(cq) np.testing.assert_allclose(out.get(), np.arange(10)) @@ -1255,7 +1255,7 @@ def test_call_kernel_w_preds(ctx_factory, inline): if inline: knl = lp.inline_callable_kernel(knl, "twice") - evt, (out,) = knl(cq, x=np.ones((10, 10))) + _evt, (out,) = knl(cq, x=np.ones((10, 10))) np.testing.assert_allclose(out[:5], 1) np.testing.assert_allclose(out[5:], 2) @@ -1486,7 +1486,7 @@ def test_subarray_ref_with_repeated_indices(ctx_factory): ) knl = lp.merge([parent_knl, child_knl]) knl = lp.inline_callable_kernel(knl, "ones") - evt, (z_dev,) = knl(cq) + _evt, (z_dev,) = knl(cq) assert np.allclose(z_dev.get(), np.eye(10)) diff --git a/test/test_diff.py b/test/test_diff.py index 5b7d0bbca888a9655374848e2d96d9caeb59c24b..0f9694cc990660e1c184a23409a1a5d305d4889c 100644 --- a/test/test_diff.py +++ b/test/test_diff.py @@ -69,7 +69,7 @@ def test_diff(ctx_factory): from loopy.transform.diff import diff_kernel # FIXME Is this the correct interface. Does it make sense to take the entire # translation unit? - dknl, diff_map = diff_kernel(knl["diff"], "z", "x") + dknl, _diff_map = diff_kernel(knl["diff"], "z", "x") dknl = knl.with_kernel(dknl) dknl = lp.remove_unused_arguments(dknl) @@ -87,12 +87,12 @@ def test_diff(ctx_factory): h1 = 1e-4 h2 = h1 * fac - evt, (z0,) = knl(queue, x=x, y=y) - evt, (z1,) = knl(queue, x=(x + h1*dx), y=y) - evt, (z2,) = knl(queue, x=(x + h2*dx), y=y) + _evt, (z0,) = knl(queue, x=x, y=y) + _evt, (z1,) = knl(queue, x=(x + h1*dx), y=y) + _evt, (z2,) = knl(queue, x=(x + h2*dx), y=y) dknl = lp.set_options(dknl, write_code=True) - evt, (df,) = dknl(queue, x=x, y=y) + _evt, (df,) = dknl(queue, x=x, y=y) diff1 = (z1-z0) diff2 = (z2-z0) diff --git a/test/test_domain.py b/test/test_domain.py index 843bcf3175152483b1019a2ebb6778d88c922f99..f8f812bc1782ac535674568b1c056703efcd6ce4 100644 --- a/test/test_domain.py +++ b/test/test_domain.py @@ -268,7 +268,7 @@ def test_independent_multi_domain(ctx_factory): assert knl["loopy_kernel"].parents_per_domain() == 2*[None] n = 50 - evt, (a, b) = knl(queue, n=n, out_host=True) + _evt, (a, b) = knl(queue, n=n, out_host=True) assert a.shape == (50,) assert b.shape == (50,) diff --git a/test/test_einsum.py b/test/test_einsum.py index f2964a121a16acf7447618b844f5742ca5aa66a6..65624ba5ee5d536220ef7ec27127566320984bf5 100644 --- a/test/test_einsum.py +++ b/test/test_einsum.py @@ -57,7 +57,7 @@ def test_einsum_array_manipulation(ctx_factory, spec): arg_names = ("a",) knl = lp.make_einsum(spec, arg_names) - evt, (out,) = knl(queue, a=a) + _evt, (out,) = knl(queue, a=a) ans = np.einsum(spec, a) assert np.linalg.norm(out - ans) <= 1e-15 @@ -76,7 +76,7 @@ def test_einsum_array_matvec(ctx_factory, spec): arg_names = ("a", "b") knl = lp.make_einsum(spec, arg_names) - evt, (out,) = knl(queue, a=a, b=b) + _evt, (out,) = knl(queue, a=a, b=b) ans = np.einsum(spec, a, b) assert np.linalg.norm(out - ans) <= 1e-15 @@ -97,7 +97,7 @@ def test_einsum_array_ops_same_dims(ctx_factory, spec): arg_names = ("a", "b") knl = lp.make_einsum(spec, arg_names) - evt, (out,) = knl(queue, a=a, b=b) + _evt, (out,) = knl(queue, a=a, b=b) ans = np.einsum(spec, a, b) assert np.linalg.norm(out - ans) <= 1e-15 @@ -118,7 +118,7 @@ def test_einsum_array_ops_diff_dims(ctx_factory, spec): arg_names = ("a", "b") knl = lp.make_einsum(spec, arg_names) - evt, (out,) = knl(queue, a=a, b=b) + _evt, (out,) = knl(queue, a=a, b=b) ans = np.einsum(spec, a, b) assert np.linalg.norm(out - ans) <= 1e-15 @@ -138,7 +138,7 @@ def test_einsum_array_ops_triple_prod(ctx_factory, spec): arg_names = ("a", "b", "c") knl = lp.make_einsum(spec, arg_names) - evt, (out,) = knl(queue, a=a, b=b, c=c) + _evt, (out,) = knl(queue, a=a, b=b, c=c) ans = np.einsum(spec, a, b, c) assert np.linalg.norm(out - ans) <= 1e-15 diff --git a/test/test_expression.py b/test/test_expression.py index b4b856e2b180e3440848c5cfeb5f9c88da798a38..aa60f8a5348aafd821f76eba55d562a799d13d7f 100644 --- a/test/test_expression.py +++ b/test/test_expression.py @@ -371,9 +371,9 @@ def test_fuzz_expression_code_gen(ctx_factory, expr_type, random_seed, target_cl cl_ctx = ctx_factory() knl = lp.set_options(knl, write_code=True) with cl.CommandQueue(cl_ctx) as queue: - evt, lp_values = knl(queue, out_host=True) + _evt, lp_values = knl(queue, out_host=True) elif type(target) is lp.ExecutableCTarget: - evt, lp_values = knl() + _evt, lp_values = knl() else: raise NotImplementedError("unsupported target") @@ -413,7 +413,7 @@ def test_sci_notation_literal(ctx_factory): set_kernel = lp.set_options(set_kernel, write_code=True) - evt, (out,) = set_kernel(queue) + _evt, (out,) = set_kernel(queue) assert (np.abs(out.get() - 1e-12) < 1e-20).all() @@ -430,7 +430,7 @@ def test_indexof(ctx_factory): knl = lp.set_options(knl, write_code=True) - (evt, (out,)) = knl(queue) + (_evt, (out,)) = knl(queue) out = out.get() assert np.array_equal(out.ravel(order="C"), np.arange(25)) @@ -454,7 +454,7 @@ def test_indexof_vec(ctx_factory): knl = lp.tag_data_axes(knl, "out", "vec,c,c") knl = lp.set_options(knl, write_code=True) - (evt, (out,)) = knl(queue) + (_evt, (_out,)) = knl(queue) # out = out.get() # assert np.array_equal(out.ravel(order="C"), np.arange(25)) @@ -568,9 +568,9 @@ def test_complex_support(ctx_factory, target): if target == lp.PyOpenCLTarget: cl_ctx = ctx_factory() with cl.CommandQueue(cl_ctx) as queue: - evt, out = knl(queue, **kwargs) + _evt, out = knl(queue, **kwargs) elif target == lp.ExecutableCTarget: - evt, out = knl(**kwargs) + _evt, out = knl(**kwargs) else: raise NotImplementedError("unsupported target") @@ -623,7 +623,7 @@ def test_bool_type_context(ctx_factory): lp.GlobalArg("k", dtype=np.bool_, shape=lp.auto), ]) - evt, (out,) = knl(queue) + _evt, (out,) = knl(queue) assert out.get() == np.logical_and(7.0, 8.0) @@ -638,7 +638,7 @@ def test_np_bool_handling(ctx_factory): "{:}", [lp.Assignment(parse("y"), p.LogicalNot(np.bool_(False)))], [lp.GlobalArg("y", dtype=np.bool_, shape=lp.auto)]) - evt, (out,) = knl(queue) + _evt, (out,) = knl(queue) assert out.get().item() is True @@ -692,10 +692,10 @@ def test_complex_functions_with_real_args(ctx_factory, target): if target == lp.PyOpenCLTarget: cl_ctx = ctx_factory() with cl.CommandQueue(cl_ctx) as queue: - evt, out = t_unit(queue, c64=c64, c128=c128, f32=f32, f64=f64) + _evt, out = t_unit(queue, c64=c64, c128=c128, f32=f32, f64=f64) elif target == lp.ExecutableCTarget: t_unit = lp.set_options(t_unit, build_options=["-Werror"]) - evt, out = t_unit(c64=c64, c128=c128, f32=f32, f64=f64) + _evt, out = t_unit(c64=c64, c128=c128, f32=f32, f64=f64) else: raise NotImplementedError("unsupported target") diff --git a/test/test_fusion.py b/test/test_fusion.py index 66daf972587925314bf517c8e95c8b8236cebf91..ab3b4e74a5584debe6d6ed58839f0d5ccb1c27b7 100644 --- a/test/test_fusion.py +++ b/test/test_fusion.py @@ -52,7 +52,7 @@ def test_two_kernel_fusion(ctx_factory): """ ) knl = lp.fuse_kernels([knla, knlb], data_flow=[("out", 0, 1)]) - evt, (out,) = knl(queue) + _evt, (out,) = knl(queue) np.testing.assert_allclose(out.get(), np.arange(100, 110)) @@ -163,7 +163,7 @@ def test_write_block_matrix_fusion(ctx_factory): bidirectional=True, force=True ) - evt, result = fused_knl(queue, **kwargs) + _evt, result = fused_knl(queue, **kwargs) result = result["result"] np.testing.assert_allclose(result, answer) diff --git a/test/test_isl.py b/test/test_isl.py index d61031dfca4f0a83a046f7ea9a17f3a25f210419..125fae143d92187f8036269331e58f15c60fa0fd 100644 --- a/test/test_isl.py +++ b/test/test_isl.py @@ -26,7 +26,6 @@ import islpy as isl def test_aff_to_expr(): s = isl.Space.create_from_names(isl.Context(), ["a", "b"]) zero = isl.Aff.zero_on_domain(isl.LocalSpace.from_space(s)) - one = zero.set_constant_val(1) a = zero.set_coefficient_val(isl.dim_type.in_, 0, 1) b = zero.set_coefficient_val(isl.dim_type.in_, 1, 1) diff --git a/test/test_loopy.py b/test/test_loopy.py index d58fd270c2d4f51c63d5695bddf3da4905f4a04a..44281bab7bfa3f756405126af726bb5e42a1bbec 100644 --- a/test/test_loopy.py +++ b/test/test_loopy.py @@ -78,7 +78,7 @@ def test_globals_decl_once_with_multi_subprogram(ctx_factory): knl = lp.split_iname(knl, "i", 2, outer_tag="g.0", inner_tag="l.0") knl = lp.split_iname(knl, "ii", 2, outer_tag="g.0", inner_tag="l.0") - evt, (out,) = knl(queue, a=a) + _evt, (out,) = knl(queue, a=a) assert np.linalg.norm(out-(2*(a+cnst)+cnst)) <= 1e-15 @@ -243,7 +243,7 @@ def test_bare_data_dependency(ctx_factory): ]) n = 20000 - evt, (a,) = knl(queue, n=n, out_host=True) + _evt, (a,) = knl(queue, n=n, out_host=True) assert a.shape == (n,) assert (a == 1).all() @@ -788,12 +788,12 @@ def test_make_copy_kernel(ctx_factory): cknl1 = lp.fix_parameters(cknl1, n2=3) cknl1 = lp.set_options(cknl1, write_code=True) - evt, a2 = cknl1(queue, input=a1) + _evt, a2 = cknl1(queue, input=a1) cknl2 = lp.make_copy_kernel("c,c,c", intermediate_format) cknl2 = lp.fix_parameters(cknl2, n2=3) - evt, a3 = cknl2(queue, input=a2) + _evt, a3 = cknl2(queue, input=a2) assert (a1 == a3).all() @@ -810,7 +810,7 @@ def test_make_copy_kernel_with_offsets(ctx_factory): cknl1 = lp.fix_parameters(cknl1, n0=3) cknl1 = lp.set_options(cknl1, write_code=True) - evt, (a2_dev,) = cknl1(queue, input=a1_dev) + _evt, (a2_dev,) = cknl1(queue, input=a1_dev) assert (a1 == a2_dev.get()).all() @@ -1508,7 +1508,7 @@ def test_finite_difference_expr_subst(ctx_factory): ]) fused_knl = lp.set_options(fused_knl, write_code=True) - evt, _ = fused_knl(queue, u=u, h=np.float32(1e-1)) + _evt, _ = fused_knl(queue, u=u, h=np.float32(1e-1)) fused_knl = lp.assignment_to_subst(fused_knl, "f") @@ -1517,7 +1517,7 @@ def test_finite_difference_expr_subst(ctx_factory): # This is the real test here: The automatically generated # shape expressions are '2+n' and the ones above are 'n+2'. # Is loopy smart enough to understand that these are equal? - evt, _ = fused_knl(queue, u=u, h=np.float32(1e-1)) + _evt, _ = fused_knl(queue, u=u, h=np.float32(1e-1)) fused0_knl = lp.affine_map_inames(fused_knl, "i", "inew", "inew+1=i") @@ -1530,7 +1530,7 @@ def test_finite_difference_expr_subst(ctx_factory): precomp_knl = lp.tag_inames(precomp_knl, {"j_0_outer": "unr"}) precomp_knl = lp.set_options(precomp_knl, return_dict=True) - evt, _ = precomp_knl(queue, u=u, h=h) + _evt, _ = precomp_knl(queue, u=u, h=h) # {{{ call without returned values @@ -1549,7 +1549,7 @@ def test_call_with_no_returned_value(ctx_factory): from library_for_test import NoRetFunction knl = lp.register_callable(knl, "f", NoRetFunction("f")) - evt, _ = knl(queue) + _evt, _ = knl(queue) # }}} @@ -1842,7 +1842,7 @@ def test_temp_initializer(ctx_factory, src_order, tmp_order): knl = lp.set_options(knl, write_code=True) knl = lp.fix_parameters(knl, n=a.shape[0]) - evt, (a2,) = knl(queue, out_host=True) + _evt, (a2,) = knl(queue, out_host=True) assert np.array_equal(a, a2) @@ -1939,7 +1939,7 @@ def test_if_else(ctx_factory): """ ) - evt, (out,) = knl(queue, out_host=True) + _evt, (out,) = knl(queue, out_host=True) out_ref = np.empty(50) out_ref[::3] = 15 @@ -1967,7 +1967,7 @@ def test_if_else(ctx_factory): """ ) - evt, (out,) = knl(queue, out_host=True) + _evt, (out,) = knl(queue, out_host=True) out_ref = np.zeros(50) out_ref[1::2] = 4 @@ -2000,7 +2000,7 @@ def test_if_else(ctx_factory): """ ) - evt, (out,) = knl(queue, out_host=True) + _evt, (out,) = knl(queue, out_host=True) out_ref = np.zeros((50, 50)) out_ref[:25, 0::2] = 1 @@ -2036,7 +2036,7 @@ def test_tight_loop_bounds(ctx_factory): knl = lp.set_options(knl, write_code=True) - evt, (out,) = knl(queue, out_host=True) + _evt, (out,) = knl(queue, out_host=True) assert (out == np.arange(10)).all() @@ -2542,7 +2542,7 @@ def test_relaxed_stride_checks(ctx_factory): mat = np.zeros((1, 10), order="F") b = np.zeros(10) - evt, (a,) = knl(queue, A=mat, b=b) + _evt, (a,) = knl(queue, A=mat, b=b) assert a == 0 @@ -3020,7 +3020,7 @@ def test_pow(ctx_factory, base_type, exp_type): knl = lp.add_dtypes(knl, {"base": base_type, "power": exp_type}) - evt, (result,) = knl(queue, base=base, power=power) + _evt, (result,) = knl(queue, base=base, power=power) assert result.dtype == expected_result.dtype @@ -3070,7 +3070,7 @@ def test_scalar_temporary(ctx_factory): lp.TemporaryVariable("tmp", address_space=lp.AddressSpace.GLOBAL, shape=lp.auto), ...]) - evt, (out, ) = knl(queue, x=x_in) + _evt, (out, ) = knl(queue, x=x_in) np.testing.assert_allclose(4*x_in, out.get()) @@ -3255,7 +3255,7 @@ def test_zero_stride_array(ctx_factory): y[i, j] = 1 """, [lp.GlobalArg("y", shape=(10, 0))]) - evt, (out,) = knl(cq) + _evt, (out,) = knl(cq) assert out.shape == (10, 0) @@ -3277,7 +3277,7 @@ def test_sep_array_ordering(ctx_factory): knl = lp.tag_inames(knl, "k:unr") x = [cl.array.empty(cq, (0,), dtype=np.float64) for i in range(n)] - evt, out = knl(cq, x=x) + _evt, out = knl(cq, x=x) for i in range(n): assert out[i] is x[i], f"failed on input x{i}: {id(out[i])} {id(x[i])}" @@ -3532,7 +3532,7 @@ def test_type_inference_of_clbls_in_substitutions(ctx_factory): y[i] = subst_0(i) """) - evt, (out,) = knl(cq) + _evt, (out,) = knl(cq) np.testing.assert_allclose(out.get(), np.abs(10.0*(np.arange(10)-5))) @@ -3716,7 +3716,7 @@ def test_loop_imperfect_nest_priorities_in_v2_scheduler(): loop_priority=frozenset({("i", "j"), ("i", "k")}), ) - code = lp.generate_code_v2(knl) + lp.generate_code_v2(knl) if __name__ == "__main__": diff --git a/test/test_reduction.py b/test/test_reduction.py index b8b32fb08e3ad70d2a452599fe5b9a331dfef597..dcf92b7a8d6be4cf055f83b08b1005f927d62f81 100644 --- a/test/test_reduction.py +++ b/test/test_reduction.py @@ -86,7 +86,7 @@ def test_empty_reduction(ctx_factory): print(knl) knl = lp.set_options(knl, write_code=True) - evt, (a,) = knl(queue) + _evt, (a,) = knl(queue) assert (a.get() == 0).all() @@ -113,7 +113,7 @@ def test_nested_dependent_reduction(ctx_factory): n = 330 ell = np.arange(n, dtype=np.int32) - evt, (a,) = knl(queue, ell=ell, n=n, out_host=True) + _evt, (a,) = knl(queue, ell=ell, n=n, out_host=True) tgt_result = (2*ell-1)*2*ell/2 assert (a == tgt_result).all() @@ -314,7 +314,7 @@ def test_argmax(ctx_factory): knl = lp.set_options(knl, write_code=True, allow_terminal_colors=True) a = np.random.randn(10000).astype(dtype) - evt, (max_idx, max_val) = knl(queue, a=a, out_host=True) + _evt, (max_idx, max_val) = knl(queue, a=a, out_host=True) assert max_val == np.max(np.abs(a)) assert max_idx == np.where(np.abs(a) == max_val)[-1] @@ -333,7 +333,7 @@ def test_simul_reduce(ctx_factory): ], assumptions="n>=1") - evt, (a, b) = knl(queue, n=n) + _evt, (a, b) = knl(queue, n=n) ref = sum(i*j for i in range(n) for j in range(n)) assert a.get() == ref @@ -358,7 +358,7 @@ def test_reduction_library(ctx_factory, op_name, np_op): assumptions="n>=1") a = np.random.randn(20, 10) - evt, (res,) = knl(queue, a=a) + _evt, (res,) = knl(queue, a=a) assert np.allclose(res, np_op(a, axis=1)) @@ -395,7 +395,7 @@ def test_double_sum_made_unique(ctx_factory): knl = lp.make_reduction_inames_unique(knl) print(knl) - evt, (a, b) = knl(queue, n=n) + _evt, (a, b) = knl(queue, n=n) ref = sum(i*j for i in range(n) for j in range(n)) assert a.get() == ref @@ -415,7 +415,7 @@ def test_parallel_multi_output_reduction(ctx_factory): with cl.CommandQueue(ctx) as queue: a = np.random.rand(128) - out, (max_index, max_val) = knl(queue, a=a) + _out, (max_index, max_val) = knl(queue, a=a) assert max_val == np.max(a) assert max_index == np.argmax(np.abs(a)) @@ -497,7 +497,7 @@ def test_reduction_in_conditional(ctx_factory): knl = lp.preprocess_program(knl) - evt, (out,) = knl(cq) + _evt, (out,) = knl(cq) assert (out == 45).all() diff --git a/test/test_scan.py b/test/test_scan.py index 5cb7573e4b80599e5fbc65ee5a484f19a7f5faee..abba7ad0c12f8ce1118f5e7343754b98e639c746 100644 --- a/test/test_scan.py +++ b/test/test_scan.py @@ -77,7 +77,7 @@ def test_sequential_scan(ctx_factory, n, stride): knl = lp.fix_parameters(knl, n=n) knl = lp.realize_reduction(knl, force_scan=True) - evt, (a,) = knl(queue) + _evt, (a,) = knl(queue) assert (a.get() == np.cumsum(np.arange(stride*n)**2)[::stride]).all() @@ -108,7 +108,7 @@ def test_scan_with_different_lower_bound_from_sweep( knl = lp.fix_parameters(knl, sweep_lbound=sweep_lbound, scan_lbound=scan_lbound) knl = lp.realize_reduction(knl, force_scan=True) - evt, (out,) = knl(queue, n=n) + _evt, (out,) = knl(queue, n=n) assert (out.get() == np.cumsum(np.arange(scan_lbound, 2*n+scan_lbound)**2)[::2]).all() @@ -161,7 +161,7 @@ def test_dependent_domain_scan(ctx_factory): """ ) knl = lp.realize_reduction(knl, force_scan=True) - evt, (a,) = knl(queue, n=100) + _evt, (a,) = knl(queue, n=100) assert (a.get() == np.cumsum(np.arange(200)**2)[::2]).all() @@ -191,7 +191,7 @@ def test_nested_scan(ctx_factory, i_tag, j_tag): print(knl) - evt, (out,) = knl(queue) + _evt, (out,) = knl(queue) print(out) @@ -227,7 +227,7 @@ def test_local_parallel_scan(ctx_factory, n): knl = lp.add_dtypes(knl, dict(a=int)) - evt, (a,) = knl(queue, a=np.arange(n)) + _evt, (a,) = knl(queue, a=np.arange(n)) assert (a == np.cumsum(np.arange(n)**2)).all() @@ -248,7 +248,7 @@ def test_local_parallel_scan_with_nonzero_lower_bounds(ctx_factory): knl = lp.realize_reduction(knl, force_scan=True) knl = lp.add_dtypes(knl, dict(a=int)) - evt, (out,) = knl(queue, a=np.arange(1, 17)) + _evt, (out,) = knl(queue, a=np.arange(1, 17)) assert (out == np.cumsum(np.arange(1, 17)**2)).all() @@ -281,7 +281,7 @@ def test_scan_with_outer_parallel_iname(ctx_factory, sweep_iname_tag): knl = lp.fix_parameters(knl, n=n) knl = lp.realize_reduction(knl, force_scan=True) - evt, (out,) = knl(queue) + _evt, (out,) = knl(queue) inner = np.cumsum(np.arange(n)**2) @@ -302,7 +302,7 @@ def test_scan_data_types(ctx_factory, dtype): a = np.random.randn(20).astype(dtype) knl = lp.add_dtypes(knl, dict(a=dtype)) knl = lp.realize_reduction(knl, force_scan=True) - evt, (res,) = knl(queue, a=a) + _evt, (res,) = knl(queue, a=a) assert np.allclose(res, np.cumsum(a)) @@ -325,7 +325,7 @@ def test_scan_library(ctx_factory, op_name, np_op): a = np.random.randn(20) knl = lp.add_dtypes(knl, dict(a=np.float64)) knl = lp.realize_reduction(knl, force_scan=True) - evt, (res,) = knl(queue, a=a) + _evt, (res,) = knl(queue, a=a) assert np.allclose(res, np.array( [np_op(a[:i+1]) for i in range(len(a))])) @@ -356,7 +356,7 @@ def test_argmax(ctx_factory, i_tag): knl = lp.realize_reduction(knl, force_scan=True) a = np.random.randn(n).astype(dtype) - evt, (max_indices, max_vals) = knl(queue, a=a, out_host=True) + _evt, (max_indices, max_vals) = knl(queue, a=a, out_host=True) assert (max_vals == [np.max(np.abs(a)[0:i+1]) for i in range(n)]).all() assert (max_indices == [np.argmax(np.abs(a[0:i+1])) for i in range(n)]).all() @@ -417,7 +417,7 @@ def test_segmented_scan(ctx_factory, n, segment_boundaries_indices, iname_tag): knl = lp.tag_inames(knl, dict(i=iname_tag)) knl = lp.realize_reduction(knl, force_scan=True) - (evt, (out,)) = knl(queue, arr=arr, segflag=segment_boundaries) + (_evt, (out,)) = knl(queue, arr=arr, segflag=segment_boundaries) check_segmented_scan_output(arr, segment_boundaries_indices, out) diff --git a/test/test_target.py b/test/test_target.py index 3d36837c96dc08104c86ee7570f504aa934c768e..5e634f53af4a51853764a6e8ee36aaaf758a19ee 100644 --- a/test/test_target.py +++ b/test/test_target.py @@ -218,7 +218,7 @@ def test_random123(ctx_factory, tp): knl = lp.split_iname(knl, "i", 128, outer_tag="g.0", inner_tag="l.0") knl = lp.set_options(knl, write_code=True) - evt, (out,) = knl(queue, n=n) + _evt, (out,) = knl(queue, n=n) out = out.get() assert (out < 1).all() @@ -236,7 +236,7 @@ def test_tuple(ctx_factory): a, b = make_tuple(1, 2.) """) - evt, (a, b) = knl(queue) + _evt, (a, b) = knl(queue) assert a.get() == 1 assert b.get() == 2. @@ -256,7 +256,7 @@ def test_clamp(ctx_factory): knl = lp.split_iname(knl, "i", 128, outer_tag="g.0", inner_tag="l.0") knl = lp.set_options(knl, write_code=True) - evt, (out,) = knl(queue, x=x, a=np.float32(12), b=np.float32(15)) + _evt, (_out,) = knl(queue, x=x, a=np.float32(12), b=np.float32(15)) def test_sized_integer_c_codegen(ctx_factory): @@ -272,7 +272,7 @@ def test_sized_integer_c_codegen(ctx_factory): knl = lp.set_options(knl, write_code=True) n = 40 - evt, (a,) = knl(queue, n=n) + _evt, (a,) = knl(queue, n=n) a_ref = 1 << np.arange(n, dtype=np.int64) @@ -348,7 +348,7 @@ def test_pyopencl_execution_numpy_handling(ctx_factory): y = np.array([3.]) x = np.array([4.]) - evt, out = knl(queue, y=y, x=x) + _evt, out = knl(queue, y=y, x=x) assert out[0] is x assert x[0] == 7. @@ -357,7 +357,7 @@ def test_pyopencl_execution_numpy_handling(ctx_factory): import pyopencl.array as cla y = cla.zeros(queue, shape=(1), dtype="float64") + 3. x = np.array([4.]) - evt, out = knl(queue, y=y, x=x) + _evt, out = knl(queue, y=y, x=x) assert out[0] is x assert x[0] == 7. @@ -366,7 +366,7 @@ def test_pyopencl_execution_numpy_handling(ctx_factory): y = np.array([3.]) x = np.array([4.]) - evt, out = knl(queue, y=y, x=x) + _evt, out = knl(queue, y=y, x=x) assert out[0] is x assert x[0] == 5. @@ -380,7 +380,7 @@ def test_opencl_support_for_bool(ctx_factory): [lp.GlobalArg("y", dtype=np.bool_, shape=lp.auto)]) cl_ctx = ctx_factory() - evt, (out, ) = knl(cl.CommandQueue(cl_ctx)) + _evt, (out, ) = knl(cl.CommandQueue(cl_ctx)) out = out.get() np.testing.assert_equal(out, np.tile(np.array([0, 1], dtype=np.bool_), 5)) @@ -411,10 +411,10 @@ def test_nan_support(ctx_factory, target): knl = lp.set_options(knl, return_dict=True) if target == lp.PyOpenCLTarget: - evt, out_dict = knl(queue) + _evt, out_dict = knl(queue) out_dict = {k: v.get() for k, v in out_dict.items()} elif target == lp.ExecutableCTarget: - evt, out_dict = knl() + _evt, out_dict = knl() else: raise NotImplementedError("unsupported target") @@ -451,9 +451,9 @@ def test_emits_ternary_operators_correctly(ctx_factory, target): knl = lp.set_options(knl, return_dict=True) if target == lp.PyOpenCLTarget: - evt, out_dict = knl(queue) + _evt, out_dict = knl(queue) elif target == lp.ExecutableCTarget: - evt, out_dict = knl() + _evt, out_dict = knl() else: raise NotImplementedError("unsupported target") @@ -479,7 +479,7 @@ def test_scalar_array_take_offset(ctx_factory): x_in_base = cla.arange(cq, 42, dtype=np.int32) x_in = x_in_base[13] - evt, (out,) = knl(cq, x=x_in) + _evt, (out,) = knl(cq, x=x_in) np.testing.assert_allclose(out.get(), 1729) @@ -772,7 +772,7 @@ def test_passing_bajillions_of_svm_args(ctx_factory, with_gbarrier): cl.array.zeros(queue, 20, np.float32, allocator=alloc) + np.float32(iargset)) - evt, res = knl(queue, **args, allocator=alloc) + _evt, res = knl(queue, **args, allocator=alloc) for iargset in range(nargsets): assert (res[f"c{iargset}"].get() == iargset * multiplier + iargset).all() diff --git a/test/test_transform.py b/test/test_transform.py index f03a5d0e81349768ff17d801994b7657deda060a..d7c699d5b164d94beebcb1f7f51f94cc58de4078 100644 --- a/test/test_transform.py +++ b/test/test_transform.py @@ -145,8 +145,8 @@ def test_to_batched(ctx_factory): x = np.random.randn(7, 5).astype(np.float32) # Running both the kernels - evt, (out1, ) = bknl(queue, a=a, x=x, n=5, nbatches=7) - evt, (out2, ) = ref_knl(queue, a=a, x=x, n=5, nbatches=7) + _evt, (out1, ) = bknl(queue, a=a, x=x, n=5, nbatches=7) + _evt, (out2, ) = ref_knl(queue, a=a, x=x, n=5, nbatches=7) # checking that the outputs are same assert np.linalg.norm(out1-out2) < 1e-15 @@ -211,7 +211,7 @@ def test_add_barrier(ctx_factory): knl = lp.split_iname(knl, "ii", 2, outer_tag="g.0", inner_tag="l.0") knl = lp.split_iname(knl, "jj", 2, outer_tag="g.1", inner_tag="l.1") - evt, (out,) = knl(queue, a=a) + _evt, (out,) = knl(queue, a=a) assert (np.linalg.norm(out-2*a.T) < 1e-16) @@ -225,7 +225,7 @@ def test_rename_argument(ctx_factory): kernel = lp.rename_argument(kernel, "a", "b") - evt, (out,) = kernel(queue, b=np.float32(12), n=20) + _evt, (out,) = kernel(queue, b=np.float32(12), n=20) assert (np.abs(out.get() - 14) < 1e-8).all() @@ -301,7 +301,7 @@ def test_vectorize(ctx_factory): knl = lp.tag_inames(knl, {"i_inner": "vec"}) knl = lp.preprocess_kernel(knl) - code, inf = lp.generate_code(knl) + _code, _inf = lp.generate_code(knl) lp.auto_test_vs_ref( ref_knl, ctx, knl, @@ -393,7 +393,7 @@ def test_tag_inames_keeps_all_tags_if_able(): knl = t_unit.default_entrypoint - tags = knl.iname_tags("i") + knl.iname_tags("i") assert not knl.iname_tags_of_type("i", FooTag) assert not knl.iname_tags_of_type("i", BarTag) @@ -1154,7 +1154,7 @@ def test_rename_argument_with_auto_stride(ctx_factory): assert code_str.find("double const *__restrict__ x_new,") != -1 assert code_str.find("double const *__restrict__ x,") == -1 - evt, (out, ) = knl(queue, x_new=np.random.rand(10)) + _evt, (_out, ) = knl(queue, x_new=np.random.rand(10)) def test_rename_argument_with_assumptions():