解决来自集群工作人员的 big.matrix
addressing a big.matrix from cluster workers
我正在尝试从 windows 机器上的 parLapply 函数访问 big.matrix(非文件备份)。但是,R 在调用 big.matrix - "R for Windows front-end stopped working" 时崩溃。
我需要先附上 big.matrix 吗?我该怎么做呢?非常感谢任何帮助。
require(parallel)
require(bigmemory)
data <- matrix(rnorm(10^8),ncol=1000)
data.big <- as.big.matrix(data)
cl <- makeCluster(2)
parLapply(cl,1:2,function(x,data.big){
require(bigmemory)
data.big[x,1] # this line causes R to crash
},data.big)
stopCluster(cl)
您想使用attach.big.matrix
访问共享内存。这是通过使用来自 describe
的信息完成的。以下应该有效。
datadesc <- describe(data.big)
parLapply(cl,1:2,function(x,datadesc){
require(bigmemory)
data.big <- attach.big.matrix(datadesc)
data.big[x,1] # this line causes R to crash
},datadesc)
我正在尝试从 windows 机器上的 parLapply 函数访问 big.matrix(非文件备份)。但是,R 在调用 big.matrix - "R for Windows front-end stopped working" 时崩溃。
我需要先附上 big.matrix 吗?我该怎么做呢?非常感谢任何帮助。
require(parallel)
require(bigmemory)
data <- matrix(rnorm(10^8),ncol=1000)
data.big <- as.big.matrix(data)
cl <- makeCluster(2)
parLapply(cl,1:2,function(x,data.big){
require(bigmemory)
data.big[x,1] # this line causes R to crash
},data.big)
stopCluster(cl)
您想使用attach.big.matrix
访问共享内存。这是通过使用来自 describe
的信息完成的。以下应该有效。
datadesc <- describe(data.big)
parLapply(cl,1:2,function(x,datadesc){
require(bigmemory)
data.big <- attach.big.matrix(datadesc)
data.big[x,1] # this line causes R to crash
},datadesc)