Skip to content

File Setup_GPU.h

FileList > src > Setup_GPU.h

Go to the source code of this file

  • #include "General.h"
  • #include "Forcing.h"
  • #include "Param.h"
  • #include "Arrays.h"
  • #include "MemManagement.h"
  • #include "Halo.h"
  • #include "InitialConditions.h"

Public Functions

Type Name
void AllocateBndTEX (bndparam & side)
Allocate boundary texture for GPU.
void AllocateTEX (int nx, int ny, TexSetP & Tex, float * input)
Allocate and bind a CUDA texture object.
void CUDA_CHECK (cudaError CUDerr)
Check CUDA error status and print message if error occurs.
void CopyGPUtoCPU (int nblk, int blksize, T * z_cpu, T * z_gpu)
Copy data from GPU to CPU memory.
void CopytoGPU (int nblk, int blksize, Param XParam, Model< T > XModel_cpu, Model< T > XModel_gpu)
Copy complex data structures from CPU to GPU.
void CopytoGPU (int nblk, int blksize, T * z_cpu, T * z_gpu)
Copy data from CPU to GPU memory.
void CopytoGPU (int nblk, int blksize, EvolvingP< T > XEv_cpu, EvolvingP< T > XEv_gpu)
Copy complex data structures from CPU to GPU.
void CopytoGPU (int nblk, int blksize, EvolvingP_M< T > XEv_cpu, EvolvingP_M< T > XEv_gpu)
Copy complex data structures from CPU to GPU.
void CopytoGPU (int nblk, int blksize, GradientsP< T > XGrad_cpu, GradientsP< T > XGrad_gpu)
Copy complex data structures from CPU to GPU.
void SetupGPU (Param & XParam, Model< T > XModel, Forcing< float > & XForcing, Model< T > & XModel_g)
Setup and initialize GPU for simulation.

Public Functions Documentation

function AllocateBndTEX

Allocate boundary texture for GPU.

void AllocateBndTEX (
    bndparam & side
) 

Allocates and binds boundary water level data as a CUDA texture for GPU use.

Parameters:

  • side Boundary parameter structure

function AllocateTEX

Allocate and bind a CUDA texture object.

void AllocateTEX (
    int nx,
    int ny,
    TexSetP & Tex,
    float * input
) 

Allocates a CUDA array and creates a texture object for use in GPU kernels.

Parameters:

  • nx Number of x grid points
  • ny Number of y grid points
  • Tex Texture set structure
  • input Input data array

function CUDA_CHECK

Check CUDA error status and print message if error occurs.

void CUDA_CHECK (
    cudaError CUDerr
) 

Checks the CUDA error code and prints an error message if the code indicates failure.

Parameters:

  • CUDerr CUDA error code

function CopyGPUtoCPU

Copy data from GPU to CPU memory.

template<class T>
void CopyGPUtoCPU (
    int nblk,
    int blksize,
    T * z_cpu,
    T * z_gpu
) 

Copies an array from device (GPU) memory to host (CPU) memory using CUDA.

Template parameters:

  • T Data type

Parameters:

  • nblk Number of blocks
  • blksize Block size
  • z_cpu Destination array (CPU)
  • z_gpu Source array (GPU)

function CopytoGPU

Copy complex data structures from CPU to GPU.

template<class T>
void CopytoGPU (
    int nblk,
    int blksize,
    Param XParam,
    Model < T > XModel_cpu,
    Model < T > XModel_gpu
) 

This function copies the entire model structure from the host (CPU) to the device (GPU) memory.

Template parameters:

  • T Data type

Parameters:

  • nblk Number of blocks
  • blksize Block size
  • XParam Simulation parameters
  • XModel_cpu Source model structure (CPU)
  • XModel_gpu Destination model structure (GPU)

function CopytoGPU

Copy data from CPU to GPU memory.

template<class T>
void CopytoGPU (
    int nblk,
    int blksize,
    T * z_cpu,
    T * z_gpu
) 

Copies an array from host (CPU) memory to device (GPU) memory using CUDA.

Template parameters:

  • T Data type

Parameters:

  • nblk Number of blocks
  • blksize Block size
  • z_cpu Source array (CPU)
  • z_gpu Destination array (GPU)

function CopytoGPU

Copy complex data structures from CPU to GPU.

template<class T>
void CopytoGPU (
    int nblk,
    int blksize,
    EvolvingP < T > XEv_cpu,
    EvolvingP < T > XEv_gpu
) 

This function copies the evolving variables structure from the host (CPU) to the device (GPU) memory.

Template parameters:

  • T Data type

Parameters:

  • nblk Number of blocks
  • blksize Block size
  • XEv_cpu Source evolving variables structure (CPU)
  • XEv_gpu Destination evolving variables structure (GPU)

function CopytoGPU

Copy complex data structures from CPU to GPU.

template<class T>
void CopytoGPU (
    int nblk,
    int blksize,
    EvolvingP_M < T > XEv_cpu,
    EvolvingP_M < T > XEv_gpu
) 

This function copies the evolving variables with momentum structure from the host (CPU) to the device (GPU) memory.

Template parameters:

  • T Data type

Parameters:

  • nblk Number of blocks
  • blksize Block size
  • XEv_cpu Source evolving variables with momentum structure (CPU)
  • XEv_gpu Destination evolving variables with momentum structure (GPU)

function CopytoGPU

Copy complex data structures from CPU to GPU.

template<class T>
void CopytoGPU (
    int nblk,
    int blksize,
    GradientsP < T > XGrad_cpu,
    GradientsP < T > XGrad_gpu
) 

This function copies the gradients structure from the host (CPU) to the device (GPU) memory.

Template parameters:

  • T Data type

Parameters:

  • nblk Number of blocks
  • blksize Block size
  • XGrad_cpu Source gradients structure (CPU)
  • XGrad_gpu Destination gradients structure (GPU)

function SetupGPU

Setup and initialize GPU for simulation.

template<class T>
void SetupGPU (
    Param & XParam,
    Model < T > XModel,
    Forcing < float > & XForcing,
    Model < T > & XModel_g
) 

This function sets up the GPU device, allocates memory, and copies data from the host to the device.

Parameters:

  • XParam Simulation parameters
  • XModel Host model data structure
  • XForcing Forcing data structure
  • XModel_g Device model data structure


The documentation for this class was generated from the following file src/Setup_GPU.h