[英]Configuring MKL with R
I'm having a problem to trigger threads with R using the MKL library. 我在使用MKL库触发带有R的线程时遇到问题。 I am currently using Ubuntu 18.04.2 LTS.
我目前正在使用Ubuntu 18.04.2 LTS。
Linux pedro-HP-EliteOne-800-G1-AiO 4.18.0-15-generic #16~18.04.1-Ubuntu SMP Thu Feb 7 14:06:04 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
r-open$ screenfetch
./+o+- pedro@pedro-HP-EliteOne-800-G1-AiO
yyyyy- -yyyyyy+ OS: Ubuntu 18.04 bionic
://+//////-yyyyyyo Kernel: x86_64 Linux 4.18.0-15-generic
.++ .:/++++++/-.+sss/` Uptime: 19h 27m
.:++o: /++++++++/:--:/- Packages: 1834
o:+o+:++.`..```.-/oo+++++/ Shell: bash
.:+o:+o/. `+sssoo+/ Resolution: 1920x1080
.++/+:+oo+o:` /sssooo. DE: GNOME
/+++//+:`oo+o /::--:. WM: GNOME Shell
\+/+o+++`o++o ++////. WM Theme: Adwaita
.++.o+++oo+:` /dddhhh. GTK Theme: Ambiance [GTK2/3]
.+.o+oo:. `oddhhhh+ Icon Theme: ubuntu-mono-dark
\+.++o+o``-````.:ohdhhhhh+ Font: Ubuntu 11
`:o+++ `ohhhhhhhhyo++os: CPU: Intel Core i5-4590S @ 4x 3.7GHz [27.8°C]
.o:`.syhhhhhhh/.oo++o` GPU: intel
/osyyyyyyo++ooo+++/ RAM: 2659MiB / 7867MiB
````` +oo+++o\:
`oo++.
Note : My machine has 4 cores . 注意 :我的机器有4个核心 。
Initially I downloaded the file l_mkl_2019.2.187.tgz on the intel website and did the installation for /home/pedro/
. 最初,我在intel网站上下载了文件l_mkl_2019.2.187.tgz ,并完成了
/home/pedro/
的安装。 Later I downloaded the R-3.5.2.tar.gz
file to compile R with multithreaded MKL support. 后来我下载了
R-3.5.2.tar.gz
文件来编译具有多线程MKL支持的R。 I performed the compilation by doing: 我通过以下方式执行了编译:
source /home/pedro/intel/mkl/bin/mklvars.sh intel64
cd /home/pedro/Downloads/R-3.5.2 && ./configure --enable-R-shlib --enable-threads=posix --with-lapack --with-blas="-fopenmp -m64 -I$MKLROOT/include -L$MKLROOT/lib/intel64 -lmkl_gf_lp64 -lmkl_gnu_thread -lmkl_core -lpthread -lm"
make
make install
Apparently the compilation occurred without any problems. 显然,编译过程没有任何问题。 Using the
sessionInfo()
command I had the following result: 使用
sessionInfo()
命令,我得到以下结果:
> sessionInfo()
R version 3.5.2 (2018-12-20)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.2 LTS
Matrix products: default
BLAS/LAPACK: /home/pedro/intel/compilers_and_libraries_2019.2.187/linux/mkl/lib/intel64_lin/libmkl_gf_lp64.so
locale:
[1] LC_CTYPE=pt_BR.UTF-8 LC_NUMERIC=C
[3] LC_TIME=pt_BR.UTF-8 LC_COLLATE=pt_BR.UTF-8
[5] LC_MONETARY=pt_BR.UTF-8 LC_MESSAGES=pt_BR.UTF-8
[7] LC_PAPER=pt_BR.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=pt_BR.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.5.2
Basically I'm trying to parallelize a Monte Carlo simulation using the parallel :: mclapply
function. 基本上,我试图使用
parallel :: mclapply
函数并行化Monte Carlo模拟。 The fact is that serially (1 core) I have better results using the MKL but when trying to parallelize, I realize that the threads are not fired in the 4 cores. 事实是,串行(1核)使用MKL会有更好的结果,但是当尝试并行化时,我意识到4核中没有触发线程。
What I did using the function parallel::mclapply
was: 我使用
parallel::mclapply
函数parallel::mclapply
是:
parallel::mclapply(1:8, FUN = function(x) func_metodos(), mc.cores = 4))
, wherein func_metodos()
is a function that I implemented in R and want to repeat 8 times. parallel::mclapply(1:8, FUN = function(x) func_metodos(), mc.cores = 4))
,其中func_metodos()
是我在R中实现的函数,想重复8次。
Note : I would like a solution other than using the Microsoft R Open . 注意 :除了使用Microsoft R Open之外,我还需要其他解决方案。 I do not like to use something that Microsoft puts its finger on.
我不喜欢使用微软指责的东西。
Best regards. 最好的祝福。
I covered that in some length in 我在某种程度上涵盖了
This can be fully automated as I demonstrated there. 正如我在那里演示的那样,这可以完全自动化。 I can add more color but I got to run now...
我可以添加更多颜色,但现在必须运行...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.