ViennaCL - The Vienna Computing Library  1.7.0
Free open-source GPU-accelerated linear algebra and solver library.
viennacl::backend::opencl Namespace Reference

Provides implementations for handling OpenCL memory buffers. More...

Namespaces

 detail
 Holds implementation details for handling OpenCL memory buffers. Not intended for direct use by library users.
 

Functions

cl_mem memory_create (viennacl::ocl::context const &ctx, vcl_size_t size_in_bytes, const void *host_ptr=NULL)
 Creates an array of the specified size in the current OpenCL context. If the second argument is provided, the buffer is initialized with data from that pointer. More...
 
void memory_copy (viennacl::ocl::handle< cl_mem > const &src_buffer, viennacl::ocl::handle< cl_mem > &dst_buffer, vcl_size_t src_offset, vcl_size_t dst_offset, vcl_size_t bytes_to_copy)
 Copies 'bytes_to_copy' bytes from address 'src_buffer + src_offset' in the OpenCL context to memory starting at address 'dst_buffer + dst_offset' in the same OpenCL context. More...
 
void memory_write (viennacl::ocl::handle< cl_mem > &dst_buffer, vcl_size_t dst_offset, vcl_size_t bytes_to_copy, const void *ptr, bool async=false)
 Writes data from main RAM identified by 'ptr' to the OpenCL buffer identified by 'dst_buffer'. More...
 
void memory_read (viennacl::ocl::handle< cl_mem > const &src_buffer, vcl_size_t src_offset, vcl_size_t bytes_to_copy, void *ptr, bool async=false)
 Reads data from an OpenCL buffer back to main RAM. More...
 

Detailed Description

Provides implementations for handling OpenCL memory buffers.

Function Documentation

void viennacl::backend::opencl::memory_copy ( viennacl::ocl::handle< cl_mem > const &  src_buffer,
viennacl::ocl::handle< cl_mem > &  dst_buffer,
vcl_size_t  src_offset,
vcl_size_t  dst_offset,
vcl_size_t  bytes_to_copy 
)
inline

Copies 'bytes_to_copy' bytes from address 'src_buffer + src_offset' in the OpenCL context to memory starting at address 'dst_buffer + dst_offset' in the same OpenCL context.

Parameters
src_bufferA smart pointer to the begin of an allocated OpenCL buffer
dst_bufferA smart pointer to the end of an allocated OpenCL buffer
src_offsetOffset of the first byte to be written from the address given by 'src_buffer' (in bytes)
dst_offsetOffset of the first byte to be written to the address given by 'dst_buffer' (in bytes)
bytes_to_copyNumber of bytes to be copied

Definition at line 69 of file opencl.hpp.

cl_mem viennacl::backend::opencl::memory_create ( viennacl::ocl::context const &  ctx,
vcl_size_t  size_in_bytes,
const void *  host_ptr = NULL 
)
inline

Creates an array of the specified size in the current OpenCL context. If the second argument is provided, the buffer is initialized with data from that pointer.

Parameters
size_in_bytesNumber of bytes to allocate
host_ptrPointer to data which will be copied to the new array. Must point to at least 'size_in_bytes' bytes of data.
ctxOptional context in which the matrix is created (one out of multiple OpenCL contexts, CUDA, host)

Definition at line 55 of file opencl.hpp.

void viennacl::backend::opencl::memory_read ( viennacl::ocl::handle< cl_mem > const &  src_buffer,
vcl_size_t  src_offset,
vcl_size_t  bytes_to_copy,
void *  ptr,
bool  async = false 
)
inline

Reads data from an OpenCL buffer back to main RAM.

Parameters
src_bufferA smart pointer to the beginning of an allocated OpenCL source buffer
src_offsetOffset of the first byte to be read from the beginning of src_buffer (in bytes_
bytes_to_copyNumber of bytes to be read
ptrLocation in main RAM where to read data should be written to
asyncWhether the operation should be asynchronous

Definition at line 129 of file opencl.hpp.

void viennacl::backend::opencl::memory_write ( viennacl::ocl::handle< cl_mem > &  dst_buffer,
vcl_size_t  dst_offset,
vcl_size_t  bytes_to_copy,
const void *  ptr,
bool  async = false 
)
inline

Writes data from main RAM identified by 'ptr' to the OpenCL buffer identified by 'dst_buffer'.

Parameters
dst_bufferA smart pointer to the beginning of an allocated OpenCL buffer
dst_offsetOffset of the first written byte from the beginning of 'dst_buffer' (in bytes)
bytes_to_copyNumber of bytes to be copied
ptrPointer to the first byte to be written
asyncWhether the operation should be asynchronous

Definition at line 97 of file opencl.hpp.