Skip to content
Draft
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
23 changes: 23 additions & 0 deletions grudge/array_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
.. autoclass:: MPIBasedArrayContext
.. autoclass:: MPIPyOpenCLArrayContext
.. autoclass:: MPINumpyArrayContext
.. autoclass:: MPICupyArrayContext
.. class:: MPIPytatoArrayContext
.. autofunction:: get_reasonable_array_context_class
"""
Expand Down Expand Up @@ -87,6 +88,8 @@
)


from arraycontext import CupyArrayContext

if TYPE_CHECKING:
import pytato as pt
from mpi4py import MPI
Expand Down Expand Up @@ -374,6 +377,26 @@ def to_output_template(keys, _):
# }}}


# {{{

class MPICupyArrayContext(CupyArrayContext, MPIBasedArrayContext):
"""An array context for using distributed computation with :mod:`cupy`
eager evaluation.

.. autofunction:: __init__
"""

def __init__(self, mpi_communicator):
super().__init__()

self.mpi_communicator = mpi_communicator

def clone(self):
return type(self)(self.mpi_communicator)

# }}}


# {{{ distributed + pyopencl

class MPIPyOpenCLArrayContext(PyOpenCLArrayContext, MPIBasedArrayContext):
Expand Down
Loading