Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Towards using array contexts #118

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ def write_git_revision(package_name):
"boxtree>=2018.1",
"pytest>=2.3",
"pyrsistent>=0.16.0",
"arraycontext",
"dataclasses>=0.7;python_version<='3.6'",
"sympy>=0.7.2",
"pymbolic>=2021.1",
Expand Down
14 changes: 2 additions & 12 deletions sumpy/e2e.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@
# {{{ translation base class

class E2EBase(KernelCacheWrapper):
def __init__(self, ctx, src_expansion, tgt_expansion,
name=None, device=None):
def __init__(self, src_expansion, tgt_expansion,
name=None):
"""
:arg expansion: a subclass of :class:`sympy.expansion.ExpansionBase`
:arg strength_usage: A list of integers indicating which expression
Expand All @@ -59,9 +59,6 @@ def __init__(self, ctx, src_expansion, tgt_expansion,
Default: all kernels use the same strength.
"""

if device is None:
device = ctx.devices[0]

if src_expansion is tgt_expansion:
from sumpy.kernel import (TargetTransformationRemover,
SourceTransformationRemover)
Expand All @@ -80,11 +77,9 @@ def __init__(self, ctx, src_expansion, tgt_expansion,
SourceTransformationRemover()(
TargetTransformationRemover()(tgt_expansion.kernel)))

self.ctx = ctx
self.src_expansion = src_expansion
self.tgt_expansion = tgt_expansion
self.name = name or self.default_name
self.device = device

if src_expansion.dim != tgt_expansion.dim:
raise ValueError("source and target expansions must have "
Expand Down Expand Up @@ -149,11 +144,6 @@ class E2EFromCSR(E2EBase):

default_name = "e2e_from_csr"

def __init__(self, ctx, src_expansion, tgt_expansion,
name=None, device=None):
super().__init__(ctx, src_expansion, tgt_expansion,
name=name, device=device)

def get_translation_loopy_insns(self):
from sumpy.symbolic import make_sym_vector
dvec = make_sym_vector("d", self.dim)
Expand Down
8 changes: 1 addition & 7 deletions sumpy/e2p.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@
# {{{ E2P base class

class E2PBase(KernelCacheWrapper):
def __init__(self, ctx, expansion, kernels,
name=None, device=None):
def __init__(self, expansion, kernels, name=None):
"""
:arg expansion: a subclass of :class:`sympy.expansion.ExpansionBase`
:arg strength_usage: A list of integers indicating which expression
Expand All @@ -53,9 +52,6 @@ def __init__(self, ctx, expansion, kernels,
Default: all kernels use the same strength.
"""

if device is None:
device = ctx.devices[0]

from sumpy.kernel import (SourceTransformationRemover,
TargetTransformationRemover)
sxr = SourceTransformationRemover()
Expand All @@ -67,11 +63,9 @@ def __init__(self, ctx, expansion, kernels,
for knl in kernels:
assert txr(knl) == expansion.kernel

self.ctx = ctx
self.expansion = expansion
self.kernels = kernels
self.name = name or self.default_name
self.device = device

self.dim = expansion.dim

Expand Down
Loading