4
votes

I'm trying to parallelize some Python code that uses NumPy extensively with the Python multiprocessing package. Unfortunately, as noted here, the default linear algebra libraries provided by Apple (Accelerate/Veclib) cannot be run in parallel. So I'm trying to link an alternate LAPACK/BLAS when installing NumPy, in the hopes that my code can then be parallelized without crashes!

I downloaded and compiled an alternative LAPACK/BLAS. Then, following instructions here, I did:

export LAPACK=/usr/local/Cellar/lapack/3.4.2/lib/liblapack.dylib
export BLAS=/usr/local/Cellar/lapack/3.4.2/lib/libblas.dylib
export ATLAS=None
pip install numpy

which ran fine. However, if I run

numpy.show_config()

in Python, I get

atlas_threads_info:
  NOT AVAILABLE
blas_opt_info:
    extra_link_args = ['-Wl,-framework', '-Wl,Accelerate']
    extra_compile_args = ['-msse3', '-I/System/Library/Frameworks/vecLib.framework/Headers']
    define_macros = [('NO_ATLAS_INFO', 3)]
atlas_blas_threads_info:
  NOT AVAILABLE
openblas_info:
  NOT AVAILABLE
lapack_opt_info:
    extra_link_args = ['-Wl,-framework', '-Wl,Accelerate']
    extra_compile_args = ['-msse3']
    define_macros = [('NO_ATLAS_INFO', 3)]
atlas_info:
  NOT AVAILABLE
lapack_mkl_info:
  NOT AVAILABLE
blas_mkl_info:
  NOT AVAILABLE
atlas_blas_info:
  NOT AVAILABLE
mkl_info:
  NOT AVAILABLE

indicating NumPy is still using Apple's LAPACK/BLAS! And indeed crashes still abound. Could anyone help me?

1
Do you have either of the Fortran compilers, g77 or gfortran installed? I do not and see pretty much the same as what you are seeing - installed using Anaconda.Fred Mitchell
Yes, I have gfortran installed.Josh Burkart
To correct you slightly, the default linear algebra libraries provided by Apple "run in parallel" just fine; the problem is with calling them on both sides of a fork-without-exec (and I should note that there's no really good reason to expect that would work).Stephen Canon
These instructions worked for me: stackoverflow.com/a/14391693/777706Oriol Nieto

1 Answers

0
votes

I have no idea if either of these will be any help: https://github.com/obspy/obspy/wiki/Notes-on-Parallel-Processing-with-Python-and-ObsPy

Multiprocessing with numpy makes Python quit unexpectedly on OSX

I remember seeing something about lapack/blas on a Mac forum as well, but have not located it, but the author seemed to know what she was talking about.