SWE
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
SWE_BlockCUDA Class Reference

#include <SWE_BlockCUDA.hh>

Inheritance diagram for SWE_BlockCUDA:
SWE_Block SWE_RusanovBlockCUDA SWE_WavePropagationBlockCuda

List of all members.

Public Member Functions

 SWE_BlockCUDA (int l_nx, int l_ny, float l_dx, float l_dy)
virtual ~SWE_BlockCUDA ()
virtual SWE_Block1DregisterCopyLayer (BoundaryEdge edge)
virtual SWE_Block1DgrabGhostLayer (BoundaryEdge edge)
const float * getCUDA_waterHeight ()
const float * getCUDA_bathymetry ()

Static Public Member Functions

static void printDeviceInformation ()
static void init (int i_cudaDevice=0)
static void finalize ()

Protected Member Functions

virtual void synchAfterWrite ()
virtual void synchWaterHeightAfterWrite ()
virtual void synchDischargeAfterWrite ()
virtual void synchBathymetryAfterWrite ()
virtual void synchGhostLayerAfterWrite ()
virtual void synchBeforeRead ()
virtual void synchWaterHeightBeforeRead ()
virtual void synchDischargeBeforeRead ()
virtual void synchBathymetryBeforeRead ()
virtual void synchCopyLayerBeforeRead ()
virtual void setBoundaryConditions ()

Protected Attributes

float * hd
float * hud
float * hvd
float * bd

Detailed Description

SWE_BlockCUDA extends the base class SWE_Block towards a base class for a CUDA implementation of the shallow water equations. It adds the respective variables in GPU memory, and provides methods for data transfer between main and GPU memory.


Constructor & Destructor Documentation

SWE_BlockCUDA::SWE_BlockCUDA ( int  l_nx,
int  l_ny,
float  l_dx,
float  l_dy 
)

Constructor: allocate variables for simulation

unknowns h,hu,hv,b are defined on grid indices [0,..,nx+1]*[0,..,ny+1] -> computational domain is [1,..,nx]*[1,..,ny] -> plus ghost cell layer

flux terms are defined for edges with indices [0,..,nx]*[1,..,ny] or [1,..,nx]*[0,..,ny] (for horizontal/vertical edges) Flux term with index (i,j) is located on the edge between cells with index (i,j) and (i+1,j) or (i,j+1)

bathymetry source terms are defined for cells with indices [1,..,nx]*[1,..,ny]

Parameters:
i_cudaDeviceID of the CUDA-device, which should be used.

Destructor: de-allocate all variables


Member Function Documentation

void SWE_BlockCUDA::finalize ( ) [static]

Cleans up the cuda device

const float* SWE_BlockCUDA::getCUDA_bathymetry ( ) [inline]
Returns:
pointer to the array #hb (bathymetry) in device memory
const float* SWE_BlockCUDA::getCUDA_waterHeight ( ) [inline]
Returns:
pointer to the array #hd (water height) in device memory

"grab" the ghost layer at the specific boundary in order to set boundary values in this ghost layer externally. The boundary conditions at the respective ghost layer is set to PASSIVE, such that the grabbing program component is responsible to provide correct values in the ghost layer, for example by receiving data from a remote copy layer via MPI communication.

Parameters:
specifiededge
Returns:
a SWE_Block1D object that contains row variables h, hu, and hv

Reimplemented from SWE_Block.

void SWE_BlockCUDA::init ( int  i_cudaDevice = 0) [static]

Initializes the cuda device Has to be called once at the beginning.

Print some available information about the CUDA devices.

id of the CUDA device.

total number of CUDA devices on this host.

drive and runtime version

device properties

register the row or column layer next to a boundary as a "copy layer", from which values will be copied into the ghost layer or a neighbour;

Returns:
a SWE_Block1D object that contains row variables h, hu, and hv

Reimplemented from SWE_Block.

void SWE_BlockCUDA::setBoundaryConditions ( ) [protected, virtual]

set the values of all ghost cells depending on the specifed boundary conditions

Reimplemented from SWE_Block.

void SWE_BlockCUDA::synchAfterWrite ( ) [protected, virtual]

Update all temporary and non-local (for heterogeneous computing) variables after an external update of the main variables h, hu, hv, and b.

Reimplemented from SWE_Block.

void SWE_BlockCUDA::synchBathymetryAfterWrite ( ) [protected, virtual]

Update temporary and non-local (for heterogeneous computing) variables after an external update of the bathymetry b

Reimplemented from SWE_Block.

void SWE_BlockCUDA::synchBathymetryBeforeRead ( ) [protected, virtual]

Update temporary and non-local (for heterogeneous computing) variables before an external access to the bathymetry b

Reimplemented from SWE_Block.

void SWE_BlockCUDA::synchBeforeRead ( ) [protected, virtual]

Update the main variables h, hu, hv, and b before an external read access: copies current content of the respective device variables hd, hud, hvd, bd

Reimplemented from SWE_Block.

void SWE_BlockCUDA::synchCopyLayerBeforeRead ( ) [protected, virtual]

Update (for heterogeneous computing) variables h, hu, hv in copy layers before an external access to the unknowns (only required for PASSIVE and CONNECT boundaries)

  • copy (up-to-date) content from device memory into main memory

Reimplemented from SWE_Block.

void SWE_BlockCUDA::synchDischargeAfterWrite ( ) [protected, virtual]

Update temporary and non-local (for heterogeneous computing) variables after an external update of the discharge variables hu and hv

Reimplemented from SWE_Block.

void SWE_BlockCUDA::synchDischargeBeforeRead ( ) [protected, virtual]

Update temporary and non-local (for heterogeneous computing) variables before an external access to the discharge variables hu and hv

Reimplemented from SWE_Block.

void SWE_BlockCUDA::synchGhostLayerAfterWrite ( ) [protected, virtual]

synchronise the ghost layer content of h, hu, and hv in main memory with device memory and auxiliary data structures, i.e. transfer memory from main/auxiliary memory into device memory

Reimplemented from SWE_Block.

void SWE_BlockCUDA::synchWaterHeightAfterWrite ( ) [protected, virtual]

Update temporary and non-local (for heterogeneous computing) variables after an external update of the water height h

Reimplemented from SWE_Block.

void SWE_BlockCUDA::synchWaterHeightBeforeRead ( ) [protected, virtual]

Update temporary and non-local (for heterogeneous computing) variables before an external access to the water height h

Reimplemented from SWE_Block.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends