0

我最近在 R 中的 Windows 机器上开发了一个模糊字符串匹配例程。我对速度感到非常满意。现在我尝试在虚拟红帽服务器上运行相同的程序,但速度要慢得多,即大约一个因素。100.整个过程在Windows机器上耗时1小时(6核,Intel,3.4Ghz)

我基本上做的是这样的:

location <- (if (RB$ORT[x] == "n/a"){rep(NA, length(TAC$ORT))} else {stringdist(RB$ORT[x], TAC$ORT, useBytes = TRUE)})

在 redhat 机器(14 核,AMD,2.6 GHz)上,我在启用了 openblas 的情况下运行 R。r-package stringdist 在版本 0.9.4.1 的两台机器上都运行 上面的命令运行了几百万次。奇怪的是,它甚至似乎放慢了速度。启动该过程时,我的日志告诉我:

get location right: 0.04 secs
engine used: tclget location right: 0.05 secs
engine used: tclget location right: 0.02 secs
engine used: tclget location right: 0.01 secs
engine used: tclget location right: 0.02 secs
engine used: tclget location right: 0.03 secs
engine used: tclget location right: 0.02 secs

几个小时后它告诉我:

get location right: 0.27 secs
get location right: 0.27 secs
get location right: 0.26 secs
engine used: tclget location right: 0.14 secs
get location right: 0.27 secs
engine used: tclget location right: 0.26 secs
engine used: tclget location right: 0.23 secs
engine used: tclget location right: 0.14 secs
get location right: 0.28 secs
get location right: 0.29 secs

在 Windows 机器上,这看起来像这样(6 个进程正在写入日志):

get location right: 0 secs
get location right: 0 secs
engine used: tclget location right: 0 secs
get location right: 0 secs
engine used: tclget location right: 0 secs
engine used: tclengine used: tclget location right: 0 secs
get location right: 0 secs
get location right: 0 secs

在 Windows 机器上,我们不使用 RevolutionR(或其 R-open-MS 变体)。不知道它是否使用 mkl,但实际上在使用 R 中的字符类时并不重要。可能是某种编码问题吗?当使用 Rprof 进行分析时,它所花费的绝对时间在 windows 和 linux 上的报告不同。关于相对时间,只有 enc2utf8 似乎在 linux 上更为突出。

还有其他想法吗?谢谢马丁

4

0 回答 0