Core Functionality

Functionality to catch exceptions, dispatch kernels for different dtypes, and writing kernels.

template<typename T, int N>
class augpy::array

A simple fixed-size array. Importantly sizeof(array) gives the actual size of the array in bytes, so it can be used as an argument in function calls etc.

Template Parameters
  • T: element type

  • N: length of array

Public Functions

array()

Create a new array, setting all bytes in x to zero.

array(T *values, int n)

Create a new array, copying n values from the given pointer. All remaining bytes in x are set to zero.

T &operator[](size_t idx)

Return a reference to the element at index idx.

const T &operator[](size_t idx) const

Return a const reference to the element at index idx.

T *ptr()

Return a pointer to the internal array storage x.

Public Members

T x[N]

Array that holds the data.

template<class T, class ...Tail>
array<T, 1 + sizeof...(Tail)> augpy::make_array(T head, Tail... tail)

Similar to std::make_tuple, but makes a fixed-length array instead.

Example: auto tensors = make_array(tensor1, tensor2, tensor3);

BLOCKS_PER_SM

Default value for blocks to generate per SM. Used to calculate kernel launch config. Currently 8.