kaneplusplus / bigmemory

126 stars 24 forks source link

How to access matrix/keep in shared memory after script got executed #109

Closed matmu closed 2 years ago

matmu commented 2 years ago

I use the bigmemory package to put a very large matrix into shared memory (see script below, so it can be accessed in parallel by scripts in other R sessions.

I now want to execute the script in a non-interactive way. The problem is, that if I run it with Rscript, the matrix is removed from shared memory right after the Rscript process ended. I could add Sys.sleep(99999) to the end of the script, but I am wondering if there is any better way to acclompish this. Thanks for your help.

library(bigmemory)

m = read.big.matrix("matrix.txt", type='double', shared = TRUE, header = FALSE, sep = "\t")

sign = describe(m)
dput(sign, "matrix.signature")