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
db650343
Commit
db650343
authored
11 years ago
by
Marko Bencun
Browse files
Options
Downloads
Patches
Plain Diff
get_gl_sharing_context_properties parsing
parent
580a44c2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
pyopencl/cffi_cl.py
+5
-2
5 additions, 2 deletions
pyopencl/cffi_cl.py
src/c_wrapper/wrap_cl.cpp
+8
-0
8 additions, 0 deletions
src/c_wrapper/wrap_cl.cpp
src/c_wrapper/wrap_cl_core.h
+1
-0
1 addition, 0 deletions
src/c_wrapper/wrap_cl_core.h
with
14 additions
and
2 deletions
pyopencl/cffi_cl.py
+
5
−
2
View file @
db650343
...
...
@@ -232,7 +232,9 @@ def _parse_context_properties(properties):
# TODO: without ctypes?
import
ctypes
val
=
(
ctypes
.
cast
(
value
,
ctypes
.
c_void_p
)).
value
props
.
append
(
0
if
val
is
None
else
val
)
if
val
is
None
:
raise
LogicError
(
"
Context
"
,
status_code
.
INVALID_VALUE
,
"
You most likely have not initialized OpenGL properly.
"
)
props
.
append
(
val
)
else
:
raise
RuntimeError
(
"
Context
"
,
status_code
.
INVALID_VALUE
,
"
invalid context property
"
)
props
.
append
(
0
)
...
...
@@ -412,7 +414,8 @@ def _generic_info_to_python(info):
ret
=
list
(
value
)
else
:
ret
=
value
[
0
]
_lib
.
_free
(
info
.
value
)
if
info
.
dontfree
==
0
:
_lib
.
_free
(
info
.
value
)
return
ret
class
Kernel
(
_Common
):
...
...
This diff is collapsed.
Click to expand it.
src/c_wrapper/wrap_cl.cpp
+
8
−
0
View file @
db650343
...
...
@@ -76,6 +76,7 @@
PYOPENCL_CALL_GUARDED(clGet##WHAT##Info, \
(FIRST_ARG, SECOND_ARG, sizeof(param_value), ¶m_value, 0)); \
generic_info info; \
info.dontfree = 0; \
info.opaque_class = CLASS_##TYPEU; \
info.type = "void *"; \
if (param_value) \
...
...
@@ -93,6 +94,7 @@
ar[i] = new pyopencl::CLS(VEC[i]); \
} \
generic_info info; \
info.dontfree = 0; \
info.opaque_class = CLASS_##CLSU; \
info.type = _copy_str(std::string("void*[") + tostring(VEC.size()) + "]"); \
info.value = (void**)ar; \
...
...
@@ -111,6 +113,7 @@
(FIRST_ARG, SECOND_ARG, param_value_size, \
param_value, ¶m_value_size)); \
generic_info info; \
info.dontfree = 0; \
info.opaque_class = CLASS_NONE; \
info.type = "char*"; \
info.value = (void*)param_value; \
...
...
@@ -123,6 +126,7 @@
PYOPENCL_CALL_GUARDED(clGet##WHAT##Info, \
(FIRST_ARG, SECOND_ARG, sizeof(param_value), param_value, 0)); \
generic_info info; \
info.dontfree = 0; \
info.opaque_class = CLASS_NONE; \
info.type = #TYPE"*"; \
info.value = (void*)param_value; \
...
...
@@ -136,6 +140,7 @@
ar[i] = VEC[i]; \
} \
generic_info info; \
info.dontfree = 0; \
info.opaque_class = CLASS_NONE; \
info.type = _copy_str(std::string(#TYPE"[") + tostring(VEC.size()) + "]"); \
info.value = (void*)ar; \
...
...
@@ -783,6 +788,7 @@ generic_info get_info(cl_device_info param_name) const
if
(
key
==
0
)
break
;
generic_info
info
;
info
.
dontfree
=
0
;
info
.
opaque_class
=
CLASS_NONE
;
switch
(
key
)
{
...
...
@@ -806,6 +812,8 @@ generic_info get_info(cl_device_info param_name) const
#endif
info
.
type
=
"intptr_t *"
;
info
.
value
=
(
void
*
)
result
[
i
+
1
];
// we do not own this object
info
.
dontfree
=
1
;
break
;
#endif
...
...
This diff is collapsed.
Click to expand it.
src/c_wrapper/wrap_cl_core.h
+
1
−
0
View file @
db650343
...
...
@@ -23,6 +23,7 @@ typedef struct {
class_t
opaque_class
;
const
char
*
type
;
void
*
value
;
int
dontfree
;
}
generic_info
;
...
...
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