data.table中的R rowsum使R崩溃

时间:2022-07-14 23:23:46

The code below works fine

下面的代码工作正常

library(data.table)
dt <- data.table(mtcars)[,.(cyl, gear, mpg)]
colsToSum <- c("cyl", "gear", "mpg")
dt[, F15_49 := rowSums(.SD), .SDcols = colsToSum]

but a version of this crashes R in RStudio with the message "R Session Aborted. R encountered a fatal error. The session was terminated." Followed by a Start New Session button. The code snippet that crashes is

但是这个版本会在RStudio中崩溃R,并显示消息“R Session Aborted .R遇到致命错误。会话终止了。”然后是“开始新会话”按钮。崩溃的代码片段是

ageColsToSum <- c("F15_19", "F20_24", "F25_29", "F30_34", "F35_39", "F40_44", "F45_49")
dt.SSP.scen.wide[, F15_49 := rowSums(.SD), .SDcols = ageColsToSum]

When I run the code in R in a shell I get the following message.

当我在shell中运行R中的代码时,我收到以下消息。

OMP: Error #15: Initializing libomp.dylib, but found libomp.dylib already initialized. OMP: Hint: This means that multiple copies of the OpenMP runtime have been linked into the program. That is dangerous, since it can degrade performance or cause incorrect results. The best thing to do is to ensure that only a single OpenMP runtime is linked into the process, e.g. by avoiding static linking of the OpenMP runtime in any library. As an unsafe, unsupported, undocumented workaround you can set the environment variable KMP_DUPLICATE_LIB_OK=TRUE to allow the program to continue to execute, but that may cause crashes or silently produce incorrect results. For more information, please see http://www.intel.com/software/products/support/. Abort trap: 6

OMP:错误#15:初始化libomp.dylib,但发现libomp.dylib已经初始化。 OMP:提示:这意味着OpenMP运行时的多个副本已链接到该程序中。这很危险,因为它会降低性能或导致错误的结果。最好的办法是确保只有一个OpenMP运行时链接到进程中,例如通过避免任何库中的OpenMP运行时的静态链接。作为不安全,不受支持,未记录的变通方法,您可以设置环境变量KMP_DUPLICATE_LIB_OK = TRUE以允许程序继续执行,但这可能导致崩溃或无声地产生不正确的结果。有关详细信息,请访问http://www.intel.com/software/products/support/。中止陷阱:6

I don't know anything about openMP so I don't know what could be initializing libomp.dylib.

我对openMP一无所知,所以我不知道什么可以初始化libomp.dylib。

1 个解决方案

#1


2  

I followed the directions at https://github.com/Rdatatable/data.table/wiki/Installation and installed the development version of data.table 1.10.5. My code now works.

我按照https://github.com/Rdatatable/data.table/wiki/Installation上的说明进行操作,并安装了data.table 1.10.5的开发版本。我的代码现在有效。

#1


2  

I followed the directions at https://github.com/Rdatatable/data.table/wiki/Installation and installed the development version of data.table 1.10.5. My code now works.

我按照https://github.com/Rdatatable/data.table/wiki/Installation上的说明进行操作,并安装了data.table 1.10.5的开发版本。我的代码现在有效。