MatmulOptions#

class nvmath.sparse.MatmulOptions(
codegen: bool = False,
compute_type: int | None = None,
logger: Logger | None = None,
memory_limit: int | str | None = '80%',
blocking: Literal[True, 'auto'] = 'auto',
allocator: BaseCUDAMemoryManager | None = None,
)[source]#

A data class for providing options to the Matmul object and the wrapper function matmul().

codegen#

If True the operation will not be dispatched to cuSPARSE (even if it is supported) for UST operands. Instead, the kernel will be generated, compiled just-in-time, and used. The default is False.

Type:

bool

compute_type#

CUDA compute type. A suitable compute type will be selected if not specified.

Type:

nvmath.sparse.ComputeType

logger#

Python Logger object. The root logger will be used if a logger object is not provided.

Type:

logging.Logger

memory_limit#

Maximum memory available to the MM operation. It can be specified as a value (with optional suffix like K[iB], M[iB], G[iB]) or as a percentage. The default is 80% of the device memory.

Type:

int | str | None

blocking#

A flag specifying the behavior of the execution functions and methods, such as matmul() and Matmul.execute(). When blocking is True, the execution methods do not return until the operation is complete. When blocking is "auto", the methods return immediately when the inputs are on the GPU. The execution methods always block when the operands are on the CPU to ensure that the user doesn’t inadvertently use the result before it becomes available. The default is "auto".

Type:

Literal[True, ‘auto’]

allocator#

An object that supports the BaseCUDAMemoryManager protocol, used to draw device memory. If an allocator is not provided, a memory allocator from the library package will be used (torch.cuda.caching_allocator_alloc() for PyTorch operands, cupy.cuda.alloc() otherwise).

Type:

nvmath.memory.BaseCUDAMemoryManager | None

See also

Matmul, matmul()