TiledArray::cpu_cuda_vector< T, HostAlloc, DeviceAlloc > Class Template Reference

Documentation

template<typename T, typename HostAlloc = std::allocator<T>, typename DeviceAlloc = thrust::device_allocator<T>>
class TiledArray::cpu_cuda_vector< T, HostAlloc, DeviceAlloc >

a vector that lives on either host or device side, or both

Template Parameters
Tthe type of values this vector holds
HostAllocThe allocator type used for host data
DeviceAllocThe allocator type used for device data

Definition at line 19 of file cpu_cuda_vector.h.

Public Types

enum  state { state::none = 0x00, state::host = 0x01, state::device = 0x10, state::all = 0x11 }
 
typedef T value_type
 
typedef T & reference
 
typedef const T & const_reference
 
typedef thrust::host_vector< T, HostAlloc >::size_type size_type
 
typedef thrust::host_vector< T, HostAlloc >::difference_type difference_type
 
typedef thrust::host_vector< T, HostAlloc >::iterator iterator
 
typedef thrust::host_vector< T, HostAlloc >::const_iterator const_iterator
 

Public Member Functions

 cpu_cuda_vector ()
 creates an empty vector More...
 
 cpu_cuda_vector (size_type size, state st=state::host)
 
 cpu_cuda_vector (size_type size, T value, state st=state::host)
 
template<typename RandomAccessIterator >
 cpu_cuda_vector (RandomAccessIterator begin, RandomAccessIterator end)
 
size_type size () const
 
void resize (size_type new_size)
 
