Skip to content

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.

template<class T>
__host__ void AllocateCPU (
    int nx,
    int ny,
    T *& zb
) 

Allocates memory for the given array and checks for allocation failure.

Template parameters:

  • T Data type (float or int)

Parameters:

  • nx Number of x elements
  • ny Number of y elements
  • zb Array to allocate

function AllocateCPU

Allocate memory for multiple arrays (zs, h, u, v) on the CPU.

template<class T>
__host__ void AllocateCPU (
    int nx,
    int ny,
    T *& zs,
    T *& h,
    T *& u,
    T *& v
) 

Allocates memory for the given arrays.

Template parameters:

  • T Data type (float, double, int)

Parameters:

  • nx Number of x elements
  • ny Number of y elements
  • zs Array to allocate
  • h Array to allocate
  • u Array to allocate
  • v Array 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:

  • T Data type (float, double, int)

Parameters:

  • nx Number of x elements
  • ny Number of y elements
  • zs Array to allocate
  • h Array to allocate
  • u Array to allocate
  • v Array to allocate
  • U Array to allocate
  • hU Array to allocate

function AllocateCPU

Allocate memory for gradient arrays on the CPU.

template<class T>
__host__ void AllocateCPU (
    int nx,
    int ny,
    GradientsP < T > & Grad
) 

Allocates memory for all gradient arrays in GradientsP structure.

Template parameters:

  • T Data type (float or double)

Parameters:

  • nx Number of x elements
  • ny Number of y elements
  • Grad GradientsP structure to allocate

function AllocateCPU

Allocate memory for evolving variables on the CPU.

template<class T>
void AllocateCPU (
    int nblk,
    int blksize,
    EvolvingP < T > & Ev
) 

Allocates memory for h, zs, u, v arrays in EvolvingP structure.

Template parameters:

  • T Data type (float or double)

Parameters:

  • nblk Number of blocks
  • blksize Block size
  • Ev EvolvingP structure to allocate

function AllocateCPU

Allocate memory for extended evolving variables on the CPU.

template<class T>
void AllocateCPU (
    int nblk,
    int blksize,
    EvolvingP_M < T > & Ev
) 

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 blocks
  • blksize Block size
  • Ev EvolvingP_M structure to allocate

function AllocateCPU

Allocate all model arrays on the CPU.

template<class T>
void AllocateCPU (
    int nblk,
    int blksize,
    Param XParam,
    Model < T > & XModel
) 

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:

  • nblk Number of blocks
  • blksize Block size
  • XParam Model parameters
  • XModel Model structure to allocate

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 >

template void AllocateCPU< double > (
    int nx,
    int ny,
    GradientsP < double > & Grad
) 

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 >

template void AllocateCPU< float > (
    int nx,
    int ny,
    GradientsP < float > & Grad
) 

function AllocateCPU< float >

template void AllocateCPU< float > (
    int nblk,
    int blksize,
    Param XParam,
    Model < float > & XModel
) 

function AllocateCPU< int >

template void AllocateCPU< int > (
    int nx,
    int ny,
    int *& zs,
    int *& h,
    int *& u,
    int *& v
) 

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.

template<class T>
void AllocateGPU (
    int nx,
    int ny,
    T *& z_g
) 

Allocates device memory for the given array.

Template parameters:

  • T Data type (float or double)

Parameters:

  • nx Number of x elements
  • ny Number of y elements
  • z_g Device pointer output

function AllocateGPU

Allocate memory on the GPU for multiple arrays (zs, h, u, v).

template<class T>
void AllocateGPU (
    int nx,
    int ny,
    T *& zs,
    T *& h,
    T *& u,
    T *& v
) 

Allocates device memory for the given arrays.

Template parameters:

  • T Data type (float or double)

Parameters:

  • nx Number of x elements
  • ny Number of y elements
  • zs Device pointer output
  • h Device pointer output
  • u Device pointer output
  • v Device 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:

  • T Data type (float or double)

