Skip to main content

cutensorCreateTensorDescriptor

Function cutensorCreateTensorDescriptor 

Source
pub unsafe extern "C" fn cutensorCreateTensorDescriptor(
    handle: cutensorHandle_t,
    desc: *mut cutensorTensorDescriptor_t,
    numModes: u32,
    extent: *const i64,
    stride: *const i64,
    dataType: cudaDataType_t,
    alignmentRequirement: u32,
) -> cutensorStatus_t
Expand description

Creates a tensor descriptor.

This allocates a small amount of host-memory.

The user is responsible for calling cutensorDestroyTensorDescriptor to free the associated resources once the tensor descriptor is no longer used.

Remark

non-blocking, no reentrant, and thread-safe.

§Parameters

  • handle: Opaque handle holding cuTENSOR’s library context.
  • desc: Pointer to the address where the allocated tensor descriptor object will be stored.
  • numModes: Number of modes.
  • extent: Extent of each mode (must be larger than zero).
  • stride: stride[i] denotes the displacement (a.k.a. stride)—in elements of the base type—between two consecutive elements in the ith-mode. If stride is NULL, a packed generalized column-major memory layout is assumed (i.e., the strides increase monotonically from left to right). Each stride must be larger than zero; to be precise, a stride of zero can be achieved by omitting this mode entirely; for instance instead of writing C[a,b] = A[b,a] with strideA(a) = 0, you can write C[a,b] = A[b] directly; cuTENSOR will then automatically infer that the a-mode in A should be broadcasted.
  • dataType: Data type of the stored entries.
  • alignmentRequirement: Alignment (in bytes) to the base pointer that will be used in conjunction with this tensor descriptor (e.g., cudaMalloc has a default alignment of 256 bytes).

§Return value