void to_device () const
 moves the data from the host to the device (even if it's there) More...
 
void to_host () const
 moves the data from the device to the host (even if it's there) More...
 
const T * host_data () const
 
T * host_data ()
 
const T * device_data () const
 
T * device_data ()
 
const T * data () const
 
T * data ()
 
iterator begin ()
 
const_iterator begin () const
 
const_iterator cbegin () const
 
iterator end ()
 
const_iterator end () const
 
const_iterator cend () const
 
const_reference operator[] (std::size_t i) const
 
reference operator[] (std::size_t i)
 
bool on_host () const
 
bool on_device () const
 

Member Typedef Documentation

◆ const_iterator

template<typename T , typename HostAlloc = std::allocator<T>, typename DeviceAlloc = thrust::device_allocator<T>>
typedef thrust::host_vector<T, HostAlloc>::const_iterator TiledArray::cpu_cuda_vector< T, HostAlloc, DeviceAlloc >::const_iterator

Definition at line 29 of file cpu_cuda_vector.h.

◆ const_reference

template<typename T , typename HostAlloc = std::allocator<T>, typename DeviceAlloc = thrust::device_allocator<T>>
typedef const T& TiledArray::cpu_cuda_vector< T, HostAlloc, DeviceAlloc >::const_reference

Definition at line 23 of file cpu_cuda_vector.h.

◆ difference_type

template<typename T , typename HostAlloc = std::allocator<T>, typename DeviceAlloc = thrust::device_allocator<T>>
typedef thrust::host_vector<T, HostAlloc>::difference_type TiledArray::cpu_cuda_vector< T, HostAlloc, DeviceAlloc >::difference_type

Definition at line 26 of file cpu_cuda_vector.h.

◆ iterator

template<typename T , typename HostAlloc = std::allocator<T>, typename DeviceAlloc = thrust::device_allocator<T>>
typedef thrust::host_vector<T, HostAlloc>::iterator TiledArray::cpu_cuda_vector< T, HostAlloc, DeviceAlloc >::iterator

Definition at line 27 of file cpu_cuda_vector.h.

◆ reference

template<typename T , typename HostAlloc = std::allocator<T>, typename DeviceAlloc = thrust::device_allocator<T>>
typedef T& TiledArray::cpu_cuda_vector< T, HostAlloc, DeviceAlloc >::reference

Definition at line 22 of file cpu_cuda_vector.h.

◆ size_type

template<typename T , typename HostAlloc = std::allocator<T>, typename DeviceAlloc = thrust::device_allocator<T>>
typedef thrust::host_vector<T, HostAlloc>::size_type TiledArray::cpu_cuda_vector< T, HostAlloc, DeviceAlloc >::size_type

Definition at line 24 of file cpu_cuda_vector.h.

◆ value_type

template<typename T , typename HostAlloc = std::allocator<T>, typename DeviceAlloc = thrust::device_allocator<T>>
typedef T TiledArray::cpu_cuda_vector< T, HostAlloc, DeviceAlloc >::value_type

Definition at line 21 of file cpu_cuda_vector.h.

Member Enumeration Documentation

◆ state

template<typename T , typename HostAlloc = std::allocator<T>, typename DeviceAlloc = thrust::device_allocator<T>>
enum TiledArray::cpu_cuda_vector::state
strong
Enumerator
none 
host 
device 
all 

Definition at line 31 of file cpu_cuda_vector.h.

Constructor & Destructor Documentation

◆ cpu_cuda_vector() [1/4]

template<typename T , typename HostAlloc = std::allocator<T>, typename DeviceAlloc = thrust::device_allocator<T>>
TiledArray::cpu_cuda_vector< T, HostAlloc, DeviceAlloc >::cpu_cuda_vector ( )
inline

creates an empty vector

Definition at line 34 of file cpu_cuda_vector.h.

◆ cpu_cuda_vector() [2/4]

template<typename T , typename HostAlloc = std::allocator<T>, typename DeviceAlloc = thrust::device_allocator<T>>
TiledArray::cpu_cuda_vector< T, HostAlloc, DeviceAlloc >::cpu_cuda_vector ( size_type  size,
state  st = state::host 
)
inline

creates a vector with size elements

Parameters
stthe target state of the vector

Definition at line 37 of file cpu_cuda_vector.h.

Here is the call graph for this function:

◆ cpu_cuda_vector() [3/4]

template<typename T , typename HostAlloc = std::allocator<T>, typename DeviceAlloc = thrust::device_allocator<T>>
TiledArray::cpu_cuda_vector< T, HostAlloc, DeviceAlloc >::cpu_cuda_vector ( size_type  size,
value,
state  st = state::host 
)
inline

creates a vector with size elements filled with value

Parameters
valuethe value used to fill the vector
stthe target state of the vector

Definition at line 47 of file cpu_cuda_vector.h.

◆ cpu_cuda_vector() [4/4]

template<typename T , typename HostAlloc = std::allocator<T>, typename DeviceAlloc = thrust::device_allocator<T>>
template<typename RandomAccessIterator >
TiledArray::cpu_cuda_vector< T, HostAlloc, DeviceAlloc >::cpu_cuda_vector ( RandomAccessIterator  begin,
RandomAccessIterator  end 
)
inline

initializes on host side from an iterator range

Template Parameters
RandomAccessIterator

Definition at line 58 of file cpu_cuda_vector.h.

Member Function Documentation

◆ begin() [1/2]

template<typename T , typename HostAlloc = std::allocator<T>, typename DeviceAlloc = thrust::device_allocator<T>>
iterator TiledArray::cpu_cuda_vector< T, HostAlloc, DeviceAlloc >::begin ( )
inline

Definition at line 109 of file cpu_cuda_vector.h.

Here is the call graph for this function:

◆ begin() [2/2]

template<typename T , typename HostAlloc = std::allocator<T>, typename DeviceAlloc = thrust::device_allocator<T>>
const_iterator TiledArray::cpu_cuda_vector< T, HostAlloc, DeviceAlloc >::begin ( ) const
inline

Definition at line 113 of file cpu_cuda_vector.h.

Here is the call graph for this function:

◆ cbegin()

template<typename T , typename HostAlloc = std::allocator<T>, typename DeviceAlloc = thrust::device_allocator<T>>
const_iterator TiledArray::cpu_cuda_vector< T, HostAlloc, DeviceAlloc >::cbegin ( ) const
inline

Definition at line 117 of file cpu_cuda_vector.h.

Here is the call graph for this function:

◆ cend()

template<typename T , typename HostAlloc = std::allocator<T>, typename DeviceAlloc = thrust::device_allocator<T>>
const_iterator TiledArray::cpu_cuda_vector< T, HostAlloc, DeviceAlloc >::cend ( ) const
inline

Definition at line 129 of file cpu_cuda_vector.h.

Here is the call graph for this function:

◆ data() [1/2]

template<typename T , typename HostAlloc = std::allocator<T>, typename DeviceAlloc = thrust::device_allocator<T>>
T* TiledArray::cpu_cuda_vector< T, HostAlloc, DeviceAlloc >::data ( )
inline

Definition at line 107 of file cpu_cuda_vector.h.

Here is the call graph for this function:

◆ data() [2/2]

template<typename T , typename HostAlloc = std::allocator<T>, typename DeviceAlloc = thrust::device_allocator<T>>
const T* TiledArray::cpu_cuda_vector< T, HostAlloc, DeviceAlloc >::data ( ) const
inline

Definition at line 106 of file cpu_cuda_vector.h.

Here is the call graph for this function:

◆ device_data() [1/2]

template<typename T , typename HostAlloc = std::allocator<T>, typename DeviceAlloc = thrust::device_allocator<T>>
T* TiledArray::cpu_cuda_vector< T, HostAlloc, DeviceAlloc >::device_data ( )
inline

Definition at line 100 of file cpu_cuda_vector.h.

Here is the call graph for this function:

◆ device_data() [2/2]

template<typename T , typename HostAlloc = std::allocator<T>, typename DeviceAlloc = thrust::device_allocator<T>>
const T* TiledArray::cpu_cuda_vector< T, HostAlloc, DeviceAlloc >::device_data ( ) const
inline

Definition at line 96 of file cpu_cuda_vector.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ end() [1/2]

template<typename T , typename HostAlloc = std::allocator<T>, typename DeviceAlloc = thrust::device_allocator<T>>
iterator TiledArray::cpu_cuda_vector< T, HostAlloc, DeviceAlloc >::end ( )
inline

Definition at line 121 of file cpu_cuda_vector.h.

Here is the call graph for this function:

◆ end() [2/2]

template<typename T , typename HostAlloc = std::allocator<T>, typename DeviceAlloc = thrust::device_allocator<T>>
const_iterator TiledArray::cpu_cuda_vector< T, HostAlloc, DeviceAlloc >::end ( ) const
inline

Definition at line 125 of file cpu_cuda_vector.h.

Here is the call graph for this function:

◆ host_data() [1/2]

template<typename T , typename HostAlloc = std::allocator<T>, typename DeviceAlloc = thrust::device_allocator<T>>
T* TiledArray::cpu_cuda_vector< T, HostAlloc, DeviceAlloc >::host_data ( )
inline

Definition at line 91 of file cpu_cuda_vector.h.

Here is the call graph for this function:

◆ host_data() [2/2]

template<typename T , typename HostAlloc = std::allocator<T>, typename DeviceAlloc = thrust::device_allocator<T>>
const T* TiledArray::cpu_cuda_vector< T, HostAlloc, DeviceAlloc >::host_data ( ) const
inline

Definition at line 87 of file cpu_cuda_vector.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ on_device()

template<typename T , typename HostAlloc = std::allocator<T>, typename DeviceAlloc = thrust::device_allocator<T>>
bool TiledArray::cpu_cuda_vector< T, HostAlloc, DeviceAlloc >::on_device ( ) const
inline

Definition at line 147 of file cpu_cuda_vector.h.

Here is the caller graph for this function:

◆ on_host()

template<typename T , typename HostAlloc = std::allocator<T>, typename DeviceAlloc = thrust::device_allocator<T>>
bool TiledArray::cpu_cuda_vector< T, HostAlloc, DeviceAlloc >::on_host ( ) const
inline

Definition at line 144 of file cpu_cuda_vector.h.

Here is the caller graph for this function:

◆ operator[]() [1/2]

template<typename T , typename HostAlloc = std::allocator<T>, typename DeviceAlloc = thrust::device_allocator<T>>
reference TiledArray::cpu_cuda_vector< T, HostAlloc, DeviceAlloc >::operator[] ( std::size_t  i)
inline

Definition at line 139 of file cpu_cuda_vector.h.

Here is the call graph for this function:

◆ operator[]() [2/2]

template<typename T , typename HostAlloc = std::allocator<T>, typename DeviceAlloc = thrust::device_allocator<T>>
const_reference TiledArray::cpu_cuda_vector< T, HostAlloc, DeviceAlloc >::operator[] ( std::size_t  i) const
inline

Definition at line 134 of file cpu_cuda_vector.h.

Here is the call graph for this function:

◆ resize()

template<typename T , typename HostAlloc = std::allocator<T>, typename DeviceAlloc = thrust::device_allocator<T>>
void TiledArray::cpu_cuda_vector< T, HostAlloc, DeviceAlloc >::resize ( size_type  new_size)
inline

Definition at line 66 of file cpu_cuda_vector.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ size()

template<typename T , typename HostAlloc = std::allocator<T>, typename DeviceAlloc = thrust::device_allocator<T>>
size_type TiledArray::cpu_cuda_vector< T, HostAlloc, DeviceAlloc >::size ( ) const
inline

Definition at line 61 of file cpu_cuda_vector.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ to_device()

template<typename T , typename HostAlloc = std::allocator<T>, typename DeviceAlloc = thrust::device_allocator<T>>
void TiledArray::cpu_cuda_vector< T, HostAlloc, DeviceAlloc >::to_device ( ) const
inline

moves the data from the host to the device (even if it's there)

Definition at line 75 of file cpu_cuda_vector.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ to_host()

template<typename T , typename HostAlloc = std::allocator<T>, typename DeviceAlloc = thrust::device_allocator<T>>
void TiledArray::cpu_cuda_vector< T, HostAlloc, DeviceAlloc >::to_host ( ) const
inline

moves the data from the device to the host (even if it's there)

Definition at line 81 of file cpu_cuda_vector.h.

Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following file: