Intel-MKL在home ubuntu18.04的尝试

今天在win10平台尝试使用MKL库+VC2015,运行LTE的phy,没有成功,在VC上的compile始终有问题,而且遇到c代码的数组【0:x】语法问题,可能是C++的扩展,需要email作者。

回到家里上网百度发现ubuntu的环境比较简洁,基于gcc编译,可以不采用VC或intel的icc编译。参考此文:<https://blog.csdn.net/qccz123456/article/details/85246439>

  • 首先把下载的“l_mkl_2019.5.281.tgz”执行“./install.sh”安装在我的~目录;
  • 然后执行“source ~/intel/bin/compilervars.sh intel64”设环境变量,这个是最关键的一步,然后安装gcc(7.4.0)编译器 apt install gcc;
  • 解压从intel下载的example文件“ipsxe2019_samples_lin_20190327.tgz”,tar -zxvf 放在/mkl-software目录。
  • 里面的mkl目录里有一个C例子“dgemm_example.c”,用它来验证MKL;
  • 编译“gcc -I ~/intel/mkl/include/ ./dgemm_example.c -lmkl_rt” 生成a.out,运行就可以出现下面内容:

This example computes real matrix C=alphaAB+beta*C using
Intel(R) MKL function dgemm, where A, B, and C are matrices and
alpha and beta are double precision scalars

Initializing data for matrix multiplication C=A*B for matrix
A(2000×200) and matrix B(200×1000)

Allocating memory for matrices aligned on 64-byte boundary for better
performance

Intializing matrix data

Computing matrix product using Intel(R) MKL dgemm function via CBLAS interface

Computations completed.

Top left corner of matrix A:
1 2 3 4 5 6
201 202 203 204 205 206
401 402 403 404 405 406
601 602 603 604 605 606
801 802 803 804 805 806
1001 1002 1003 1004 1005 1006

Top left corner of matrix B:
-1 -2 -3 -4 -5 -6
-1001 -1002 -1003 -1004 -1005 -1006
-2001 -2002 -2003 -2004 -2005 -2006
-3001 -3002 -3003 -3004 -3005 -3006
-4001 -4002 -4003 -4004 -4005 -4006
-5001 -5002 -5003 -5004 -5005 -5006

Top left corner of matrix C:
-2.6666E+09 -2.6666E+09 -2.6667E+09 -2.6667E+09 -2.6667E+09 -2.6667E+09
-6.6467E+09 -6.6467E+09 -6.6468E+09 -6.6468E+09 -6.6469E+09 -6.647E+09
-1.0627E+10 -1.0627E+10 -1.0627E+10 -1.0627E+10 -1.0627E+10 -1.0627E+10
-1.4607E+10 -1.4607E+10 -1.4607E+10 -1.4607E+10 -1.4607E+10 -1.4607E+10
-1.8587E+10 -1.8587E+10 -1.8587E+10 -1.8587E+10 -1.8588E+10 -1.8588E+10
-2.2567E+10 -2.2567E+10 -2.2567E+10 -2.2567E+10 -2.2568E+10 -2.2568E+10

Deallocating memory

Example completed.

这张图是我遇到的语法问题,代码是github shang de LTE_PHY_GP的intel目录里的代码,继续扫盲咯。。。。。

Leave a Reply

Your email address will not be published. Required fields are marked *