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:
T
Data type (float or int)
Parameters:
nx
Number of x elementsny
Number of y elementszb
Array to allocate
function AllocateCPU
Allocate memory for multiple arrays (zs, h, u, v) on the CPU.
Allocates memory for the given arrays.
Template parameters:
T
Data type (float, double, int)
Parameters:
nx
Number of x elementsny
Number of y elementszs
Array to allocateh
Array to allocateu
Array to allocatev
Array 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:
T
Data type (float, double, int)
Parameters:
nx
Number of x elementsny
Number of y elementszs
Array to allocateh
Array to allocateu
Array to allocatev
Array to allocateU
Array to allocatehU
Array to allocate
function AllocateCPU
Allocate memory for gradient arrays on the CPU.
Allocates memory for all gradient arrays in GradientsP structure.
Template parameters:
T
Data type (float or double)
Parameters:
nx
Number of x elementsny
Number of y elementsGrad
GradientsP 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:
T
Data type (float or double)
Parameters:
nblk
Number of blocksblksize
Block sizeEv
EvolvingP 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:
T
Data type (float or double)
Parameters:
nblk
Number of blocksblksize
Block sizeEv
EvolvingP_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:
T
Data 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:
T
Data 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:
T
Data type (float or double)
Parameters:
nx
Number of x elementsny
Number of y elementsz_g
Device 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:
T
Data type (float or double)
Parameters:
nx
Number of x elementsny
Number of y elementsgpudevice
GPU device indexz
Pointer 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:
T
Data type (float or double)
Parameters:
nx
Number of x elementsny
Number of y elementsgpudevice
GPU device indexz_g
Device pointer outputz
Host 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:
T
Data type (float, double, int)
Parameters:
nx
Number of x elementsny
Number of y elementsfillval
Value to fillzb
Array 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:
T
Data type (float or double)
Parameters:
nblk
Number of blocksblksize
Block sizezb
Array 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:
T
Data type (float or double)
Parameters:
nblk
Number of blocksblksize
Block sizezs
Array to reallocateh
Array to reallocateu
Array to reallocatev
Array 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:
T
Data type (float or double)
Parameters:
nblk
Number of blocksblksize
Block sizezs
Array to reallocateh
Array to reallocateu
Array to reallocatev
Array to reallocateU
Array to reallocatehU
Array to reallocate
function ReallocArray
Reallocate memory for evolving variables structure.
Reallocates memory for all arrays in EvolvingP structure.
Template parameters:
T
Data type (float or double)
Parameters:
nblk
Number of blocksblksize
Block sizeEv
EvolvingP structure to reallocate
function ReallocArray
Reallocate memory for extended evolving variables structure.
Reallocates memory for all arrays in EvolvingP_M structure.
Template parameters:
T
Data type (float or double)
Parameters:
nblk
Number of blocksblksize
Block sizeEv
EvolvingP_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:
T
Data type (float or double)
Parameters:
nblk
Number of blocksblksize
Block sizeXParam
Model parametersXModel
Model 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:
XParam
Model parametersi
Cell x-indexj
Cell y-indexib
Block 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:
halowidth
Halo widthblkmemwidth
Block memory widthi
Cell x-indexj
Cell y-indexib
Block index
Returns:
Linear memory index
The documentation for this class was generated from the following file src/MemManagement.h