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

add MPICupyArrayContext #328

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
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 @@ -104,6 +105,8 @@
)


from arraycontext import CupyArrayContext

if TYPE_CHECKING:
import pytato as pt
from mpi4py import MPI
Expand Down Expand Up @@ -426,6 +429,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
Loading