HyPar
1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
|
GPU implementations of array functions. More...
Go to the source code of this file.
Functions | |
__global__ void | ArrayCopy1D_kernel (const double *x, double *y, int n) |
__global__ void | ArraySetValue_kernel (double *x, int n, double value) |
__global__ void | ArrayAXPY_kernel (const double *x, double a, double *y, int n) |
__global__ void | ArrayBlockMultiply_kernel (double *x, const double *a, int n, int bs) |
__global__ void | ArrayCopy1DNewScheme_kernel (const double *__restrict__ src, double *__restrict__ dest, int npoints, int nvars) |
void | gpuSetDevice (int device) |
void | gpuMemcpy (void *dest, const void *src, size_t count, enum gpuMemcpyKind kind) |
void | gpuMalloc (void **devPtr, size_t size) |
void | gpuMemset (void *devPtr, int value, size_t count) |
void | gpuFree (void *devPtr) |
void | gpuArrayCopy1D (const double *x, double *y, int n) |
void | gpuArraySetValue (double *devPtr, int n, double value) |
void | gpuArrayAXPY (const double *x, double a, double *y, int n) |
void | gpuArrayBlockMultiply (double *x, const double *a, int n, int bs) |
double | gpuArraySumSquarenD (int nvars, int ndims, int *dim, int ghosts, int *index, double *x) |
void | gpuArrayCopy1DNewScheme (const double *src, double *dest, int npoints, int nvars) |
void | gpuArrayCheckEqual (const char *msg, const double *var_adj, const double *var_sep, int npoints) |
GPU implementations of array functions.
Definition in file ArrayImplementations_GPU.cu.
__global__ void ArrayCopy1D_kernel | ( | const double * | x, |
double * | y, | ||
int | n | ||
) |
Element-wise copy y = x, where x, y are 1-dimensional arrays of length size.
x | copy-from array |
y | copy-to array |
n | size of array |
Definition at line 13 of file ArrayImplementations_GPU.cu.
__global__ void ArraySetValue_kernel | ( | double * | x, |
int | n, | ||
double | value | ||
) |
Set all elements of a 1-dimensional array x (any datatype) of length size to a scalar value.
x | array |
n | size of array |
value | scalar value |
Definition at line 25 of file ArrayImplementations_GPU.cu.
__global__ void ArrayAXPY_kernel | ( | const double * | x, |
double | a, | ||
double * | y, | ||
int | n | ||
) |
Element-wise AXPY y = a x + y, where a is a scalar, and x, y, z are 1-dimensional arrays of length size.
x | x |
a | a |
y | y |
n | size of array |
Definition at line 40 of file ArrayImplementations_GPU.cu.
__global__ void ArrayBlockMultiply_kernel | ( | double * | x, |
const double * | a, | ||
int | n, | ||
int | bs | ||
) |
Given two arrays: x of size n*bs, and a of size n, this function implements: x[i][j] *= a[i] where i = 1,...,n, j = 1,...,bs, and x is stored as a 1D array in row-major format, i.e., x[i][j] = x[i*bs+j].
x | x |
a | a |
n | size of array |
bs | block size |
Definition at line 56 of file ArrayImplementations_GPU.cu.
__global__ void ArrayCopy1DNewScheme_kernel | ( | const double *__restrict__ | src, |
double *__restrict__ | dest, | ||
int | npoints, | ||
int | nvars | ||
) |
Alternative implementation of _ArrayCopy1D_
src | source array |
dest | destination array |
npoints | number of points |
nvars | number of components |
Definition at line 69 of file ArrayImplementations_GPU.cu.
void gpuSetDevice | ( | int | device | ) |
void gpuMemcpy | ( | void * | dest, |
const void * | src, | ||
size_t | count, | ||
enum gpuMemcpyKind | kind | ||
) |
GPU memory copy
dest | destination |
src | source |
count | count |
kind | kind of copy |
Definition at line 94 of file ArrayImplementations_GPU.cu.
void gpuMalloc | ( | void ** | devPtr, |
size_t | size | ||
) |
Allocate memory
devPtr | pointer to memory |
size | size of memory |
Definition at line 118 of file ArrayImplementations_GPU.cu.
void gpuMemset | ( | void * | devPtr, |
int | value, | ||
size_t | count | ||
) |
Set value
devPtr | Pointer to memory |
value | value to set |
count | size of data |
Definition at line 131 of file ArrayImplementations_GPU.cu.
void gpuFree | ( | void * | devPtr | ) |
deallocate memory
devPtr | Pointer to memory |
Definition at line 140 of file ArrayImplementations_GPU.cu.
void gpuArrayCopy1D | ( | const double * | x, |
double * | y, | ||
int | n | ||
) |
Element-wise copy y = x, where x, y are 1-dimensional arrays of length size.
x | copy-from array |
y | copy-to array |
n | size of array |
Definition at line 148 of file ArrayImplementations_GPU.cu.
void gpuArraySetValue | ( | double * | devPtr, |
int | n, | ||
double | value | ||
) |
Set all elements of a 1-dimensional array x (any datatype) of length size to a scalar value.
devPtr | array |
n | size of array |
value | scalar value |
Definition at line 161 of file ArrayImplementations_GPU.cu.
void gpuArrayAXPY | ( | const double * | x, |
double | a, | ||
double * | y, | ||
int | n | ||
) |
Element-wise AXPY y = a x + y, where a is a scalar, and x, y, z are 1-dimensional arrays of length size.
x | x |
a | a |
y | y |
n | size of array |
Definition at line 177 of file ArrayImplementations_GPU.cu.
void gpuArrayBlockMultiply | ( | double * | x, |
const double * | a, | ||
int | n, | ||
int | bs | ||
) |
Given two arrays: x of size n*bs, and a of size n, this function implements: x[i][j] *= a[i] where i = 1,...,n, j = 1,...,bs, and x is stored as a 1D array in row-major format, i.e., x[i][j] = x[i*bs+j].
x | x |
a | a |
n | size of array |
bs | block size |
Definition at line 193 of file ArrayImplementations_GPU.cu.
double gpuArraySumSquarenD | ( | int | nvars, |
int | ndims, | ||
int * | dim, | ||
int | ghosts, | ||
int * | index, | ||
double * | x | ||
) |
Returns the sum-of-squares of the elements in an n-D array (useful for L_2 norm)
nvars | number of elements at one array location, can be > 1 for systems of equations |
ndims | number of dimensions |
dim | integer array of size in each dimension |
ghosts | number of ghost points in the array x |
index | pre-allocated (by the calling function) integer array of size ndims |
x | the array |
Definition at line 206 of file ArrayImplementations_GPU.cu.
void gpuArrayCopy1DNewScheme | ( | const double * | src, |
double * | dest, | ||
int | npoints, | ||
int | nvars | ||
) |
Alternative implementation of _ArrayCopy1D_
src | source array |
dest | destination array |
npoints | number of points |
nvars | number of components |
Definition at line 223 of file ArrayImplementations_GPU.cu.
void gpuArrayCheckEqual | ( | const char * | msg, |
const double * | var_adj, | ||
const double * | var_sep, | ||
int | npoints | ||
) |
Check if two arrays are equal, if not, report the difference
Check if two arrays are equal, if not, report the difference
msg | message |
var_adj | array |
var_sep | array |
npoints | size of array |
Definition at line 236 of file ArrayImplementations_GPU.cu.