link numpy with openblas on Ubuntu 16.04
来源:互联网 发布:淘宝商标上传 编辑:程序博客网 时间:2024/06/06 01:55
最近在美帝搞了台台式机,总算有机会可以玩玩Ubuntu了,正好ST790的project需要用到TensorFlow,当然就要先配置一下Python,特别是numpy。
首先安装openblas
sudo apt-get install libopenblas-base
切换blas库
sudo update-alternatives --config libblas.so.3
安装numpy(pip或者apt-get均可)
测试
我用了两段代码测试。
import numpy as npa1 = np.random.rand(10000, 10000)a2 = np.random.rand(10000, 10000)np.dot(a1, a2)
用时13s左右
import numpy as npimport numpy.random as nprimport time# --- Test 1N = 1n = 1000A = npr.randn(n,n)B = npr.randn(n,n)t = time.time()for i in range(N): C = np.dot(A, B)td = time.time() - tprint("dotted two (%d,%d) matrices in %0.1f ms" % (n, n, 1e3*td/N))# --- Test 2N = 100n = 4000A = npr.randn(n)B = npr.randn(n)t = time.time()for i in range(N): C = np.dot(A, B)td = time.time() - tprint("dotted two (%d) vectors in %0.2f us" % (n, 1e6*td/N))# --- Test 3m,n = (2000,1000)A = npr.randn(m,n)t = time.time()[U,s,V] = np.linalg.svd(A, full_matrices=False)td = time.time() - tprint("SVD of (%d,%d) matrix in %0.3f s" % (m, n, td))# --- Test 4n = 1500A = npr.randn(n,n)t = time.time()w, v = np.linalg.eig(A)td = time.time() - tprint("Eigendecomp of (%d,%d) matrix in %0.3f s" % (n, n, td))
输出为:
dotted two (1000,1000) matrices in 547.5 msdotted two (4000) vectors in 5.73 usSVD of (2000,1000) matrix in 6.938 sEigendecomp of (1500,1500) matrix in 16.114 s
跑程序的时候通过htop可见8核全开。
0 0
- link numpy with openblas on Ubuntu 16.04
- ubuntu openblas
- openblas+lapack numpy scipy
- Link OpenBLAS to armadillo
- OpenBLAS,Numpy,Scipy For Linux
- 安装OpenBlas (ubuntu 14.04)
- 安装OpenBlas(ubuntu 14.04)
- ubuntu 安装OpenBLAS
- ubuntu安装OpenBLAS
- ubuntu安装Openblas
- Ubuntu-OpenBlas for Caffe
- ubuntu 安装OpenBLAS
- Kinect on Ubuntu with OpenNI
- Play with caffe on ubuntu
- Ubuntu下如何编译OpenBLAS
- How To Install Java with Apt-Get on Ubuntu 16.04
- How To Install WordPress with LAMP on Ubuntu 16.04
- How To Install WordPress with LAMP on Ubuntu 16.04
- 【剑指offer】面试题22:栈的压入、弹出序列
- 判断一个链表是否为回文结构
- 小议:人工智能
- Plesk镜像制作(脚本)
- 浅谈出版物的纸、电一体化新方向
- link numpy with openblas on Ubuntu 16.04
- Linux最简单的文件系统aufs剖析详解
- The packaging for this project did not assign a file to the build artifact
- Hill密码的加密与解密(C语言)
- Subarray Sum Closest
- tar.xz压缩与解压
- React 组件图片库的延迟加载
- 在Mac Os安装并建立ITK
- Leetcode 138. Copy List with Random Pointer