About cblas_dgbmv

64 views
Skip to first unread message

John Gliksberg

unread,
Nov 26, 2014, 12:14:14 PM11/26/14
to openbla...@googlegroups.com
Hello all, I have been using OpenBLAS for the past month in the spectrum of my CS studies.

(Disclaimer: I'm not well acquainted with the world of BLAS and such)

I am trying to compare my implementation of the product of a tridiagonal matrix (stocked in General Band format) with a vector, with OpenBLAS's cblas_dgbmv.

The vector I build with the OpenBLAS implementation has bad values and I am trying to figure out what I am doing wrong.

Here are bits of the code I'm using (nothing really incredible) :

/* building the square tridiagonal vector, leaving some
 * extra space in case it is needed (see LU factoring) */
double *getA(int n) {
    double *A;
    int i;
    A = (double *)malloc(n*4*sizeof(double));
    A[0] = 0;
    for (i=1; i<n;   i++) A[i]     = -1; // upper
    for (i=0; i<n;   i++) A[n+i]   =  2; // diag
    for (i=0; i<n-1; i++) A[n+n+i] = -1; // lower
    A[n+n+n-1] = 0; // end
    for (i=0; i<n; i++) A[n+n+n+i] = 0; // extra ( I have tried without of course )
    return A;
}


/* building a simple vector */
double *v = (double *)malloc(n*sizeof(double));
for (i=0; i<n; i++)
    v[i] = i;

/* calculating the matrix-vector product with dgbmv (Y := alpha*A*X+beta*Y) */
double *w = (double *)malloc(n*sizeof(double));
cblas_dgbmv(CblasColMajor, CblasNoTrans,
    n, n,      /* size */
    1, 1,      /* kl, ku */
    1., A, n,  /* alpha, A, lda */
    v, 1,      /* X, incX */
    0., w, 1   /* beta, Y, incY */
);


I invariably get results like
w = (1, 0, -1, -1, 9.63428e-322, 0)
though it should be something along the lines of
w = (-1, 0, 0, 0, 0, 6)


When looking through OpenBLAS sources I can't find %gb*.S implementation files like for %gemm*.S and such functions, so I really don't know how to go about finding out what I'm doing wrong.

Anyway if someone has some clue about what's going on, I'd love to hear about it :)
Thanks in advance,
-trosh

Zhang Xianyi

unread,
Nov 28, 2014, 3:23:02 AM11/28/14
to John Gliksberg, openbla...@googlegroups.com
Hi ,

For the gbmv, OpenBLAS doesn't provide a gbmv assembly kernels.

If OPENBLAS_NUM_THREADS=1 (single thread version), the call graph is listed as following.

OpenBLAS/interface/gbmv.c
                   |
OpenBLAS/driver/level2/gbmv_k.c
                   |
  some blas1 assembly kernels (dot, copy,axpy)


Xianyi

--
You received this message because you are subscribed to the Google Groups "OpenBLAS-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openblas-user...@googlegroups.com.
To post to this group, send email to openbla...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages