这里有没有人成功地将大矩阵导出到 R 中的雪团?bigmatrix 和 attach.resource 示例中的注释行说可以这样做,但我没有成功。
library(bigmemory)
library(snow)
z <- big.matrix(3, 3, type='integer', init=3)
cl = makeCluster(8, type = "SOCK")
clusterEvalQ(cl,{library(bigmemory)})
zdescription <- describe(z)
clusterExport(cl,"zdescription")
clusterEvalQ(cl,{y <- attach.resource(zdescription)}) #attach.big.matrix also crashes
即使我使用文件支持的大矩阵它也会崩溃(这很奇怪,因为它甚至不使用共享内存)
[[1]]
Warning: This is not advised. Here is the head of the matrix:
*** caught segfault ***
address 0x10, cause 'memory not mapped'
Traceback:
1: .Call("CGetNrow", x@address)
2: nrow(x)
3: nrow(x)
4: .local(x, ...)
5: head(x)
6: head(x)
Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace