Skip to main content

cusparseAxpby

Function cusparseAxpby 

Source
pub unsafe extern "C" fn cusparseAxpby(
    handle: cusparseHandle_t,
    alpha: *const c_void,
    vecX: cusparseConstSpVecDescr_t,
    beta: *const c_void,
    vecY: cusparseDnVecDescr_t,
) -> cusparseStatus_t
๐Ÿ‘ŽDeprecated
Expand description

The function computes the sum of a sparse vector vecX and a dense vector vecY.

In other words,

for i=0 to n-1
Y\[i\] = beta * Y\[i\]
for i=0 to nnz-1
Y\[X_indices[i\]] += alpha * X_values\[i\]

cusparseAxpby supports the following index type for representing the sparse vector vecX:

cusparseAxpby supports the following data types:

Uniform-precision computation:

X/Y/compute
cudaDataType_t::CUDA_R_32F
cudaDataType_t::CUDA_R_64F
cudaDataType_t::CUDA_C_32F
cudaDataType_t::CUDA_C_64F

Mixed-precision computation:

X/Ycompute
cudaDataType_t::CUDA_R_16FcudaDataType_t::CUDA_R_32F
cudaDataType_t::CUDA_R_16BF
cudaDataType_t::CUDA_C_16FcudaDataType_t::CUDA_C_32F[DEPRECATED]
cudaDataType_t::CUDA_C_16BF[DEPRECATED]

cusparseAxpby has the following constraints:

  • The arrays representing the sparse vector vecX must be aligned to 16 bytes

cusparseAxpby has the following properties:

  • The routine requires no extra storage
  • The routine supports asynchronous execution
  • Provides deterministic (bit-wise) results for each run if the sparse vector vecX indices are distinct
  • The routine allows indices of vecX to be unsorted

cusparseAxpby supports the following optimizations:

  • CUDA graph capture
  • Hardware Memory Compression

Please visit cuSPARSE Library Samples - cusparseAxpby for a code example.

ยงParameters

  • handle: Handle to the cuSPARSE library context.
  • alpha: $\alpha$ scalar used for multiplication of compute type.
  • vecX: Sparse vector X.
  • beta: $\beta$ scalar used for multiplication of compute type.
  • vecY: Dense vector Y.