Parameters:

  • nx Number of x elements
  • ny Number of y elements
  • zs Device pointer output
  • h Device pointer output
  • u Device pointer output
  • v Device pointer output
  • U Device pointer output
  • hU Device pointer output

function AllocateGPU

Allocate memory on the GPU for gradient arrays.

template<class T>
void AllocateGPU (
    int nx,
    int ny,
    GradientsP < T > & Grad
) 

Allocates device memory for all gradient arrays in GradientsP structure.

Template parameters:

  • T Data type (float or double)

Parameters:

  • nx Number of x elements
  • ny Number of y elements
  • Grad GradientsP structure to allocate

function AllocateGPU

Allocate memory on the GPU for evolving variables structure.

template<class T>
void AllocateGPU (
    int nblk,
    int blksize,
    EvolvingP < T > & Ev
) 

Allocates device memory for all arrays in EvolvingP structure.

Template parameters:

  • T Data type (float or double)

Parameters:

  • nblk Number of blocks
  • blksize Block size
  • Ev EvolvingP structure to allocate

function AllocateGPU

Allocate memory on the GPU for extended evolving variables structure.

template<class T>
void AllocateGPU (
    int nblk,
    int blksize,
    EvolvingP_M < T > & Ev
) 

Allocates device memory for all arrays in EvolvingP_M structure.

Template parameters:

  • T Data type (float or double)

Parameters:

  • nblk Number of blocks
  • blksize Block size
  • Ev EvolvingP_M structure to allocate

function AllocateGPU

Allocate all model arrays on the GPU.

template<class T>
void AllocateGPU (
    int nblk,
    int blksize,
    Param XParam,
    Model < T > & XModel
) 

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:

  • nblk Number of blocks
  • blksize Block size
  • XParam Model parameters
  • XModel Model structure to allocate

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 >

template void AllocateGPU< double > (
    int nx,
    int ny,
    GradientsP < double > & Grad
) 

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 >

template void AllocateGPU< float > (
    int nx,
    int ny,
    GradientsP < float > & Grad
) 

function AllocateGPU< float >

template void AllocateGPU< float > (
    int nblk,
    int blksize,
    Param XParam,
    Model < float > & XModel
) 

function AllocateGPU< int >

template void AllocateGPU< int > (
    int nx,
    int ny,
    int *& zs,
    int *& h,
    int *& u,
    int *& v
) 

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.

template<class T>
void AllocateMappedMemCPU (
    int nx,
    int ny,
    int gpudevice,
    T *& z
) 

Allocates pinned or mapped memory for CUDA host-device interoperation.

Template parameters:

  • T Data type (float or double)

Parameters:

  • nx Number of x elements
  • ny Number of y elements
  • gpudevice GPU device index
  • z Pointer to allocated memory

function AllocateMappedMemCPU< double >

template void AllocateMappedMemCPU< double > (
    int nx,
    int ny,
    int gpudevice,
    double *& z
) 

function AllocateMappedMemCPU< float >

template void AllocateMappedMemCPU< float > (
    int nx,
    int ny,
    int gpudevice,
    float *& z
) 

function AllocateMappedMemCPU< int >

template void AllocateMappedMemCPU< int > (
    int nx,
    int ny,
    int gpudevice,
    int *& z
) 

function AllocateMappedMemGPU

Get device pointer for mapped host memory.

template<class T>
void AllocateMappedMemGPU (
    int nx,
    int ny,
    int gpudevice,
    T *& z_g,
    T * z
) 

Retrieves the device pointer for host memory mapped for CUDA interop.

Template parameters:

  • T Data type (float or double)

Parameters:

  • nx Number of x elements
  • ny Number of y elements
  • gpudevice GPU device index
  • z_g Device pointer output
  • z Host 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 >

template void AllocateMappedMemGPU< int > (
    int nx,
    int ny,
    int gpudevice,
    int *& z_g,
    int * z
) 

function FillCPU

Fill a CPU array with a specified value.

template<class T>
__host__ void FillCPU (
    int nx,
    int ny,
    T fillval,
    T *& zb
) 

Sets all elements of the array to the given fill value.

