cl.create.buffer: Allocate OpenCL buffer

Description Usage Arguments Details Value

View source: R/rcl.r

Description

Allocates an OpenCL buffer with the given context.

Usage

1
cl.create.buffer(context, flags, size = NULL, vector = NULL)

Arguments

context

An opencl_context object.

flags

Character vector of OpenCL buffer flags. Refer to The OpenCL documentation.

size

The size in bytes of the vector. Mandatory if vector is NULL.

vector

The data to go into an OpenCL buffer. Mandatory if size is NULL.

Details

Calls clCreateBuffer with the given context, flags and buffer. The data is optional, if vector is left null an empty buffer wil be allocated. It can be filled with data at a later point with a call to cl.enqueue.write.buffer. The size must be the size in bytes of the OpenCL buffer to be allocated. Note that object.size includes R overhead. Integer and float32 vectors take up 4 bytes per element, double vectors (the R default) take up 8 bytes per element. Note that 64-bit float performance is crippled on most GPUs, so it is a good idea to cast a double vector to a float32 vector before use with OpenCL.

Value

An opencl_buffer object


caffeine-overload/rocl documentation built on May 6, 2019, 7:02 p.m.