R and shared memory for parallel::mclapply

前端 未结 3 1649
死守一世寂寞
死守一世寂寞 2020-12-16 20:20

I am trying to take advantage of a quad-core machine by parallelizing a costly operation that is performed on a list of about 1000 items.

I am using R\'s parallel::m

3条回答
  •  心在旅途
    2020-12-16 21:00

    Linux and macosx have a copy-on-write mechanism when forking, it means that the pages of memory are not actually copied, but shared until the first write. mclapply is based on fork(), so probably (unless you write to your big shared data), the memory that you see reported by your process lister is not actual memory.

    But, when collecting the results, the master process will have to allocate memory for each returned result of the mclapply.

    To help you further, we would need to know more about your fun function.

提交回复
热议问题