No speed-up after using MKL for Eigen

倖福魔咒の 提交于 2020-01-06 15:43:10

问题


I use Eigen 3.3 and Intel MKL 2017, and write and run program in Visual Studio 2012 with Win-7 64-bit system and Intel Xeon(R) CPU E5-1620 v2@3.70GHZ CPU.

I belive that my configuration for MKL is correct, because I can succesfully run MKL examlpe codes. The configuraton for using Intel MKL from Eigen follows from https://eigen.tuxfamily.org/dox/TopicUsingIntelMKL.html. For Visiual Studio 2012, I complie codes via Intel C++ Complier in Release x64 model.

However, the following code always takes about 400 seconds, no matter if I set #define EIGEN_USE_MKL_ALL or not (i.e., if use Intel MKL). It seems that MKL does not work in Eigen.

Could anyone give some suggestion? Thanks.

#define EIGEN_USE_MKL_ALL // Determine if use MKL
#define EIGEN_VECTORIZE_SSE4_2

#include "stdafx.h"
#include <iostream>
#include <Eigen/Core>
#include <Eigen/Dense>
#include <time.h>

using namespace std;
using namespace Eigen;

//
int main(int argc, char *argv[])
{
    MatrixXd a = MatrixXd::Random(30000, 3000);  
    MatrixXd b = MatrixXd::Random(3000, 30000);

    double start = clock();
    MatrixXd c = a * b;    // 
    double endd = clock();
    double thisTime = (double)(endd - start) / CLOCKS_PER_SEC;

    cout << thisTime << endl;

    system("PAUSE");
    return 0;
}

来源:https://stackoverflow.com/questions/40868462/no-speed-up-after-using-mkl-for-eigen

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!