Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/numpy/__config__.py: 58%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

55 statements  

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 

5 

6import os 

7import sys 

8 

9extra_dll_dir = os.path.join(os.path.dirname(__file__), '.libs') 

10 

11if sys.platform == 'win32' and os.path.isdir(extra_dll_dir): 

12 os.add_dll_directory(extra_dll_dir) 

13 

14blas_armpl_info={} 

15blas_mkl_info={} 

16blis_info={} 

17openblas_info={} 

18accelerate_info={} 

19atlas_3_10_blas_threads_info={} 

20atlas_3_10_blas_info={} 

21atlas_blas_threads_info={} 

22atlas_blas_info={} 

23blas_info={} 

24blas_src_info={} 

25blas_opt_info={} 

26lapack_armpl_info={} 

27lapack_mkl_info={} 

28openblas_lapack_info={} 

29openblas_clapack_info={} 

30flame_info={} 

31atlas_3_10_threads_info={} 

32atlas_3_10_info={} 

33atlas_threads_info={} 

34atlas_info={} 

35lapack_info={} 

36lapack_src_info={} 

37lapack_opt_info={} 

38numpy_linalg_lapack_lite={'language': 'c'} 

39 

40def get_info(name): 

41 g = globals() 

42 return g.get(name, g.get(name + "_info", {})) 

43 

44def show(): 

45 """ 

46 Show libraries in the system on which NumPy was built. 

47 

48 Print information about various resources (libraries, library 

49 directories, include directories, etc.) in the system on which 

50 NumPy was built. 

51 

52 See Also 

53 -------- 

54 get_include : Returns the directory containing NumPy C 

55 header files. 

56 

57 Notes 

58 ----- 

59 1. Classes specifying the information to be printed are defined 

60 in the `numpy.distutils.system_info` module. 

61 

62 Information may include: 

63 

64 * ``language``: language used to write the libraries (mostly 

65 C or f77) 

66 * ``libraries``: names of libraries found in the system 

67 * ``library_dirs``: directories containing the libraries 

68 * ``include_dirs``: directories containing library header files 

69 * ``src_dirs``: directories containing library source files 

70 * ``define_macros``: preprocessor macros used by 

71 ``distutils.setup`` 

72 * ``baseline``: minimum CPU features required 

73 * ``found``: dispatched features supported in the system 

74 * ``not found``: dispatched features that are not supported 

75 in the system 

76 

77 2. NumPy BLAS/LAPACK Installation Notes 

78 

79 Installing a numpy wheel (``pip install numpy`` or force it 

80 via ``pip install numpy --only-binary :numpy: numpy``) includes 

81 an OpenBLAS implementation of the BLAS and LAPACK linear algebra 

82 APIs. In this case, ``library_dirs`` reports the original build 

83 time configuration as compiled with gcc/gfortran; at run time 

84 the OpenBLAS library is in 

85 ``site-packages/numpy.libs/`` (linux), or 

86 ``site-packages/numpy/.dylibs/`` (macOS), or 

87 ``site-packages/numpy/.libs/`` (windows). 

88 

89 Installing numpy from source 

90 (``pip install numpy --no-binary numpy``) searches for BLAS and 

91 LAPACK dynamic link libraries at build time as influenced by 

92 environment variables NPY_BLAS_LIBS, NPY_CBLAS_LIBS, and 

93 NPY_LAPACK_LIBS; or NPY_BLAS_ORDER and NPY_LAPACK_ORDER; 

94 or the optional file ``~/.numpy-site.cfg``. 

95 NumPy remembers those locations and expects to load the same 

96 libraries at run-time. 

97 In NumPy 1.21+ on macOS, 'accelerate' (Apple's Accelerate BLAS 

98 library) is in the default build-time search order after 

99 'openblas'. 

100 

101 Examples 

102 -------- 

103 >>> import numpy as np 

104 >>> np.show_config() 

105 blas_opt_info: 

106 language = c 

107 define_macros = [('HAVE_CBLAS', None)] 

108 libraries = ['openblas', 'openblas'] 

109 library_dirs = ['/usr/local/lib'] 

110 """ 

111 from numpy.core._multiarray_umath import ( 

112 __cpu_features__, __cpu_baseline__, __cpu_dispatch__ 

113 ) 

114 for name,info_dict in globals().items(): 

115 if name[0] == "_" or type(info_dict) is not type({}): continue 

116 print(name + ":") 

117 if not info_dict: 

118 print(" NOT AVAILABLE") 

119 for k,v in info_dict.items(): 

120 v = str(v) 

121 if k == "sources" and len(v) > 200: 

122 v = v[:60] + " ...\n... " + v[-60:] 

123 print(" %s = %s" % (k,v)) 

124 

125 features_found, features_not_found = [], [] 

126 for feature in __cpu_dispatch__: 

127 if __cpu_features__[feature]: 

128 features_found.append(feature) 

129 else: 

130 features_not_found.append(feature) 

131 

132 print("Supported SIMD extensions in this NumPy install:") 

133 print(" baseline = %s" % (','.join(__cpu_baseline__))) 

134 print(" found = %s" % (','.join(features_found))) 

135 print(" not found = %s" % (','.join(features_not_found))) 

136