0

我使用 Eigen 3.3 和 Intel MKL 2017,并使用 Win-7 64 位系统和 Intel Xeon(R) CPU E5-1620 v2@3.70GHZ CPU 在 Visual Studio 2012 中编写和运行程序。

我相信我的 MKL 配置是正确的,因为我可以成功运行 MKL 示例代码。使用 Eigen 的英特尔 MKL 的配置来自 https://eigen.tuxfamily.org/dox/TopicUsingIntelMKL.html。对于 Visiual Studio 2012,我在 Release x64 模型中通过 Intel C++ Complier 编译代码。

但是,无论我是否设置#define EIGEN_USE_MKL_ALL(即,如果使用Intel MKL),以下代码总是需要大约400 秒。似乎 MKL 在 Eigen 中不起作用。

谁能给点建议?谢谢。

#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;
}
4

0 回答 0