 |
COMPASS
5.0.0
End-to-end AO simulation tool using GPU acceleration
|
Go to the documentation of this file.
42 #ifndef _CarmaHostObj_H_
43 #define _CarmaHostObj_H_
61 #define MEMORY_ALIGNMENT 4096
62 #define ALIGN_UP(x, size) (((size_t)x + (size - 1)) & (~(size - 1)))
64 template <
class T_data>
67 template <
class T_data>
111 unsigned int stream);
115 operator std::string() {
116 std::ostringstream stream;
120 inline char const *
c_str() {
return std::string(*this).c_str(); }
138 return "MA_PAGELOCK";
142 return "MA_PORTABLE";
153 template <
class T_data>
155 os <<
"-----------------------" << std::endl;
156 os <<
"CarmaHostObj<" <<
typeid(T_data).name() <<
"> object" << std::endl;
158 os <<
"ndims = " << ndims << std::endl;
159 for (
long dim = 0; dim < ndims; dim++) {
160 os <<
"dim[" << dim <<
"] = " << obj.
get_dims(dim + 1) << std::endl;
163 os <<
"sizeof(" <<
typeid(T_data).name() <<
") = " <<
sizeof(T_data)
165 os <<
"-----------------------" << std::endl;
175 #endif // _CarmaHostObj_H_
void get_devpntr(void **pntr_dev)
std::string get_mem_alloc()
this file provides tools to CarmaObj
CarmaHostObj(const long *dims_data, MemAlloc malloc_type)
std::ostream & operator<<(std::ostream &os, CarmaHostObj< T_data > &obj)
int nb_elem
number of elments in the array
T_data * get_data_at(int index)
CarmaHostObj(const long *dims_data, const T_data *data, MemAlloc malloc_type, int nb_streams)
CarmaHostObj(const CarmaHostObj< T_data > *obj, MemAlloc malloc_type, int nb_streams)
CarmaHostObj(const long *dims_data, const T_data *data, int nb_streams)
cudaStream_t get_cuda_stream(int stream)
CarmaHostObj(const long *dims_data, int nb_streams)
this class provides the stream features to CarmaObj
CarmaHostObj(const CarmaHostObj< T_data > *obj, MemAlloc malloc_type)
T_data * data_UA
unpadded input dara for generic pinned mem
CarmaHostObj(const long *dims_data)
this class provides wrappers to the generic carma object
int wait_stream(int stream)
MemAlloc malloc_type
type of host alloc
int cpy_obj(CarmaObj< T_data > *carma_obj, cudaMemcpyKind flag, unsigned int stream)
int fill_from(const T_data *data)
CarmaHostObj(const long *dims_data, const T_data *data)
CarmaHostObj(const CarmaHostObj< T_data > *obj)
this class provides wrappers to the generic carma host object
long * dims_data
dimensions of the array
CarmaHostObj(const long *dims_data, const T_data *data, MemAlloc malloc_type)
T_data & operator[](int index)
T_data * h_data
Input data.
CarmaHostObj(const CarmaHostObj< T_data > *obj, int nb_streams)
int cpy_obj(CarmaObj< T_data > *carma_obj, cudaMemcpyKind flag)
void init(const long *dims_data, const T_data *data, MemAlloc malloc_type, int nb_streams)
CarmaHostObj(const long *dims_data, MemAlloc malloc_type, int nb_streams)
int fill_into(T_data *data)