在Windows上将英特尔的数学内核库(MKL)链接到R [英] Linking Intel's Math Kernel Library (MKL) to R on Windows
问题描述
为R使用替代的BLAS具有多个优点,请参见例如 https://cran.r-project.org/web/packages/gcbd/vignettes/gcbd.pdf .
Using an alternative BLAS for R has several advantages, see e.g. https://cran.r-project.org/web/packages/gcbd/vignettes/gcbd.pdf.
Microsoft R打开 https://mran.revolutionanalytics.com/documents/rro/installation/#sysreq 使用Intel的MKL而不是默认的Reference BLAS来加快计算速度.
Microsoft R Open https://mran.revolutionanalytics.com/documents/rro/installation/#sysreq is using Intel's MKL instead of the default Reference BLAS to speed up calculations.
我的问题是:
将**手动将Intel的MKL库链接到Windows上R **的最新版本的确切步骤是什么(
What would be the exact steps to link Intel's MKL library **manually to R**'s most recent version on Windows (https://cran.r-project.org/bin/windows/base/)?
更新20-07-2016: 这是有关如何为Windows≥3.3.0的Windows 64位R建立基于OpenBLAS的Rblas.dll的非常详细的说明:
UPDATE 20-07-2016: Here is very detailed description on how to build a OpenBLAS-based Rblas.dll for 64-bit R for Windows for R ≥ 3.3.0: http://www.avrahamadler.com/r-tips/build-openblas-for-windows-r64/
推荐答案
I was able to link R 3.6.0 with custom dlls you create using the builder. Basically you have to export the same symbols Rblas.dll
and Rlapack.dll
do. Start the Compiler 19.0 Update 4 for Intel 64 Visual Studio 2017 environment
command prompt:
获取符号:
dumpbin /exports Rblas.dll > Rblas_list
dumpbin /exports Rlapack.dll > Rlapack_list_R
编辑两个文件,删除页眉"和页脚",并使所有带有符号名称的行(例如:248 F7 00138CE0 dgeevx_
)都像dgeevx_
(仅包含名称).
将builder
目录复制到PC中的某个位置并在其中运行:
Edit both files deleting the "header" and "footer" and have all the lines with the symbol names (ex.: 248 F7 00138CE0 dgeevx_
) be like dgeevx_
(only with the names).
Copy the builder
directory to somewhere in your pc and inside it run:
# blas links fine
nmake libintel64 export=..path..\Rblas_list name=Rblas
# save lapack errors in another list
nmake libintel64 export=..path..\Rlapack_list_R name=Rlapack 1> undefined_symbols_list
编辑undefined_symbols_list
仅在每行中保留名称并创建一个新名称
列出差异
Edit undefined_symbols_list
keep only the names in each line and create a new
list with the difference
findstr /v /g:undefined_symbols_list Rlapack_list_R > Rlapack_list
nmake libintel64 export=..path..\Rlapack_list name=Rlapack
使用dumpbin /dependents Rlapack.dll
,您可以看到它们取决于libiomp5md.dll
,您可以在mkl安装的redist
文件夹中找到该文件.
With dumpbin /dependents Rlapack.dll
, you can see that they depend on libiomp5md.dll
, which you can find inside the redist
folder in mkl installation.
此方法使用更多的磁盘空间,但是更简单.从这些文件夹中复制所有内容
This method uses more disk space, but it's simpler. Copy all the contents from inside these folders
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries\windows\redist\intel64\mkl
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries\windows\redist\intel64\compiler
到
C:\Program Files\R\R-3.6.1\bin\x64
在目标文件夹中,创建2个mkl_rt.dll
副本,并将其中一个Rblas.dll
重命名,另一个Rlapack.dll
重命名原件并保留mkl_rt.dll
.
Inside the destination folder, create 2 copies of mkl_rt.dll
and rename one of them Rblas.dll
and the other Rlapack.dll
replacing the originals and also keeping mkl_rt.dll
.
这篇关于在Windows上将英特尔的数学内核库(MKL)链接到R的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!