8#ifndef MEMORY_ARRAY_HPP_
9#define MEMORY_ARRAY_HPP_
11#include "memory/memory.hpp"
13#include "util/cuda_util.hpp"
29#if defined(__GNUG__) || defined(__clang__)
32 T __attribute__((aligned(16))) *
ptr;
73 this->ptr =
static_cast<T *
>(
ptr);
97 ptr =
static_cast<T *
>(ptr_);
164 for (
size_t i = 0 ; i <
sz ; i++)
This class give a representation to a chunk or memory.
size_t sz
number of elements
void set_pointer(void *ptr_)
Set the internal pointer to the indicated chunk of memory.
~memory_array()
Destructor.
memory_array(void *ptr, size_t sz, bool init)
Memory array constructor.
void initialize(void *ptr, size_t sz, bool init)
Initialize the memory array.
__host__ __device__ const T & operator[](mem_id i) const
Access element an element of the array.
memory_array()
Default constructor.
size_t size()
return the size of the array
void deinit()
Deinitialize the memory.
__host__ __device__ T & operator[](mem_id i)
Access element an element of the array.
__device__ __host__ void * get_pointer() const
Return the pointer.
void bind_ref(const memory_array< Tbind > &ref)
Set from another memory array.
T get(mem_id i)
Get the i element.
T value_type
type returned by this structure
void swap(memory_array< T > &obj)
swap the two objects memory