rfile-ioparallel-processingdomc

file locking in R doMC


I have some non-parallel code that I would like to parallelize. The code should be embarrassingly parallelizeable except for file operations (multiple files are written to and which file to write is somewhat stochastic and could potentially be the same in different processors). With the doMC and foreach packages, do I have to handle file locking or is it already handled by the package? I am not tied to doMC, I selected it because I will still be making a lot of changes to my code and it seems simple to work with.


Solution

  • I have not found a solution for the general problem. There appears to be a solution in:

    Is there a way to share a lock (e.g. a lock file) between R processes?

    and this could be considered a duplicate of that.