Skip to content
Snippets Groups Projects
Commit ad7f2488 authored by Jonathan Mackenzie's avatar Jonathan Mackenzie
Browse files

Removed staticmethod from cl vector functions,

Improved documentation for enqueue_fill_buffer and enqueue_copy_buffer
parent 3a61e368
No related branches found
No related tags found
1 merge request!9Scalar types
......@@ -96,7 +96,10 @@ Buffer
.. function:: enqueue_fill_buffer(queue, mem, pattern, offset, size, wait_for=None)
:arg pattern: a buffer object (likely a :class:`numpy.ndarray`)
:arg mem: the on device :class:`Buffer`
:arg pattern: a buffer object (likely a :class:`numpy.ndarray`, eg. `np.uint32(0)`)
Fills a buffer with the provided pattern
|std-enqueue-blurb|
......@@ -104,6 +107,16 @@ Buffer
.. versionadded:: 2011.2
.. function:: enqueue_copy_buffer(queue, src, dst, byte_count=-1, src_offset=0, dst_offset=0, wait_for=None)
:arg src: the source :class:`Buffer`
:arg dst: the destination device :class:`Buffer`
:arg byte_count: the number of bytes to copy
Performs a device to device copy from `src` to `dst`.
|std-enqueue-blurb|
.. _svm:
Shared Virtual Memory (SVM)
......
......@@ -98,7 +98,7 @@ def _create_vector_types():
from warnings import warn
warn("default values for make_xxx are deprecated;"
" instead specify all parameters or use"
" array.vec.zeros_xxx", DeprecationWarning)
" cltypes.zeros_xxx", DeprecationWarning)
padded_args = tuple(list(args)+[0]*(padded_count-len(args)))
array = eval("array(padded_args, dtype=dtype)",
dict(array=np.array, padded_args=padded_args,
......@@ -107,16 +107,14 @@ def _create_vector_types():
array[key] = val
return array
set_global("make_"+name, staticmethod(eval(
set_global("make_"+name, eval(
"lambda *args, **kwargs: create_array(dtype, %i, %i, "
"*args, **kwargs)" % (count, padded_count),
dict(create_array=create_array, dtype=dtype))))
set_global("filled_"+name, staticmethod(eval(
"lambda val: vec.make_%s(*[val]*%i)" % (name, count))))
set_global("zeros_"+name,
staticmethod(eval("lambda: vec.filled_%s(0)" % (name))))
set_global("ones_"+name,
staticmethod(eval("lambda: vec.filled_%s(1)" % (name))))
dict(create_array=create_array, dtype=dtype)))
set_global("filled_"+name, eval(
"lambda val: make_%s(*[val]*%i)" % (name, count)))
set_global("zeros_"+name, eval("lambda: filled_%s(0)" % (name)))
set_global("ones_"+name, eval("lambda: filled_%s(1)" % (name)))
globals()['types'][np.dtype(base_type), count] = dtype
globals()['type_to_scalar_and_count'][dtype] = np.dtype(base_type), count
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment