block_sparse_contract#

nvmath.bindings.cutensor.block_sparse_contract(
intptr_t handle,
intptr_t plan,
intptr_t alpha,
a,
b,
intptr_t beta,
c,
d,
intptr_t workspace,
uint64_t workspace_size,
intptr_t stream,
)[source]#

This routine computes the block-sparse tensor contraction .

Parameters:
  • handle (intptr_t) – Opaque handle holding cuTENSOR’s library context.

  • plan (intptr_t) – Opaque handle holding the contraction execution plan (created by cutensorcreateblockSparsecontraction followed by cutensorcreatePlan).

  • alpha (intptr_t) – Scaling for a*b. Its data type is determined by ‘desccompute’ (see cutensorcreateblockSparsecontraction). Pointer to host memory.

  • a (object) –

    Host-array of size numNonZeroblocks(a), containing pointers to GPU-accessible memory, corresponding the blocks of a. The data accessed via these pointers must not overlap with the elements written to d. It can be:

    • an int as the pointer address to the array, or

    • a Python sequence of ints (as pointer addresses).

  • b (object) –

    Host-array of size numNonZeroblocks(b), containing pointers to GPU-accessible memory, corresponding the blocks of b. The data accessed via these pointers must not overlap with the elements written to d. It can be:

    • an int as the pointer address to the array, or

    • a Python sequence of ints (as pointer addresses).

  • beta (intptr_t) – Scaling for c. Its data type is determined by ‘desccompute’ (see cutensorcreateblockSparsecontraction). Pointer to host memory.

  • c (object) –

    Host-array of size numNonZeroblocks(c), containing pointers to GPU-accessible memory, corresponding the blocks of c. It can be:

    • an int as the pointer address to the array, or

    • a Python sequence of ints (as pointer addresses).

  • d (object) –

    Host-array of size numNonZeroblocks(d), containing pointers to GPU-accessible memory, corresponding the blocks of d. It can be:

    • an int as the pointer address to the array, or

    • a Python sequence of ints (as pointer addresses).

  • workspace (intptr_t) – This pointer provides the required workspace in device memory. The workspace must be aligned to 256 bytes (i.e., the default alignment of cudaMalloc).

  • workspace_size (uint64_t) – Size of the workspace array in bytes; please refer to cutensorEstimateWorkspaceSize to query the required workspace. For block-sparse contractions, this estimate is exact.

  • stream (intptr_t) – The cUda stream to which all of the computation is synchronised.

See also

cutensorBlockSparseContract