Skip to main content

cutensorReduce

Function cutensorReduce 

Source
pub unsafe extern "C" fn cutensorReduce(
    handle: cutensorHandle_t,
    plan: cutensorPlan_t,
    alpha: *const c_void,
    A: *const c_void,
    beta: *const c_void,
    C: *const c_void,
    D: *mut c_void,
    workspace: *mut c_void,
    workspaceSize: u64,
    stream: cudaStream_t,
) -> cutensorStatus_t
Expand description

Performs the tensor reduction that is encoded by plan (see cutensorCreateReduction).

§Parameters

  • handle: Opaque handle holding cuTENSOR’s library context.
  • plan: Opaque handle holding the reduction execution plan (created by cutensorCreateReduction followed by cutensorCreatePlan).
  • alpha: Scaling for A. Its data type is determined by ‘descCompute’ (see cutensorOperationDescriptorGetAttribute(desc, CUTENSOR_OPERATION_SCALAR_TYPE)). Pointer to the host memory.
  • A: Pointer to the data corresponding to A in device memory. Pointer to the GPU-accessible memory. The data accessed via this pointer must not overlap with the elements written to D.
  • beta: Scaling for C. Its data type is determined by ‘descCompute’ (see cutensorOperationDescriptorGetAttribute(desc, CUTENSOR_OPERATION_SCALAR_TYPE)). Pointer to the host memory.
  • C: Pointer to the data corresponding to C in device memory. Pointer to the GPU-accessible memory.
  • D: Pointer to the data corresponding to C in device memory. Pointer to the GPU-accessible memory.
  • workspace: Scratchpad (device) memory of size —at least— workspaceSize bytes; the workspace must be aligned to 256 bytes (i.e., the default alignment of cudaMalloc).
  • workspaceSize: Please use cutensorEstimateWorkspaceSize() to query the required workspace.
  • stream: The CUDA stream in which all the computation is performed.