1 #ifndef VIENNACL_BACKEND_CPU_RAM_HPP_
2 #define VIENNACL_BACKEND_CPU_RAM_HPP_
72 char * raw_ptr = new_handle.
get();
73 const char * data_ptr =
static_cast<const char *
>(host_ptr);
75 raw_ptr[i] = data_ptr[i];
89 handle_type & dst_buffer,
94 assert( (dst_buffer.
get() != NULL) &&
bool(
"Memory not initialized!"));
95 assert( (src_buffer.
get() != NULL) &&
bool(
"Memory not initialized!"));
98 dst_buffer.
get()[i+dst_offset] = src_buffer.
get()[i + src_offset];
114 assert( (dst_buffer.
get() != NULL) &&
bool(
"Memory not initialized!"));
117 dst_buffer.
get()[i+dst_offset] =
static_cast<const char *
>(ptr)[i];
133 assert( (src_buffer.
get() != NULL) &&
bool(
"Memory not initialized!"));
136 static_cast<char *>(ptr)[i] = src_buffer.
get()[i+src_offset];
std::size_t vcl_size_t
Definition: forwards.h:58
void memory_read(handle_type const &src_buffer, vcl_size_t src_offset, vcl_size_t bytes_to_copy, void *ptr, bool)
Reads data from a buffer back to main RAM.
Definition: cpu_ram.hpp:127
handle_type memory_create(vcl_size_t size_in_bytes, const void *host_ptr=NULL)
Creates an array of the specified size in main RAM. If the second argument is provided, the buffer is initialized with data from that pointer.
Definition: cpu_ram.hpp:64
viennacl::tools::shared_ptr< char > handle_type
Definition: cpu_ram.hpp:35
Helper struct for deleting an pointer to an array.
Definition: cpu_ram.hpp:51
void memory_write(handle_type &dst_buffer, vcl_size_t dst_offset, vcl_size_t bytes_to_copy, const void *ptr, bool)
Writes data from main RAM identified by 'ptr' to the buffer identified by 'dst_buffer'.
Definition: cpu_ram.hpp:108
Implementation of a shared pointer class (cf. std::shared_ptr, boost::shared_ptr). Will be used until C++11 is widely available.
Main namespace in ViennaCL. Holds all the basic types such as vector, matrix, etc. and defines operations upon them.
Definition: cpu_ram.hpp:29
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' to memory starting at address 'ds...
Definition: cpu_ram.hpp:88
void operator()(U *p) const
Definition: cpu_ram.hpp:53