是否可以通过apt-get安装openblas sudo apt-get install openblas-dev?
好像在ubuntu 14.04上找不到它.
sudo apt-get install openblas-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package openblas-dev
Run Code Online (Sandbox Code Playgroud) 根据着名的check_blas.py脚本,我写了一个来检查theano实际上可以使用多个核心:
import os
os.environ['MKL_NUM_THREADS'] = '8'
os.environ['GOTO_NUM_THREADS'] = '8'
os.environ['OMP_NUM_THREADS'] = '8'
os.environ['THEANO_FLAGS'] = 'device=cpu,blas.ldflags=-lblas -lgfortran'
import numpy
import theano
import theano.tensor as T
M=2000
N=2000
K=2000
iters=100
order='C'
a = theano.shared(numpy.ones((M, N), dtype=theano.config.floatX, order=order))
b = theano.shared(numpy.ones((N, K), dtype=theano.config.floatX, order=order))
c = theano.shared(numpy.ones((M, K), dtype=theano.config.floatX, order=order))
f = theano.function([], updates=[(c, 0.4 * c + .8 * T.dot(a, b))])
for i in range(iters):
f(y)
Run Code Online (Sandbox Code Playgroud)
运行此操作python3 check_theano.py表明正在使用8个线程.更重要的是,代码的运行速度比没有os.environ设置快9倍,只需1个核心:7.863s vs 71.292s.
所以,我希望Keras现在在调用时fit(或者predict就此而言)也使用多个内核.但是,以下代码不是这种情况:
import …Run Code Online (Sandbox Code Playgroud) 我正在运行一个用Python实现并使用NumPy的算法.算法中计算成本最高的部分涉及求解一组线性系统(即调用numpy.linalg.solve().我想出了这个小基准:
import numpy as np
import time
# Create two large random matrices
a = np.random.randn(5000, 5000)
b = np.random.randn(5000, 5000)
t1 = time.time()
# That's the expensive call:
np.linalg.solve(a, b)
print time.time() - t1
Run Code Online (Sandbox Code Playgroud)
我一直在运行:
sysctl -n machdep.cpu.brand_string给我Intel(R)Core(TM)i7-4750HQ CPU @ 2.00GHz)c3.xlarge实例,具有4个vCPU.亚马逊宣称它们为"高频英特尔至强E5-2680 v2(Ivy Bridge)处理器"底线:
我也在其他基于OpenBLAS/Intel MKL的设置上尝试过它,运行时总是与我在EC2实例上得到的(模块化硬件配置)相当.
任何人都可以解释为什么Mac(使用Accelerate Framework)的性能提高了4倍?下面提供了有关NumPy/BLAS设置的更多详细信息.
numpy.show_config() 给我:
atlas_threads_info:
NOT AVAILABLE
blas_opt_info:
extra_link_args = ['-Wl,-framework', '-Wl,Accelerate']
extra_compile_args …Run Code Online (Sandbox Code Playgroud) 我现在面临一个问题,无法在集群中运行任何程序。它给出了错误。
OpenBLAS blas_thread_init: pthread_create: Resource temporarily unavailable
OpenBLAS blas_thread_init: RLIMIT_NPROC 64 current, 64 max
OpenBLAS blas_thread_init: pthread_create: Resource temporarily unavailable
OpenBLAS blas_thread_init: RLIMIT_NPROC 64 current, 64 max
OpenBLAS blas_thread_init: pthread_create: Resource temporarily unavailable
OpenBLAS blas_thread_init: RLIMIT_NPROC 64 current, 64 max
OpenBLAS blas_thread_init: pthread_create: Resource temporarily unavailable
OpenBLAS blas_thread_init: RLIMIT_NPROC 64 current, 64 max
Traceback (most recent call last):
File "hello-world.py", line 1, in <module>
from keras.models import Sequential
File "/home/amalli2s/anaconda3/lib/python3.6/site-packages/keras/__init__.py", line 3, in <module>
from . import utils
File "/home/amalli2s/anaconda3/lib/python3.6/site-packages/keras/utils/__init__.py", …Run Code Online (Sandbox Code Playgroud) 当我尝试导入numpy时,我收到以下错误:
/usr/local/lib/python2.7/dist-packages/numpy/linalg/__init__.py in <module>()
49 from .info import __doc__
50
---> 51 from .linalg import *
52
53 from numpy.testing import Tester
/usr/local/lib/python2.7/dist-packages/numpy/linalg/linalg.py in <module>()
27 )
28 from numpy.lib import triu, asfarray
---> 29 from numpy.linalg import lapack_lite, _umath_linalg
30 from numpy.matrixlib.defmatrix import matrix_power
31 from numpy.compat import asbytes
ImportError: /usr/lib/liblapack.so.3: undefined symbol: gotoblas
Run Code Online (Sandbox Code Playgroud)
我已经尝试过解决方案发布错误导入numpy:lapack_lite.so:未定义符号和GotoBLAS错误安装matplotlib与pip在virtualenv上debian wheezy
我已经尝试了以下所有选项:
vvkulkarni@galileo:~$ sudo update-alternatives --config liblapack.so.3
There are 3 choices for the alternative liblapack.so.3 (providing /usr/lib/liblapack.so.3).
Selection Path Priority Status …Run Code Online (Sandbox Code Playgroud) 在花了大量时间从源代码构建ATLAS之后,我在OpenSUSE 13.1存储库中发现了libopenblas和libatals.我的问题是
是否易于安装(无需在您自己的计算机上进行调整)存储库中的"libatlas"真的能提高计算性能吗?
OpenBLAS比ATLAS更好还是只比Linux中的易安装"libatlas"更好?请参阅更快的R使用OpenBLAS:比ATLAS更好,切换到Ubuntu很简单.
我跟着这篇文章使用OpenBLAS编译Numpy,但找不到"numpy.core._dotblas"模块.更多的我无法同时使用ATLAS和OpenBLAS构建Numpy.
有人可以发布.py文件或bash代码来进行ATLAS和OpenBLAS之间的比较吗?例如.
我使用自己的ATLAS构建了Numpy-1.9,从源代码编译了OpenBLAS,并在OpenSUSE 13.1的存储库中安装了"libopenblaso"(OpenMP版本)和"libopenblasp"(pthreads版本).如何配置链接和库,以便在不重建Numpy-1.9软件包的情况下告诉Numpy-1.9使用OpenBLAS而不是ATLAS.
注意:如果在存储库中安装"libatlas",则ATLAS不会针对您的计算机进行调整,并且计算性能不会太高.因此,我首先构建并调整了ATLAS,然后使用我自己的ATLAS构建了Numpy.之后,我尝试将OpenBLAS链接到Numpy,但失败了.
提前谢谢了!
谢谢@Dmitry的快速回复!但问题没有解决......
$ sudo zypper in libopenblasp0
The following NEW package is going to be installed:
libopenblasp0
1 new package to install.
Overall download size: 3.0 MiB. After the operation, additional 30.3 MiB will be used.
Continue? [y/n/? shows all options] (y):
Retrieving package libopenblasp0-0.2.11-11.1.x86_64 (1/1), 3.0 MiB ( 30.3 MiB unpacked)
Retrieving: libopenblasp0-0.2.11-11.1.x86_64.rpm ...........................[done (2.1 MiB/s)]
(1/1) …Run Code Online (Sandbox Code Playgroud) 我想知道是否可以在(Python)运行时更改OpenBLAS在numpy后面使用的最大线程数?
我知道可以在通过环境变量运行解释器之前设置它OMP_NUM_THREADS,但我想在运行时更改它.
通常,使用MKL而不是OpenBLAS时,可能:
import mkl
mkl.set_num_threads(n)
Run Code Online (Sandbox Code Playgroud) 我有这种依赖:
blas = "0.18.1"
Run Code Online (Sandbox Code Playgroud)
在构建这个简单程序期间(程序中没有实际使用的类型):
extern crate blas;
use blas::c::*;
Run Code Online (Sandbox Code Playgroud)
我收到这些错误:
error: linking with `gcc` failed: exit code: 1
|
= note: "gcc" "-Wl,--enable-long-section-names" "-fno-use-linker-plugin" "-Wl,--nxcompat" "-nostdlib" "-m64" "C:\\Users\\steve\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\crt2.o" "C:\\Users\\steve\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\rsbegin.o" "-L" "C:\\Users\\steve\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib" "C:\\Users\\steve\\Dropbox\\Projects\\rpolysolve\\target\\debug\\deps\\rpolysolve-88ff07ef5c6657b1.0.o" "-o" "C:\\Users\\steve\\Dropbox\\Projects\\rpolysolve\\target\\debug\\deps\\rpolysolve-88ff07ef5c6657b1.exe" "-Wl,--gc-sections" "-nodefaultlibs" "-L" "C:\\Users\\steve\\Dropbox\\Projects\\rpolysolve\\target\\debug\\deps" "-L" "C:/Users/steve/Dropbox/Projects/rpolysolve/target/debug/build/openblas-src-d878051769a2d73f/out\\opt/OpenBLAS/lib" "-L" "C:\\Users\\steve\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib" "-Wl,-Bstatic" "C:\\Users\\steve\\Dropbox\\Projects\\rpolysolve\\target\\debug\\deps\\libblas-b4aae95537d012fb.rlib" "C:\\Users\\steve\\Dropbox\\Projects\\rpolysolve\\target\\debug\\deps\\libblas_sys-e0d39b2df28e83ce.rlib" "C:\\Users\\steve\\Dropbox\\Projects\\rpolysolve\\target\\debug\\deps\\libopenblas_src-f69049297a7464c8.rlib" "C:\\Users\\steve\\Dropbox\\Projects\\rpolysolve\\target\\debug\\deps\\libnum_complex-f6dcb9467a42a2a8.rlib" "C:\\Users\\steve\\Dropbox\\Projects\\rpolysolve\\target\\debug\\deps\\liblibc-c8ae433ae4a960ed.rlib" "C:\\Users\\steve\\Dropbox\\Projects\\rpolysolve\\target\\debug\\deps\\libnum_traits-f34085513d19d5a6.rlib" "C:\\Users\\steve\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libstd-5a958d157a8d8d98.rlib" "C:\\Users\\steve\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libpanic_unwind-14e8bb7ca07ebf2c.rlib" "C:\\Users\\steve\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libunwind-a4bc20050f473f79.rlib" "C:\\Users\\steve\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\liblibc-892bd58ec617c3bd.rlib" "C:\\Users\\steve\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\librand-ce86047000b56785.rlib" "C:\\Users\\steve\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libcollections-b8b9a576d130e244.rlib" "C:\\Users\\steve\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\liballoc-b9c9173c47c20c41.rlib" "C:\\Users\\steve\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\liballoc_system-141f235246f01712.rlib" "C:\\Users\\steve\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libstd_unicode-9fbe5d3bbc85c563.rlib" "C:\\Users\\steve\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libcore-3a6338503b91076c.rlib" "C:\\Users\\steve\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libcompiler_builtins-e9e280acad4314a4.rlib" "-Wl,-Bdynamic" "-l" "gfortran" "-l" "openblas" "-l" "advapi32" "-l" "ws2_32" "-l" "userenv" "-l" "shell32" "-Wl,-Bstatic" "-l" "gcc_eh" "-l" "pthread" "-Wl,-Bdynamic" …Run Code Online (Sandbox Code Playgroud) 特别是,我想知道是否安装了xianyi的OpenBLAS.我在几台PC上工作并在过去几年中安装在几台PC上,但是我丢失了没有安装它的轨道.我需要知道哪台PC有,哪台没有.这就是我安装它的方式:
git clone git://github.com/xianyi/OpenBLAS
cd OpenBLAS
make FC=gfortran
sudo make PREFIX=/usr/local/ install
Run Code Online (Sandbox Code Playgroud)
注意:我可能删除了OpenBLAS目录,因此它不是一个可靠的指标.我不知道如何卸载它,所以我不能尝试在每台PC上安装它,然后选择性卸载(这是非常麻烦).