OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
openfpm::vector_gpu_ker< T, layout_base > Struct Template Reference

grid interface available when on gpu More...

Detailed Description

template<typename T, template< typename > class layout_base>
struct openfpm::vector_gpu_ker< T, layout_base >

grid interface available when on gpu

Template Parameters
n_bufnumber of template buffers

Definition at line 196 of file tokernel_transformation.hpp.

#include <tokernel_transformation.hpp>

Public Types

typedef vector_gpu_ker< T, layout_base > self_type
 
typedef apply_transform< layout_base, T >::type T_
 
typedef int yes_i_am_vector
 it define that it is a vector
 
typedef layout_base< T_ >::type layout_type
 Type of the encapsulation memory parameter.
 
typedef grid_base< 1, T_, CudaMemory, typename layout_base< T_ >::type >::container container
 Object container for T, it is the return type of get_o it return a object type trough.
 
typedef T_ value_type
 Type of the value the vector is storing.
 
typedef int yes_has_check_device_pointer
 Indicate this structure has a function to check the device pointer.
 

Public Member Functions

__device__ __host__ bool check_bound (size_t v1) const
 Check that the key is inside the grid. More...
 
__device__ __host__ unsigned int size () const
 Return the size of the vector. More...
 
__device__ __host__ unsigned int capacity () const
 return the maximum capacity of the vector before reallocation More...
 
template<unsigned int p>
__device__ __host__ auto get (unsigned int id) const -> decltype(base.template get< p >(grid_key_dx< 1 >(0)))
 Get an element of the vector. More...
 
__device__ __host__ auto get (unsigned int id) -> decltype(base.get_o(grid_key_dx< 1 >(id)))
 Get an element of the vector. More...
 
__device__ __host__ auto get (unsigned int id) const -> const decltype(base.get_o(grid_key_dx< 1 >(id)))
 Get an element of the vector. More...
 
__device__ __host__ auto get_o (unsigned int id) const -> decltype(base.get_o(grid_key_dx< 1 >(id)))
 Get an element of the vector. More...
 
__device__ __host__ auto get_o (unsigned int id) -> decltype(base.get_o(grid_key_dx< 1 >(id)))
 Get an element of the vector. More...
 
auto last () const -> decltype(base.get_o(grid_key_dx< 1 >(0)))
 Get the last element of the vector. More...
 
template<unsigned int p>
__device__ __host__ auto get (unsigned int id) -> decltype(base.template get< p >(grid_key_dx< 1 >(0)))
 Get an element of the vector. More...
 
auto last () -> decltype(base.get_o(grid_key_dx< 1 >(0)))
 Get the last element of the vector. More...
 
 vector_gpu_ker (int v_size, const grid_gpu_ker< 1, T_, layout_base, grid_sm< 1, void >> &cpy)
 
 vector_gpu_ker (const vector_gpu_ker_ref< T, layout_base > &vref)
 
void constructor_impl (int v_size, const grid_gpu_ker< 1, T_, layout_base, grid_sm< 1, void >> &cpy)
 implementation of the constructor More...
 
void constructor_impl (int v_size, const grid_gpu_ker_ref< 1, T_, layout_base, grid_sm< 1, void >> &cpy)
 implementation of the constructor More...
 
__device__ void set (int id, const container &obj)
 Set the object id to obj. More...
 
template<unsigned int p>
__device__ __host__ void * getPointer ()
 Get the pointer for the property p. More...
 
template<unsigned int p>
__device__ __host__ const void * getPointer () const
 Get the pointer for the property p. More...
 
template<typename encap_S , unsigned int ... args>
void set_o (unsigned int i, const encap_S &obj)
 It set an element of the vector from a object that is a subset of the vector properties. More...
 
__device__ void set (unsigned int id, const vector_gpu_ker< T_, layout_base > &v, unsigned int src)
 Set the element of the vector v from another element of another vector. More...
 
template<unsigned int ... prp>
__device__ void set (unsigned int id, const vector_gpu_ker< T_, layout_base > &v, unsigned int src)
 Set the element of the vector v from another element of another vector. More...
 
__host__ ite_gpu< 1 > getGPUIterator (size_t n_thr=default_kernel_wg_threads_) const
 Get an iterator for the GPU. More...
 
ite_gpu< 1 > getGPUIteratorTo (size_t stop, size_t n_thr=default_kernel_wg_threads_) const
 Get an iterator for the GPU. More...
 
__host__ vector_gpu_ker< T, layout_base > & operator= (const vector_gpu_ker< T, layout_base > &v)
 operator= this operator absorb the pointers, consider that this object wrap device pointers More...
 
__device__ grid_gpu_ker< 1, T_, layout_base, grid_sm< 1, void > > & getBase ()
 Return the base. More...
 
void * internal_get_size_pointer ()
 
void print_size ()
 

Data Fields

unsigned int v_size
 
grid_gpu_ker< 1, T_, layout_base, grid_sm< 1, void > > base
 1-D static grid
 

