Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pyopencl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
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
Andreas Klöckner
pyopencl
Commits
fd055f3a
Commit
fd055f3a
authored
12 years ago
by
Andreas Klöckner
Browse files
Options
Downloads
Patches
Plain Diff
Use header version *and* platform version to decide which image creation method to use.
parent
b870d22c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pyopencl/__init__.py
+16
-1
16 additions, 1 deletion
pyopencl/__init__.py
with
16 additions
and
1 deletion
pyopencl/__init__.py
+
16
−
1
View file @
fd055f3a
...
@@ -224,7 +224,7 @@ class Image(_cl._ImageBase):
...
@@ -224,7 +224,7 @@ class Image(_cl._ImageBase):
if
hostbuf
is
None
and
pitches
is
not
None
:
if
hostbuf
is
None
and
pitches
is
not
None
:
raise
Error
(
"'
pitches
'
may only be given if
'
hostbuf
'
is given
"
)
raise
Error
(
"'
pitches
'
may only be given if
'
hostbuf
'
is given
"
)
if
get_cl_header_version
()
>=
(
1
,
2
):
if
context
.
_get_cl_version
()
>=
(
1
,
2
)
and
get_cl_header_version
()
>=
(
1
,
2
):
if
buffer
is
not
None
and
is_array
:
if
buffer
is
not
None
and
is_array
:
raise
ValueError
(
"'
buffer
'
and
'
is_array
'
are mutually exclusive
"
)
raise
ValueError
(
"'
buffer
'
and
'
is_array
'
are mutually exclusive
"
)
...
@@ -387,11 +387,26 @@ def _add_functionality():
...
@@ -387,11 +387,26 @@ def _add_functionality():
# }}}
# }}}
# {{{ Context
# {{{ Context
def
context_repr
(
self
):
def
context_repr
(
self
):
return
"
<pyopencl.Context at 0x%x on %s>
"
%
(
self
.
obj_ptr
,
return
"
<pyopencl.Context at 0x%x on %s>
"
%
(
self
.
obj_ptr
,
"
,
"
.
join
(
repr
(
dev
)
for
dev
in
self
.
devices
))
"
,
"
.
join
(
repr
(
dev
)
for
dev
in
self
.
devices
))
def
context_get_cl_version
(
self
):
import
re
platform
=
self
.
devices
[
0
].
platform
plat_version_string
=
platform
.
version
match
=
re
.
match
(
r
"
^OpenCL ([0-9]+)\.([0-9]+) .*$
"
,
plat_version_string
)
if
match
is
None
:
raise
RuntimeError
(
"
platform %s returned non-conformant
"
"
platform version string
'
%s
'"
%
(
platform
,
plat_version_string
))
return
int
(
match
.
group
(
1
)),
int
(
match
.
group
(
2
))
Context
.
__repr__
=
context_repr
Context
.
__repr__
=
context_repr
from
pytools
import
memoize_method
Context
.
_get_cl_version
=
memoize_method
(
context_get_cl_version
)
# }}}
# }}}
...
...
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