Template parameters:

  • T Data type (float, double, int)

Parameters:

  • nx Number of x elements
  • ny Number of y elements
  • fillval Value to fill
  • zb Array to fill

function FillCPU< double >

template void FillCPU< double > (
    int nx,
    int ny,
    double fillval,
    double *& zb
) 

function FillCPU< float >

template void FillCPU< float > (
    int nx,
    int ny,
    float fillval,
    float *& zb
) 

function FillCPU< int >

template void FillCPU< int > (
    int nx,
    int ny,
    int fillval,
    int *& zb
) 

function ReallocArray

Reallocate memory for a single array.

template<class T>
void ReallocArray (
    int nblk,
    int blksize,
    T *& zb
) 

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 blocks
  • blksize Block size
  • zb Array to reallocate

function ReallocArray

Reallocate memory for multiple arrays (zs, h, u, v).

template<class T>
void ReallocArray (
    int nblk,
    int blksize,
    T *& zs,
    T *& h,
    T *& u,
    T *& 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 blocks
  • blksize Block size
  • zs Array to reallocate
  • h Array to reallocate
  • u Array to reallocate
  • v 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 blocks
  • blksize Block size
  • zs Array to reallocate
  • h Array to reallocate
  • u Array to reallocate
  • v Array to reallocate
  • U Array to reallocate
  • hU Array to reallocate

function ReallocArray

Reallocate memory for evolving variables structure.

template<class T>
void ReallocArray (
    int nblk,
    int blksize,
    EvolvingP < T > & Ev
) 

Reallocates memory for all arrays in EvolvingP structure.

Template parameters:

  • T Data type (float or double)

Parameters:

  • nblk Number of blocks
  • blksize Block size
  • Ev EvolvingP structure to reallocate

function ReallocArray

Reallocate memory for extended evolving variables structure.

template<class T>
void ReallocArray (
    int nblk,
    int blksize,
    EvolvingP_M < T > & Ev
) 

Reallocates memory for all arrays in EvolvingP_M structure.

Template parameters:

  • T Data type (float or double)

Parameters:

  • nblk Number of blocks
  • blksize Block size
  • Ev EvolvingP_M structure to reallocate

function ReallocArray

Reallocate all model arrays.

template<class T>
void ReallocArray (
    int nblk,
    int blksize,
    Param XParam,
    Model < T > & XModel
) 

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 blocks
  • blksize Block size
  • XParam Model parameters
  • XModel Model 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 >

template void ReallocArray< double > (
    int nblk,
    int blksize,
    EvolvingP < double > & Ev
) 

function ReallocArray< double >

template void ReallocArray< double > (
    int nblk,
    int blksize,
    EvolvingP_M < double > & Ev
) 

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 >

template void ReallocArray< float > (
    int nblk,
    int blksize,
    EvolvingP < float > & Ev
) 

function ReallocArray< float >

template void ReallocArray< float > (
    int nblk,
    int blksize,
    EvolvingP_M < float > & Ev
) 

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 ).

__host__ int memloc (
    Param XParam,
    int i,
    int j,
    int ib
) 

Calculates the linear memory index for a cell in a block using model parameters.

Parameters:

  • XParam Model parameters
  • i Cell x-index
  • j Cell y-index
  • ib Block index

Returns:

Linear memory index


function memloc

Compute memory index for a cell in a block (using explicit sizes).

__host__ __device__ int memloc (
    int halowidth,
    int blkmemwidth,
    int i,
    int j,
    int ib
) 

Calculates the linear memory index for a cell in a block using explicit halo and block sizes.

Parameters:

  • halowidth Halo width
  • blkmemwidth Block memory width
  • i Cell x-index
  • j Cell y-index
  • ib Block index

Returns:

Linear memory index


Macro Definition Documentation

define ALIGN_UP

#define ALIGN_UP (
    x,
    size
) `( ((size_t)x+(size-1))&(~(size-1)) )`

define MEMORY_ALIGNMENT

#define MEMORY_ALIGNMENT `4096`


The documentation for this class was generated from the following file src/MemManagement.cu