Class CUDAUtils

Class Documentation

class CUDAUtils

The CUDAUtils provides basic functionality for querying baremetal CUDA GPU’s.

Public Functions

CUDAUtils()

Default Construct a new CUDAUtils object.

~CUDAUtils()

Destroy the CUDAUtils object.

void check_cuda_error(cudaError_t err, const char *file, int line)

Generic cuda error handler.

Parameters
  • err – This parameter holds the CUDA runtime API error code that you want to check. The CUDA runtime API functions return an error code of type

  • file – This parameter represents the name of the source code file where the check_cuda_error function is called. It is typically filled in automatically using the FILE macro when the macro is used in the code.

  • line – This parameter represents the line number in the source code where the check_cuda_error function is called. It is typically filled in automatically using the LINE macro when the macro is used in the code.

void print_gpu_info()

Prints details regarding GPU detected by CUDA libraries.

void checkGPUAvailability()

Check the availability of GPUs and validate the CUDA driver and runtime versions.

bool test_fibonacci(const size_t n)

Generate fibonacci sequence.

Generate fibonacci sequence using a GPU and validate the result

Parameters
  • n – Length of seqence

  • n – Length of sequence

Returns

true GPU sequence matches a CPU computed sequence.

Returns

false GPU sequence does not match a CPU computed sequence