DGEMM and ATLAS vs BLAS

Post here if you have a question about the installation process

DGEMM and ATLAS vs BLAS

Postby V1cSt0ne » Fri Aug 05, 2016 3:24 pm

I'm trying to properly link the LAPACK routine to perform a matrix multiply, dgemm, but I don't think that I properly understand the relationship between BLAS and LAPACK. I used the command

sudo apt-get liblapack-dev

I got the program to compile, but I removed the -llapack flag and kept the -lblas flagto ensure that it wasn't using BLAS routine, and the program still compiled. I am not sure how dgemm relates to lapack; I know that it is a blas routine, but LAPACK should provide an optimized version of this I would think. I can't find it in the documentation, which makes me think that it is an auxiliary function if that. Can anyone offer any clarification on this?
V1cSt0ne
 
Posts: 4
Joined: Wed Nov 18, 2015 7:48 pm

Re: DGEMM and ATLAS vs BLAS

Postby Julien Langou » Fri Aug 05, 2016 3:40 pm

DGEMM is in the BLAS. It is not in LAPACK. So, if your code only needs DGEMM, and you link with only BLAS, then all good indeed.

LAPACK needs BLAS. LAPACK does not provide BLAS. You have to add the external library BLAS to LAPACK for proper link.

BLAS does not need LAPACK. In BLAS is DGEMM.

LAPACK does not provide an optimized version of DGEMM. (Since it does not provide DGEMM to start with.)

LAPACK uses the fact that in optimized BLAS libraries (like ATLAS, vecLib, MKL, OpenBLAS, ACML, etc.) DGEMM is highly tuned and highly efficient. So the algorithm in LAPACK tries to call DGEMM on as large as possible matrices as many times as possible. This is how LAPACK is efficient. Without an optimized BLAS, most of LAPACK routines are not very efficient.

If you link with the blas that you got from `apt-get`, I do not think this BLAS is optimized. This is likely to be the reference BLAS which is provided with LAPACK (as a separate library but we provide it in the package).

Hope this makes some sense.
Cheers,
Julien.
Julien Langou
 
Posts: 821
Joined: Thu Dec 09, 2004 12:32 pm
Location: Denver, CO, USA

Re: DGEMM and ATLAS vs BLAS

Postby V1cSt0ne » Sat Aug 06, 2016 8:26 am

Yeah, that helps a lot! As I see, there's no ARM implementation for the BLAS libraries on the netlib site, so, for an optimized library, I should check out OpenBLAS for a quick, more optimized implementation, and ATLAS for best case, assuming that I get the tuning options all correct.
V1cSt0ne
 
Posts: 4
Joined: Wed Nov 18, 2015 7:48 pm


Return to Installation

Who is online

Users browsing this forum: No registered users and 1 guest