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
19974a27
Commit
19974a27
authored
10 years ago
by
Yichao Yu
Browse files
Options
Downloads
Patches
Plain Diff
UserEvent
parent
2252bfa9
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
pyopencl/c_wrapper/wrap_cl_core.h
+3
-0
3 additions, 0 deletions
pyopencl/c_wrapper/wrap_cl_core.h
pyopencl/cffi_cl.py
+8
-1
8 additions, 1 deletion
pyopencl/cffi_cl.py
src/c_wrapper/event.cpp
+35
-0
35 additions, 0 deletions
src/c_wrapper/event.cpp
with
46 additions
and
1 deletion
pyopencl/c_wrapper/wrap_cl_core.h
+
3
−
0
View file @
19974a27
...
...
@@ -145,6 +145,9 @@ error *event__set_callback(clobj_t _evt, cl_int type, void *pyobj);
error
*
wait_for_events
(
const
clobj_t
*
_wait_for
,
uint32_t
num_wait_for
);
// Nanny Event
void
*
nanny_event__get_ward
(
clobj_t
evt
);
// User Event
error
*
create_user_event
(
clobj_t
*
_evt
,
clobj_t
_ctx
);
error
*
user_event__set_status
(
clobj_t
_evt
,
cl_int
status
);
// enqueue_*
error
*
enqueue_nd_range_kernel
(
clobj_t
*
event
,
clobj_t
queue
,
clobj_t
kernel
,
cl_uint
work_dim
,
...
...
This diff is collapsed.
Click to expand it.
pyopencl/cffi_cl.py
+
8
−
1
View file @
19974a27
...
...
@@ -930,8 +930,15 @@ class NannyEvent(Event):
return
return
_ffi
.
from_handle
(
_handle
).
ward
class
UserEvent
(
Event
):
def
__init__
(
self
,
ctx
):
_evt
=
_ffi
.
new
(
'
clobj_t*
'
)
_handle_error
(
_lib
.
create_user_event
(
_evt
,
ctx
.
ptr
))
self
.
ptr
=
_evt
[
0
]
def
set_status
(
self
,
status
):
_handle_error
(
_lib
.
user_event__set_status
(
self
.
ptr
,
status
))
# TODO
# UserEvent
# enqueue_migrate_mem_objects
# enqueue_migrate_mem_objects_ext
...
...
This diff is collapsed.
Click to expand it.
src/c_wrapper/event.cpp
+
35
−
0
View file @
19974a27
...
...
@@ -189,6 +189,18 @@ nanny_event::get_ward() const noexcept
nullptr
);
}
#if PYOPENCL_CL_VERSION >= 0x1010
class
user_event
:
public
event
{
public:
using
event
::
event
;
PYOPENCL_INLINE
void
set_status
(
cl_int
status
)
{
pyopencl_call_guarded
(
clSetUserEventStatus
,
this
,
status
);
}
};
#endif
}
// c wrapper
...
...
@@ -266,3 +278,26 @@ enqueue_wait_for_events(clobj_t _queue, const clobj_t *_wait_for,
pyopencl_call_guarded
(
clEnqueueWaitForEvents
,
queue
,
wait_for
);
});
}
#if PYOPENCL_CL_VERSION >= 0x1010
error
*
create_user_event
(
clobj_t
*
_evt
,
clobj_t
_ctx
)
{
auto
ctx
=
static_cast
<
context
*>
(
_ctx
);
return
c_handle_error
([
&
]
{
auto
evt
=
pyopencl_call_guarded
(
clCreateUserEvent
,
ctx
);
*
_evt
=
pyopencl_convert_obj
(
user_event
,
clReleaseEvent
,
evt
);
});
}
error
*
user_event__set_status
(
clobj_t
_evt
,
cl_int
status
)
{
auto
evt
=
static_cast
<
user_event
*>
(
_evt
);
return
c_handle_error
([
&
]
{
evt
->
set_status
(
status
);
});
}
#endif
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