OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
 
Loading...
Searching...
No Matches
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
Template Parameters
n_bufnumber of template buffers

Definition at line 121 of file map_vector_cuda_ker.cuh.

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, typenamelayout_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.
 
__device__ __host__ unsigned int size () const
 Return the size of the vector.
 
__host__ __device__ size_t size_local () const
 
__device__ __host__ unsigned int capacity () const
 return the maximum capacity of the vector before reallocation
 
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.
 
template<unsigned int p>
__device__ __host__ auto getProp (unsigned int id) const -> decltype(base.template get< p >(grid_key_dx< 1 >(0)))
 Get an element of the vector.
 
template<unsigned int p, typename key_type >
__device__ __host__ auto getProp (key_type id) const -> decltype(base.template get< p >(grid_key_dx< 1 >(0)))
 Get an element of the vector.
 
__device__ __host__ auto get (unsigned int id) -> decltype(base.get_o(grid_key_dx< 1 >(id)))
 Get an element of the vector.
 
__device__ __host__ auto get (unsigned int id) const -> const decltype(base.get_o(grid_key_dx< 1 >(id)))
 Get an element of the vector.
 
__device__ __host__ auto get_o (unsigned int id) const -> decltype(base.get_o(grid_key_dx< 1 >(id)))
 Get an element of the vector.
 
__device__ __host__ auto get_o (unsigned int id) -> decltype(base.get_o(grid_key_dx< 1 >(id)))
 Get an element of the vector.
 
auto last () const -> decltype(base.get_o(grid_key_dx< 1 >(0)))
 Get the last element of the vector.
 
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.
 
auto last () -> decltype(base.get_o(grid_key_dx< 1 >(0)))
 Get the last element of the vector.
 
 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
 
void constructor_impl (int v_size, const grid_gpu_ker_ref< 1, T_, layout_base, grid_sm< 1, void > > &cpy)
 implementation of the constructor
 
__device__ void set (int id, const container &obj)
 Set the object id to obj.
 
template<unsigned int p>
__device__ __host__ void * getPointer ()
 Get the pointer for the property p.
 
template<unsigned int p>
__device__ __host__ const void * getPointer () const
 Get the pointer for the property p.
 
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.
 
__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.
 
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.
 
__host__ ite_gpu< 1 > getGPUIterator (size_t n_thr=default_kernel_wg_threads_) const
 Get an iterator for the GPU.
 
ite_gpu< 1 > getDomainIteratorGPU (size_t n_thr=default_kernel_wg_threads_) const
 Get a domain iterator for the GPU.
 
void init () const
 
__host__ __device__ auto value (unsigned int p) -> decltype(base.template get< 0 >(grid_key_dx< 1 >(0)))
 
ite_gpu< 1 > getGPUIteratorTo (size_t stop, size_t n_thr=default_kernel_wg_threads_) const
 Get an iterator for the GPU.
 
__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
 
__device__ __host__ vector_gpu_ker< T, layout_base > & getVector ()
 
__device__ __host__ const vector_gpu_ker< T, layout_base > & getVector () const
 
__device__ grid_gpu_ker< 1, T_, layout_base, grid_sm< 1, void > > & getBase ()
 Return the base.
 
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 Typedef Documentation

◆ container

template<typename T , template< typename > class layout_base>
typedef grid_base<1,T_,CudaMemory,typenamelayout_base<T_>::type>::container openfpm::vector_gpu_ker< T, layout_base >::container

Object container for T, it is the return type of get_o it return a object type trough.

Definition at line 157 of file map_vector_cuda_ker.cuh.

◆ layout_type

template<typename T , template< typename > class layout_base>
typedef layout_base<T_>::type openfpm::vector_gpu_ker< T, layout_base >::layout_type

Type of the encapsulation memory parameter.

Definition at line 153 of file map_vector_cuda_ker.cuh.

◆ self_type

template<typename T , template< typename > class layout_base>
typedef vector_gpu_ker<T,layout_base> openfpm::vector_gpu_ker< T, layout_base >::self_type

Definition at line 123 of file map_vector_cuda_ker.cuh.

◆ T_

template<typename T , template< typename > class layout_base>
typedef apply_transform<layout_base,T>::type openfpm::vector_gpu_ker< T, layout_base >::T_

Definition at line 125 of file map_vector_cuda_ker.cuh.

◆ value_type

template<typename T , template< typename > class layout_base>
typedef T_ openfpm::vector_gpu_ker< T, layout_base >::value_type

