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

Remove force_device_scalars=True from examples #449

Merged
merged 3 commits into from
Feb 8, 2025
Merged
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
10 changes: 5 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ meshmode: High-Order Meshes and Discontinuous Function Spaces
.. image:: https://gitlab.tiker.net/inducer/meshmode/badges/main/pipeline.svg
:alt: Gitlab Build Status
:target: https://gitlab.tiker.net/inducer/meshmode/commits/main
.. image:: https://github.com/inducer/meshmode/workflows/CI/badge.svg
.. image:: https://github.com/inducer/meshmode/actions/workflows/ci.yml/badge.svg
:alt: Github Build Status
:target: https://github.com/inducer/meshmode/actions?query=branch%3Amain+workflow%3ACI
.. image:: https://badge.fury.io/py/meshmode.png
:target: https://github.com/inducer/meshmode/actions/workflows/ci.yml
.. image:: https://badge.fury.io/py/meshmode.svg
:alt: Python Package Index Release Page
:target: https://pypi.org/project/meshmode/

Expand Down Expand Up @@ -35,5 +35,5 @@ Meshmode emerged as the shared discretization layer for `pytential

Places on the web related to meshmode:

* `Source code on Github <https://github.com/inducer/meshmode>`_
* `Documentation <https://documen.tician.de/meshmode>`_
* `Source code on Github <https://github.com/inducer/meshmode>`__
* `Documentation <https://documen.tician.de/meshmode>`__
2 changes: 1 addition & 1 deletion examples/from_firedrake.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def main(visualize=True):
# Make connections
cl_ctx = cl.create_some_context()
queue = cl.CommandQueue(cl_ctx)
actx = PyOpenCLArrayContext(queue, force_device_scalars=True)
actx = PyOpenCLArrayContext(queue)

fd_connection = build_connection_from_firedrake(actx, fd_fspace)
fd_bdy_connection = \
Expand Down
2 changes: 1 addition & 1 deletion examples/moving-geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ def source(t, x):
if __name__ == "__main__":
cl_ctx = cl.create_some_context()
queue = cl.CommandQueue(cl_ctx)
actx = PyOpenCLArrayContext(queue, force_device_scalars=True)
actx = PyOpenCLArrayContext(queue)

from pytools import ProcessTimer
for _ in range(1):
Expand Down
2 changes: 1 addition & 1 deletion examples/parallel-vtkhdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def main(*, ambient_dim: int) -> None:
logger.info("[%4d] fields: finished", comm.rank)

from meshmode.discretization.visualization import make_visualizer
vis = make_visualizer(actx, discr, vis_order=order, force_equidistant=False)
vis = make_visualizer(actx, discr, force_equidistant=False)
logger.info("[%4d] make_visualizer: finished", comm.rank)

filename = f"parallel-vtkhdf-example-{ambient_dim}d.hdf"
Expand Down
2 changes: 1 addition & 1 deletion examples/plot-connectivity.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
def main():
cl_ctx = cl.create_some_context()
queue = cl.CommandQueue(cl_ctx)
actx = PyOpenCLArrayContext(queue, force_device_scalars=True)
actx = PyOpenCLArrayContext(queue)

from meshmode.mesh.generation import ( # noqa: F401
generate_icosahedron,
Expand Down
8 changes: 7 additions & 1 deletion examples/simple-dg.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,9 @@ class TracePair:
interior: ArrayContainer
exterior: ArrayContainer

# NOTE: let the container do the broadcasting + arithmetic
__array_ufunc__ = None

def __getattr__(self, name):
return map_array_container(
lambda ary: getattr(ary, name),
Expand Down Expand Up @@ -450,6 +453,9 @@ class WaveState:
u: DOFArray
v: np.ndarray # [object]

# NOTE: let the container do the broadcasting + arithmetic
__array_ufunc__ = None

def __post_init__(self):
assert isinstance(self.v, np.ndarray) and self.v.dtype.char == "O"

Expand All @@ -464,7 +470,7 @@ def main(lazy=False):

cl_ctx = cl.create_some_context()
queue = cl.CommandQueue(cl_ctx)
actx_outer = PyOpenCLArrayContext(queue, force_device_scalars=True)
actx_outer = PyOpenCLArrayContext(queue)
if lazy:
actx_rhs = PytatoPyOpenCLArrayContext(queue)
else:
Expand Down
2 changes: 1 addition & 1 deletion examples/to_firedrake.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def main():

cl_ctx = cl.create_some_context()
queue = cl.CommandQueue(cl_ctx)
actx = PyOpenCLArrayContext(queue, force_device_scalars=True)
actx = PyOpenCLArrayContext(queue)

nel_1d = 16
from meshmode.mesh.generation import generate_regular_rect_mesh
Expand Down
2 changes: 1 addition & 1 deletion examples/tp-lagrange-stl.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
def main():
cl_ctx = cl.create_some_context()
queue = cl.CommandQueue(cl_ctx)
actx = PyOpenCLArrayContext(queue, force_device_scalars=True)
actx = PyOpenCLArrayContext(queue)

npts1d = 100 # use 300 for actual print
rs_coords = np.linspace(-1, 1, npts1d)
Expand Down
2 changes: 1 addition & 1 deletion meshmode/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,4 @@ def _acf():

context = cl._csc()
queue = cl.CommandQueue(context)
return PyOpenCLArrayContext(queue, force_device_scalars=True)
return PyOpenCLArrayContext(queue)
2 changes: 1 addition & 1 deletion test/test_partition.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ def _test_mpi_boundary_swap(dim, order, num_groups):
from meshmode.array_context import PyOpenCLArrayContext
cl_ctx = cl.create_some_context()
queue = cl.CommandQueue(cl_ctx)
actx = PyOpenCLArrayContext(queue, force_device_scalars=True)
actx = PyOpenCLArrayContext(queue)

from meshmode.discretization import Discretization
vol_discr = Discretization(actx, local_mesh, group_factory)
Expand Down
Loading