Skip to content

Commit

Permalink
add MPICupyArrayContext
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiasdiener committed Feb 16, 2024
1 parent 0da9e04 commit 925ce61
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions grudge/array_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
.. autoclass:: PytatoPyOpenCLArrayContext
.. autoclass:: MPIBasedArrayContext
.. autoclass:: MPIPyOpenCLArrayContext
.. autoclass:: MPICupyArrayContext
.. class:: MPIPytatoArrayContext
.. autofunction:: get_reasonable_array_context_class
"""
Expand Down Expand Up @@ -97,6 +98,8 @@
from arraycontext.container import ArrayContainer
from arraycontext.impl.pytato.compile import LazilyPyOpenCLCompilingFunctionCaller

from arraycontext import CupyArrayContext

if TYPE_CHECKING:
import pytato as pt
from pytato.partition import PartId
Expand Down Expand Up @@ -421,6 +424,26 @@ def clone(self):
# }}}


# {{{

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

0 comments on commit 925ce61

Please sign in to comment.