From 8bbbeae6dec6ad0ceba938b6e04439147d87ee47 Mon Sep 17 00:00:00 2001 From: xywei Date: Thu, 27 Feb 2020 23:05:06 -0600 Subject: [PATCH 01/27] Fix dlt normalizer --- volumential/tools.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/volumential/tools.py b/volumential/tools.py index 7e96e9d..3891213 100644 --- a/volumential/tools.py +++ b/volumential/tools.py @@ -371,8 +371,8 @@ class DiscreteLegendreTransform(BoxSpecificMap): self.V = np.polynomial.legendre.legvander2d( x.reshape(-1), y.reshape(-1), [self.degree - 1] * self.dim) - self.W = (self.leg_tplt_w[:, None] - * self.leg_tplt_w[None, :]).reshape(-1) + self.W = (self.leg_tplt_w[None, :] + * self.leg_tplt_w[:, None]).reshape(-1) elif self.dim == 3: x, y, z = np.meshgrid(self.leg_tplt_x, self.leg_tplt_x, self.leg_tplt_x) @@ -392,7 +392,8 @@ class DiscreteLegendreTransform(BoxSpecificMap): # Normalizers self.I = np.ascontiguousarray( # noqa: E741 - np.diag(self.V.T * np.matmul(self.W, self.V))) + np.diag( + (self.V.T * self.W) @ self.V)) assert self.I.shape == (self.degree**self.dim,) # Fix strides for loopy -- GitLab From db0a1dcc8b8db77a5095614321870da16046b297 Mon Sep 17 00:00:00 2001 From: xywei Date: Thu, 27 Feb 2020 23:05:56 -0600 Subject: [PATCH 02/27] Unified interface for pymeshgen and meshgen_dealii --- volumential/meshgen.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/volumential/meshgen.py b/volumential/meshgen.py index 26cd21b..0b835af 100644 --- a/volumential/meshgen.py +++ b/volumential/meshgen.py @@ -268,9 +268,12 @@ else: greet, MeshGen2D, MeshGen3D, - make_uniform_cubic_grid, ) + def make_uniform_cubic_grid(degree, level, dim, queue=None): + from volumential.meshgen_dealii import make_uniform_cubic_grid as _mucg + return _mucg(degree, level, dim) + # {{{ mesh utils -- GitLab From 21b470f66c293980af2e24463c6348a8ef341ffd Mon Sep 17 00:00:00 2001 From: xywei Date: Sun, 26 Apr 2020 18:43:53 -0500 Subject: [PATCH 03/27] Minor bug fixes --- volumential/function_extension.py | 4 +++- volumential/list1.py | 8 +++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/volumential/function_extension.py b/volumential/function_extension.py index 1612d60..93b99bc 100644 --- a/volumential/function_extension.py +++ b/volumential/function_extension.py @@ -269,7 +269,9 @@ class ComplexLogKernel(ExpressionKernel): if self.dim == 2: if nderivatives == 0: - return expr + var("log")(rscale) + # return expr + var("log")(rscale) + import sumpy.symbolic as sp + return (expr + sp.log(rscale)) else: return expr diff --git a/volumential/list1.py b/volumential/list1.py index 186a3a3..ad7d9ca 100644 --- a/volumential/list1.py +++ b/volumential/list1.py @@ -495,6 +495,11 @@ class NearFieldFromCSR(NearFieldEvalBase): if isinstance(val, float): integral_kernel_init_kargs[key] = np.float64(val) + extra_knl_args_from_init = {} + for key, val in integral_kernel_init_kargs.items(): + if key in knl.arg_dict: + extra_knl_args_from_init[key] = val + evt, res = knl( queue, result=result, @@ -527,7 +532,8 @@ class NearFieldFromCSR(NearFieldEvalBase): table_data=table_data_combined, target_boxes=target_boxes, table_root_extent=table_root_extent, - **integral_kernel_init_kargs) + **extra_knl_args_from_init + ) res['result'].add_event(evt) if isinstance(result, cl.array.Array): -- GitLab From a30179db0dccd378fd4ba6c56a7d090548cc5c23 Mon Sep 17 00:00:00 2001 From: xywei Date: Wed, 8 Jul 2020 10:31:31 -0500 Subject: [PATCH 04/27] Explicitly read README as unicode --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 9ddef85..82a6680 100644 --- a/setup.py +++ b/setup.py @@ -88,7 +88,7 @@ def main(): name="volumential", version=version_dict["VERSION_TEXT"], description="Volume potential computation powered by FMM.", - long_description=open("README.md", "rt").read(), + long_description=open("README.md", "rb").read().decode('utf-8'), author="Xiaoyu Wei", author_email="wxy0516@gmail.com", license="MIT", -- GitLab From 194436394c4d634f62a40b826e41c294bdeee107 Mon Sep 17 00:00:00 2001 From: xywei Date: Wed, 8 Jul 2020 10:37:19 -0500 Subject: [PATCH 05/27] Drop py2 --- .gitlab-ci.yml | 21 --------------------- setup.py | 1 + 2 files changed, 1 insertion(+), 21 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6fe8bec..5bcf31f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -23,27 +23,6 @@ Pylint: except: - tags -Python 2.7 POCL: - script: - - export PY_EXE=python2.7 - - export PYOPENCL_TEST=portable:pthread - - export HDF5_USE_FILE_LOCKING=FALSE - - export PYTEST_ADDOPTS=${PYTEST_ADDOPTS:--k-slowtest} - - export EXTRA_INSTALL="pybind11 cython numpy pytest scipy mako wheel" - - git submodule sync && git submodule update --init --recursive --remote - - ((cd contrib/meshgen11_dealii/; ./build.sh) && echo "Using meshgen11_dealii.") || (echo "Using boxtree for meshgen.") - - 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: - - python2.7 - - pocl - - large-node - except: - - tags - artifacts: - reports: - junit: test/pytest.xml - Python 3 POCL: script: - export PY_EXE=python3 diff --git a/setup.py b/setup.py index 82a6680..5004b8d 100644 --- a/setup.py +++ b/setup.py @@ -108,6 +108,7 @@ def main(): "Topic :: Utilities", ], packages=find_packages(), + python_requires='~=3.6', install_requires=[ "boxtree", "h5py", -- GitLab From d4ebf15e20b266eeb4a9ce2c768b4facc80504b0 Mon Sep 17 00:00:00 2001 From: xywei Date: Wed, 8 Jul 2020 10:47:47 -0500 Subject: [PATCH 06/27] Use from..import.. for function quadrature() --- volumential/singular_integral_2d.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/volumential/singular_integral_2d.py b/volumential/singular_integral_2d.py index 109b1f2..9b71386 100644 --- a/volumential/singular_integral_2d.py +++ b/volumential/singular_integral_2d.py @@ -25,9 +25,9 @@ THE SOFTWARE. import logging import numpy as np -import scipy.integrate as sint -import scipy.integrate.quadrature as quad # noqa import scipy as sp +import scipy.integrate as sint +from scipy.integrate import quadrature as quad __doc__ = """The 2D singular integrals are computed using the transform described in http://link.springer.com/10.1007/BF00370482. -- GitLab From 938bdd8e2277e021f56d916fa56e548174eea3a4 Mon Sep 17 00:00:00 2001 From: xywei Date: Wed, 8 Jul 2020 11:03:05 -0500 Subject: [PATCH 07/27] Flake8 fixes --- volumential/table_manager.py | 8 ++++---- volumential/tools.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/volumential/table_manager.py b/volumential/table_manager.py index bd6d387..cb6ad6c 100644 --- a/volumential/table_manager.py +++ b/volumential/table_manager.py @@ -407,8 +407,8 @@ class NearFieldInteractionTableManager(object): def case_encode(case_vec): table_id = 0 - for l in case_vec: - table_id = table_id * base + (l + shift) + for case_vec_comp in case_vec: + table_id = table_id * base + (case_vec_comp + shift) return int(table_id) table.case_encode = case_encode @@ -673,8 +673,8 @@ class NearFieldInteractionTableManager(object): distinct_numbers = set() for vec in table.interaction_case_vecs: - for l in vec: - distinct_numbers.add(l) + for case_vec_comp in vec: + distinct_numbers.add(case_vec_comp) base = len(range(min(distinct_numbers), max(distinct_numbers) + 1)) shift = -min(distinct_numbers) diff --git a/volumential/tools.py b/volumential/tools.py index 3891213..6b24224 100644 --- a/volumential/tools.py +++ b/volumential/tools.py @@ -225,8 +225,8 @@ class ScalarFieldExpressionEvaluation(KernelCacheWrapper): lp.ValueArg("dim, n_targets", np.int32), lp.GlobalArg("target_points", np.float64, "dim, n_targets"), ] - + list(extra_kernel_kwarg_types) - + ["...", ], + + list(extra_kernel_kwarg_types) + + ["...", ], name="eval_expr", lang_version=(2018, 2), ) -- GitLab From dbbc92ca8448e5a75a6033e5138b4ed9be4eaa8e Mon Sep 17 00:00:00 2001 From: xywei Date: Wed, 8 Jul 2020 11:07:03 -0500 Subject: [PATCH 08/27] More flake8 fixes --- volumential/droste.py | 14 +++++++------- volumential/nearfield_potential_table.py | 4 +++- volumential/singular_integral_2d.py | 2 +- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/volumential/droste.py b/volumential/droste.py index 7307fea..960bda2 100644 --- a/volumential/droste.py +++ b/volumential/droste.py @@ -92,7 +92,7 @@ class DrosteBase(KernelCacheWrapper): [ 1 if int(max(abs(np.array(vec)))) == 0 - else max([abs(l) - 0.5 for l in np.array(vec) / 4]) * 2 + else max([abs(cvc) - 0.5 for cvc in np.array(vec) / 4]) * 2 for vec in case_vecs ] ) @@ -676,8 +676,8 @@ class DrosteFull(DrosteBase): ) + ", n_cases", ), ] - + list(extra_kernel_kwarg_types) - + ["...", ], + + list(extra_kernel_kwarg_types) + + ["...", ], name="brick_map", lang_version=(2018, 2), ) @@ -1135,7 +1135,7 @@ class DrosteReduced(DrosteBase): ) + ", n_cases", ), ] + list(extra_kernel_kwarg_types) - + ["...", ], + + ["...", ], name="brick_map", lang_version=(2018, 2), ) @@ -1154,7 +1154,7 @@ class DrosteReduced(DrosteBase): ) + ", n_cases", ), ] + list(extra_kernel_kwarg_types) - + ["...", ], + + ["...", ], name="brick_map_expansion", lang_version=(2018, 2), ) @@ -1942,7 +1942,7 @@ class InverseDrosteReduced(DrosteReduced): ) + ", n_cases", ), ] + list(extra_kernel_kwarg_types) - + ["...", ], + + ["...", ], name="brick_map_%d" % self.get_kernel_id, lang_version=(2018, 2), **extra_loopy_kernel_kwargs @@ -1962,7 +1962,7 @@ class InverseDrosteReduced(DrosteReduced): ) + ", n_cases", ), ] + list(extra_kernel_kwarg_types) - + ["...", ], + + ["...", ], name="brick_map_expansion", lang_version=(2018, 2), **extra_loopy_kernel_kwargs diff --git a/volumential/nearfield_potential_table.py b/volumential/nearfield_potential_table.py index c7420f4..aea0451 100644 --- a/volumential/nearfield_potential_table.py +++ b/volumential/nearfield_potential_table.py @@ -591,7 +591,9 @@ class NearFieldInteractionTable(object): new_size = 1 else: new_size = ( - max([abs(l) - 2 for l in self.interaction_case_vecs[case_index]]) / 2 + max([abs(cvc) - 2 + for cvc in self.interaction_case_vecs[case_index] + ]) / 2 ) # print(vec, new_cntr, new_size) diff --git a/volumential/singular_integral_2d.py b/volumential/singular_integral_2d.py index 9b71386..30bcd93 100644 --- a/volumential/singular_integral_2d.py +++ b/volumential/singular_integral_2d.py @@ -27,7 +27,7 @@ import logging import numpy as np import scipy as sp import scipy.integrate as sint -from scipy.integrate import quadrature as quad +from scipy.integrate import quadrature as quad # noqa:F401 __doc__ = """The 2D singular integrals are computed using the transform described in http://link.springer.com/10.1007/BF00370482. -- GitLab From e757b9fa759b16aeb23c15ffbeab8ff39a39f054 Mon Sep 17 00:00:00 2001 From: xywei Date: Wed, 8 Jul 2020 11:12:27 -0500 Subject: [PATCH 09/27] More flake8 fixes --- examples/volume_potential_2d.py | 6 +++--- examples/volume_potential_3d.py | 6 +++--- test/test_list1_gallery.py | 12 ++++++------ volumential/expansion_wrangler_fpnd.py | 8 ++++---- volumential/function_extension.py | 7 +++---- volumential/list1_gallery.py | 8 ++++---- 6 files changed, 23 insertions(+), 24 deletions(-) diff --git a/examples/volume_potential_2d.py b/examples/volume_potential_2d.py index 5eed2ad..0458082 100644 --- a/examples/volume_potential_2d.py +++ b/examples/volume_potential_2d.py @@ -229,13 +229,13 @@ def main(): - (b - a)) < 1e-15) nftable = [] - for l in range(0, tree.nlevels + 1): - print("Getting table at level", l) + for lev in range(0, tree.nlevels + 1): + print("Getting table at level", lev) tb, _ = tm.get_table( dim, "Laplace", q_order, - source_box_level=l, + source_box_level=lev, compute_method="DrosteSum", queue=queue, n_brick_quad_poitns=100, diff --git a/examples/volume_potential_3d.py b/examples/volume_potential_3d.py index 2997e85..8bebeae 100644 --- a/examples/volume_potential_3d.py +++ b/examples/volume_potential_3d.py @@ -240,13 +240,13 @@ def main(): - (b - a)) < 1e-15) nftable = [] - for l in range(0, tree.nlevels + 1): - print("Getting table at level", l) + for lev in range(0, tree.nlevels + 1): + print("Getting table at level", lev) tb, _ = tm.get_table( dim, "Laplace", q_order, - source_box_level=l, + source_box_level=lev, compute_method="DrosteSum", queue=queue, n_brick_quad_points=120, diff --git a/test/test_list1_gallery.py b/test/test_list1_gallery.py index 0fab90d..2fdf289 100644 --- a/test/test_list1_gallery.py +++ b/test/test_list1_gallery.py @@ -31,8 +31,8 @@ def test_1d(): distinct_numbers = set() for vec in l1g1d: - for l in vec: - distinct_numbers.add(l) + for cvc in vec: + distinct_numbers.add(cvc) assert len(distinct_numbers) == 7 assert max(distinct_numbers) == 6 @@ -45,8 +45,8 @@ def test_2d(): distinct_numbers = set() for vec in l1g2d: - for l in vec: - distinct_numbers.add(l) + for cvc in vec: + distinct_numbers.add(cvc) assert len(distinct_numbers) == 11 assert max(distinct_numbers) == 6 @@ -58,8 +58,8 @@ def test_3d(): distinct_numbers = set() for vec in l1g3d: - for l in vec: - distinct_numbers.add(l) + for cvc in vec: + distinct_numbers.add(cvc) assert max(distinct_numbers) == 6 assert min(distinct_numbers) == -6 diff --git a/volumential/expansion_wrangler_fpnd.py b/volumential/expansion_wrangler_fpnd.py index 330b969..b89c48e 100644 --- a/volumential/expansion_wrangler_fpnd.py +++ b/volumential/expansion_wrangler_fpnd.py @@ -367,8 +367,8 @@ class FPNDSumpyExpansionWrangler( # table.case_encode distinct_numbers = set() for vec in self.near_field_table[kname][0].interaction_case_vecs: - for l in vec: - distinct_numbers.add(l) + for cvc in vec: + distinct_numbers.add(cvc) base = len(range(min(distinct_numbers), max(distinct_numbers) + 1)) shift = -min(distinct_numbers) @@ -980,8 +980,8 @@ class FPNDFMMLibExpansionWrangler( # table.case_encode distinct_numbers = set() for vec in self.near_field_table[kname][0].interaction_case_vecs: - for l in vec: - distinct_numbers.add(l) + for cvc in vec: + distinct_numbers.add(cvc) base = len(range(min(distinct_numbers), max(distinct_numbers) + 1)) shift = -min(distinct_numbers) diff --git a/volumential/function_extension.py b/volumential/function_extension.py index 93b99bc..0fbbab1 100644 --- a/volumential/function_extension.py +++ b/volumential/function_extension.py @@ -558,10 +558,9 @@ def compute_biharmonic_extension(queue, target_discr, (qbx_stick_out, target_discr), sym.grad(dim, GD1) )(queue, mu=mu, - arclength_parametrization_derivatives=make_obj_array( - [xp, yp] - ) - ).real + arclength_parametrization_derivatives=make_obj_array( + [xp, yp]) + ).real grad_omega_D = grad_omega_D1 + grad_v1 # noqa: N806 omega_D1_bdry = bind( # noqa: N806 diff --git a/volumential/list1_gallery.py b/volumential/list1_gallery.py index f3a9f7f..70463ec 100644 --- a/volumential/list1_gallery.py +++ b/volumential/list1_gallery.py @@ -178,8 +178,8 @@ def generate_list1_gallery(dim): distinct_numbers = set() for vec in vec_list: - for l in vec: - distinct_numbers.add(l) + for cvc in vec: + distinct_numbers.add(cvc) # contains a lookup table for case indices base = len(range(min(distinct_numbers), max(distinct_numbers) + 1)) @@ -188,8 +188,8 @@ def generate_list1_gallery(dim): def case_encode(case_vec): table_id = 0 - for l in case_vec: - table_id = table_id * base + (l + shift) + for cvc in case_vec: + table_id = table_id * base + (cvc + shift) return int(table_id) case_id = 0 -- GitLab From e8fd169d88ba8aa727b066e9eca096b8a696a973 Mon Sep 17 00:00:00 2001 From: xywei Date: Wed, 8 Jul 2020 11:18:19 -0500 Subject: [PATCH 10/27] Replace time.clock() with time.time() --- examples/volume_potential_2d.py | 4 ++-- examples/volume_potential_3d.py | 4 ++-- experiments/sep.py | 4 ++-- experiments/volume_potential_2d_derivatives.py | 4 ++-- experiments/volume_potential_3d_derivatives.py | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/examples/volume_potential_2d.py b/examples/volume_potential_2d.py index 0458082..0e7975e 100644 --- a/examples/volume_potential_2d.py +++ b/examples/volume_potential_2d.py @@ -322,7 +322,7 @@ def main(): import time queue.finish() - t0 = time.clock() + t0 = time.time() pot, = drive_volume_fmm( trav, @@ -333,7 +333,7 @@ def main(): ) queue.finish() - t1 = time.clock() + t1 = time.time() print("Finished in %.2f seconds." % (t1 - t0)) print("(%e points per second)" % ( diff --git a/examples/volume_potential_3d.py b/examples/volume_potential_3d.py index 8bebeae..ec612fc 100644 --- a/examples/volume_potential_3d.py +++ b/examples/volume_potential_3d.py @@ -334,7 +334,7 @@ def main(): import time queue.finish() - t0 = time.clock() + t0 = time.time() pot, = drive_volume_fmm( trav, @@ -344,7 +344,7 @@ def main(): direct_evaluation=force_direct_evaluation, list1_only=False) - t1 = time.clock() + t1 = time.time() print("Finished in %.2f seconds." % (t1 - t0)) print("(%e points per second)" % ( diff --git a/experiments/sep.py b/experiments/sep.py index f4f94ad..730e24c 100644 --- a/experiments/sep.py +++ b/experiments/sep.py @@ -327,7 +327,7 @@ def main(): import time queue.finish() - t0 = time.clock() + t0 = time.time() pot, = drive_volume_fmm( trav, @@ -338,7 +338,7 @@ def main(): ) queue.finish() - t1 = time.clock() + t1 = time.time() print("Finished in %.2f seconds." % (t1 - t0)) print("(%e points per second)" % ( diff --git a/experiments/volume_potential_2d_derivatives.py b/experiments/volume_potential_2d_derivatives.py index 2d03223..192d512 100644 --- a/experiments/volume_potential_2d_derivatives.py +++ b/experiments/volume_potential_2d_derivatives.py @@ -387,7 +387,7 @@ from volumential.volume_fmm import drive_volume_fmm import time queue.finish() -t0 = time.clock() +t0 = time.time() pot = drive_volume_fmm( trav, @@ -398,7 +398,7 @@ pot = drive_volume_fmm( ) queue.finish() -t1 = time.clock() +t1 = time.time() print("Finished in %.2f seconds." % (t1 - t0)) print("(%e points per second)" % ( diff --git a/experiments/volume_potential_3d_derivatives.py b/experiments/volume_potential_3d_derivatives.py index 914aa86..023871c 100644 --- a/experiments/volume_potential_3d_derivatives.py +++ b/experiments/volume_potential_3d_derivatives.py @@ -365,7 +365,7 @@ from volumential.volume_fmm import drive_volume_fmm import time queue.finish() -t0 = time.clock() +t0 = time.time() pot = drive_volume_fmm( trav, @@ -375,7 +375,7 @@ pot = drive_volume_fmm( direct_evaluation=force_direct_evaluation, ) -t1 = time.clock() +t1 = time.time() print("Finished in %.2f seconds." % (t1 - t0)) print("(%e points per second)" % ( -- GitLab From 6e1d747a64125af293236a9e32280185aa5757b0 Mon Sep 17 00:00:00 2001 From: xywei Date: Wed, 8 Jul 2020 14:25:49 -0500 Subject: [PATCH 11/27] More flak8 fixes --- test/test_singular_integral_2d.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/test_singular_integral_2d.py b/test/test_singular_integral_2d.py index 09dcf9d..e69f15f 100644 --- a/test/test_singular_integral_2d.py +++ b/test/test_singular_integral_2d.py @@ -69,8 +69,8 @@ def test_quadrature_2d_box(): def test_affine_mapping(): tria1 = ((1, 1), (2, 3), (0, 4)) tria2 = ((0, 0), (1, 0), (0, 1)) - mp, J, imp, iJ = sint.solve_affine_map_2d(tria1, tria2) - assert np.isclose(J * iJ, 1) + mp, jac, imp, ivjac = sint.solve_affine_map_2d(tria1, tria2) + assert np.isclose(jac * ivjac, 1) for i in range(3): assert np.allclose(mp(tria1[i]), tria2[i]) assert np.allclose(imp(tria2[i]), tria1[i]) @@ -99,7 +99,7 @@ def test_is_in_r(): def test_tria2rect_map(): - t2r, J_t2r, r2t, J_r2t = sint.tria2rect_map_2d() + t2r, jac_t2r, r2t, jac_r2t = sint.tria2rect_map_2d() assert np.allclose(t2r((0, 0)), (0, 0)) assert np.allclose(t2r((1, 0)), (1, 0)) assert np.allclose(t2r((0, 1)), (1, np.pi / 2)) @@ -110,10 +110,10 @@ def test_tria2rect_map(): def test_tria2rect_jacobian(): - t2r, J_t2r, r2t, J_r2t = sint.tria2rect_map_2d() + t2r, jac_t2r, r2t, jac_r2t = sint.tria2rect_map_2d() p1 = (0.1, 0.1) - assert np.isclose(J_t2r(p1) * J_r2t(t2r(p1)), 1) - assert np.isclose(J_r2t(p1) * J_t2r(r2t(p1)), 1) + assert np.isclose(jac_t2r(p1) * jac_r2t(t2r(p1)), 1) + assert np.isclose(jac_r2t(p1) * jac_t2r(r2t(p1)), 1) def run_test_tria_quad(func, region, exact): -- GitLab From 0211a74ccd6d3d3aa96b8a281b30780983c40f64 Mon Sep 17 00:00:00 2001 From: xywei Date: Wed, 8 Jul 2020 14:29:31 -0500 Subject: [PATCH 12/27] Pylint fixes --- volumential/function_extension.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/volumential/function_extension.py b/volumential/function_extension.py index 0fbbab1..fd186a9 100644 --- a/volumential/function_extension.py +++ b/volumential/function_extension.py @@ -530,7 +530,7 @@ def compute_biharmonic_extension(queue, target_discr, omega_S1 = bind( # noqa: N806 (qbx_stick_out, target_discr), GS1)(queue, mu=mu).real - omega_S2 = - bind( # noqa: N806 + omega_S2 = -1 * bind( # noqa: N806 (qbx_stick_out, target_discr), GS2)(queue, mu=mu).real omega_S3 = (z_conj * int_rho).real # noqa: N806 omega_S = -(omega_S1 + omega_S2 + omega_S3) # noqa: N806 @@ -538,14 +538,14 @@ def compute_biharmonic_extension(queue, target_discr, grad_omega_S1 = bind( # noqa: N806 (qbx_stick_out, target_discr), sym.grad(dim, GS1))(queue, mu=mu).real - grad_omega_S2 = - bind( # noqa: N806 + grad_omega_S2 = -1 * bind( # noqa: N806 (qbx_stick_out, target_discr), sym.grad(dim, GS2))(queue, mu=mu).real grad_omega_S3 = (int_rho * make_obj_array([1., -1.])).real # noqa: N806 grad_omega_S = -(grad_omega_S1 + grad_omega_S2 + grad_omega_S3) # noqa: N806 omega_S1_bdry = bind(qbx, GS1_bdry)(queue, mu=mu).real # noqa: N806 - omega_S2_bdry = - bind(qbx, GS2_bdry)(queue, mu=mu).real # noqa: N806 + omega_S2_bdry = -1 * bind(qbx, GS2_bdry)(queue, mu=mu).real # noqa: N806 omega_S3_bdry = (z_conj_bdry * int_rho).real # noqa: N806 omega_S_bdry = -(omega_S1_bdry + omega_S2_bdry + omega_S3_bdry) # noqa: N806 -- GitLab From 1580ee8c02831a0ac4a820e432a4ad4e11264a49 Mon Sep 17 00:00:00 2001 From: xywei Date: Wed, 8 Jul 2020 14:32:17 -0500 Subject: [PATCH 13/27] Fix self reference in constructors --- contrib/meshgen11_dealii/meshgen.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/contrib/meshgen11_dealii/meshgen.cpp b/contrib/meshgen11_dealii/meshgen.cpp index b7cdcef..a7d3573 100644 --- a/contrib/meshgen11_dealii/meshgen.cpp +++ b/contrib/meshgen11_dealii/meshgen.cpp @@ -145,9 +145,9 @@ public: d::GridGenerator::hyper_cube(triangulation, box_a, box_b); // initial number of levels must be compatible - assert(level > self.min_grid_level); - assert(level <= self.max_grid_level + 1); - assert(std::pow(std::pow(2, dimension), level - 1) <= self.max_n_cells); + assert(level > this->min_grid_level); + assert(level <= this->max_grid_level + 1); + assert(std::pow(std::pow(2, dimension), level - 1) <= this->max_n_cells); if (level > 1) { triangulation.refine_global(level - 1); @@ -168,9 +168,9 @@ public: d::GridGenerator::hyper_cube(triangulation, box_a, box_b); // initial number of levels must be compatible - assert(level > self.min_grid_level); - assert(level <= self.max_grid_level + 1); - assert(std::pow(std::pow(2, dimension), level - 1) <= self.max_n_cells); + assert(level > this->min_grid_level); + assert(level <= this->max_grid_level + 1); + assert(std::pow(std::pow(2, dimension), level - 1) <= this->max_n_cells); if (level > 1) { triangulation.refine_global(level - 1); -- GitLab From b3660c31fcd8e677c564a220df5831c22bcaf1c6 Mon Sep 17 00:00:00 2001 From: xywei Date: Wed, 8 Jul 2020 14:52:00 -0500 Subject: [PATCH 14/27] Refactor to make pylint happy --- volumential/nearfield_potential_table.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/volumential/nearfield_potential_table.py b/volumential/nearfield_potential_table.py index aea0451..45bd89d 100644 --- a/volumential/nearfield_potential_table.py +++ b/volumential/nearfield_potential_table.py @@ -459,7 +459,9 @@ class NearFieldInteractionTable(object): import scipy.special as sps - cheby_nodes, _, cheby_weights = sps.chebyt(cheb_order).weights.T + # quad_info contains: roots, weights, equiv_weights + quad_info = sps.chebyt(cheb_order).weights.T + cheby_nodes, cheby_weights = (quad_info[0, :], quad_info[2, :]) window = [0, 1] cheby_nodes = cheby_nodes * (window[1] - window[0]) / 2 + np.mean(window) -- GitLab From 3a461fb72d065d6eb3488e104043ba010e4f997e Mon Sep 17 00:00:00 2001 From: xywei Date: Wed, 8 Jul 2020 15:05:07 -0500 Subject: [PATCH 15/27] Update to pytential main branch (lose CH operator temporarily) --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 9cd6c9a..77b5dc0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,8 +3,8 @@ git+https://gitlab.tiker.net/xywei/pypvfmm.git#egg=pypvfmm -e git+https://gitlab.tiker.net/xywei/boxtree.git#egg=boxtree -e git+https://www.github.com/xywei/gmsh_interop.git#egg=gmsh_interop --e git+https://gitlab.tiker.net/xywei/pytential.git#egg=pytential +-e git+https://gitlab.tiker.net/inducer/pytential.git#egg=pytential -e git+https://gitlab.tiker.net/inducer/pytools.git#egg=pytools -e git+https://gitlab.tiker.net/inducer/cgen.git#egg=cgen -e git+https://gitlab.tiker.net/inducer/meshmode.git#egg=meshmode -- GitLab From 25d9bc8c706c0aa5372424063d188349ed62667d Mon Sep 17 00:00:00 2001 From: xywei Date: Wed, 8 Jul 2020 15:50:46 -0500 Subject: [PATCH 16/27] Supress pylint false positive --- volumential/nearfield_potential_table.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/volumential/nearfield_potential_table.py b/volumential/nearfield_potential_table.py index 45bd89d..13bd817 100644 --- a/volumential/nearfield_potential_table.py +++ b/volumential/nearfield_potential_table.py @@ -459,9 +459,8 @@ class NearFieldInteractionTable(object): import scipy.special as sps - # quad_info contains: roots, weights, equiv_weights - quad_info = sps.chebyt(cheb_order).weights.T - cheby_nodes, cheby_weights = (quad_info[0, :], quad_info[2, :]) + cheby_nodes, _, cheby_weights = \ + sps.chebyt(cheb_order).weights.T # pylint: disable=E1136 window = [0, 1] cheby_nodes = cheby_nodes * (window[1] - window[0]) / 2 + np.mean(window) -- GitLab From d87a45101417359055221e1dfdd567162b9ab6af Mon Sep 17 00:00:00 2001 From: xywei Date: Wed, 8 Jul 2020 16:05:14 -0500 Subject: [PATCH 17/27] Skip tests that relies on GeometryCollection --- test/test_function_extension.py | 1 + 1 file changed, 1 insertion(+) diff --git a/test/test_function_extension.py b/test/test_function_extension.py index 90e91d0..aff8d2a 100644 --- a/test/test_function_extension.py +++ b/test/test_function_extension.py @@ -38,6 +38,7 @@ from pytential import bind, sym, norm # noqa from pytential.target import PointsTarget +@pytest.mark.skip(reason="this test needs to be updated to use GeometryCollection") def test_harmonic_extension_exterior_3d(ctx_factory): dim = 3 # noqa: F841 -- GitLab From 5fba3faa89aa1dffd2d73ad532a80081d1863ea5 Mon Sep 17 00:00:00 2001 From: xywei Date: Wed, 8 Jul 2020 16:11:02 -0500 Subject: [PATCH 18/27] flake8 E261 --- volumential/nearfield_potential_table.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/volumential/nearfield_potential_table.py b/volumential/nearfield_potential_table.py index 13bd817..68ad5a2 100644 --- a/volumential/nearfield_potential_table.py +++ b/volumential/nearfield_potential_table.py @@ -460,7 +460,7 @@ class NearFieldInteractionTable(object): import scipy.special as sps cheby_nodes, _, cheby_weights = \ - sps.chebyt(cheb_order).weights.T # pylint: disable=E1136 + sps.chebyt(cheb_order).weights.T # pylint: disable=E1136 window = [0, 1] cheby_nodes = cheby_nodes * (window[1] - window[0]) / 2 + np.mean(window) -- GitLab From 8d0e6b67343f5b1f3794f0848d89a320b3fd444a Mon Sep 17 00:00:00 2001 From: xywei Date: Wed, 8 Jul 2020 16:53:29 -0500 Subject: [PATCH 19/27] Supress pylint false positive --- volumential/nearfield_potential_table.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/volumential/nearfield_potential_table.py b/volumential/nearfield_potential_table.py index 68ad5a2..3f87649 100644 --- a/volumential/nearfield_potential_table.py +++ b/volumential/nearfield_potential_table.py @@ -460,7 +460,7 @@ class NearFieldInteractionTable(object): import scipy.special as sps cheby_nodes, _, cheby_weights = \ - sps.chebyt(cheb_order).weights.T # pylint: disable=E1136 + sps.chebyt(cheb_order).weights.T # pylint: disable=E1136,E0633 window = [0, 1] cheby_nodes = cheby_nodes * (window[1] - window[0]) / 2 + np.mean(window) -- GitLab From 9d492fdd68e3a067c89db8c09e1333f482446e4f Mon Sep 17 00:00:00 2001 From: xywei Date: Wed, 8 Jul 2020 18:04:59 -0500 Subject: [PATCH 20/27] Switch to upstream gmsh_interop --- docker/Dockerfile.firedrake | 29 +++++++++++++++++++++++++++++ requirements.txt | 4 ++-- 2 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 docker/Dockerfile.firedrake diff --git a/docker/Dockerfile.firedrake b/docker/Dockerfile.firedrake new file mode 100644 index 0000000..9749541 --- /dev/null +++ b/docker/Dockerfile.firedrake @@ -0,0 +1,29 @@ +# DockerFile that builds on firedrake's official docker image. +# The resulting image preserves the firedrake user & venv & packages. + +FROM firedrakeproject/firedrake:latest + +# This DockerFile is looked after by +MAINTAINER Xiaoyu Wei + +########################################## +USER root +RUN apt-get update \ + && apt install -y wget \ + && apt install -y opencl-pocl-icd opencl-headers \ + && apt install -y fftw3 fftw3-dev \ + && rm -rf /var/lib/apt/lists/* + +# This symlink is for pyopencl build +RUN ln -s /usr/lib/x86_64-linux-gnu/libOpenCL.so.1 /usr/lib/libOpenCL.so + +########################################## +USER firedrake +WORKDIR /home/firedrake + +RUN git clone "https://gitlab.tiker.net/xywei/volumential.git" + +# Code generation in pypvfm's setup.py needs mako +RUN bash -c "source firedrake/bin/activate; pip install mako" + +RUN bash -c "source firedrake/bin/activate; pip install -r volumential/requirements.txt; pip install volumential/" diff --git a/requirements.txt b/requirements.txt index 77b5dc0..f57a521 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,9 +1,9 @@ --index-url https://pypi.python.org/simple/ -git+https://gitlab.tiker.net/xywei/pypvfmm.git#egg=pypvfmm +-e git+https://gitlab.tiker.net/xywei/pypvfmm.git#egg=pypvfmm -e git+https://gitlab.tiker.net/xywei/boxtree.git#egg=boxtree --e git+https://www.github.com/xywei/gmsh_interop.git#egg=gmsh_interop +-e git+https://gitlab.tiker.net/inducer/gmsh_interop.git#egg=gmsh_interop -e git+https://gitlab.tiker.net/inducer/pytential.git#egg=pytential -e git+https://gitlab.tiker.net/inducer/pytools.git#egg=pytools -e git+https://gitlab.tiker.net/inducer/cgen.git#egg=cgen -- GitLab From 2f3245954930e99834ebbc9ba912c9bbde61a4c9 Mon Sep 17 00:00:00 2001 From: xywei Date: Wed, 8 Jul 2020 18:24:25 -0500 Subject: [PATCH 21/27] Add a DockerFile based off of firedrake --- docker/Dockerfile.firedrake | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/docker/Dockerfile.firedrake b/docker/Dockerfile.firedrake index 9749541..25d050d 100644 --- a/docker/Dockerfile.firedrake +++ b/docker/Dockerfile.firedrake @@ -9,9 +9,9 @@ MAINTAINER Xiaoyu Wei ########################################## USER root RUN apt-get update \ - && apt install -y wget \ - && apt install -y opencl-pocl-icd opencl-headers \ - && apt install -y fftw3 fftw3-dev \ + && apt install -y wget deal.ii deal.ii-dev\ + opencl-pocl-icd opencl-headers \ + fftw3 fftw3-dev \ && rm -rf /var/lib/apt/lists/* # This symlink is for pyopencl build @@ -21,9 +21,10 @@ RUN ln -s /usr/lib/x86_64-linux-gnu/libOpenCL.so.1 /usr/lib/libOpenCL.so USER firedrake WORKDIR /home/firedrake -RUN git clone "https://gitlab.tiker.net/xywei/volumential.git" +RUN git clone --recurse-submodules "https://gitlab.tiker.net/xywei/volumential.git" # Code generation in pypvfm's setup.py needs mako RUN bash -c "source firedrake/bin/activate; pip install mako" -RUN bash -c "source firedrake/bin/activate; pip install -r volumential/requirements.txt; pip install volumential/" +RUN bash -c "source firedrake/bin/activate; pip install -r volumential/requirements.txt; pip install -e volumential/" +RUN bash -c "source firedrake/bin/activate; cd volumential/contrib/meshgen11_dealii; ./build.sh" -- GitLab From 3c0d9dcfb1449f84ff54af6670ef5291795033be Mon Sep 17 00:00:00 2001 From: xywei Date: Wed, 8 Jul 2020 18:28:49 -0500 Subject: [PATCH 22/27] pypvfmm should not be installed with -e --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index f57a521..1a2bf60 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ --index-url https://pypi.python.org/simple/ --e git+https://gitlab.tiker.net/xywei/pypvfmm.git#egg=pypvfmm +git+https://gitlab.tiker.net/xywei/pypvfmm.git#egg=pypvfmm -e git+https://gitlab.tiker.net/xywei/boxtree.git#egg=boxtree -e git+https://gitlab.tiker.net/inducer/gmsh_interop.git#egg=gmsh_interop -- GitLab From 54ae7a9ca2a72a99ce1715c9497dd30a134500ed Mon Sep 17 00:00:00 2001 From: xywei Date: Wed, 8 Jul 2020 19:57:30 -0500 Subject: [PATCH 23/27] Add CI job for Dockerfile.firedrake --- .gitlab-ci.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5bcf31f..644006c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -154,3 +154,15 @@ Documentation Sphinx: except: - tags allow_failure: true + +Docker Image w/t Firedrake: + script: + - docker info + - docker login --username "${DOCKERHUB_USERNAME}" --password "${DOCKERHUB_ACCESS_TOKEN}" + - docker build --no-cache -t xywei/volumential-firedrake:latest -f docker/Dockerfile.firedrake + - docker push xywei/volumential-firedrake:latest + tags: + - docker + except: + - tags + allow_failure: true -- GitLab From e3f75601526def9ce321aa6dea313d815bf19b71 Mon Sep 17 00:00:00 2001 From: xywei Date: Wed, 8 Jul 2020 19:59:56 -0500 Subject: [PATCH 24/27] Allow non-protected branches to build docker images (but not to push) --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 644006c..6883561 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -158,8 +158,8 @@ Documentation Sphinx: Docker Image w/t Firedrake: script: - docker info - - docker login --username "${DOCKERHUB_USERNAME}" --password "${DOCKERHUB_ACCESS_TOKEN}" - docker build --no-cache -t xywei/volumential-firedrake:latest -f docker/Dockerfile.firedrake + - docker login --username "${DOCKERHUB_USERNAME}" --password "${DOCKERHUB_ACCESS_TOKEN}" - docker push xywei/volumential-firedrake:latest tags: - docker -- GitLab From 47084d714aec53dd961726491647f57f0604de51 Mon Sep 17 00:00:00 2001 From: xywei Date: Wed, 8 Jul 2020 20:08:36 -0500 Subject: [PATCH 25/27] Dockerfile fixes --- .gitlab-ci.yml | 2 +- docker/Dockerfile.firedrake | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6883561..fe686ac 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -158,7 +158,7 @@ Documentation Sphinx: Docker Image w/t Firedrake: script: - docker info - - docker build --no-cache -t xywei/volumential-firedrake:latest -f docker/Dockerfile.firedrake + - docker build --no-cache -t xywei/volumential-firedrake:latest -f docker/Dockerfile.firedrake . - docker login --username "${DOCKERHUB_USERNAME}" --password "${DOCKERHUB_ACCESS_TOKEN}" - docker push xywei/volumential-firedrake:latest tags: diff --git a/docker/Dockerfile.firedrake b/docker/Dockerfile.firedrake index 25d050d..fe1bde4 100644 --- a/docker/Dockerfile.firedrake +++ b/docker/Dockerfile.firedrake @@ -9,8 +9,8 @@ MAINTAINER Xiaoyu Wei ########################################## USER root RUN apt-get update \ - && apt install -y wget deal.ii deal.ii-dev\ - opencl-pocl-icd opencl-headers \ + && apt-get install -y wget deal.ii deal.ii-dev \ + pocl-opencl-icd opencl-headers \ fftw3 fftw3-dev \ && rm -rf /var/lib/apt/lists/* -- GitLab From 630ff5ed63b36bd62a59eb1abb1df3b1aa5f7c59 Mon Sep 17 00:00:00 2001 From: xywei Date: Wed, 8 Jul 2020 20:30:11 -0500 Subject: [PATCH 26/27] Fix docker install script --- docker/Dockerfile.firedrake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile.firedrake b/docker/Dockerfile.firedrake index fe1bde4..f32a2f7 100644 --- a/docker/Dockerfile.firedrake +++ b/docker/Dockerfile.firedrake @@ -26,5 +26,5 @@ RUN git clone --recurse-submodules "https://gitlab.tiker.net/xywei/volumential.g # Code generation in pypvfm's setup.py needs mako RUN bash -c "source firedrake/bin/activate; pip install mako" -RUN bash -c "source firedrake/bin/activate; pip install -r volumential/requirements.txt; pip install -e volumential/" RUN bash -c "source firedrake/bin/activate; cd volumential/contrib/meshgen11_dealii; ./build.sh" +RUN bash -c "source firedrake/bin/activate; cd volumential; pip install -r volumential/requirements.txt" -- GitLab From 837436306b5e06dca15115bd0ded2b5c0c2e37c4 Mon Sep 17 00:00:00 2001 From: xywei Date: Wed, 8 Jul 2020 20:44:56 -0500 Subject: [PATCH 27/27] Dockerfile fixes --- docker/Dockerfile.firedrake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile.firedrake b/docker/Dockerfile.firedrake index f32a2f7..ccc06e8 100644 --- a/docker/Dockerfile.firedrake +++ b/docker/Dockerfile.firedrake @@ -27,4 +27,4 @@ RUN git clone --recurse-submodules "https://gitlab.tiker.net/xywei/volumential.g RUN bash -c "source firedrake/bin/activate; pip install mako" RUN bash -c "source firedrake/bin/activate; cd volumential/contrib/meshgen11_dealii; ./build.sh" -RUN bash -c "source firedrake/bin/activate; cd volumential; pip install -r volumential/requirements.txt" +RUN bash -c "source firedrake/bin/activate; cd volumential; pip install -r requirements.txt" -- GitLab