File MemManagement.cu
FileList > src > MemManagement.cu
Go to the source code of this file
#include "MemManagement.h"
Public Functions
| Type | Name |
|---|---|
| __host__ void | AllocateCPU (int nx, int ny, T *& zb) Allocate memory for a single array on the CPU. |
| __host__ void | AllocateCPU (int nx, int ny, T *& zs, T *& h, T *& u, T *& v) Allocate memory for multiple arrays (zs, h, u, v) on the CPU. |
| __host__ void | AllocateCPU (int nx, int ny, T *& zs, T *& h, T *& u, T *& v, T *& U, T *& hU) Allocate memory for extended arrays (zs, h, u, v, U, hU) on the CPU. |
| __host__ void | AllocateCPU (int nx, int ny, GradientsP< T > & Grad) Allocate memory for gradient arrays on the CPU. |
| void | AllocateCPU (int nblk, int blksize, EvolvingP< T > & Ev) Allocate memory for evolving variables on the CPU. |
| void | AllocateCPU (int nblk, int blksize, EvolvingP_M< T > & Ev) Allocate memory for extended evolving variables on the CPU. |
| void | AllocateCPU (int nblk, int blksize, Param XParam, Model< T > & XModel) Allocate all model arrays on the CPU. |
| template void | AllocateCPU< double > (int nx, int ny, double *& zs, double *& h, double *& u, double *& v) |
| template void | AllocateCPU< double > (int nx, int ny, double *& zs, double *& h, double *& u, double *& v, double *& U, double *& hU) |
| template void | AllocateCPU< double > (int nx, int ny, GradientsP< double > & Grad) |
| template void | AllocateCPU< double > (int nblk, int blksize, Param XParam, Model< double > & XModel) |
| template void | AllocateCPU< float > (int nx, int ny, float *& zs, float *& h, float *& u, float *& v) |
| template void | AllocateCPU< float > (int nx, int ny, float *& zs, float *& h, float *& u, float *& v, float *& U, float *& hU) |
| template void | AllocateCPU< float > (int nx, int ny, GradientsP< float > & Grad) |
| template void | AllocateCPU< float > (int nblk, int blksize, Param XParam, Model< float > & XModel) |
| template void | AllocateCPU< int > (int nx, int ny, int *& zs, int *& h, int *& u, int *& v) |
| template void | AllocateCPU< int > (int nx, int ny, int *& zs, int *& h, int *& u, int *& v, int *& U, int *& hU) |
| void | AllocateGPU (int nx, int ny, T *& z_g) Allocate memory on the GPU for a single array. |
| void | AllocateGPU (int nx, int ny, T *& zs, T *& h, T *& u, T *& v) Allocate memory on the GPU for multiple arrays (zs, h, u, v). |
| void | AllocateGPU (int nx, int ny, T *& zs, T *& h, T *& u, T *& v, T *& U, T *& hU) Allocate memory on the GPU for extended arrays (zs, h, u, v, U, hU). |
| void | AllocateGPU (int nx, int ny, GradientsP< T > & Grad) Allocate memory on the GPU for gradient arrays. |
| void | AllocateGPU (int nblk, int blksize, EvolvingP< T > & Ev) Allocate memory on the GPU for evolving variables structure. |
| void | AllocateGPU (int nblk, int blksize, EvolvingP_M< T > & Ev) Allocate memory on the GPU for extended evolving variables structure. |
| void | AllocateGPU (int nblk, int blksize, Param XParam, Model< T > & XModel) Allocate all model arrays on the GPU. |
| template void | AllocateGPU< double > (int nx, int ny, double *& zs, double *& h, double *& u, double *& v) |
| template void | AllocateGPU< double > (int nx, int ny, double *& zs, double *& h, double *& u, double *& v, double *& U, double *& hU) |
| template void | AllocateGPU< double > (int nx, int ny, GradientsP< double > & Grad) |
| template void | AllocateGPU< double > (int nblk, int blksize, Param XParam, Model< double > & XModel) |
| template void | AllocateGPU< float > (int nx, int ny, float *& zs, float *& h, float *& u, float *& v) |
| template void | AllocateGPU< float > (int nx, int ny, float *& zs, float *& h, float *& u, float *& v, float *& U, float *& hU) |
| template void | AllocateGPU< float > (int nx, int ny, GradientsP< float > & Grad) |
| template void | AllocateGPU< float > (int nblk, int blksize, Param XParam, Model< float > & XModel) |
| template void | AllocateGPU< int > (int nx, int ny, int *& zs, int *& h, int *& u, int *& v) |
| template void | AllocateGPU< int > (int nx, int ny, int *& zs, int *& h, int *& u, int *& v, int *& U, int *& hU) |
| void | AllocateMappedMemCPU (int nx, int ny, int gpudevice, T *& z) Allocate mapped memory on the CPU for CUDA interop. |
| template void | AllocateMappedMemCPU< double > (int nx, int ny, int gpudevice, double *& z) |
| template void | AllocateMappedMemCPU< float > (int nx, int ny, int gpudevice, float *& z) |
| template void | AllocateMappedMemCPU< int > (int nx, int ny, int gpudevice, int *& z) |
| void | AllocateMappedMemGPU (int nx, int ny, int gpudevice, T *& z_g, T * z) Get device pointer for mapped host memory. |
| template void | AllocateMappedMemGPU< double > (int nx, int ny, int gpudevice, double *& z_g, double * z) |
| template void | AllocateMappedMemGPU< float > (int nx, int ny, int gpudevice, float *& z_g, float * z) |
| template void | AllocateMappedMemGPU< int > (int nx, int ny, int gpudevice, int *& z_g, int * z) |
| __host__ void | FillCPU (int nx, int ny, T fillval, T *& zb) Fill a CPU array with a specified value. |
| template void | FillCPU< double > (int nx, int ny, double fillval, double *& zb) |
| template void | FillCPU< float > (int nx, int ny, float fillval, float *& zb) |
| template void | FillCPU< int > (int nx, int ny, int fillval, int *& zb) |
| void | ReallocArray (int nblk, int blksize, T *& zb) Reallocate memory for a single array. |
| void | ReallocArray (int nblk, int blksize, T *& zs, T *& h, T *& u, T *& v) Reallocate memory for multiple arrays (zs, h, u, v). |
| void | ReallocArray (int nblk, int blksize, T *& zs, T *& h, T *& u, T *& v, T *& U, T *& hU) Reallocate memory for extended arrays (zs, h, u, v, U, hU). |
| void | ReallocArray (int nblk, int blksize, EvolvingP< T > & Ev) Reallocate memory for evolving variables structure. |
| void | ReallocArray (int nblk, int blksize, EvolvingP_M< T > & Ev) Reallocate memory for extended evolving variables structure. |
| void | ReallocArray (int nblk, int blksize, Param XParam, Model< T > & XModel) Reallocate all model arrays. |
| template void | ReallocArray< double > (int nblk, int blksize, double *& zs, double *& h, double *& u, double *& v) |
| template void | ReallocArray< double > (int nblk, int blksize, double *& zs, double *& h, double *& u, double *& v, double *& U, double *& hU) |
| template void | ReallocArray< double > (int nblk, int blksize, EvolvingP< double > & Ev) |
| template void | ReallocArray< double > (int nblk, int blksize, EvolvingP_M< double > & Ev) |
| template void | ReallocArray< double > (int nblk, int blksize, Param XParam, Model< double > & XModel) |
| template void | ReallocArray< float > (int nblk, int blksize, float *& zs, float *& h, float *& u, float *& v) |
| template void | ReallocArray< float > (int nblk, int blksize, float *& zs, float *& h, float *& u, float *& v, float *& U, float *& hU) |
| template void | ReallocArray< float > (int nblk, int blksize, EvolvingP< float > & Ev) |
| template void | ReallocArray< float > (int nblk, int blksize, EvolvingP_M< float > & Ev) |
| template void | ReallocArray< float > (int nblk, int blksize, Param XParam, Model< float > & XModel) |
| template void | ReallocArray< int > (int nblk, int blksize, int *& zs, int *& h, int *& u, int *& v) |
| template void | ReallocArray< int > (int nblk, int blksize, int *& zs, int *& h, int *& u, int *& v, int *& U, int *& hU) |
| __host__ int | memloc (Param XParam, int i, int j, int ib) Compute memory index for a cell in a block (using Param ). |
| __host__ __device__ int | memloc (int halowidth, int blkmemwidth, int i, int j, int ib) Compute memory index for a cell in a block (using explicit sizes). |
Macros
| Type | Name |
|---|---|
| define | ALIGN_UP (x, size) ( ((size\_t)x+(size-1))&(~(size-1)) ) |
| define | MEMORY_ALIGNMENT 4096 |
Public Functions Documentation
function AllocateCPU
Allocate memory for a single array on the CPU.
Allocates memory for the given array and checks for allocation failure.
Template parameters:
TData type (float or int)
Parameters:
nxNumber of x elementsnyNumber of y elementszbArray to allocate
function AllocateCPU
Allocate memory for multiple arrays (zs, h, u, v) on the CPU.
Allocates memory for the given arrays.
Template parameters:
TData type (float, double, int)
Parameters:
nxNumber of x elementsnyNumber of y elementszsArray to allocatehArray to allocateuArray to allocatevArray to allocate
function AllocateCPU
Allocate memory for extended arrays (zs, h, u, v, U, hU) on the CPU.
template<class T>
__host__ void AllocateCPU (
int nx,
int ny,
T *& zs,
T *& h,
T *& u,
T *& v,
T *& U,
T *& hU
)
Allocates memory for the given arrays.
Template parameters:
TData type (float, double, int)
Parameters:
nxNumber of x elementsnyNumber of y elementszsArray to allocatehArray to allocateuArray to allocatevArray to allocateUArray to allocatehUArray to allocate
function AllocateCPU
Allocate memory for gradient arrays on the CPU.
Allocates memory for all gradient arrays in GradientsP structure.
Template parameters:
TData type (float or double)
Parameters:
nxNumber of x elementsnyNumber of y elementsGradGradientsP structure to allocate
function AllocateCPU
Allocate memory for evolving variables on the CPU.
Allocates memory for h, zs, u, v arrays in EvolvingP structure.
Template parameters:
TData type (float or double)
Parameters:
nblkNumber of blocksblksizeBlock sizeEvEvolvingP structure to allocate
function AllocateCPU
Allocate memory for extended evolving variables on the CPU.
Allocates memory for h, zs, u, v, U, hU arrays in EvolvingP_M structure.
Template parameters:
TData type (float or double)
Parameters:
nblkNumber of blocksblksizeBlock sizeEvEvolvingP_M structure to allocate
function AllocateCPU
Allocate all model arrays on the CPU.
Allocates memory for all arrays in the Model structure, including blocks, gradients, fluxes, and output buffers.
Template parameters:
TData type (float or double)
Parameters:
function AllocateCPU< double >
template void AllocateCPU< double > (
int nx,
int ny,
double *& zs,
double *& h,
double *& u,
double *& v
)
function AllocateCPU< double >
template void AllocateCPU< double > (
int nx,
int ny,
double *& zs,
double *& h,
double *& u,
double *& v,
double *& U,
double *& hU
)
function AllocateCPU< double >
function AllocateCPU< double >
template void AllocateCPU< double > (
int nblk,
int blksize,
Param XParam,
Model < double > & XModel
)
function AllocateCPU< float >
template void AllocateCPU< float > (
int nx,
int ny,
float *& zs,
float *& h,
float *& u,
float *& v
)
function AllocateCPU< float >
template void AllocateCPU< float > (
int nx,
int ny,
float *& zs,
float *& h,
float *& u,
float *& v,
float *& U,
float *& hU
)
function AllocateCPU< float >
function AllocateCPU< float >
template void AllocateCPU< float > (
int nblk,
int blksize,
Param XParam,
Model < float > & XModel
)
function AllocateCPU< int >
function AllocateCPU< int >
template void AllocateCPU< int > (
int nx,
int ny,
int *& zs,
int *& h,
int *& u,
int *& v,
int *& U,
int *& hU
)
function AllocateGPU
Allocate memory on the GPU for a single array.
Allocates device memory for the given array.
Template parameters:
TData type (float or double)
Parameters:
nxNumber of x elementsnyNumber of y elementsz_gDevice pointer output
function AllocateGPU
Allocate memory on the GPU for multiple arrays (zs, h, u, v).
Allocates device memory for the given arrays.
Template parameters:
TData type (float or double)
Parameters:
nxNumber of x elementsnyNumber of y elementszsDevice pointer outputhDevice pointer outputuDevice pointer outputvDevice pointer output
function AllocateGPU
Allocate memory on the GPU for extended arrays (zs, h, u, v, U, hU).
template<class T>
void AllocateGPU (
int nx,
int ny,
T *& zs,
T *& h,
T *& u,
T *& v,
T *& U,
T *& hU
)
Allocates device memory for the given arrays.
Template parameters:
TData type (float or double)
Parameters:
nxNumber of x elementsnyNumber of y elementszsDevice pointer outputhDevice pointer outputuDevice pointer outputvDevice pointer outputUDevice pointer outputhUDevice pointer output
function AllocateGPU
Allocate memory on the GPU for gradient arrays.
Allocates device memory for all gradient arrays in GradientsP structure.
Template parameters:
TData type (float or double)
Parameters:
nxNumber of x elementsnyNumber of y elementsGradGradientsP structure to allocate
function AllocateGPU
Allocate memory on the GPU for evolving variables structure.
Allocates device memory for all arrays in EvolvingP structure.
Template parameters:
TData type (float or double)
Parameters:
nblkNumber of blocksblksizeBlock sizeEvEvolvingP structure to allocate
function AllocateGPU
Allocate memory on the GPU for extended evolving variables structure.
Allocates device memory for all arrays in EvolvingP_M structure.
Template parameters:
TData type (float or double)
Parameters:
nblkNumber of blocksblksizeBlock sizeEvEvolvingP_M structure to allocate
function AllocateGPU
Allocate all model arrays on the GPU.
Allocates device memory for all arrays in the Model structure, including blocks, gradients, fluxes, and output buffers.
Template parameters:
TData type (float or double)
Parameters:
function AllocateGPU< double >
template void AllocateGPU< double > (
int nx,
int ny,
double *& zs,
double *& h,
double *& u,
double *& v
)
function AllocateGPU< double >
template void AllocateGPU< double > (
int nx,
int ny,
double *& zs,
double *& h,
double *& u,
double *& v,
double *& U,
double *& hU
)
function AllocateGPU< double >
function AllocateGPU< double >
template void AllocateGPU< double > (
int nblk,
int blksize,
Param XParam,
Model < double > & XModel
)
function AllocateGPU< float >
template void AllocateGPU< float > (
int nx,
int ny,
float *& zs,
float *& h,
float *& u,
float *& v
)
function AllocateGPU< float >
template void AllocateGPU< float > (
int nx,
int ny,
float *& zs,
float *& h,
float *& u,
float *& v,
float *& U,
float *& hU
)
function AllocateGPU< float >
function AllocateGPU< float >
template void AllocateGPU< float > (
int nblk,
int blksize,
Param XParam,
Model < float > & XModel
)
function AllocateGPU< int >
function AllocateGPU< int >
template void AllocateGPU< int > (
int nx,
int ny,
int *& zs,
int *& h,
int *& u,
int *& v,
int *& U,
int *& hU
)
function AllocateMappedMemCPU
Allocate mapped memory on the CPU for CUDA interop.
Allocates pinned or mapped memory for CUDA host-device interoperation.
Template parameters:
TData type (float or double)
Parameters:
nxNumber of x elementsnyNumber of y elementsgpudeviceGPU device indexzPointer to allocated memory
function AllocateMappedMemCPU< double >
function AllocateMappedMemCPU< float >
function AllocateMappedMemCPU< int >
function AllocateMappedMemGPU
Get device pointer for mapped host memory.
Retrieves the device pointer for host memory mapped for CUDA interop.
Template parameters:
TData type (float or double)
Parameters:
nxNumber of x elementsnyNumber of y elementsgpudeviceGPU device indexz_gDevice pointer outputzHost pointer input
function AllocateMappedMemGPU< double >
template void AllocateMappedMemGPU< double > (
int nx,
int ny,
int gpudevice,
double *& z_g,
double * z
)
function AllocateMappedMemGPU< float >
template void AllocateMappedMemGPU< float > (
int nx,
int ny,
int gpudevice,
float *& z_g,
float * z
)
function AllocateMappedMemGPU< int >
function FillCPU
Fill a CPU array with a specified value.
Sets all elements of the array to the given fill value.
Template parameters:
TData type (float, double, int)
Parameters:
nxNumber of x elementsnyNumber of y elementsfillvalValue to fillzbArray to fill
function FillCPU< double >
function FillCPU< float >
function FillCPU< int >
function ReallocArray
Reallocate memory for a single array.
Reallocates memory for the given array to match the new block and size.
Template parameters:
TData type (float or double)
Parameters:
nblkNumber of blocksblksizeBlock sizezbArray to reallocate
function ReallocArray
Reallocate memory for multiple arrays (zs, h, u, v).
Reallocates memory for the given arrays to match the new block and size.
Template parameters:
TData type (float or double)
Parameters:
nblkNumber of blocksblksizeBlock sizezsArray to reallocatehArray to reallocateuArray to reallocatevArray to reallocate
function ReallocArray
Reallocate memory for extended arrays (zs, h, u, v, U, hU).
template<class T>
void ReallocArray (
int nblk,
int blksize,
T *& zs,
T *& h,
T *& u,
T *& v,
T *& U,
T *& hU
)
Reallocates memory for the given arrays to match the new block and size.
Template parameters:
TData type (float or double)
Parameters:
nblkNumber of blocksblksizeBlock sizezsArray to reallocatehArray to reallocateuArray to reallocatevArray to reallocateUArray to reallocatehUArray to reallocate
function ReallocArray
Reallocate memory for evolving variables structure.
Reallocates memory for all arrays in EvolvingP structure.
Template parameters:
TData type (float or double)
Parameters:
nblkNumber of blocksblksizeBlock sizeEvEvolvingP structure to reallocate
function ReallocArray
Reallocate memory for extended evolving variables structure.
Reallocates memory for all arrays in EvolvingP_M structure.
Template parameters:
TData type (float or double)
Parameters:
nblkNumber of blocksblksizeBlock sizeEvEvolvingP_M structure to reallocate
function ReallocArray
Reallocate all model arrays.
Reallocates memory for all arrays in the Model structure, including blocks, gradients, fluxes, and output buffers.
Template parameters:
TData type (float or double)
Parameters:
nblkNumber of blocksblksizeBlock sizeXParamModel parametersXModelModel structure to reallocate
function ReallocArray< double >
template void ReallocArray< double > (
int nblk,
int blksize,
double *& zs,
double *& h,
double *& u,
double *& v
)
function ReallocArray< double >
template void ReallocArray< double > (
int nblk,
int blksize,
double *& zs,
double *& h,
double *& u,
double *& v,
double *& U,
double *& hU
)
function ReallocArray< double >
function ReallocArray< double >
function ReallocArray< double >
template void ReallocArray< double > (
int nblk,
int blksize,
Param XParam,
Model < double > & XModel
)
function ReallocArray< float >
template void ReallocArray< float > (
int nblk,
int blksize,
float *& zs,
float *& h,
float *& u,
float *& v
)
function ReallocArray< float >
template void ReallocArray< float > (
int nblk,
int blksize,
float *& zs,
float *& h,
float *& u,
float *& v,
float *& U,
float *& hU
)
function ReallocArray< float >
function ReallocArray< float >
function ReallocArray< float >
template void ReallocArray< float > (
int nblk,
int blksize,
Param XParam,
Model < float > & XModel
)
function ReallocArray< int >
template void ReallocArray< int > (
int nblk,
int blksize,
int *& zs,
int *& h,
int *& u,
int *& v
)
function ReallocArray< int >
template void ReallocArray< int > (
int nblk,
int blksize,
int *& zs,
int *& h,
int *& u,
int *& v,
int *& U,
int *& hU
)
function memloc
Compute memory index for a cell in a block (using Param ).
Calculates the linear memory index for a cell in a block using model parameters.
Parameters:
XParamModel parametersiCell x-indexjCell y-indexibBlock index
Returns:
Linear memory index
function memloc
Compute memory index for a cell in a block (using explicit sizes).
Calculates the linear memory index for a cell in a block using explicit halo and block sizes.
Parameters:
halowidthHalo widthblkmemwidthBlock memory widthiCell x-indexjCell y-indexibBlock index
Returns:
Linear memory index
Macro Definition Documentation
define ALIGN_UP
define MEMORY_ALIGNMENT
The documentation for this class was generated from the following file src/MemManagement.cu