I am builing my numpy/scipy environment based on blas and lapack more or less based on this walk through.
我正在构建基于blas和lapack的numpy/scipy环境。
When I am done, how can I check, that my numpy/scipy functions really do use the previously built blas/lapack functionalities?
完成后,如何检查numpy/scipy函数是否确实使用了以前构建的blas/lapack函数?
4 个解决方案
#1
26
What you are searching for is this: system info
您正在搜索的是:系统信息
I compiled numpy/scipy with atlas and i can check this with:
我用atlas编译numpy/scipy,我可以用:
import numpy.distutils.system_info as sysinfo
sysinfo.get_info('atlas')
Check the documentation for more commands.
查看文档以获取更多命令。
#2
246
The method numpy.__config__.show()
outputs information about linkage gathered at build time. My output looks like this. I think it means I am using the BLAS/LAPACK that ships with Mac OS.
show()方法numpy.__config .show()输出关于构建时收集的链接的信息。输出是这样的。我认为这意味着我正在使用带有Mac OS的BLAS/LAPACK。
>>>import numpy as np
>>>np.__config__.show()
lapack_opt_info:
extra_link_args = ['-Wl,-framework', '-Wl,Accelerate']
extra_compile_args = ['-msse3']
define_macros = [('NO_ATLAS_INFO', 3)]
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)]
#3
11
As it uses the dynamically loaded versions, you can just do this:
由于它使用的是动态加载的版本,您可以这样做:
$ ldd anyoftheCmodules.so
where anyoftheCmodules.so
could be, for example, numpy/core/_dotblas.so
, which links to libblas.so
.
anyoftheCmodules的地方。比如,numpy/core/_dotblas。它链接到libblas。
#4
7
You can use the link loader dependency tool to look at the C level hook components of your build and see whether they have external dependencies on your blas and lapack of choice. I am not near a linux box right now, but on an OS X machine you can do this inside the site-packages directory which holds the installations:
您可以使用link loader依赖性工具查看构建的C级hook组件,并查看它们是否对blas和lapack进行外部依赖。我现在不在linux机器附近,但是在OS X机器上,你可以在保存安装的站点包目录中这样做:
$ otool -L numpy/core/_dotblas.so
numpy/core/_dotblas.so:
/System/Library/Frameworks/Accelerate.framework/Versions/A/Accelerate (compatibility version 1.0.0, current version 4.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.0)
/System/Library/Frameworks/vecLib.framework/Versions/A/vecLib (compatibility version 1.0.0, current version 268.0.1)
$ otool -L scipy/linalg/flapack.so
scipy/linalg/flapack.so (architecture i386):
/System/Library/Frameworks/Accelerate.framework/Versions/A/Accelerate (compatibility version 1.0.0, current version 4.0.0)
/usr/local/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.1.4)
/System/Library/Frameworks/vecLib.framework/Versions/A/vecLib (compatibility version 1.0.0, current version 242.0.0)
scipy/linalg/flapack.so (architecture ppc):
/System/Library/Frameworks/Accelerate.framework/Versions/A/Accelerate (compatibility version 1.0.0, current version 4.0.0)
/usr/local/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.1.4)
$ otool -L scipy/linalg/fblas.so
scipy/linalg/fblas.so (architecture i386):
/System/Library/Frameworks/Accelerate.framework/Versions/A/Accelerate (compatibility version 1.0.0, current version 4.0.0)
/usr/local/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.1.4)
/System/Library/Frameworks/vecLib.framework/Versions/A/vecLib (compatibility version 1.0.0, current version 242.0.0)
scipy/linalg/fblas.so (architecture ppc):
/System/Library/Frameworks/Accelerate.framework/Versions/A/Accelerate (compatibility version 1.0.0, current version 4.0.0)
/usr/local/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.1.4)
substitute ldd
in place of otool
on a gnu/Linux system and you should get the answers you need.
在gnu/Linux系统上代替otool替代ldd,您应该得到您需要的答案。
#1
26
What you are searching for is this: system info
您正在搜索的是:系统信息
I compiled numpy/scipy with atlas and i can check this with:
我用atlas编译numpy/scipy,我可以用:
import numpy.distutils.system_info as sysinfo
sysinfo.get_info('atlas')
Check the documentation for more commands.
查看文档以获取更多命令。
#2
246
The method numpy.__config__.show()
outputs information about linkage gathered at build time. My output looks like this. I think it means I am using the BLAS/LAPACK that ships with Mac OS.
show()方法numpy.__config .show()输出关于构建时收集的链接的信息。输出是这样的。我认为这意味着我正在使用带有Mac OS的BLAS/LAPACK。
>>>import numpy as np
>>>np.__config__.show()
lapack_opt_info:
extra_link_args = ['-Wl,-framework', '-Wl,Accelerate']
extra_compile_args = ['-msse3']
define_macros = [('NO_ATLAS_INFO', 3)]
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)]
#3
11
As it uses the dynamically loaded versions, you can just do this:
由于它使用的是动态加载的版本,您可以这样做:
$ ldd anyoftheCmodules.so
where anyoftheCmodules.so
could be, for example, numpy/core/_dotblas.so
, which links to libblas.so
.
anyoftheCmodules的地方。比如,numpy/core/_dotblas。它链接到libblas。
#4
7
You can use the link loader dependency tool to look at the C level hook components of your build and see whether they have external dependencies on your blas and lapack of choice. I am not near a linux box right now, but on an OS X machine you can do this inside the site-packages directory which holds the installations:
您可以使用link loader依赖性工具查看构建的C级hook组件,并查看它们是否对blas和lapack进行外部依赖。我现在不在linux机器附近,但是在OS X机器上,你可以在保存安装的站点包目录中这样做:
$ otool -L numpy/core/_dotblas.so
numpy/core/_dotblas.so:
/System/Library/Frameworks/Accelerate.framework/Versions/A/Accelerate (compatibility version 1.0.0, current version 4.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.0)
/System/Library/Frameworks/vecLib.framework/Versions/A/vecLib (compatibility version 1.0.0, current version 268.0.1)
$ otool -L scipy/linalg/flapack.so
scipy/linalg/flapack.so (architecture i386):
/System/Library/Frameworks/Accelerate.framework/Versions/A/Accelerate (compatibility version 1.0.0, current version 4.0.0)
/usr/local/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.1.4)
/System/Library/Frameworks/vecLib.framework/Versions/A/vecLib (compatibility version 1.0.0, current version 242.0.0)
scipy/linalg/flapack.so (architecture ppc):
/System/Library/Frameworks/Accelerate.framework/Versions/A/Accelerate (compatibility version 1.0.0, current version 4.0.0)
/usr/local/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.1.4)
$ otool -L scipy/linalg/fblas.so
scipy/linalg/fblas.so (architecture i386):
/System/Library/Frameworks/Accelerate.framework/Versions/A/Accelerate (compatibility version 1.0.0, current version 4.0.0)
/usr/local/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.1.4)
/System/Library/Frameworks/vecLib.framework/Versions/A/vecLib (compatibility version 1.0.0, current version 242.0.0)
scipy/linalg/fblas.so (architecture ppc):
/System/Library/Frameworks/Accelerate.framework/Versions/A/Accelerate (compatibility version 1.0.0, current version 4.0.0)
/usr/local/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.1.4)
substitute ldd
in place of otool
on a gnu/Linux system and you should get the answers you need.
在gnu/Linux系统上代替otool替代ldd,您应该得到您需要的答案。