11
11
void pyopencl_expose_part_1()
13
py::docstring_options doc_op;
14
doc_op.disable_cpp_signatures();
13
16
py::def("get_cl_header_version", get_cl_header_version);
21
24
.DEF_SIMPLE_METHOD(get_info)
22
25
.def("get_devices", &cls::get_devices,
23
26
py::arg("device_type")=CL_DEVICE_TYPE_ALL)
24
.add_property("obj_ptr", &cls::obj_ptr)
25
27
.def(py::self == py::self)
26
28
.def(py::self != py::self)
27
29
.def("__hash__", &cls::hash)
30
PYOPENCL_EXPOSE_TO_FROM_INT_PTR(cl_platform_id)
35
38
typedef device cls;
36
39
py::class_<cls, boost::noncopyable>("Device", py::no_init)
37
40
.DEF_SIMPLE_METHOD(get_info)
38
.add_property("obj_ptr", &cls::obj_ptr)
39
41
.def(py::self == py::self)
40
42
.def(py::self != py::self)
41
43
.def("__hash__", &cls::hash)
56
59
typedef context cls;
57
py::class_<cls, boost::noncopyable,
60
py::class_<cls, boost::noncopyable,
58
61
boost::shared_ptr<cls> >("Context", py::no_init)
59
62
.def("__init__", make_constructor(create_context,
60
63
py::default_call_policies(),
63
66
py::arg("dev_type")=py::object()
65
68
.DEF_SIMPLE_METHOD(get_info)
66
.add_property("obj_ptr", &cls::obj_ptr)
67
69
.def(py::self == py::self)
68
70
.def(py::self != py::self)
69
71
.def("__hash__", &cls::hash)
72
PYOPENCL_EXPOSE_TO_FROM_INT_PTR(cl_context)
86
89
.DEF_SIMPLE_METHOD(flush)
87
90
.DEF_SIMPLE_METHOD(finish)
88
.add_property("obj_ptr", &cls::obj_ptr)
89
91
.def(py::self == py::self)
90
92
.def(py::self != py::self)
91
93
.def("__hash__", &cls::hash)
94
PYOPENCL_EXPOSE_TO_FROM_INT_PTR(cl_command_queue)
101
104
.DEF_SIMPLE_METHOD(get_info)
102
105
.DEF_SIMPLE_METHOD(get_profiling_info)
103
106
.DEF_SIMPLE_METHOD(wait)
104
.add_property("obj_ptr", &cls::obj_ptr)
105
107
.def(py::self == py::self)
106
108
.def(py::self != py::self)
107
109
.def("__hash__", &cls::hash)
108
.def("from_cl_event_as_int", create_event_wrapper_from_int,
109
py::args("cl_event_as_int"))
110
PYOPENCL_EXPOSE_TO_FROM_INT_PTR(cl_event)
112
// deprecated, remove in 2015.x.
113
.def("from_cl_event_as_int", from_int_ptr<cls, cl_event>,
114
py::return_value_policy<py::manage_new_object>())
110
115
.staticmethod("from_cl_event_as_int")
120
125
DEF_SIMPLE_FUNCTION(wait_for_events);
121
py::def("enqueue_marker", enqueue_marker,
122
(py::arg("queue"), py::arg("wait_for")=py::object()),
123
py::return_value_policy<py::manage_new_object>());
124
py::def("enqueue_barrier", enqueue_barrier,
125
(py::arg("queue"), py::arg("wait_for")=py::object()),
126
py::return_value_policy<py::manage_new_object>());
128
DEF_SIMPLE_FUNCTION(enqueue_wait_for_events);
127
#if PYOPENCL_CL_VERSION >= 0x1020
128
py::def("_enqueue_marker_with_wait_list", enqueue_marker_with_wait_list,
129
(py::arg("queue"), py::arg("wait_for")=py::object()),
130
py::return_value_policy<py::manage_new_object>());
132
py::def("_enqueue_marker", enqueue_marker,
134
py::return_value_policy<py::manage_new_object>());
135
py::def("_enqueue_wait_for_events", enqueue_wait_for_events,
136
(py::arg("queue"), py::arg("wait_for")=py::object()));
138
#if PYOPENCL_CL_VERSION >= 0x1020
139
py::def("_enqueue_barrier_with_wait_list", enqueue_barrier_with_wait_list,
140
(py::arg("queue"), py::arg("wait_for")=py::object()),
141
py::return_value_policy<py::manage_new_object>());
143
py::def("_enqueue_barrier", enqueue_barrier, py::arg("queue"));
130
145
#if PYOPENCL_CL_VERSION >= 0x1010
152
167
.def(py::self == py::self)
153
168
.def(py::self != py::self)
154
169
.def("__hash__", &cls::hash)
171
.add_property("int_ptr", to_int_ptr<cls>,
172
"Return an integer corresponding to the pointer value "
173
"of the underlying :c:type:`cl_mem`. "
174
"Use :meth:`from_int_ptr` to turn back into a Python object."
175
"\n\n.. versionadded:: 2013.2\n")
159
180
py::class_<cls, boost::noncopyable, py::bases<memory_object_holder> >(
160
181
"MemoryObject", py::no_init)
161
182
.DEF_SIMPLE_METHOD(release)
162
.add_property("obj_ptr", &cls::obj_ptr)
163
183
.add_property("hostbuf", &cls::hostbuf)
164
.def("from_cl_mem_as_int", memory_object_from_int,
165
py::args("cl_mem_as_int"))
185
.def("from_int_ptr", memory_object_from_int,
186
"(static method) Return a new Python object referencing the C-level " \
187
":c:type:`cl_mem` object at the location pointed to " \
188
"by *int_ptr_value*. The relevant :c:func:`clRetain*` function " \
190
"\n\n.. versionadded:: 2013.2\n") \
191
.staticmethod("from_int_ptr")
193
// deprecated, remove in 2015.x
194
.def("from_cl_mem_as_int", memory_object_from_int)
166
195
.staticmethod("from_cl_mem_as_int")
275
304
#if PYOPENCL_CL_VERSION >= 0x1020
276
py::def("enqueue_fill_buffer", enqueue_fill_buffer,
305
py::def("_enqueue_fill_buffer", enqueue_fill_buffer,
277
306
(py::args("queue", "mem", "pattern", "offset", "size"),
278
307
py::arg("wait_for")=py::object()),
279
308
py::return_value_policy<py::manage_new_object>());