__config__.py 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. # This file is generated by numpy's setup.py
  2. # It contains system_info results at the time of building this package.
  3. __all__ = ["get_info","show"]
  4. import os
  5. import sys
  6. extra_dll_dir = os.path.join(os.path.dirname(__file__), '.libs')
  7. if sys.platform == 'win32' and os.path.isdir(extra_dll_dir):
  8. os.add_dll_directory(extra_dll_dir)
  9. 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']}
  10. 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']}
  11. 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']}
  12. 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']}
  13. def get_info(name):
  14. g = globals()
  15. return g.get(name, g.get(name + "_info", {}))
  16. def show():
  17. """
  18. Show libraries in the system on which NumPy was built.
  19. Print information about various resources (libraries, library
  20. directories, include directories, etc.) in the system on which
  21. NumPy was built.
  22. See Also
  23. --------
  24. get_include : Returns the directory containing NumPy C
  25. header files.
  26. Notes
  27. -----
  28. 1. Classes specifying the information to be printed are defined
  29. in the `numpy.distutils.system_info` module.
  30. Information may include:
  31. * ``language``: language used to write the libraries (mostly
  32. C or f77)
  33. * ``libraries``: names of libraries found in the system
  34. * ``library_dirs``: directories containing the libraries
  35. * ``include_dirs``: directories containing library header files
  36. * ``src_dirs``: directories containing library source files
  37. * ``define_macros``: preprocessor macros used by
  38. ``distutils.setup``
  39. * ``baseline``: minimum CPU features required
  40. * ``found``: dispatched features supported in the system
  41. * ``not found``: dispatched features that are not supported
  42. in the system
  43. 2. NumPy BLAS/LAPACK Installation Notes
  44. Installing a numpy wheel (``pip install numpy`` or force it
  45. via ``pip install numpy --only-binary :numpy: numpy``) includes
  46. an OpenBLAS implementation of the BLAS and LAPACK linear algebra
  47. APIs. In this case, ``library_dirs`` reports the original build
  48. time configuration as compiled with gcc/gfortran; at run time
  49. the OpenBLAS library is in
  50. ``site-packages/numpy.libs/`` (linux), or
  51. ``site-packages/numpy/.dylibs/`` (macOS), or
  52. ``site-packages/numpy/.libs/`` (windows).
  53. Installing numpy from source
  54. (``pip install numpy --no-binary numpy``) searches for BLAS and
  55. LAPACK dynamic link libraries at build time as influenced by
  56. environment variables NPY_BLAS_LIBS, NPY_CBLAS_LIBS, and
  57. NPY_LAPACK_LIBS; or NPY_BLAS_ORDER and NPY_LAPACK_ORDER;
  58. or the optional file ``~/.numpy-site.cfg``.
  59. NumPy remembers those locations and expects to load the same
  60. libraries at run-time.
  61. In NumPy 1.21+ on macOS, 'accelerate' (Apple's Accelerate BLAS
  62. library) is in the default build-time search order after
  63. 'openblas'.
  64. Examples
  65. --------
  66. >>> import numpy as np
  67. >>> np.show_config()
  68. blas_opt_info:
  69. language = c
  70. define_macros = [('HAVE_CBLAS', None)]
  71. libraries = ['openblas', 'openblas']
  72. library_dirs = ['/usr/local/lib']
  73. """
  74. from numpy.core._multiarray_umath import (
  75. __cpu_features__, __cpu_baseline__, __cpu_dispatch__
  76. )
  77. for name,info_dict in globals().items():
  78. if name[0] == "_" or type(info_dict) is not type({}): continue
  79. print(name + ":")
  80. if not info_dict:
  81. print(" NOT AVAILABLE")
  82. for k,v in info_dict.items():
  83. v = str(v)
  84. if k == "sources" and len(v) > 200:
  85. v = v[:60] + " ...\n... " + v[-60:]
  86. print(" %s = %s" % (k,v))
  87. features_found, features_not_found = [], []
  88. for feature in __cpu_dispatch__:
  89. if __cpu_features__[feature]:
  90. features_found.append(feature)
  91. else:
  92. features_not_found.append(feature)
  93. print("Supported SIMD extensions in this NumPy install:")
  94. print(" baseline = %s" % (','.join(__cpu_baseline__)))
  95. print(" found = %s" % (','.join(features_found)))
  96. print(" not found = %s" % (','.join(features_not_found)))