Skip to content
Snippets Groups Projects
Commit 3a9d4020 authored by Andreas Klöckner's avatar Andreas Klöckner Committed by Andreas Klöckner
Browse files

Add a flag to indicate whether an array context permits inplace modification

parent 4d5198ac
No related branches found
No related tags found
No related merge requests found
...@@ -103,7 +103,7 @@ THE SOFTWARE. ...@@ -103,7 +103,7 @@ THE SOFTWARE.
""" """
from typing import Sequence, Union from typing import Sequence, Union
from abc import ABC, abstractmethod from abc import ABC, abstractmethod, abstractproperty
import numpy as np import numpy as np
from pytools import memoize_method from pytools import memoize_method
...@@ -349,6 +349,11 @@ class ArrayContext(ABC): ...@@ -349,6 +349,11 @@ class ArrayContext(ABC):
"setup-only" array context "leaks" into the application. "setup-only" array context "leaks" into the application.
""" """
# undocumented for now
@abstractproperty
def permits_inplace_modification(self):
pass
# }}} # }}}
# vim: foldmethod=marker # vim: foldmethod=marker
...@@ -436,6 +436,9 @@ class PyOpenCLArrayContext(ArrayContext): ...@@ -436,6 +436,9 @@ class PyOpenCLArrayContext(ArrayContext):
def clone(self): def clone(self):
return type(self)(self.queue, self.allocator, self._wait_event_queue_length) return type(self)(self.queue, self.allocator, self._wait_event_queue_length)
def permits_inplace_modification(self):
return True
# }}} # }}}
# vim: foldmethod=marker # vim: foldmethod=marker
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment