From 73f4bce04ca223e8eb184bef81905ac11c0fb439 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Sun, 2 Jun 2019 13:31:35 -0500 Subject: [PATCH 1/4] Minor traversal doc improvement --- boxtree/traversal.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/boxtree/traversal.py b/boxtree/traversal.py index 2d60f68..e99b7d8 100644 --- a/boxtree/traversal.py +++ b/boxtree/traversal.py @@ -1566,7 +1566,8 @@ class FMMTraversalInfo(DeviceDataRecord): type ``box_id_t``. (Note: This list contains global box numbers, not indices into :attr:`source_boxes`.) - Note *starts* are indexed by `target_boxes_sep_smaller_by_source_level`. For + Note *starts* are indexed along with + `target_boxes_sep_smaller_by_source_level`. For example, for level *i*, *lists[starts[j]:starts[j+1]]* represents "List 3" source boxes of *target_boxes_sep_smaller_by_source_level[i][j]* on level *i*. -- GitLab From 4148547ee2d3b9521f644db9958539e6618b7393 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Sun, 2 Jun 2019 13:31:53 -0500 Subject: [PATCH 2/4] Fix, test interaction list plotting --- boxtree/visualization.py | 2 +- test/test_traversal.py | 21 ++++++++++++++++----- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/boxtree/visualization.py b/boxtree/visualization.py index e5fb19d..e9671e0 100644 --- a/boxtree/visualization.py +++ b/boxtree/visualization.py @@ -245,7 +245,7 @@ def draw_box_lists(tree_plotter, traversal, ibox): _draw_box_list(tree_plotter, ibox, traversal.from_sep_smaller_by_level[ilev].starts, traversal.from_sep_smaller_by_level[ilev].lists, - key_to_box=traversal.target_boxes, + key_to_box=traversal.target_boxes_sep_smaller_by_source_level[ilev], facecolor="orange") # list 3 close diff --git a/test/test_traversal.py b/test/test_traversal.py index 32645a2..909add8 100644 --- a/test/test_traversal.py +++ b/test/test_traversal.py @@ -290,9 +290,12 @@ def test_tree_connectivity(ctx_factory, dims, sources_are_targets): # }}} -# {{{ visualization helper (not a test) +# {{{ visualization helper -def plot_traversal(ctx_factory, do_plot=False, well_sep_is_n_away=1): +# Set 'plot' kwarg to True to actually plot. Otherwise, this +# test simply ensures that interaction list plotting is still +# working. +def test_plot_traversal(ctx_factory, well_sep_is_n_away=1, plot=False): ctx = ctx_factory() queue = cl.CommandQueue(ctx) @@ -337,11 +340,19 @@ def plot_traversal(ctx_factory, do_plot=False, well_sep_is_n_away=1): from boxtree.visualization import draw_box_lists #draw_box_lists(randrange(tree.nboxes)) - draw_box_lists(plotter, trav, 320) + + if well_sep_is_n_away == 1: + draw_box_lists(plotter, trav, 380) + elif well_sep_is_n_away == 2: + draw_box_lists(plotter, trav, 320) #plotter.draw_box_numbers() - import matplotlib.pyplot as pt - pt.show() + if plot: + import matplotlib.pyplot as pt + pt.gca().set_xticks([]) + pt.gca().set_yticks([]) + + pt.show() # }}} -- GitLab From 2a881cfe9066ba00f17b60126f02e91addedb57b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Kl=C3=B6ckner?= Date: Mon, 3 Jun 2019 07:06:37 +0200 Subject: [PATCH 3/4] CI: Install matplotlib to enable interaction list drawing test --- .gitlab-ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 39a38ed..d2f31bd 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,7 +2,7 @@ Python 2.7 POCL: script: - export PY_EXE=python2.7 - export PYOPENCL_TEST=portable - - export EXTRA_INSTALL="pybind11 numpy mako" + - export EXTRA_INSTALL="pybind11 numpy mako matplotlib" - 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: @@ -18,7 +18,7 @@ Python 3 Titan V: script: - export PY_EXE=python3 - export PYOPENCL_TEST=nvi:titan - - EXTRA_INSTALL="pybind11 numpy mako" + - EXTRA_INSTALL="pybind11 numpy mako matplotlib" - 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: @@ -51,7 +51,7 @@ Python 3 K40: script: - export PY_EXE=python3 - export PYOPENCL_TEST=nvi:k40 - - export EXTRA_INSTALL="pybind11 numpy mako" + - export EXTRA_INSTALL="pybind11 numpy mako matplotlib" - 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 @@ -68,7 +68,7 @@ Python 3 POCL: script: - export PY_EXE=python3 - export PYOPENCL_TEST=portable - - export EXTRA_INSTALL="pybind11 numpy mako" + - export EXTRA_INSTALL="pybind11 numpy mako matplotlib" - 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: -- GitLab From b797c191fa32c0e6d7d68826ae534ef2fd5c5ac7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Kl=C3=B6ckner?= Date: Mon, 3 Jun 2019 08:27:59 +0200 Subject: [PATCH 4/4] Skip interaction list drawing test if matplotlib is not available, only test ilist drawing on Py3 --- .gitlab-ci.yml | 4 ++-- test/test_traversal.py | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d2f31bd..1467e0c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,7 +2,7 @@ Python 2.7 POCL: script: - export PY_EXE=python2.7 - export PYOPENCL_TEST=portable - - export EXTRA_INSTALL="pybind11 numpy mako matplotlib" + - 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" tags: @@ -51,7 +51,7 @@ Python 3 K40: script: - export PY_EXE=python3 - export PYOPENCL_TEST=nvi:k40 - - export EXTRA_INSTALL="pybind11 numpy mako matplotlib" + - 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 diff --git a/test/test_traversal.py b/test/test_traversal.py index 909add8..25ef18f 100644 --- a/test/test_traversal.py +++ b/test/test_traversal.py @@ -296,6 +296,7 @@ def test_tree_connectivity(ctx_factory, dims, sources_are_targets): # test simply ensures that interaction list plotting is still # working. def test_plot_traversal(ctx_factory, well_sep_is_n_away=1, plot=False): + pytest.importorskip("matplotlib") ctx = ctx_factory() queue = cl.CommandQueue(ctx) -- GitLab