Skip to content

Commit

Permalink
Merge branch 'fusion-actx-freeze-thaw' into build-production-freeze-thaw
Browse files Browse the repository at this point in the history
  • Loading branch information
MTCam committed Jul 4, 2022
2 parents 1adf9fa + b73fce1 commit 5e369d3
Show file tree
Hide file tree
Showing 40 changed files with 141 additions and 185 deletions.
3 changes: 1 addition & 2 deletions examples/autoignition-mpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
from mirgecom.initializers import MixtureInitializer
from mirgecom.eos import PyrometheusMixture
from mirgecom.gas_model import GasModel
from arraycontext import thaw

from mirgecom.logging_quantities import (
initialize_logmgr,
Expand Down Expand Up @@ -171,7 +170,7 @@ def main(actx_class, ctx_factory=cl.create_some_context, use_logmgr=True,

discr = create_discretization_collection(actx, local_mesh, order=order,
mpi_communicator=comm)
nodes = thaw(discr.nodes(), actx)
nodes = actx.thaw(discr.nodes())
ones = discr.zeros(actx) + 1.0

if use_overintegration:
Expand Down
5 changes: 2 additions & 3 deletions examples/doublemach-mpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import pyopencl.tools as cl_tools
from functools import partial

from arraycontext import thaw
from meshmode.mesh import BTAG_ALL, BTAG_NONE # noqa
from grudge.dof_desc import DTAG_BOUNDARY
from grudge.shortcuts import make_visualizer
Expand Down Expand Up @@ -195,7 +194,7 @@ def main(ctx_factory=cl.create_some_context, use_logmgr=True,
order = 3
discr = create_discretization_collection(actx, local_mesh, order=order,
mpi_communicator=comm)
nodes = thaw(discr.nodes(), actx)
nodes = actx.thaw(discr.nodes())

from grudge.dof_desc import DISCR_TAG_QUAD
if use_overintegration:
Expand Down Expand Up @@ -241,7 +240,7 @@ def main(ctx_factory=cl.create_some_context, use_logmgr=True,
def _boundary_state(discr, btag, gas_model, state_minus, **kwargs):
actx = state_minus.array_context
bnd_discr = discr.discr_from_dd(btag)
nodes = thaw(bnd_discr.nodes(), actx)
nodes = actx.thaw(bnd_discr.nodes())
return make_fluid_state(initializer(x_vec=nodes, eos=gas_model.eos,
**kwargs), gas_model)

Expand Down
3 changes: 1 addition & 2 deletions examples/heat-source-mpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,7 @@ def main(actx_class, ctx_factory=cl.create_some_context, use_logmgr=True,

source_width = 0.2

from arraycontext import thaw
nodes = thaw(discr.nodes(), actx)
nodes = actx.thaw(discr.nodes())

boundaries = {
DTAG_BOUNDARY("dirichlet"): DirichletDiffusionBoundary(0.),
Expand Down
5 changes: 2 additions & 3 deletions examples/hotplate-mpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import pyopencl.tools as cl_tools
from functools import partial

from arraycontext import thaw
from meshmode.mesh import BTAG_ALL, BTAG_NONE # noqa

from grudge.shortcuts import make_visualizer
Expand Down Expand Up @@ -172,7 +171,7 @@ def main(ctx_factory=cl.create_some_context, use_logmgr=True,
discr = create_discretization_collection(
actx, local_mesh, order=order, mpi_communicator=comm
)
nodes = thaw(discr.nodes(), actx)
nodes = actx.thaw(discr.nodes())

if logmgr:
logmgr_add_device_name(logmgr, queue)
Expand Down Expand Up @@ -225,7 +224,7 @@ def tramp_2d(x_vec, eos, cv=None, **kwargs):
def _boundary_state(discr, btag, gas_model, state_minus, **kwargs):
actx = state_minus.array_context
bnd_discr = discr.discr_from_dd(btag)
nodes = thaw(bnd_discr.nodes(), actx)
nodes = actx.thaw(bnd_discr.nodes())
return make_fluid_state(initializer(x_vec=nodes, eos=gas_model.eos,
**kwargs), gas_model)

Expand Down
5 changes: 2 additions & 3 deletions examples/lump-mpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import pyopencl.tools as cl_tools
from functools import partial

from arraycontext import thaw
from meshmode.mesh import BTAG_ALL, BTAG_NONE # noqa
from grudge.shortcuts import make_visualizer

Expand Down Expand Up @@ -151,7 +150,7 @@ def main(actx_class, ctx_factory=cl.create_some_context, use_logmgr=True,
discr = create_discretization_collection(
actx, local_mesh, order=order, mpi_communicator=comm
)
nodes = thaw(discr.nodes(), actx)
nodes = actx.thaw(discr.nodes())

vis_timer = None

Expand Down Expand Up @@ -185,7 +184,7 @@ def main(actx_class, ctx_factory=cl.create_some_context, use_logmgr=True,
def boundary_solution(discr, btag, gas_model, state_minus, **kwargs):
actx = state_minus.array_context
bnd_discr = discr.discr_from_dd(btag)
nodes = thaw(bnd_discr.nodes(), actx)
nodes = actx.thaw(bnd_discr.nodes())
return make_fluid_state(initializer(x_vec=nodes, eos=gas_model.eos,
**kwargs), gas_model)

Expand Down
5 changes: 2 additions & 3 deletions examples/mixture-mpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import pyopencl.tools as cl_tools
from functools import partial

from arraycontext import thaw
from meshmode.mesh import BTAG_ALL, BTAG_NONE # noqa
from grudge.shortcuts import make_visualizer

Expand Down Expand Up @@ -151,7 +150,7 @@ def main(actx_class, ctx_factory=cl.create_some_context, use_logmgr=True,
discr = create_discretization_collection(
actx, local_mesh, order=order, mpi_communicator=comm
)
nodes = thaw(discr.nodes(), actx)
nodes = actx.thaw(discr.nodes())

vis_timer = None

Expand Down Expand Up @@ -206,7 +205,7 @@ def main(actx_class, ctx_factory=cl.create_some_context, use_logmgr=True,
def boundary_solution(discr, btag, gas_model, state_minus, **kwargs):
actx = state_minus.array_context
bnd_discr = discr.discr_from_dd(btag)
nodes = thaw(bnd_discr.nodes(), actx)
nodes = actx.thaw(bnd_discr.nodes())
return make_fluid_state(initializer(x_vec=nodes, eos=gas_model.eos,
**kwargs), gas_model,
temperature_seed=state_minus.temperature)
Expand Down
3 changes: 1 addition & 2 deletions examples/nsmix-mpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
PytatoPyOpenCLArrayContext
)
from mirgecom.profiling import PyOpenCLProfilingArrayContext
from arraycontext import thaw
from meshmode.mesh import BTAG_ALL, BTAG_NONE # noqa
from grudge.shortcuts import make_visualizer

Expand Down Expand Up @@ -159,7 +158,7 @@ def main(ctx_factory=cl.create_some_context, use_logmgr=True,
discr = create_discretization_collection(
actx, local_mesh, order=order, mpi_communicator=comm
)
nodes = thaw(discr.nodes(), actx)
nodes = actx.thaw(discr.nodes())
ones = discr.zeros(actx) + 1.0

if logmgr:
Expand Down
5 changes: 2 additions & 3 deletions examples/poiseuille-mpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
PytatoPyOpenCLArrayContext
)
from mirgecom.profiling import PyOpenCLProfilingArrayContext
from arraycontext import thaw
from meshmode.mesh import BTAG_ALL, BTAG_NONE # noqa

from grudge.shortcuts import make_visualizer
Expand Down Expand Up @@ -174,7 +173,7 @@ def main(ctx_factory=cl.create_some_context, use_logmgr=True,
discr = create_discretization_collection(
actx, local_mesh, order=order, mpi_communicator=comm
)
nodes = thaw(discr.nodes(), actx)
nodes = actx.thaw(discr.nodes())

if use_overintegration:
quadrature_tag = DISCR_TAG_QUAD
Expand Down Expand Up @@ -241,7 +240,7 @@ def poiseuille_2d(x_vec, eos, cv=None, **kwargs):
def _boundary_solution(discr, btag, gas_model, state_minus, **kwargs):
actx = state_minus.array_context
bnd_discr = discr.discr_from_dd(btag)
nodes = thaw(bnd_discr.nodes(), actx)
nodes = actx.thaw(bnd_discr.nodes())
return make_fluid_state(initializer(x_vec=nodes, eos=gas_model.eos,
cv=state_minus.cv, **kwargs), gas_model)

Expand Down
3 changes: 1 addition & 2 deletions examples/pulse-mpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import pyopencl as cl
import pyopencl.tools as cl_tools

from arraycontext import thaw
from meshmode.mesh import BTAG_ALL, BTAG_NONE # noqa
from grudge.shortcuts import make_visualizer
from grudge.dof_desc import DISCR_TAG_QUAD
Expand Down Expand Up @@ -157,7 +156,7 @@ def main(actx_class, ctx_factory=cl.create_some_context, use_logmgr=True,
discr = create_discretization_collection(
actx, local_mesh, order=order, mpi_communicator=comm
)
nodes = thaw(discr.nodes(), actx)
nodes = actx.thaw(discr.nodes())

if use_overintegration:
quadrature_tag = DISCR_TAG_QUAD
Expand Down
5 changes: 2 additions & 3 deletions examples/scalar-lump-mpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
from functools import partial
from pytools.obj_array import make_obj_array

from arraycontext import thaw
from meshmode.mesh import BTAG_ALL, BTAG_NONE # noqa
from grudge.shortcuts import make_visualizer

Expand Down Expand Up @@ -150,7 +149,7 @@ def main(actx_class, ctx_factory=cl.create_some_context, use_logmgr=True,
discr = create_discretization_collection(
actx, local_mesh, order=order, mpi_communicator=comm
)
nodes = thaw(discr.nodes(), actx)
nodes = actx.thaw(discr.nodes())

vis_timer = None

Expand Down Expand Up @@ -190,7 +189,7 @@ def main(actx_class, ctx_factory=cl.create_some_context, use_logmgr=True,
def boundary_solution(discr, btag, gas_model, state_minus, **kwargs):
actx = state_minus.array_context
bnd_discr = discr.discr_from_dd(btag)
nodes = thaw(bnd_discr.nodes(), actx)
nodes = actx.thaw(bnd_discr.nodes())
return make_fluid_state(initializer(x_vec=nodes, eos=gas_model.eos,
**kwargs), gas_model)

Expand Down
5 changes: 2 additions & 3 deletions examples/sod-mpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import pyopencl.tools as cl_tools
from functools import partial

from arraycontext import thaw
from meshmode.mesh import BTAG_ALL, BTAG_NONE # noqa
from grudge.shortcuts import make_visualizer

Expand Down Expand Up @@ -149,7 +148,7 @@ def main(actx_class, ctx_factory=cl.create_some_context, use_logmgr=True,
discr = create_discretization_collection(
actx, local_mesh, order=order, mpi_communicator=comm
)
nodes = thaw(discr.nodes(), actx)
nodes = actx.thaw(discr.nodes())

vis_timer = None

Expand Down Expand Up @@ -178,7 +177,7 @@ def main(actx_class, ctx_factory=cl.create_some_context, use_logmgr=True,
def boundary_solution(discr, btag, gas_model, state_minus, **kwargs):
actx = state_minus.array_context
bnd_discr = discr.discr_from_dd(btag)
nodes = thaw(bnd_discr.nodes(), actx)
nodes = actx.thaw(bnd_discr.nodes())
return make_fluid_state(initializer(x_vec=nodes, eos=gas_model.eos,
**kwargs), gas_model)

Expand Down
5 changes: 2 additions & 3 deletions examples/vortex-mpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import pyopencl.tools as cl_tools
from functools import partial

from arraycontext import thaw
from meshmode.mesh import BTAG_ALL, BTAG_NONE # noqa
from grudge.shortcuts import make_visualizer

Expand Down Expand Up @@ -154,7 +153,7 @@ def main(actx_class, ctx_factory=cl.create_some_context, use_logmgr=True,
discr = create_discretization_collection(
actx, local_mesh, order=order, mpi_communicator=comm
)
nodes = thaw(discr.nodes(), actx)
nodes = actx.thaw(discr.nodes())

vis_timer = None

Expand Down Expand Up @@ -195,7 +194,7 @@ def main(actx_class, ctx_factory=cl.create_some_context, use_logmgr=True,
def boundary_solution(discr, btag, gas_model, state_minus, **kwargs):
actx = state_minus.array_context
bnd_discr = discr.discr_from_dd(btag)
nodes = thaw(bnd_discr.nodes(), actx)
nodes = actx.thaw(bnd_discr.nodes())
return make_fluid_state(initializer(x_vec=nodes, eos=gas_model.eos,
**kwargs), gas_model)

Expand Down
5 changes: 2 additions & 3 deletions examples/wave-mpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import pyopencl as cl

from pytools.obj_array import flat_obj_array
from arraycontext import thaw, freeze

from meshmode.mesh import BTAG_ALL, BTAG_NONE # noqa

Expand Down Expand Up @@ -135,7 +134,7 @@ def main(actx_class, snapshot_pattern="wave-mpi-{step:04d}-{rank:04d}.pkl",
discr = create_discretization_collection(
actx, local_mesh, order=order, mpi_communicator=comm
)
nodes = thaw(discr.nodes(), actx)
nodes = actx.thaw(discr.nodes())

current_cfl = 0.485
wave_speed = 1.0
Expand Down Expand Up @@ -229,7 +228,7 @@ def rhs(t, w):
], overwrite=True
)

fields = thaw(freeze(fields, actx), actx)
fields = actx.thaw(actx.freeze(fields))
fields = rk4_step(fields, t, dt, compiled_rhs)

t += dt
Expand Down
5 changes: 2 additions & 3 deletions examples/wave.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@

from meshmode.array_context import (PyOpenCLArrayContext,
PytatoPyOpenCLArrayContext)
from arraycontext import thaw, freeze

from mirgecom.profiling import PyOpenCLProfilingArrayContext

Expand Down Expand Up @@ -104,7 +103,7 @@ def main(use_profiling=False, use_logmgr=False, lazy_eval: bool = False):
order = 3

discr = create_discretization_collection(actx, mesh, order=order)
nodes = thaw(discr.nodes(), actx)
nodes = actx.thaw(discr.nodes())

current_cfl = 0.485
wave_speed = 1.0
Expand Down Expand Up @@ -149,7 +148,7 @@ def rhs(t, w):
if logmgr:
logmgr.tick_before()

fields = thaw(freeze(fields, actx), actx)
fields = actx.thaw(actx.freeze(fields))
fields = rk4_step(fields, t, dt, compiled_rhs)

if istep % 10 == 0:
Expand Down
4 changes: 2 additions & 2 deletions mirgecom/artificial_viscosity.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@

from pytools import memoize_in, keyed_memoize_in
from functools import partial
from meshmode.dof_array import thaw, DOFArray
from meshmode.dof_array import DOFArray

from mirgecom.flux import num_flux_central
from mirgecom.operators import div_operator
Expand Down Expand Up @@ -254,7 +254,7 @@ def interp_to_vol_quad(u):

def central_flux_div(utpair):
dd = utpair.dd
normal = thaw(actx, discr.normal(dd))
normal = actx.thaw(discr.normal(dd))
return op.project(discr, dd, dd.with_dtag("all_faces"),
# This uses a central vector flux along nhat:
# flux = 1/2 * (grad(Q)- + grad(Q)+) .dot. nhat
Expand Down
Loading

0 comments on commit 5e369d3

Please sign in to comment.