nvmath.device.BlasOptions

class nvmath.device.BlasOptions(size, precision, data_type, *, code_type=None, block_size=None, block_dim=None, leading_dimension=None, transpose_mode=('non_transposed', 'non_transposed'), function='MM', execution='Block')[source]

A class that encapsulates a partial BLAS device function. A partial device function can be queried for available or optimal values for the some knobs (such as leading_dimension or block_dim). It does not contain a compiled, ready-to-use, device function until finalized using create().

Parameters:
  • size – A sequence of integers denoting the three dimensions (m, n, k) for the matrix multiplication problem.

  • precision – The computation precision specified as a numpy float dtype, currently supports numpy.float16, numpy.float32 and numpy.float64.

  • data_type – The data type of the input matrices, can be either 'real' or 'complex'.

  • code_type (CodeType) – The target GPU code and compute-capability.

  • block_size (int) – The total block size, optional. If not provided or set to 'suggested', will be set to a suggested value for 1D block dim.

  • block_dim (Dim3) – The block dimension for launching the CUDA kernel, optional. If not provided or set to 'suggested', will be set to a suggested value. Can’t not be used when block_size is explicitly specified.

  • leading_dimension (LeadingDimension) – The leading dimensions for the input matrices, optional. If not provided, will be set to match the matrix row/column dimension. Alternatively, if provided as 'suggested', will be set to a suggested value for optimal performance.

  • transpose_mode (TransposeMode) – The transpose mode for all input matrices. If not provided, no transposition by default.

  • function (str) – A string specifying the name of the function. Currently supports 'MM' (default) for matrix multiplication.

  • execution (str) – A string specifying the execution method, can be 'Block' or 'Thread'.

See also

The attributes of this class provide a 1:1 mapping with the CUDA C++ cuBLASDx APIs. For further details, please refer to cuBLASDx documentation.

Methods

__init__(size, precision, data_type, *, code_type=None, block_size=None, block_dim=None, leading_dimension=None, transpose_mode=('non_transposed', 'non_transposed'), function='MM', execution='Block')[source]
create(**kwargs)[source]
valid(*knobs)[source]

Attributes

block_dim
block_size
code_type
data_type
execution
function
leading_dimension
precision
size
transpose_mode