[petsc-dev] petsc4py, numpy's BLAS and PETSc's BLAS

Zhang, Hong hongzhang at anl.gov
Mon Oct 24 11:19:17 CDT 2022


The chances of these problems are very slim because almost nobody builds Numpy from source. I usually install it with pip. Pip-installed Numpy on Mac uses Openblas, which is shipped together with the numpy wheels. The official API to check which BLAS is used by Numpy is numpy.show_config(). However, it gives me false info on my laptop — the openblas libs do not really exist in /usr.local/lib.

openblas64__info:
    libraries = ['openblas64_', 'openblas64_']
    library_dirs = ['/usr/local/lib']
    language = c
    define_macros = [('HAVE_CBLAS', None), ('BLAS_SYMBOL_SUFFIX', '64_'), ('HAVE_BLAS_ILP64', None)]
    runtime_library_dirs = ['/usr/local/lib']
blas_ilp64_opt_info:
    libraries = ['openblas64_', 'openblas64_']
    library_dirs = ['/usr/local/lib']
    language = c
    define_macros = [('HAVE_CBLAS', None), ('BLAS_SYMBOL_SUFFIX', '64_'), ('HAVE_BLAS_ILP64', None)]
    runtime_library_dirs = ['/usr/local/lib']
openblas64__lapack_info:
    libraries = ['openblas64_', 'openblas64_']
    library_dirs = ['/usr/local/lib']
    language = c
    define_macros = [('HAVE_CBLAS', None), ('BLAS_SYMBOL_SUFFIX', '64_'), ('HAVE_BLAS_ILP64', None), ('HAVE_LAPACKE', None)]
    runtime_library_dirs = ['/usr/local/lib']
lapack_ilp64_opt_info:
    libraries = ['openblas64_', 'openblas64_']
    library_dirs = ['/usr/local/lib']
    language = c
    define_macros = [('HAVE_CBLAS', None), ('BLAS_SYMBOL_SUFFIX', '64_'), ('HAVE_BLAS_ILP64', None), ('HAVE_LAPACKE', None)]
    runtime_library_dirs = ['/usr/local/lib']
Supported SIMD extensions in this NumPy install:
    baseline = SSE,SSE2,SSE3
    found = SSSE3,SSE41,POPCNT,SSE42,AVX,F16C,FMA3,AVX2
    not found = AVX512F,AVX512CD,AVX512_KNL,AVX512_SKX,AVX512_CLX,AVX512_CNL,AVX512_ICL

I think Numpy is actually using the following openblas lib:
/usr/local/lib/python3.10/site-packages/numpy//.dylibs/libopenblas64_.0.dylib

I feel that it would be a big hassle if we want to determine the BLAS that Numpy is using, considering the different ways and platforms Numpy may be installed.

Hong (Mr.)

On Oct 21, 2022, at 4:20 PM, Barry Smith <bsmith at petsc.dev<mailto:bsmith at petsc.dev>> wrote:


 When PETSc is built with petsc4py this brings along, in some way, the BLAS/LAPACK that numpy is using. Yet PETSc is free to bring in its own BLAS/LAPACK libraries.

 To be completely proper should we be having configure (when used with petsc4py) determine the BLAS/LAPACK that numpy is using and only using that for PETSc's BLAS/LAPACK needs?  If not, why is ok to have both sets hanging around? Jose's new https://gitlab.com/petsc/petsc/-/merge_requests/5737 seems to indicate possible problems with having both.

 Barry

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20221024/c2bd989d/attachment.html>


More information about the petsc-dev mailing list