All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
memory.hpp File Reference

Main interface routines for memory management. More...

`#include <vector>`
`#include <cassert>`
`#include "viennacl/forwards.h"`
`#include "viennacl/backend/mem_handle.hpp"`
`#include "viennacl/context.hpp"`
`#include "viennacl/traits/handle.hpp"`
`#include "viennacl/traits/context.hpp"`
`#include "viennacl/backend/util.hpp"`
`#include "viennacl/backend/cpu_ram.hpp"`

Go to the source code of this file.

## Namespaces

| viennacl
| Main namespace in ViennaCL. Holds all the basic types such as vector, matrix, etc. and defines operations upon them.
| viennacl::backend
| Namespace providing routines for handling the different memory domains.
| viennacl::backend::detail
| Implementation details for the generic memory backend interface.

## Functions

void | viennacl::backend::finish ()
| Synchronizes the execution. finish() will only return after all compute kernels (CUDA, OpenCL) have completed. More...
void | viennacl::backend::memory_create (mem_handle &handle, vcl_size_t size_in_bytes, viennacl::context const &ctx, const void *host_ptr=NULL)
| Creates an array of the specified size. If the second argument is provided, the buffer is initialized with data from that pointer. More...
void | viennacl::backend::memory_copy (mem_handle const &src_buffer, mem_handle &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' to memory starting at address 'dst_buffer + dst_offset'. More...
void | viennacl::backend::memory_shallow_copy (mem_handle const &src_buffer, mem_handle &dst_buffer)
| A 'shallow' copy operation from an initialized buffer to an uninitialized buffer. The uninitialized buffer just copies the raw handle. More...
void | viennacl::backend::memory_write (mem_handle &dst_buffer, vcl_size_t dst_offset, vcl_size_t bytes_to_write, const void *ptr, bool async=false)
| Writes data from main RAM identified by 'ptr' to the buffer identified by 'dst_buffer'. More...
void | viennacl::backend::memory_read (mem_handle const &src_buffer, vcl_size_t src_offset, vcl_size_t bytes_to_read, void *ptr, bool async=false)
| Reads data from a buffer back to main RAM. More...
template<typename T >
vcl_size_t | viennacl::backend::detail::element_size (memory_types)
template<>
vcl_size_t | viennacl::backend::detail::element_size< unsigned long > (memory_types)
template<>
vcl_size_t | viennacl::backend::detail::element_size< long > (memory_types)
template<>
vcl_size_t | viennacl::backend::detail::element_size< unsigned int > (memory_types)
template<>
vcl_size_t | viennacl::backend::detail::element_size< int > (memory_types)
template<typename DataType >
void | viennacl::backend::switch_memory_context (mem_handle &handle, viennacl::context new_ctx)
| Switches the active memory domain within a memory handle. Data is copied if the new active domain differs from the old one. Memory in the source handle is not free'd. More...
template<typename DataType >
void | viennacl::backend::typesafe_memory_copy (mem_handle const &handle_src, mem_handle &handle_dst)
| Copies data of the provided 'DataType' from 'handle_src' to 'handle_dst' and converts the data if the binary representation of 'DataType' among the memory domains differs. More...
template<typename T >
void | viennacl::switch_memory_context (T &obj, viennacl::context new_ctx)
| Generic convenience routine for migrating data of an object to a new memory domain. More...

## Detailed Description

Main interface routines for memory management.

Definition in file memory.hpp.