首页 文章

使用Microsoft R Open和Google Compute Engine的所有核心

提问于
浏览
3

我在具有两个vCPU的GCE实例上使用Microsoft R Open . 这是它的规格 .

$ lscpu
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                2
On-line CPU(s) list:   0,1
Thread(s) per core:    2
Core(s) per socket:    1
Socket(s):             1
NUMA node(s):          1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 63
Model name:            Intel(R) Xeon(R) CPU @ 2.30GHz
Stepping:              0
CPU MHz:               2300.000
BogoMIPS:              4600.00
Hypervisor vendor:     KVM
Virtualization type:   full
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              46080K
NUMA node0 CPU(s):     0,1
Flags:                 fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush
 mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc
 eagerfpu pni pclmulqdq ssse3 fma cx16 sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand hyp
ervisor lahf_lm abm fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms xsaveopt

尽管我有两个内核,但Microsoft R Open似乎只识别其中一个,所以我没有充分利用我的计算能力 . 我也无法手动设置线程数 .

Microsoft R Open 3.3.2
The enhanced R distribution from Microsoft
Microsoft packages Copyright (C) 2016 Microsoft Corporation
Using the Intel MKL for parallel mathematical computing(using 1 cores).
Default CRAN mirror snapshot taken on 2016-11-01.
See: https://mran.microsoft.com/.
> getMKLthreads()
[1] 1
> setMKLthreads(2)
Number of threads at maximum: no change has been made.

这是显示CPU使用率的图表 . 它从不使用超过50%的CPU功率 .

enter image description here

那么,我应该怎么做才能将我的所有内核与MRO一起使用?

2 回答

  • 3

    你正在运行超线程的Xeon . 你有1个具有超线程的cpu,os将其视为2 cpus,但只有一个物理cpu . MRO仅使用物理核心(没有超线程)

  • 3

    你可以用这个:

    library(doParallel) no_cores <- detectCores() - 1 registerDoParallel(cores=no_cores)

    它将比您拥有的实际核心少一个核心 . 它为操作系统留下了一个核心 . 试试看 .

相关问题