Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
arraycontext
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alexandru Fikl
arraycontext
Commits
980715cb
Commit
980715cb
authored
3 years ago
by
Matthias Diener
Browse files
Options
Downloads
Plain Diff
Merge remote-tracking branch 'origin/main' into pytato
parents
93c321e9
82bb9386
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
arraycontext/impl/pyopencl.py
+13
-6
13 additions, 6 deletions
arraycontext/impl/pyopencl.py
with
13 additions
and
6 deletions
arraycontext/impl/pyopencl.py
+
13
−
6
View file @
980715cb
...
...
@@ -26,6 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
"""
from
warnings
import
warn
from
typing
import
Sequence
,
Union
from
functools
import
partial
import
operator
...
...
@@ -227,12 +228,18 @@ class PyOpenCLArrayContext(ArrayContext):
self
.
_kernel_name_to_wait_event_queue
=
{}
import
pyopencl
as
cl
if
allocator
is
None
and
queue
.
device
.
type
&
cl
.
device_type
.
GPU
:
from
warnings
import
warn
warn
(
"
PyOpenCLArrayContext created without an allocator on a GPU.
"
"
This can lead to high numbers of memory allocations.
"
"
Please consider using a pyopencl.tools.MemoryPool.
"
"
Run with allocator=False to disable this warning.
"
)
if
queue
.
device
.
type
&
cl
.
device_type
.
GPU
:
if
allocator
is
None
:
warn
(
"
PyOpenCLArrayContext created without an allocator on a GPU.
"
"
This can lead to high numbers of memory allocations.
"
"
Please consider using a pyopencl.tools.MemoryPool.
"
"
Run with allocator=False to disable this warning.
"
)
if
__debug__
:
# Use "running on GPU" as a proxy for "they care about speed".
warn
(
"
You are using the PyOpenCLArrayContext on a GPU, but you
"
"
are running Python in debug mode. Use
'
python -O
'
for
"
"
a noticeable speed improvement.
"
)
def
_get_fake_numpy_namespace
(
self
):
return
PyOpenCLFakeNumpyNamespace
(
self
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment