Skip to main content

cutensorPermute

Function cutensorPermute 

Source
pub unsafe extern "C" fn cutensorPermute(
    handle: cutensorHandle_t,
    plan: cutensorPlan_t,
    alpha: *const c_void,
    A: *const c_void,
    B: *mut c_void,
    stream: cudaStream_t,
) -> cutensorStatus_t
Expand description

Performs the tensor permutation that is encoded by plan (see cutensorCreatePermutation).

This function performs an elementwise tensor operation of the form: $$ B_{\Pi^B(i_0,i_1,…,i_n)} = \alpha op_A(A_{\Pi^A(i_0,i_1,…,i_n)}) $$

Consequently, this function performs an out-of-place tensor permutation.

Where

  • A and B are multi-mode tensors (of arbitrary data types),
  • $\Pi^A, \Pi^B$ are permutation operators that permute the modes of A, B respectively,
  • $op_A$ is an unary element-wise operators (e.g., IDENTITY, SQR, CONJUGATE), and is specified when creating the operation descriptor using cutensorCreatePermutation

Remark

calls asynchronous functions, no reentrant, and thread-safe.

§Parameters

  • handle: Opaque handle holding cuTENSOR’s library context.
  • plan: Opaque handle holding all information about the desired tensor reduction (created by cutensorCreatePermutation followed by cutensorCreatePlan).
  • alpha: Scaling factor for A (see cutensorOperationDescriptorGetAttribute(desc, CUTENSOR_OPERATION_SCALAR_TYPE)). Pointer to the host memory. If alpha is zero, A is not read and the corresponding unary operator is not applied.
  • A: Multi-mode tensor of type typeA with nmodeA modes. Pointer to the GPU-accessible memory. The data accessed via this pointer must not overlap with the elements written to D.
  • B: Multi-mode tensor of type typeB with nmodeB modes. Pointer to the GPU-accessible memory.
  • stream: The CUDA stream.

§Return value