nnlib
GPU-accelerated, C/C++ neural network library.
|
Source file defining methods regarding memory allocation on device. More...
#include "allocation_gpu.cuh"
#include "assert.cuh"
#include "verify.cuh"
#include <exceptions/unexpected_cuda_call_exception.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 | free1DArrayDevice (float *device) |
Free a 1D array from 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) |
Source file defining methods regarding memory allocation on device.
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. |