Graphitti
A toolkit/software architecture to ease creating high-performance neural network simulators
|
Public Types | |
using | reference |
Reference type that handles std::vector<bool> specialization. | |
Public Member Functions | |
DeviceVector (size_t size=0) | |
Constructor that initializes the host vector without GPU allocation. | |
DeviceVector (const DeviceVector &)=delete | |
Copy constructor is deleted to prevent accidental copies that could lead to GPU memory leaks. | |
DeviceVector & | operator= (const DeviceVector &)=delete |
Copy assignment is deleted to prevent accidental copies that could lead to GPU memory leaks. | |
void | push_back (const T &value) |
Adds an element to the end of the host vector. | |
void | resize (size_t new_size) |
Resizes the host vector to contain new_size elements. | |
void | resize (size_t new_size, const T &value) |
Resizes the host vector to new_size elements, initializing new elements with value. | |
void | clear () |
Removes all elements from the host vector. | |
void | reserve (size_t new_cap) |
Reserves storage in the host vector for at least new_cap elements. | |
size_t | size () const |
Returns the number of elements in the host vector. | |
bool | empty () const |
Checks if the host vector contains no elements. | |
void | assign (size_t n, const T &value) |
Replaces host vector contents with n copies of value. | |
const std::vector< T > & | getHostVector () const |
Gets a const reference to the underlying host vector. | |
std::vector< T > | getHostVector () |
Gets a copy of the host vector. | |
operator std::vector< T > & () | |
Implicit conversion to host vector reference. | |
operator const std::vector< T > & () const | |
Implicit conversion to const host vector reference. | |
reference | operator[] (size_t idx) |
Array subscript operator for host vector access. | |
const T | operator[] (size_t idx) const |
Const array subscript operator for host vector access. | |
T * | data () |
Gets pointer to contiguous host memory array. | |
const T * | data () const |
Gets const pointer to contiguous host memory array. | |
T & | at (size_t idx) |
Safe element access for host vector with bounds checking. | |
const T & | at (size_t idx) const |
Safe const element access for host vector with bounds checking. | |
T & | front () |
Access first element of host vector. | |
const T & | front () const |
Access first element of host vector (const) | |
T & | back () |
Access last element of host vector. | |
const T & | back () const |
Access last element of host vector (const) | |
auto | begin () |
Gets iterator to the first element of host vector. | |
auto | end () |
Gets iterator to one past the last element. | |
auto | begin () const |
Gets const iterator to the first element. | |
auto | end () const |
Gets const iterator to one past the last element. | |
Definition at line 77 of file DeviceVector.h.
using DeviceVector< T >::reference |
Reference type that handles std::vector<bool> specialization.
Definition at line 84 of file DeviceVector.h.
|
inlineexplicit |
Constructor that initializes the host vector without GPU allocation.
size | Initial size of the host vector (defaults to 0) |
Definition at line 91 of file DeviceVector.h.
|
inline |
Replaces host vector contents with n copies of value.
n | Number of elements to assign |
value | Value to fill the vector with |
Definition at line 169 of file DeviceVector.h.
|
inline |
Safe element access for host vector with bounds checking.
idx | Index of the element to access |
std::out_of_range | if idx >= size() |
Definition at line 253 of file DeviceVector.h.
|
inline |
Safe const element access for host vector with bounds checking.
idx | Index of the element to access |
std::out_of_range | if idx >= size() |
Definition at line 263 of file DeviceVector.h.
|
inline |
Access last element of host vector.
std::out_of_range | if vector is empty |
Definition at line 290 of file DeviceVector.h.
|
inline |
Access last element of host vector (const)
std::out_of_range | if vector is empty |
Definition at line 299 of file DeviceVector.h.
|
inline |
Gets iterator to the first element of host vector.
Definition at line 307 of file DeviceVector.h.
|
inline |
Gets const iterator to the first element.
Definition at line 323 of file DeviceVector.h.
|
inline |
Removes all elements from the host vector.
Definition at line 135 of file DeviceVector.h.
|
inline |
Gets pointer to contiguous host memory array.
Definition at line 235 of file DeviceVector.h.
|
inline |
Gets const pointer to contiguous host memory array.
Definition at line 243 of file DeviceVector.h.
|
inline |
Checks if the host vector contains no elements.
Definition at line 159 of file DeviceVector.h.
|
inline |
Gets iterator to one past the last element.
Definition at line 315 of file DeviceVector.h.
|
inline |
Gets const iterator to one past the last element.
Definition at line 331 of file DeviceVector.h.
|
inline |
Access first element of host vector.
std::out_of_range | if vector is empty |
Definition at line 272 of file DeviceVector.h.
|
inline |
Access first element of host vector (const)
std::out_of_range | if vector is empty |
Definition at line 281 of file DeviceVector.h.
|
inline |
Gets a copy of the host vector.
Definition at line 183 of file DeviceVector.h.
|
inline |
Gets a const reference to the underlying host vector.
Definition at line 176 of file DeviceVector.h.
|
inline |
Implicit conversion to const host vector reference.
Definition at line 201 of file DeviceVector.h.
|
inline |
Implicit conversion to host vector reference.
Definition at line 192 of file DeviceVector.h.
|
inline |
Array subscript operator for host vector access.
idx | Index of the element to access |
Definition at line 211 of file DeviceVector.h.
|
inline |
Const array subscript operator for host vector access.
idx | Index of the element to access |
Definition at line 224 of file DeviceVector.h.
|
inline |
Adds an element to the end of the host vector.
value | The element to append |
Definition at line 107 of file DeviceVector.h.
|
inline |
Reserves storage in the host vector for at least new_cap elements.
new_cap | Minimum capacity to reserve |
Definition at line 145 of file DeviceVector.h.
|
inline |
Resizes the host vector to contain new_size elements.
new_size | New size of the vector |
Definition at line 116 of file DeviceVector.h.
|
inline |
Resizes the host vector to new_size elements, initializing new elements with value.
new_size | New size of the vector |
value | Value to initialize new elements with |
Definition at line 127 of file DeviceVector.h.
|
inline |
Returns the number of elements in the host vector.
Definition at line 152 of file DeviceVector.h.