Member Function Documentation

◆ capacity()

template<typename T, template< typename > class layout_base>
__device__ __host__ unsigned int openfpm::vector_gpu_ker< T, layout_base >::capacity ( ) const
inline

return the maximum capacity of the vector before reallocation

Returns
the capacity of the vector

Definition at line 181 of file map_vector_cuda_ker.cuh.

◆ check_bound()

template<typename T, template< typename > class layout_base>
__device__ __host__ bool openfpm::vector_gpu_ker< T, layout_base >::check_bound ( size_t  v1) const
inline

Check that the key is inside the grid.

Parameters
key
Returns
true if it is bound

Definition at line 142 of file map_vector_cuda_ker.cuh.

◆ constructor_impl() [1/2]

template<typename T, template< typename > class layout_base>
void openfpm::vector_gpu_ker< T, layout_base >::constructor_impl ( int  v_size,
const grid_gpu_ker< 1, T_, layout_base, grid_sm< 1, void >> &  cpy 
)
inline

implementation of the constructor

Parameters
v_sizenumber of elements

Definition at line 363 of file map_vector_cuda_ker.cuh.

◆ constructor_impl() [2/2]

template<typename T, template< typename > class layout_base>
void openfpm::vector_gpu_ker< T, layout_base >::constructor_impl ( int  v_size,
const grid_gpu_ker_ref< 1, T_, layout_base, grid_sm< 1, void >> &  cpy 
)
inline

implementation of the constructor

Parameters
v_sizenumber of elements

Definition at line 374 of file map_vector_cuda_ker.cuh.

◆ get() [1/4]

template<typename T, template< typename > class layout_base>
template<unsigned int p>
__device__ __host__ auto openfpm::vector_gpu_ker< T, layout_base >::get ( unsigned int  id) const -> decltype(base.template get<p>(grid_key_dx<1>(0)))
inline

Get an element of the vector.

Get an element of the vector

Template Parameters
pProperty to get
Parameters
idElement to get
Returns
the element value requested

Definition at line 197 of file map_vector_cuda_ker.cuh.

◆ get() [2/4]

template<typename T, template< typename > class layout_base>
__device__ __host__ auto openfpm::vector_gpu_ker< T, layout_base >::get ( unsigned int  id) -> decltype(base.get_o(grid_key_dx<1>(id)))
inline

Get an element of the vector.

Get an element of the vector

Parameters
idElement to get
Returns
the element (encapsulated)

Definition at line 217 of file map_vector_cuda_ker.cuh.

◆ get() [3/4]

template<typename T, template< typename > class layout_base>
__device__ __host__ auto openfpm::vector_gpu_ker< T, layout_base >::get ( unsigned int  id) const -> const decltype(base.get_o(grid_key_dx<1>(id)))
inline

Get an element of the vector.

Get an element of the vector

Parameters
idElement to get
Returns
the element (encapsulated)

Definition at line 238 of file map_vector_cuda_ker.cuh.

◆ get() [4/4]

template<typename T, template< typename > class layout_base>
template<unsigned int p>
__device__ __host__ auto openfpm::vector_gpu_ker< T, layout_base >::get ( unsigned int  id) -> decltype(base.template get<p>(grid_key_dx<1>(0)))
inline

Get an element of the vector.

Get an element of the vector

Template Parameters
pProperty to get
Parameters
idElement to get
Returns
the element value requested

Definition at line 321 of file map_vector_cuda_ker.cuh.

◆ get_o() [1/2]

template<typename T, template< typename > class layout_base>
__device__ __host__ auto openfpm::vector_gpu_ker< T, layout_base >::get_o ( unsigned int  id) const -> decltype(base.get_o(grid_key_dx<1>(id)))
inline

Get an element of the vector.

Deprecated:

exactly as get, exist to keep the compatibility with grid

Parameters
idElement to get
Returns
the element (encapsulated)

Definition at line 262 of file map_vector_cuda_ker.cuh.

◆ get_o() [2/2]

template<typename T, template< typename > class layout_base>
__device__ __host__ auto openfpm::vector_gpu_ker< T, layout_base >::get_o ( unsigned int  id) -> decltype(base.get_o(grid_key_dx<1>(id)))
inline

Get an element of the vector.

Deprecated:

exactly as get, exist to keep the compatibility with grid

Parameters
idElement to get
Returns
the element (encapsulated)

Definition at line 286 of file map_vector_cuda_ker.cuh.

◆ getBase()

template<typename T, template< typename > class layout_base>
__device__ grid_gpu_ker<1,T_,layout_base, grid_sm<1,void> >& openfpm::vector_gpu_ker< T, layout_base >::getBase ( )
inline

Return the base.

Returns
the base

Definition at line 522 of file map_vector_cuda_ker.cuh.

◆ getGPUIterator()

template<typename T, template< typename > class layout_base>
__host__ ite_gpu<1> openfpm::vector_gpu_ker< T, layout_base >::getGPUIterator ( size_t  n_thr = default_kernel_wg_threads_) const
inline

