All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
viennacl::backend::cuda Namespace Reference

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

## Namespaces

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

## Classes

class | cuda_exception

## Typedefs

typedef viennacl::tools::shared_ptr < char > | handle_type

## Functions

handle_type | memory_create (vcl_size_t size_in_bytes, const void *host_ptr=NULL)
| Creates an array of the specified size on the CUDA device. If the second argument is provided, the buffer is initialized with data from that pointer. More...
void | memory_copy (handle_type const &src_buffer, handle_type &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' on the CUDA device to memory starting at address 'dst_buffer + dst_offset' on the same CUDA device. More...
void | memory_write (handle_type &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 CUDA buffer identified by 'dst_buffer'. More...
void | memory_read (handle_type const &src_buffer, vcl_size_t src_offset, vcl_size_t bytes_to_copy, void *ptr, bool async=false)
| Reads data from a CUDA buffer back to main RAM. More...

## Detailed Description

Provides implementations for handling CUDA memory buffers.

## Typedef Documentation

typedef viennacl::tools::shared_ptr<char> viennacl::backend::cuda::handle_type

Definition at line 47 of file cuda.hpp.

## Function Documentation

void viennacl::backend::cuda::memory_copy | ( | handle_type const & | src_buffer,
|  | handle_type & | 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' on the CUDA device to memory starting at address 'dst_buffer + dst_offset' on the same CUDA device.

Parameters

  src_buffer | A smart pointer to the begin of an allocated CUDA buffer
  dst_buffer | A smart pointer to the end of an allocated CUDA buffer
  src_offset | Offset of the first byte to be written from the address given by 'src_buffer' (in bytes)
  dst_offset | Offset of the first byte to be written to the address given by 'dst_buffer' (in bytes)
  bytes_to_copy | Number of bytes to be copied

Definition at line 130 of file cuda.hpp.

handle_type viennacl::backend::cuda::memory_create | ( | vcl_size_t | size_in_bytes,
|  | const void * | host_ptr = `NULL`
| ) |  |

inline

Creates an array of the specified size on the CUDA device. If the second argument is provided, the buffer is initialized with data from that pointer.

Parameters

  size_in_bytes | Number of bytes to allocate
  host_ptr | Pointer to data which will be copied to the new array. Must point to at least 'size_in_bytes' bytes of data.

Definition at line 103 of file cuda.hpp.

void viennacl::backend::cuda::memory_read | ( | handle_type const & | src_buffer,
|  | vcl_size_t | src_offset,
|  | vcl_size_t | bytes_to_copy,
|  | void * | ptr,
|  | bool | async = `false`
| ) |  |

inline

Reads data from a CUDA buffer back to main RAM.

Parameters

  src_buffer | A smart pointer to the beginning of an allocated CUDA source buffer
  src_offset | Offset of the first byte to be read from the beginning of src_buffer (in bytes_
  bytes_to_copy | Number of bytes to be read
  ptr | Location in main RAM where to read data should be written to
  async | Whether the operation should be asynchronous

Definition at line 183 of file cuda.hpp.

void viennacl::backend::cuda::memory_write | ( | handle_type & | 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 CUDA buffer identified by 'dst_buffer'.

Parameters

  dst_buffer | A smart pointer to the beginning of an allocated CUDA buffer
  dst_offset | Offset of the first written byte from the beginning of 'dst_buffer' (in bytes)
  bytes_to_copy | Number of bytes to be copied
  ptr | Pointer to the first byte to be written
  async | Whether the operation should be asynchronous

Definition at line 154 of file cuda.hpp.