diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0b5e7be9515c93fc9ee7a5a1f6cf188907b07c2e..1abab4a6acfecefea52df06d433a3f0cc3f40578 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -14,15 +14,32 @@ Python 2.7 POCL: reports: junit: test/pytest.xml -#Python 3.5 Titan X: +Python 3.7 Titan V: + script: + - py_version=3.7 + - export PYOPENCL_TEST=nvi:titan + - EXTRA_INSTALL="pybind11 numpy mako" + - curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/build-and-test-py-project.sh + - ". ./build-and-test-py-project.sh" + tags: + - python3.7 + - nvidia-titan-v + allow_failure: true + except: + - tags + artifacts: + reports: + junit: test/pytest.xml + +#Python 3.6 Titan X: # script: -# - py_version=3.5 +# - py_version=3.6 # - export PYOPENCL_TEST=nvi:titan # - EXTRA_INSTALL="pybind11 numpy mako" # - curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/build-and-test-py-project.sh # - ". ./build-and-test-py-project.sh" # tags: -# - python3.5 +# - python3.6 # - nvidia-titan-x # except: # - tags @@ -30,16 +47,16 @@ Python 2.7 POCL: # reports: # junit: test/pytest.xml -Python 3.5 K40: +Python 3.6 K40: script: - - export PY_EXE=python3.5 + - export PY_EXE=python3.6 - export PYOPENCL_TEST=nvi:k40 - export EXTRA_INSTALL="pybind11 numpy mako" - curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/build-and-test-py-project.sh - ". ./build-and-test-py-project.sh" allow_failure: true tags: - - python3.5 + - python3.6 - nvidia-k40 except: - tags diff --git a/boxtree/__init__.py b/boxtree/__init__.py index 1d88ebd6a3ee2a0fd6ab1ff633d8194db0c47428..e167a330ec0aac84f5283e2bc5d2efbb6adf9a1b 100644 --- a/boxtree/__init__.py +++ b/boxtree/__init__.py @@ -29,7 +29,7 @@ __all__ = [ "Tree", "TreeWithLinkedPointSources", "TreeBuilder", "box_flags_enum"] -__doc__ = """ +__doc__ = r""" :mod:`boxtree` can do three main things: * it can sort particles into an adaptively refined quad/octree, diff --git a/boxtree/area_query.py b/boxtree/area_query.py index 42f0ef9658b72ca5772bb011a5a004fcd19f39d2..b35d6d9abe83a08c88faf023edb1f27f6b70739e 100644 --- a/boxtree/area_query.py +++ b/boxtree/area_query.py @@ -355,9 +355,9 @@ AREA_QUERY_TEMPLATE = ( void generate(LIST_ARG_DECL USER_ARG_DECL ball_id_t i) { - """ + - AREA_QUERY_WALKER_BODY + """ + + AREA_QUERY_WALKER_BODY + + """ } """) @@ -511,14 +511,16 @@ class AreaQueryElementwiseTemplate(object): coord_t bbox_min_${ax}, %endfor """ + extra_args, - operation="//CL:mako//\n" + - wrap_in_macro("get_ball_center_and_radius(ball_center, ball_radius, i)", - ball_center_and_radius_expr) + - wrap_in_macro("leaf_found_op(leaf_box_id, ball_center, ball_radius)", - leaf_found_op) + - TRAVERSAL_PREAMBLE_MAKO_DEFS + - GUIDING_BOX_FINDER_MACRO + - AREA_QUERY_WALKER_BODY, + operation="//CL:mako//\n" + + wrap_in_macro( + "get_ball_center_and_radius(ball_center, ball_radius, i)", + ball_center_and_radius_expr) + + wrap_in_macro( + "leaf_found_op(leaf_box_id, ball_center, ball_radius)", + leaf_found_op) + + TRAVERSAL_PREAMBLE_MAKO_DEFS + + GUIDING_BOX_FINDER_MACRO + + AREA_QUERY_WALKER_BODY, name=name, preamble=preamble) @@ -554,9 +556,9 @@ class AreaQueryElementwiseTemplate(object): """ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wtypedef-redefinition" - """ + - TRAVERSAL_PREAMBLE_TYPEDEFS_AND_DEFINES + """ + + TRAVERSAL_PREAMBLE_TYPEDEFS_AND_DEFINES + + """ #pragma clang diagnostic pop """, strict_undefined=True).render(**dict(render_vars)) @@ -750,8 +752,8 @@ class AreaQueryBuilder(object): tree.box_child_ids.data, tree.box_flags.data, peer_lists.peer_list_starts.data, peer_lists.peer_lists.data, ball_radii.data, - *(tuple(tree.bounding_box[0]) + - tuple(bc.data for bc in ball_centers)), + *(tuple(tree.bounding_box[0]) + + tuple(bc.data for bc in ball_centers)), wait_for=wait_for) aq_plog.done() diff --git a/boxtree/traversal.py b/boxtree/traversal.py index f7e7045ede4f1b3e29738b7012c0f7e49863e2ff..59624df36d4eeed0fe9fa8077b8a75eaa6715ebe 100644 --- a/boxtree/traversal.py +++ b/boxtree/traversal.py @@ -190,8 +190,8 @@ typedef ${dtype_to_ctype(vec_types_dict[coord_dtype, dimensions])} coord_vec_t; TRAVERSAL_PREAMBLE_TEMPLATE = ( - TRAVERSAL_PREAMBLE_MAKO_DEFS + - TRAVERSAL_PREAMBLE_TYPEDEFS_AND_DEFINES) + TRAVERSAL_PREAMBLE_MAKO_DEFS + + TRAVERSAL_PREAMBLE_TYPEDEFS_AND_DEFINES) # }}} diff --git a/boxtree/tree.py b/boxtree/tree.py index fa8c438cc1deaf5360edbe859d60dbffbff14e8c..174286f8850e737c96c4e67ec7c00f4bdb6ecb9a 100644 --- a/boxtree/tree.py +++ b/boxtree/tree.py @@ -371,8 +371,8 @@ class Tree(DeviceDataRecord): """ crit = ( (self.box_target_starts <= itarget) - & - (itarget < self.box_target_starts + self.box_target_counts_nonchild)) + & (itarget + < self.box_target_starts + self.box_target_counts_nonchild)) return int(np.where(crit)[0]) @@ -382,8 +382,8 @@ class Tree(DeviceDataRecord): """ crit = ( (self.box_source_starts <= isource) - & - (isource < self.box_source_starts + self.box_source_counts_nonchild)) + & (isource + < self.box_source_starts + self.box_source_counts_nonchild)) return int(np.where(crit)[0]) @@ -455,7 +455,7 @@ class TreeWithLinkedPointSources(Tree): def link_point_sources(queue, tree, point_source_starts, point_sources, debug=False): - """ + r""" *Construction:* Requires that :attr:`Tree.sources_have_extent` is *True* on *tree*. diff --git a/boxtree/tree_build.py b/boxtree/tree_build.py index 9670487d91b588d9ee5fb8081d8a9e891bd3ac01..ff944c6ae783e377eeb1771772ea80beec239165 100644 --- a/boxtree/tree_build.py +++ b/boxtree/tree_build.py @@ -912,9 +912,9 @@ class TreeBuilder(object): logger.debug("LEVEL %d -> %d boxes" % (level, nboxes_new)) assert ( - level_start_box_nrs[-1] != nboxes_new or - srcntgts_have_extent or - final_level_restrict_iteration) + level_start_box_nrs[-1] != nboxes_new + or srcntgts_have_extent + or final_level_restrict_iteration) if level_start_box_nrs[-1] == nboxes_new: # We haven't created new boxes in this level loop trip. @@ -1153,9 +1153,8 @@ class TreeBuilder(object): if ( h_box_srcntgt_counts_cumul[ibox] - != - h_box_morton_bin_counts[ibox]["nonchild_srcntgts"] - + kid_sum): + != (h_box_morton_bin_counts[ibox]["nonchild_srcntgts"] + + kid_sum)): print("MISMATCH", level, ibox) has_mismatch = True @@ -1428,9 +1427,8 @@ class TreeBuilder(object): if debug: assert ( box_srcntgt_counts_nonchild.get() - == - (box_source_counts_nonchild - + box_target_counts_nonchild).get()).all() + == (box_source_counts_nonchild + + box_target_counts_nonchild).get()).all() if debug: usi_host = user_source_ids.get() diff --git a/boxtree/tree_build_kernels.py b/boxtree/tree_build_kernels.py index a8548349d3ab6e0e1ff7e5aad3b8bc66304e3be2..0d900ce4e92e1b616e6ac531f0b3181e39d5eb6e 100644 --- a/boxtree/tree_build_kernels.py +++ b/boxtree/tree_build_kernels.py @@ -934,12 +934,12 @@ def build_level_restrict_kernel(context, preamble_with_dtype_decls, operation=LEVEL_RESTRICT_TPL.render(**render_vars), name="level_restrict", preamble=( - str(preamble_with_dtype_decls) + - Template(r""" + str(preamble_with_dtype_decls) + + Template(r""" #define LEVEL_TO_RAD(level) \ (root_extent * 1 / (coord_t) (1 << (level + 1))) - """ + - HELPER_FUNCTION_TEMPLATE) + """ + + HELPER_FUNCTION_TEMPLATE) .render(**render_vars))) # }}} diff --git a/test/test_fmm.py b/test/test_fmm.py index 80417212e79b0d9aa12e8fd6d1caed8cba954b47..d1c0ecbbe1c29a22a2e4e16ddfa87741dd370156 100644 --- a/test/test_fmm.py +++ b/test/test_fmm.py @@ -492,8 +492,7 @@ def test_pyfmmlib_fmm(ctx_getter, dims, use_dipoles, helmholtz_k): sumpy_rel_err = ( la.norm(pot - sumpy_ref_pot, np.inf) - / - la.norm(sumpy_ref_pot, np.inf)) + / la.norm(sumpy_ref_pot, np.inf)) logger.info("relative l2 error vs sumpy direct: %g" % sumpy_rel_err) assert sumpy_rel_err < 1e-5, sumpy_rel_err diff --git a/test/test_tree.py b/test/test_tree.py index d6fe9f8140361d2becb02b20e652d30e2df3e56e..e4bc95e7dec877ab1ed352c433ccb300a6ce9f21 100644 --- a/test/test_tree.py +++ b/test/test_tree.py @@ -165,9 +165,7 @@ def run_build_test(builder, queue, dims, dtype, nparticles, do_plot, start:start+tree.box_source_counts_cumul[ibox]] good = ( (box_particles < extent_high[:, np.newaxis] + scaled_tol) - & - (extent_low[:, np.newaxis] - scaled_tol <= box_particles) - ) + & (extent_low[:, np.newaxis] - scaled_tol <= box_particles)) all_good_here = good.all() if do_plot and not all_good_here and all_good_so_far: @@ -381,10 +379,10 @@ def test_source_target_tree(ctx_getter, dims, do_plot=False): for ibox in range(tree.nboxes): extent_low, extent_high = tree.get_box_extent(ibox) - assert (extent_low >= - tree.bounding_box[0] - 1e-12*tree.root_extent).all(), ibox - assert (extent_high <= - tree.bounding_box[1] + 1e-12*tree.root_extent).all(), ibox + assert (extent_low + >= tree.bounding_box[0] - 1e-12*tree.root_extent).all(), ibox + assert (extent_high + <= tree.bounding_box[1] + 1e-12*tree.root_extent).all(), ibox src_start = tree.box_source_starts[ibox] tgt_start = tree.box_target_starts[ibox] @@ -407,8 +405,7 @@ def test_source_target_tree(ctx_getter, dims, do_plot=False): ]: good = ( (particles < extent_high[:, np.newaxis] + tol) - & - (extent_low[:, np.newaxis] - tol <= particles) + & (extent_low[:, np.newaxis] - tol <= particles) ).all(axis=0) all_good_here = good.all() @@ -544,17 +541,17 @@ def test_extent_tree(ctx_getter, dims, extent_norm, do_plot=False): if ichild_box != 0) assert ( tree.box_target_counts_cumul[ibox] - == - tree.box_target_counts_nonchild[ibox] - + kid_sum), ibox + == ( + tree.box_target_counts_nonchild[ibox] + + kid_sum)), ibox for ibox in range(tree.nboxes): extent_low, extent_high = tree.get_box_extent(ibox) - assert (extent_low >= - tree.bounding_box[0] - 1e-12*tree.root_extent).all(), ibox - assert (extent_high <= - tree.bounding_box[1] + 1e-12*tree.root_extent).all(), ibox + assert (extent_low + >= tree.bounding_box[0] - 1e-12*tree.root_extent).all(), ibox + assert (extent_high + <= tree.bounding_box[1] + 1e-12*tree.root_extent).all(), ibox box_children = tree.box_child_ids[:, ibox] existing_children = box_children[box_children != 0] @@ -594,7 +591,7 @@ def test_extent_tree(ctx_getter, dims, extent_norm, do_plot=False): good = ( (check_particles + check_radii < extent_high[:, np.newaxis] + stick_out_dist) - & + & # noqa: W504 (extent_low[:, np.newaxis] - stick_out_dist <= check_particles - check_radii) ).all(axis=0)