|
nnlib
GPU-accelerated, C/C++ neural network library.
|
Header file to declare common functions regarding memory allocation on device. More...
#include "../../include/allocation.h"Functions | |
| float * | allocate1DArrayDevice (size_t n) |
| Allocate a 1D array. More... | |
| void | copy1DFromDeviceToDevice (float *oldLoc, float *newLoc, size_t n) |
| Copy a 1D array within device memory. More... | |
| void | copy1DFromHostToDevice (float *host, float *device, size_t n) |
| Copy a 1D array from host memory to device memory. More... | |
| void | copy2DFromHostToDevice (float **host, float *device, size_t n, size_t m) |
| Copy a 2D array from host memory to device memory. More... | |
| void | copy1DFromDeviceToHost (float *device, float *host, size_t n) |
| Copy a 1D array from device memory to host memory. More... | |
| void | copy2DFromDeviceToHost (float *device, float **host, size_t n, size_t m) |
| Copy a 2D array from device memory to host memory. More... | |
| float * | copy1DArrayDevice (size_t n, float *old) |
| Copy the provided 1D array to a new location. More... | |
| void | copy1DArrayDevice (size_t n, float *old, float *copy) |
| void | free1DArrayDevice (float *device) |
| Free a 1D array from device memory. More... | |
Header file to declare common functions regarding memory allocation on device.
All functions in the file only allocate/copy float memory.
| float* allocate1DArrayDevice | ( | size_t | n | ) |
Allocate a 1D array.
| n | The size of the array to allocate. |
| float* copy1DArrayDevice | ( | size_t | n, |
| float * | old | ||
| ) |
Copy the provided 1D array to a new location.
As opposed to copy1DFromDeviceToDevice(), this returns the new location, rather than expecting it as an argument.
| n | The size of the array to copy. |
| old | The array to copy. |
| void copy1DFromDeviceToDevice | ( | float * | oldLoc, |
| float * | newLoc, | ||
| size_t | n | ||
| ) |
Copy a 1D array within device memory.
| oldLoc | The old location of the array. |
| newLoc | The new location of the array. |
| n | The size of the array. |
| void copy1DFromDeviceToHost | ( | float * | device, |
| float * | host, | ||
| size_t | n | ||
| ) |
Copy a 1D array from device memory to host memory.
| device | The location of the device array. |
| host | The host location where the array should be copied. |
| n | The size of the array. |
| void copy1DFromHostToDevice | ( | float * | host, |
| float * | device, | ||
| size_t | n | ||
| ) |
Copy a 1D array from host memory to device memory.
| host | The location of the host array. |
| device | The device location where the array should be copied. |
| n | The size of the array. |
| void copy2DFromDeviceToHost | ( | float * | device, |
| float ** | host, | ||
| size_t | n, | ||
| size_t | m | ||
| ) |
Copy a 2D array from device memory to host memory.
| device | The location of the device array. |
| host | The host location where the array should be copied. |
| n | The number of rows of the array. |
| m | The number of columns of the array. |
| void copy2DFromHostToDevice | ( | float ** | host, |
| float * | device, | ||
| size_t | n, | ||
| size_t | m | ||
| ) |
Copy a 2D array from host memory to device memory.
| host | The location of the host array. |
| device | The device location where the array should be copied. |
| n | The number of rows of the array. |
| m | The number of columns of the array. |
| void free1DArrayDevice | ( | float * | device | ) |
Free a 1D array from device memory.
| device | The array to free. |