Type of the value the vector is storing.

Definition at line 160 of file map_vector_cuda_ker.cuh.

◆ yes_has_check_device_pointer

template<typename T , template< typename > class layout_base>
typedef int openfpm::vector_gpu_ker< T, layout_base >::yes_has_check_device_pointer

Indicate this structure has a function to check the device pointer.

Definition at line 163 of file map_vector_cuda_ker.cuh.

◆ yes_i_am_vector

template<typename T , template< typename > class layout_base>
typedef int openfpm::vector_gpu_ker< T, layout_base >::yes_i_am_vector

it define that it is a vector

Definition at line 150 of file map_vector_cuda_ker.cuh.

Constructor & Destructor Documentation

◆ vector_gpu_ker() [1/3]

template<typename T , template< typename > class layout_base>
openfpm::vector_gpu_ker< T, layout_base >::vector_gpu_ker ( )
inline

Definition at line 382 of file map_vector_cuda_ker.cuh.

◆ vector_gpu_ker() [2/3]

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

Definition at line 386 of file map_vector_cuda_ker.cuh.

◆ vector_gpu_ker() [3/3]

template<typename T , template< typename > class layout_base>
openfpm::vector_gpu_ker< T, layout_base >::vector_gpu_ker ( const vector_gpu_ker_ref< T, layout_base > &  vref)
inline

Definition at line 390 of file map_vector_cuda_ker.cuh.

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 186 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 400 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 411 of file map_vector_cuda_ker.cuh.

◆ get() [1/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 254 of file map_vector_cuda_ker.cuh.

◆ get() [2/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 358 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 275 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) 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 202 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) -> 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 323 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) 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 299 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 585 of file map_vector_cuda_ker.cuh.

◆ getDomainIteratorGPU()

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

Get a domain iterator for the GPU.

Definition at line 532 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 521 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 548 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 439 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 450 of file map_vector_cuda_ker.cuh.

◆ getProp() [1/2]

template<typename T , template< typename > class layout_base>
template<unsigned int p, typename key_type >
__device__ __host__ auto openfpm::vector_gpu_ker< T, layout_base >::getProp ( key_type  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 240 of file map_vector_cuda_ker.cuh.

◆ getProp() [2/2]

template<typename T , template< typename > class layout_base>
template<unsigned int p>
__device__ __host__ auto openfpm::vector_gpu_ker< T, layout_base >::getProp ( 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 223 of file map_vector_cuda_ker.cuh.

◆ getVector() [1/2]

template<typename T , template< typename > class layout_base>
__device__ __host__ vector_gpu_ker< T, layout_base > & openfpm::vector_gpu_ker< T, layout_base >::getVector ( )
inline

Definition at line 570 of file map_vector_cuda_ker.cuh.

◆ getVector() [2/2]

template<typename T , template< typename > class layout_base>
__device__ __host__ const vector_gpu_ker< T, layout_base > & openfpm::vector_gpu_ker< T, layout_base >::getVector ( ) const
inline

Definition at line 575 of file map_vector_cuda_ker.cuh.

◆ init()

template<typename T , template< typename > class layout_base>
void openfpm::vector_gpu_ker< T, layout_base >::init ( ) const
inline

Definition at line 538 of file map_vector_cuda_ker.cuh.

◆ internal_get_size_pointer()

template<typename T , template< typename > class layout_base>
void * openfpm::vector_gpu_ker< T, layout_base >::internal_get_size_pointer ( )
inline

Definition at line 590 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 ( ) -> decltype(base.get_o(grid_key_dx<1>(0)))
inline

Get the last element of the vector.

Returns
the element (encapsulated)

Definition at line 375 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 ( ) 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 340 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 562 of file map_vector_cuda_ker.cuh.

◆ print_size()

template<typename T , template< typename > class layout_base>
void openfpm::vector_gpu_ker< T, layout_base >::print_size ( )
inline

Definition at line 592 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 423 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 489 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 507 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 471 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.

◆ size_local()

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

Definition at line 175 of file map_vector_cuda_ker.cuh.

◆ value()

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

Definition at line 540 of file map_vector_cuda_ker.cuh.

Field Documentation

◆ base

template<typename T , template< typename > class layout_base>
grid_gpu_ker<1,T_,layout_base,grid_sm<1,void> > openfpm::vector_gpu_ker< T, layout_base >::base
mutable

1-D static grid

Definition at line 133 of file map_vector_cuda_ker.cuh.

◆ 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: