[SciPy-User] Does scipy automatically work with openblas for parallelization?

Sturla Molden sturla.molden at gmail.com
Mon Jul 14 18:31:45 EDT 2014


Alex Eftimiades <alexeftimiades at gmail.com> wrote:

> This might effect might be well known to developers, but after a good
> deal of searching I could not find any indication that installing
> openblas would make scipy run linear algebra routines in parallel. If
> this is known, or at least could be confirmed, it would be helpful if it
> was documented.

If you use a parallel BLAS (and LAPACK) library, numpy.dot, numpy.linalg.*
and scipy.linalg.* will be parallelized depending on the BLAS
implementation.

Intel MKL, Apple Accelerate Framework (at least in OSX 10.9) and OpenBLAS
give good parallel performance. 

ATLAS is less performant and less scalable, but the official installers
that use ATLAS have some multithreading enabeled.

AMD ACML scales very badly on multiple processors, but the single-threaded
version of ACML is quite fast.

Netlib reference BLAS has no parallelization beyond what the Fortran
compiler can infere and vectorize.

IBM, HP and CRAY have optimized BLAS libraries too, but I am not sure how
well they perform.

Note that NumPy/SciPy code is usually memory bound, not CPU bound, in which
case it will help very little on the total runtime to run the computations
in parallel.

Also beware that you should only use Fortran contiguous arrays when calling
numpy.linalg.* and scipy.linalg.* if you care about performance. Otherwise
the BLAS and LAPACK wrappers will spend a significant amout of time copying
and transposing input and output arrays. numpy.dot is not affected by this
and is equally fast for C ordered arrays.

Sturla




More information about the SciPy-User mailing list