Doubts with regards to CUBLAS Library doubt on what should be the value of "incx" parameter

Hello All,

This may be a silly doubt for many of you, but I want to clear it and be sure of what I am doing.

Suppose we want to use the CUBLAS level 1 function say finding the norm for example

now suppose I use a cuDoubleComplex as my data type in that case I will call cublasDzmrm2() function to calculate the norm.

The declaration of the function in the library is

         cublasStatus_t cublasDznrm2(cublasHandle_t handle, int n, const cuDoubleComplex *x, int incx, double result);

the documentation say that the fourth parameter “int incx” is for “stride between the elements of x”.

now if my array is having cuDoubleComplex data type and all elements are stored at consecutive location. what should be the value of incx ?

incx = 0 or 1 or 8 or 16 (since its cuDoubleComplex). whats the correct answer?

Thanks in advance


The units for INCX, INCY, etc. arguments are elements. So if you are accessing contiguous vectors, the appropriate value would be 1. The most common case of a non-unit element stride would be when operating on a row of a 2D matrix stored in column-major order, in which case the stride would be the leading dimension of the matrix (e.g. LDA, LDB) as rows are store non-contiguously.