1 #ifndef VIENNACL_BACKEND_CPU_RAM_HPP_
2 #define VIENNACL_BACKEND_CPU_RAM_HPP_
27 #ifdef VIENNACL_WITH_AVX2
58 #ifdef VIENNACL_WITH_AVX2
75 #ifdef VIENNACL_WITH_AVX2
89 char * raw_ptr = new_handle.
get();
90 const char * data_ptr =
static_cast<const char *
>(host_ptr);
91 #ifdef VIENNACL_WITH_OPENMP
92 #pragma omp parallel for
94 for (
long i=0; i<long(size_in_bytes); ++i)
95 raw_ptr[i] = data_ptr[i];
114 assert( (dst_buffer.
get() != NULL) &&
bool(
"Memory not initialized!"));
115 assert( (src_buffer.
get() != NULL) &&
bool(
"Memory not initialized!"));
117 #ifdef VIENNACL_WITH_OPENMP
118 #pragma omp parallel for
120 for (
long i=0; i<long(bytes_to_copy); ++i)
137 assert( (dst_buffer.
get() != NULL) &&
bool(
"Memory not initialized!"));
139 #ifdef VIENNACL_WITH_OPENMP
140 #pragma omp parallel for
142 for (
long i=0; i<long(bytes_to_copy); ++i)
143 dst_buffer.
get()[
vcl_size_t(i)+dst_offset] =
static_cast<const char *
>(ptr)[i];
159 assert( (src_buffer.
get() != NULL) &&
bool(
"Memory not initialized!"));
161 #ifdef VIENNACL_WITH_OPENMP
162 #pragma omp parallel for
164 for (
long i=0; i<long(bytes_to_copy); ++i)
165 static_cast<char *>(ptr)[i] = src_buffer.
get()[
vcl_size_t(i)+src_offset];
viennacl::tools::shared_ptr< char > handle_type
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.
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.
Helper struct for deleting an pointer to an array.
This file provides the forward declarations for the main types used within ViennaCL.
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'.
Implementation of a shared pointer class (cf. std::shared_ptr, boost::shared_ptr). Will be used until C++11 is widely available.
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...
void operator()(U *p) const