示例#1
0
文件: array.py 项目: sys-git/pyopencl
 def make_func_for_chunk_size(chunk_size):
     knl = elementwise.get_take_kernel(indices.context,
                                       a_dtype,
                                       indices.dtype,
                                       vec_count=chunk_size)
     knl.set_block_shape(*indices._block)
     return knl
示例#2
0
文件: array.py 项目: stefanv/PyOpenCL
def take(a, indices, out=None, queue=None):
    queue = queue or a.queue

    if out is None:
        out = Array(a.context, indices.shape, a.dtype, a.allocator,
                queue=queue)

    assert len(indices.shape) == 1

    knl = elementwise.get_take_kernel(
            a.context, a.dtype, indices.dtype)
    knl(queue, a._global_size, a._local_size,
            indices.data, a.data, out.data, indices.size)

    return out
示例#3
0
def take(a, indices, out=None, queue=None):
    queue = queue or a.queue

    if out is None:
        out = Array(a.context,
                    indices.shape,
                    a.dtype,
                    a.allocator,
                    queue=queue)

    assert len(indices.shape) == 1

    knl = elementwise.get_take_kernel(a.context, a.dtype, indices.dtype)
    knl(queue, a._global_size, a._local_size, indices.data, a.data, out.data,
        indices.size)

    return out
示例#4
0
文件: array.py 项目: stefanv/PyOpenCL
 def make_func_for_chunk_size(chunk_size):
     knl = elementwise.get_take_kernel(
             indices.context, a_dtype, indices.dtype,
             vec_count=chunk_size)
     knl.set_block_shape(*indices._block)
     return knl
示例#5
0
def _take(result, ary, indices):
    return elementwise.get_take_kernel(
            result.context, result.dtype, indices.dtype)
示例#6
0
文件: array.py 项目: sys-git/pyopencl
def _take(result, ary, indices):
    return elementwise.get_take_kernel(result.context, result.dtype,
                                       indices.dtype)