犰狳中BLAS与OpenBLAS的加速比较

时间:2016-10-02 06:46:01

标签: c++11 armadillo blas openblas

有人知道在犰狳中使用OpenBLAS而不是BLAS库实现的加速吗?

这是我的结果: 我试图将矢量乘以犰狳中的矩阵

    #include <iostream>   
    #include<armadillo>
    using namespace std;
    using namespace arma;
int main(int argc, char** argv) {

int num_examples = 100000;
vec randperm(num_examples, fill::zeros);
for(uword i=0;i<num_examples;i++)
    randperm(i) = i;

vec randnum = shuffle(randperm);
randperm.reset();

sp_mat X = sprandu<sp_mat>(num_examples,127,0.8);
mat W(3,127,fill::randn);
wall_clock timer;
double t;

timer.tic();
uword pred_class = (X.row(randnum(10))*W.t()).index_max();
 t= timer.toc();
cout<<"Elapsed time is:"<<t<<endl;
}

以下是使用-lopenblas的结果:经过的时间是:0.0374926

使用-armadillo的结果是:经过的时间是:0.084193

我的机器:Ubuntu 14.04在4个物理内核上运行(启用超线程,8个内核)

0 个答案:

没有答案