Uni20
Asynchronous tensor and runtime library.
Loading...
Searching...
No Matches
Classes | Concepts | Functions
uni20::cublas Namespace Reference

Classes

class  CublasError
 Exception carrying a failed cuBLAS operation and device identity. More...
 
class  ExecutionAcquireAwaiter
 Awaiter that reserves a cuBLAS handle before waiting for an idle stream. More...
 
class  ExecutionLease
 Move-only dynamic pairing of one cuBLAS handle slot and one idle stream. More...
 
class  ExecutionPool
 Device-local cuBLAS handle pool combined with a shared idle-stream pool. More...
 
class  HandleSlot
 One expensive reusable cuBLAS handle and its handle-local state. More...
 

Concepts

concept  CublasScalar
 Scalar types supported by the cuBLAS GEMM wrappers.
 
concept  CublasLevelOneScalar
 Scalar types supported by the cuBLAS level-one wrappers.
 

Functions

ExecutionAcquireAwaiter acquire_execution (ExecutionPool &pool) noexcept
 Acquire a cuBLAS handle and idle stream without blocking a CUDA task.
 
void check (cublasStatus_t status, std::string_view operation, int device, std::source_location where=std::source_location::current())
 Raise unless a cuBLAS call returned CUBLAS_STATUS_SUCCESS.
 
presentation::report_builder diagnostic_report (CublasError const &error)
 Build a presentation report for a cuBLAS provider failure.
 
template<CublasLevelOneScalar Scalar>
auto dotc (ExecutionLease &execution, int size, Scalar const *lhs, Scalar const *rhs) -> Scalar
 Compute the conjugate-linear dot product and return a host scalar.
 
ExecutionPool & execution_pool (cuda::DeviceResources &resources)
 Return the lazily constructed cuBLAS execution pool for one CUDA device.
 
ExecutionPool & execution_pool (cuda::DeviceResources &resources, std::size_t handle_count)
 Configure or return the canonical cuBLAS execution pool for one device.
 
template<CublasScalar Scalar>
void gemm (ExecutionLease &execution, char lhs_transform, char rhs_transform, int rows, int cols, int inner, Scalar alpha, Scalar const *lhs, int lhs_leading_dimension, Scalar const *rhs, int rhs_leading_dimension, Scalar beta, Scalar *output, int output_leading_dimension)
 Enqueue column-major GEMM through an exclusive handle/stream lease.
 
template<CublasLevelOneScalar Scalar>
auto nrm2 (ExecutionLease &execution, int size, Scalar const *input) -> uni20::make_real_t< Scalar >
 Compute a Euclidean norm and return a host real scalar.
 
void raise_error (cublasStatus_t status, std::string_view operation, int device, std::source_location where=std::source_location::current())
 Raise a structured cuBLAS provider failure.
 
std::string_view status_name (cublasStatus_t status) noexcept
 Return a stable symbolic name for a cuBLAS status value.
 

Function Documentation

◆ acquire_execution()

ExecutionAcquireAwaiter uni20::cublas::acquire_execution ( ExecutionPool &  pool)
inlinenoexcept

Acquire a cuBLAS handle and idle stream without blocking a CUDA task.

◆ check()

void uni20::cublas::check ( cublasStatus_t  status,
std::string_view  operation,
int  device,
std::source_location  where 
)

Raise unless a cuBLAS call returned CUBLAS_STATUS_SUCCESS.

◆ diagnostic_report()

presentation::report_builder uni20::cublas::diagnostic_report ( CublasError const &  error)
inline

Build a presentation report for a cuBLAS provider failure.

◆ dotc()

template<CublasLevelOneScalar Scalar>
auto uni20::cublas::dotc ( ExecutionLease &  execution,
int  size,
Scalar const *  lhs,
Scalar const *  rhs 
) -> Scalar

Compute the conjugate-linear dot product and return a host scalar.

The provider call uses host pointer mode. The operation stream is synchronized before the host result and any borrowed input storage may leave scope.

◆ execution_pool() [1/2]

ExecutionPool & uni20::cublas::execution_pool ( cuda::DeviceResources &  resources)

Return the lazily constructed cuBLAS execution pool for one CUDA device.

The device resources own the pool and retain it until after every Tensor and operation using those resources has finished. Unless the pool was configured explicitly, it contains one handle per stream.

◆ execution_pool() [2/2]

ExecutionPool & uni20::cublas::execution_pool ( cuda::DeviceResources &  resources,
std::size_t  handle_count 
)

Configure or return the canonical cuBLAS execution pool for one device.

This first-use configuration must precede concurrent provider use. Repeated calls must request the same handle count. The handle count cannot exceed the device's stream capacity.

Parameters
resourcesDevice resources that own the canonical pool.
handle_countNumber of reusable cuBLAS handles.

◆ gemm()

template<CublasScalar Scalar>
void uni20::cublas::gemm ( ExecutionLease &  execution,
char  lhs_transform,
char  rhs_transform,
int  rows,
int  cols,
int  inner,
Scalar  alpha,
Scalar const *  lhs,
int  lhs_leading_dimension,
Scalar const *  rhs,
int  rhs_leading_dimension,
Scalar  beta,
Scalar *  output,
int  output_leading_dimension 
)

Enqueue column-major GEMM through an exclusive handle/stream lease.

◆ nrm2()

template<CublasLevelOneScalar Scalar>
auto uni20::cublas::nrm2 ( ExecutionLease &  execution,
int  size,
Scalar const *  input 
) -> uni20::make_real_t<Scalar>

Compute a Euclidean norm and return a host real scalar.

The operation stream is synchronized before the result returns.

◆ raise_error()

void uni20::cublas::raise_error ( cublasStatus_t  status,
std::string_view  operation,
int  device,
std::source_location  where 
)

Raise a structured cuBLAS provider failure.

◆ status_name()

std::string_view uni20::cublas::status_name ( cublasStatus_t  status)
noexcept

Return a stable symbolic name for a cuBLAS status value.