OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
 
Loading...
Searching...
No Matches
map_vector_std_cuda_ker.cuh
1/*
2 * map_vector_std_cuda_ker.cuh
3 *
4 * Created on: Mar 9, 2019
5 * Author: i-bird
6 */
7
8#ifndef MAP_VECTOR_STD_CUDA_KER_CUH_
9#define MAP_VECTOR_STD_CUDA_KER_CUH_
10
11
18template<typename T, template <typename> class layout_base>
20{
22
23 typedef typename apply_transform<layout_base,T>::type T_;
24
28 unsigned int v_size;
29
31 vector_gpu_ker<T_,layout_base> base;
32
33public:
34
36 typedef int yes_i_am_vector;
37
40
42 // you can access all the properties of T
44
46 typedef T_ value_type;
47
53 __device__ unsigned int size() const
54 {
55 return v_size;
56 }
57
64 __device__ unsigned int capacity() const
65 {
66 return base.size();
67 }
68
79 __device__ inline auto at(size_t id) const -> decltype(base.template get<0>(0))
80 {
81 return base.template get<0>(id);
82 }
83
94 __device__ inline auto at(size_t id) -> decltype(base.template get<0>(0))
95 {
96 return base.template get<0>(id);
97 }
98
109 __device__ inline auto get(size_t id) const -> decltype(base.template get<0>(0))
110 {
111 return base.template get<0>(id);
112 }
113
124 __device__ inline auto get(size_t id) -> decltype(base.template get<0>(0))
125 {
126 return base.template get<0>(id);
127 }
128
134 __device__ __host__ void * getPointer()
135 {
136 return &base.template get<0>(0);
137 }
138
144 __device__ __host__ const void * getPointer() const
145 {
146 return &base.template get<0>(0);
147 }
148
149
151 {}
152
153 vector_custd_ker(int v_size, const vector_gpu_ker<T_,layout_base> & cpy)
154 :v_size(v_size),base(cpy)
155 {}
156};
157
158
159
160
161#endif /* MAP_VECTOR_STD_CUDA_KER_CUH_ */
Transform the boost::fusion::vector into memory specification (memory_traits)
grid interface available when on gpu
__device__ auto at(size_t id) -> decltype(base.template get< 0 >(0))
Get an element of the vector.
__device__ unsigned int capacity() const
return the maximum capacity of the vector before reallocation
__device__ __host__ void * getPointer()
Return the pointer to the chunk of memory.
grid_base< 1, T_, CudaMemory, typenamememory_traits_inte< T_ >::type >::container container
Object container for T, it is the return type of get_o it return a object type trough.
__device__ auto at(size_t id) const -> decltype(base.template get< 0 >(0))
Get an element of the vector.
__device__ auto get(size_t id) -> decltype(base.template get< 0 >(0))
Get an element of the vector.
__device__ auto get(size_t id) const -> decltype(base.template get< 0 >(0))
Get an element of the vector.
__device__ __host__ const void * getPointer() const
Return the pointer to the chunk of memory.
int yes_i_am_vector
it define that it is a vector
T_ value_type
Type of the value the vector is storing.
__device__ unsigned int size() const
Return the size of the vector.
vector_gpu_ker< T_, layout_base > base
1-D static grid
memory_traits_inte< aggregate< T_ > >::type layout_type
Type of the encapsulation memory parameter.