File MemManagement.h
FileList > src > MemManagement.h
Go to the source code of this file
#include "General.h"#include "Param.h"#include "Arrays.h"#include "Setup_GPU.h"
Public Functions
| Type | Name |
|---|---|
| void | AllocateCPU (int nx, int ny, T *& zb) Allocate memory for a single array on the CPU. |
| 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. |
| 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. |
| 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. |
| void | AllocateGPU (int nblk, int blksize, Param XParam, Model< T > & XModel) Allocate all model arrays on the GPU. |
| void | AllocateGPU (int nx, int ny, T *& z_g) Allocate memory on the GPU for a single array. |
| void | AllocateMappedMemCPU (int nx, int ny, int gpudevice, T *& z) Allocate mapped memory on the CPU for CUDA interop. |
| void | AllocateMappedMemGPU (int nx, int ny, int gpudevice, T *& z_g, T * z) Get device pointer for mapped host memory. |
| __host__ void | FillCPU (int nx, int ny, T fillval, T *& zb) Fill a CPU array with a specified value. |
| 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. |
| 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). |
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>
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 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
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 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 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 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 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 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
The documentation for this class was generated from the following file src/MemManagement.h