- CLHandleType
- CLGetInfoInteger
- CLGetInfoString
- CLContextCreate
- CLContextFree
- CLGetDeviceInfo
- CLProgramCreate
- CLProgramFree
- CLKernelCreate
- CLKernelFree
- CLSetKernelArg
- CLSetKernelArgMem
- CLSetKernelArgMemLocal
- CLBufferCreate
- CLBufferFree
- CLBufferWrite
- CLBufferRead
- CLExecute
- CLExecutionStatus
CLBufferRead
Reads an OpenCL buffer into an array and returns the number of read elements.
uint CLBufferRead(
|
There are also versions for handling matrices and vectors.
Reads the OpenCL buffer to the matrix and returns true if successful.
uint CLBufferRead(
|
Reads the OpenCL buffer to the vector and returns true if successful.
uint CLBufferRead(
|
Parameters
buffer
[in] A handle of the OpenCL buffer.
data[]
[in] An array for receiving values from the OpenCL buffer. Passed by reference.
buffer_offset
[in] An offset in the OpenCL buffer in bytes, from which reading begins. By default, reading start with the very beginning of the buffer.
data_offset
[in] The index of the first array element for writing the values of the OpenCL buffer. By default, writing of the read values into an array starts from the zero index.
data_count
[in] The number of values that should be read. The whole OpenCL buffer is read by default.
mat
[out] The matrix for reading data from the buffer can be any of the three types — matrix, matrixf or matrixc.
vec
[out] The vector for reading data from the buffer can be of any of the three types — vector, vectorf or vectorc.
rows=-1
[in] If the parameter is specified, the cols parameter should be specified as well. If the new matrix dimensions are not specified, the current ones are used. If the value is -1, then the number of rows does not change.
cols=-1
[in] If the parameter is not specified, the rows parameter should be skipped as well. The matrix adheres to the rule: either both parameters are specified, or none, otherwise an error will occur. If both parameters (rows and cols) are specified, the matrix size is changed. In case of -1, the number of columns does not change.
size=-1
[in] If the parameter is not specified or its value is -1, the vector length does not change.
Return Value
The number of read elements. 0 is returned in case of an error. For information about the error, use the GetLastError() function.
true if a matrix or a vector is handled successfully, otherwise false.
Note
For one-dimensional arrays, the number of the element, into which writing of data into an OpenCL buffer begins, is calculated taking into account the AS_SERIES flags.
An array of two or more dimensions is presented as one-dimensional. In this case, data_offset is the number of elements that should be skipped in the presentation, not the number of elements in the first dimension.
Example of calculating Pi using the equation:
#define _num_steps 1000000000
|