5#define cudaFn __device__ __host__
18using stateFunc = void (*)(T*,
const unsigned int,
const unsigned int);
27using kernelFunc = void (*)(T*,
const unsigned int);
117 void initCPU(stateFunc<T> fn);
118 void initCUDA(stateFunc<T> fn);
128 template <
typename T>
173 void initCPU(kernelFunc<T> fn);
174 void initCUDA(kernelFunc<T> fn);
2D convolution kernel
Definition common.hpp:130
const Device device
Computational device.
Definition common.hpp:143
~Kernel()
Frees dynamically allocated memory.
Definition common.inl:212
void print()
Prints the kernel array.
Definition common.inl:258
T * kernel
2D Matrix
Definition common.hpp:135
void copyTo(Kernel< T > *to)
Copy the own kernel array to another kernel array across devices.
Definition common.inl:239
const unsigned int size
Side length of matrix.
Definition common.hpp:139
2D buffered matrices
Definition common.hpp:56
const unsigned int width
Width of 2D Matrix.
Definition common.hpp:76
T * curr
Current 2D Matrix buffer.
Definition common.hpp:61
void swap()
Swaps the current- and next state buffer.
Definition common.inl:139
void copyTo(State< T > *to)
Copy the own current state buffer to another current state buffer across devices.
Definition common.inl:120
void print()
Prints the current state buffer.
Definition common.inl:147
const unsigned int height
Height of 2D Matrix.
Definition common.hpp:71
const Device device
Computational device.
Definition common.hpp:81
T * next
Next 2D Matrix buffer.
Definition common.hpp:66
~State()
Frees dynamically allocated memory.
Definition common.inl:88
Main namespace.
Definition common.hpp:33
Device
Computational device.
Definition common.hpp:39
@ CPU
Allocation & computation on CPU/RAM.
Definition common.hpp:43
@ CUDA
Allocation & computation on NVIDIA GPU via CUDA.
Definition common.hpp:47