2016-06-09 11 views
0

Windows 컴퓨터의 parLapply 함수에서 big.matrix (백업되지 않은 파일)에 액세스하려고합니다. 그러나 big.matrix를 호출하면 R이 충돌합니다. "Windows 프런트 엔드 용 R이 작동을 멈췄습니다."클러스터 작업자로부터 big.matrix 주소 지정

먼저 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) 

답변

3

공유 메모리에 액세스하려면 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)