16 #ifndef _CarmaHostObj_H_
17 #define _CarmaHostObj_H_
36 #define MEMORY_ALIGNMENT 4096
37 #define ALIGN_UP(x, size) (((size_t)x + (size - 1)) & (~(size - 1)))
39 template <
class T_data>
42 template <
class T_data>
90 T_data &
operator[](
long idx) {
return this->h_data[idx]; }
91 const T_data &
operator[](
long idx)
const {
return this->h_data[idx]; }
92 operator T_data *() {
return h_data; }
93 operator std::string() {
94 std::ostringstream stream;
115 return "MA_PAGELOCK";
119 return "MA_PORTABLE";
130 template <
class T_data>
132 os <<
"-----------------------" << std::endl;
133 os <<
"CarmaHostObj<" <<
typeid(T_data).name() <<
"> object" << std::endl;
135 os <<
"ndims = " << ndims << std::endl;
136 for (
long dim = 0; dim < ndims; dim++) {
137 os <<
"dim[" << dim <<
"] = " << obj.
get_dims(dim + 1) << std::endl;
140 os <<
"sizeof(" <<
typeid(T_data).name() <<
") = " <<
sizeof(T_data)
142 os <<
"-----------------------" << std::endl;
std::ostream & operator<<(std::ostream &os, CarmaHostObj< T_data > &obj)
this file provides tools to CarmaObj
this class provides wrappers to the generic carma host object
const T_data & operator[](long idx) const
T_data * get_data_at(int index)
CarmaHostObj(const long *dims_data, const T_data *data)
int wait_stream(int stream)
int cpy_obj(CarmaObj< T_data > *carma_obj, cudaMemcpyKind flag, unsigned int stream)
CarmaHostObj(const long *dims_data)
T_data * h_data
Input data.
cudaStream_t get_cuda_stream(int stream)
T_data * data_UA
unpadded input dara for generic pinned mem
CarmaHostObj(const CarmaHostObj< T_data > *obj, MemAlloc malloc_type)
void get_devpntr(void **pntr_dev)
int cpy_obj(CarmaObj< T_data > *carma_obj, cudaMemcpyKind flag)
long * dims_data
dimensions of the array
void init(const long *dims_data, const T_data *data, MemAlloc malloc_type, int nb_streams)
int fill_into(T_data *data)
CarmaHostObj(const long *dims_data, int nb_streams)
CarmaHostObj(const CarmaHostObj< T_data > *obj)
int nb_elem
number of elments in the array
CarmaHostObj(const CarmaHostObj< T_data > *obj, int nb_streams)
CarmaHostObj(const long *dims_data, const T_data *data, int nb_streams)
MemAlloc malloc_type
type of host alloc
int fill_from(const T_data *data)
T_data & operator[](long idx)
CarmaHostObj(const std::vector< long > &dims)
std::string get_mem_alloc()
CarmaHostObj(const long *dims_data, MemAlloc malloc_type)
CarmaHostObj(const CarmaHostObj< T_data > *obj, MemAlloc malloc_type, int nb_streams)
CarmaHostObj(const long *dims_data, MemAlloc malloc_type, int nb_streams)
CarmaHostObj(const long *dims_data, const T_data *data, MemAlloc malloc_type)
CarmaHostObj(const long *dims_data, const T_data *data, MemAlloc malloc_type, int nb_streams)
this class provides wrappers to the generic carma object
this class provides the stream features to CarmaObj