#include "../core/common.hpp"
#include "cuda.inl"
Go to the source code of this file.
|
| void | CellularAutomata::cuda::allocateCUDA (void **arrayPtr, size_t bytes) |
| | Allocated memory on a CUDA device.
|
| |
| void | CellularAutomata::cuda::allocateHost (void **arrayPtr, size_t bytes) |
| | Allocated memory on the host device (CPU)
|
| |
| void | CellularAutomata::cuda::freeCUDA (void *array) |
| | Frees memory on a CUDA device.
|
| |
| void | CellularAutomata::cuda::freeHost (void *array) |
| | Frees memory on the host device (CPU)
|
| |
| void | CellularAutomata::cuda::copyCUDA (void *src, Device from, void *dst, Device to, size_t bytes) |
| | Memcopy between devices and host.
|
| |
| template<typename T , typename Activation > |
| void | CellularAutomata::cuda::epoch (T *input, T *kernel, T *output, Activation fn, const unsigned int h, const unsigned int w, const unsigned int s, const bool r) |
| | Call the CUDA kernel to run a single epoch on a given state using a kernel.
|
| |
◆ allocateCUDA()
| void CellularAutomata::cuda::allocateCUDA |
( |
void ** |
arrayPtr, |
|
|
size_t |
bytes |
|
) |
| |
Allocated memory on a CUDA device.
- Parameters
-
| arrayPtr | pointer to deviceArray |
| bytes | allocation size in bytes |
- Exceptions
-
◆ allocateHost()
| void CellularAutomata::cuda::allocateHost |
( |
void ** |
arrayPtr, |
|
|
size_t |
bytes |
|
) |
| |
Allocated memory on the host device (CPU)
- Note
- Allocates "page-locked memory" which is slower in allocation but faster in transmission between devices and host. Should be used for memory which is often transfered
- Parameters
-
| arrayPtr | pointer to hostArray |
| bytes | allocation size in bytes |
- Exceptions
-
◆ copyCUDA()
| void CellularAutomata::cuda::copyCUDA |
( |
void * |
src, |
|
|
Device |
from, |
|
|
void * |
dst, |
|
|
Device |
to, |
|
|
size_t |
bytes |
|
) |
| |
Memcopy between devices and host.
- Attention
- Size is assumed to be equal
- Note
- Host memory can be allocated using regular allocations
- Parameters
-
| src | input array to copy from |
| from | computational device where input lives |
| dst | output array to copy to |
| to | computational device where output lives |
| bytes | allocation size in bytes |
- Exceptions
-
◆ epoch()
template<typename T , typename Activation >
| void CellularAutomata::cuda::epoch |
( |
T * |
input, |
|
|
T * |
kernel, |
|
|
T * |
output, |
|
|
Activation |
fn, |
|
|
const unsigned int |
h, |
|
|
const unsigned int |
w, |
|
|
const unsigned int |
s, |
|
|
const bool |
r |
|
) |
| |
Call the CUDA kernel to run a single epoch on a given state using a kernel.
- Template Parameters
-
- Parameters
-
| input | current state array |
| kernel | kernel for convolution |
| output | next state array |
| fn | activation function |
| h | height of state array |
| w | width of state array |
| s | size of kernel |
| r | grid recursion enabled |
- Exceptions
-
◆ freeCUDA()
| void CellularAutomata::cuda::freeCUDA |
( |
void * |
array | ) |
|
Frees memory on a CUDA device.
- Parameters
-
- Exceptions
-
◆ freeHost()
| void CellularAutomata::cuda::freeHost |
( |
void * |
array | ) |
|
Frees memory on the host device (CPU)
- Attention
- Do NOT use on regular allocations
- Note
- Frees "page-locked memory" allocated with CUDA functions
- Parameters
-
- Exceptions
-