1

I want to merge huge tiff files to one files using R under ubuntu. I use the following script. But the program only used one CPU, so it also spent a several days. Acutally, I have more 16 CPUs, so how to use all CPUs when mergeing a large number raster files.

files<-list.files(path = "/mnt/hgfs/D/AUTUMN/",pattern = ".tif",full.names = T)
rl<-lapply(f,raster)
merge_result<-do.call(merge,c(rl,tolerance=1))

Maybe can use parallel package? Anyone can help me? Thanks a lot!

Tony

2008 duan
  • 31
  • 3
  • I am not very familiar with this but I was told to use: `options(mc.cores = parallel::detectCores())`. It should allow R to use all cores of the CPU. And yes it is using `parallel` . – Paul Sep 24 '20 at 06:22
  • But you might prefer to see [this answer](https://stackoverflow.com/a/8091947/10264278) – Paul Sep 24 '20 at 06:28
  • Does this answer your question? [How to let R use all the cores of the computer?](https://stackoverflow.com/questions/8091674/how-to-let-r-use-all-the-cores-of-the-computer) – prosoitos Sep 25 '20 at 03:28

0 Answers0