Get an iterator for the GPU.

Definition at line 484 of file map_vector_cuda_ker.cuh.

◆ getGPUIteratorTo()

template<typename T, template< typename > class layout_base>
ite_gpu<1> openfpm::vector_gpu_ker< T, layout_base >::getGPUIteratorTo ( size_t  stop,
size_t  n_thr = default_kernel_wg_threads_ 
) const
inline

Get an iterator for the GPU.

Definition at line 496 of file map_vector_cuda_ker.cuh.

◆ getPointer() [1/2]

template<typename T, template< typename > class layout_base>
template<unsigned int p>
__device__ __host__ void* openfpm::vector_gpu_ker< T, layout_base >::getPointer ( )
inline

Get the pointer for the property p.

Template Parameters
propertyp

copy the element

Definition at line 402 of file map_vector_cuda_ker.cuh.

◆ getPointer() [2/2]

template<typename T, template< typename > class layout_base>
template<unsigned int p>
__device__ __host__ const void* openfpm::vector_gpu_ker< T, layout_base >::getPointer ( ) const
inline

Get the pointer for the property p.

Template Parameters
propertyp

copy the element

Definition at line 413 of file map_vector_cuda_ker.cuh.

◆ last() [1/2]

template<typename T, template< typename > class layout_base>
auto openfpm::vector_gpu_ker< T, layout_base >::last ( ) const -> decltype(base.get_o(grid_key_dx<1>(0)))
inline

Get the last element of the vector.

Returns
the last element (encapsulated)

Definition at line 303 of file map_vector_cuda_ker.cuh.

◆ last() [2/2]

template<typename T, template< typename > class layout_base>
auto openfpm::vector_gpu_ker< T, layout_base >::last ( ) -> decltype(base.get_o(grid_key_dx<1>(0)))
inline

Get the last element of the vector.

Returns
the element (encapsulated)

Definition at line 338 of file map_vector_cuda_ker.cuh.

◆ operator=()

template<typename T, template< typename > class layout_base>
__host__ vector_gpu_ker<T,layout_base>& openfpm::vector_gpu_ker< T, layout_base >::operator= ( const vector_gpu_ker< T, layout_base > &  v)
inline

operator= this operator absorb the pointers, consider that this object wrap device pointers

Parameters
objectto copy

Definition at line 509 of file map_vector_cuda_ker.cuh.

◆ set() [1/3]

template<typename T, template< typename > class layout_base>
__device__ void openfpm::vector_gpu_ker< T, layout_base >::set ( int  id,
const container obj 
)
inline

Set the object id to obj.

Parameters
idelement
objobject (encapsulated)

copy the element

Definition at line 386 of file map_vector_cuda_ker.cuh.

◆ set() [2/3]

template<typename T, template< typename > class layout_base>
__device__ void openfpm::vector_gpu_ker< T, layout_base >::set ( unsigned int  id,
const vector_gpu_ker< T_, layout_base > &  v,
unsigned int  src 
)
inline

Set the element of the vector v from another element of another vector.

Parameters
idelement id
vvector source
srcsource element

Definition at line 452 of file map_vector_cuda_ker.cuh.

◆ set() [3/3]

template<typename T, template< typename > class layout_base>
template<unsigned int ... prp>
__device__ void openfpm::vector_gpu_ker< T, layout_base >::set ( unsigned int  id,
const vector_gpu_ker< T_, layout_base > &  v,
unsigned int  src 
)
inline

Set the element of the vector v from another element of another vector.

Parameters
idelement id
vvector source
srcsource element

Definition at line 470 of file map_vector_cuda_ker.cuh.

◆ set_o()

template<typename T, template< typename > class layout_base>
template<typename encap_S , unsigned int ... args>
void openfpm::vector_gpu_ker< T, layout_base >::set_o ( unsigned int  i,
const encap_S &  obj 
)
inline

It set an element of the vector from a object that is a subset of the vector properties.

The number of properties in the source vector must be smaller than the destination all the properties of S must be mapped so if S has 3 properties 3 numbers for args are required

Template Parameters
encap_Sobject that encapsulate the object
argsids of the properties to map the object to
Parameters
ielement to set
objobject that encapsulate the object
vsource vector

Definition at line 434 of file map_vector_cuda_ker.cuh.

◆ size()

template<typename T, template< typename > class layout_base>
__device__ __host__ unsigned int openfpm::vector_gpu_ker< T, layout_base >::size ( ) const
inline

Return the size of the vector.

Returns
the size

Definition at line 170 of file map_vector_cuda_ker.cuh.

Field Documentation

◆ v_size

template<typename T, template< typename > class layout_base>
unsigned int openfpm::vector_gpu_ker< T, layout_base >::v_size

Actual size of the vector, warning: it is not the space allocated in grid grid size increase by a fixed amount every time we need a vector bigger than the actually allocated space

Definition at line 130 of file map_vector_cuda_ker.cuh.


The documentation for this struct was generated from the following files: