| kspaceFirstOrder3D-CUDA 1.1 The CUDA/C++ implementation of the k-wave toolbox for the time-domain simulation of acoustic wave fields in 3D

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Attributes | Protected Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
TCUDAParameters Class Reference

Class responsible for CUDA runtime setup. More...

`#include <CUDAParameters.h>`

## Public Member Functions
| ~TCUDAParameters ()
| Destructor.
int | GetDeviceIdx () const
| Get Idx of the device being used.
int | GetSolverBlockSize1D () const
| Get number of threads for 1D block used by kSpaceSolver.
int | GetSolverGridSize1D () const
| Get number of block for 1D grid used by kSpaceSolver.
dim3 | GetSolverTransposeBlockSize () const
| Get block size for the transposition kernels.
dim3 | GetSolverTransposeGirdSize () const
| Get grid size for the transposition kernels.
int | GetSamplerBlockSize1D () const
| Get number of threads for the 1D data sampling kernels.
int | GetSamplerGridSize1D () const
| Get Number of blocks for the 1D data sampling kernels.
std::string | GetDeviceName () const
| Get the name of the device used. More...
void | SelectDevice (const int DeviceIdx=DEFAULT_DEVICE_IDX)
| Select cuda device for execution. More...
void | SetKernelConfiguration ()
| Set kernel configurations based on the simulation parameters. More...
void | SetUpDeviceConstants () const
| Upload useful simulation constants into device constant memory. More...
const cudaDeviceProp & | GetDeviceProperties () const
| Return properties of currently used GPU.

## Static Public Attributes
static const int | DEFAULT_DEVICE_IDX = -1
| Default Device Index - no default GPU.

## Protected Member Functions
| TCUDAParameters ()
| Default constructor - only friend class can create an instance. More...
| TCUDAParameters (const TCUDAParameters &src)
| Copy constructor not allowed for public.
TCUDAParameters & | operator= (const TCUDAParameters &src)
| operator = not allowed for public.
void | CheckCUDAVersion ()
| Check whether the CUDA driver version installed is sufficient for the code. More...
bool | CheckCUDACodeVersion ()
| Check whether the code was compiled for a given SM model. More...

## Private Attributes
int | deviceIdx
| Index of the device the code is being run on.
int | solverBlockSize1D
| Number of threads for 1D block used by kSpaceSolver.
int | solverGridSize1D
| Number of block for 1D grid used by kSpaceSolver.
dim3 | solverTransposeBlockSize
| Block size for the transposition kernels.
dim3 | solverTransposeGirdSize
| Grid size for the transposition kernels.
int | samplerBlockSize1D
| Number of threads for the 1D data sampling kernels.
int | samplerGridSize1D
| Number of blocks for the 1D data sampling kernels.
cudaDeviceProp | deviceProperties
| Device properties of the selected GPU.

## Static Private Attributes
static const int | UNDEFINDED_SIZE = -1
| Undefined block or grid size.

## Friends
class | TParameters
| Only TParameters can create this class.

## Detailed Description

Class responsible for selecting a CUDA device, block and grid dimensions, etc.
The class can only by constructed from inside TPrameters and there mustn't be more than 1 instance in the code

Definition at line 48 of file CUDAParameters.h.

## Constructor & Destructor Documentation

TCUDAParameters::TCUDAParameters | ( |  | ) |
| protected

Constructor.

Definition at line 51 of file CUDAParameters.cpp.

## Member Function Documentation

bool TCUDAParameters::CheckCUDACodeVersion | ( |  | ) |
| protected

Check whether the GPU has SM 2.0 at least.

Returns
  the GPU version

Definition at line 350 of file CUDAParameters.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void TCUDAParameters::CheckCUDAVersion | ( |  | ) |
| protected

Check whether the CUDA driver version installed is sufficient for the code. If anything goes wrong, throw an exception and exit/

Exceptions

  runtime_error | when the CUDA driver is too old.

Definition at line 321 of file CUDAParameters.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

std::string TCUDAParameters::GetDeviceName | ( |  | ) | const

Return the name of device used.

Returns
  device name of the selected GPU

Definition at line 73 of file CUDAParameters.cpp.

Here is the caller graph for this function:

void TCUDAParameters::SelectDevice | ( | const int | deviceIdx = `DEFAULT_DEVICE_IDX` | ) |

Select cuda device for execution. If no device is specified, the first free is chosen. The routine also checks whether the CUDA runtime and driver version match and whether the GPU is supported by the code. If there is no free device is present, the code terminates

Parameters

  [in] | deviceIdx | - Device index (default DEFAULT_DEVICE_IDX)

Definition at line 90 of file CUDAParameters.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void TCUDAParameters::SetKernelConfiguration | ( |  | ) |

Set kernel configuration. Based on the dimension sizes, sensors masks, and the GPU architecture, adequate CUDA kernel configurations are selected.

Definition at line 197 of file CUDAParameters.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void TCUDAParameters::SetUpDeviceConstants | ( |  | ) | const

Upload useful simulation constants into device constant memory.

Definition at line 254 of file CUDAParameters.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

The documentation for this class was generated from the following files:

- Parameters/CUDAParameters.h
- Parameters/CUDAParameters.cpp