Are LAPACK streams supported?

I am new to LAPACK routines, so I donโ€™t know them, and I want to use them in parallel loops (openmp).

I am using Ubuntu 14.04LTS and installing LAPACK using my package manager. Installed Version:

liblapack3 3.5.0-2ubuntu1 Library of linear algebra routines 3 - shared version 

Linked BLAS Library:

 libblas3 1.2.20110419-7 

So my first question is pretty simple: can I use any subroutine or LAPACK function in a loop parallelized using OpenMP ?. Id est, are they thread safe ?.

Other questions: can I use any subroutine or LAPACK function in my pure subroutine ?, id est, in the subroutine encoded by me and defined as pure.

If the answer to these questions is โ€œnot with all LAPACK procedures, but with some of them,โ€ can I do this with the following routines ?:

  • dgetrs
  • dgetrf
  • dgetri
  • dgecon

And the last question: do all my kernels use the LAPACK routines ?, id est, are they already parallel ?.

+6
source share
1 answer

The LAPACK library is expected to be thread safe. It does not support multiple threads, so it does not use (all) your kernel system. In fact, there is a specific announcement that all LAPACK routines are thread safe since v3.3 .

LAPACK, on โ€‹โ€‹the other hand, is designed to use BLAS library routines. The main BLAS also does not use any streams. However, there are several popular BLAS implementations (ATLAS, OpenBLAS, MKL) that have streaming versions of most BLAS routines. If your LAPACK library uses one of the aforementioned BLAS libraries, it is possible that their routines will start their own threads. Of course, in the above libraries, the user can control the number of threads used. You can review your documentation to learn how to do this.

So, you need to check which BLAS library implementation you are using in order to have a clear idea of โ€‹โ€‹using the LAPACK stream.

Regarding the use of pure functions inside, I want to note that both BLAS and LAPACK print specific error messages (stdout or stderr) on the screen. These messages are usually associated with false use of the subroutine, and not with mathematical errors. For example, if you try to invert a zero dimensional matrix. If you can provide this, perhaps you can say that it is clean.

+8
source

Source: https://habr.com/ru/post/989276/


All Articles