rsnowfall

Running different programs on multiple cores


Hopefully this is a simple question I've overlooked an answer to, but in my searches this morning I've been fruitless.

I have four cores on my computer, and want to concurrently run different programs (loops) in R over multiple cores. If I open up four R sessions, will they automatically be places on different cores, or do I need to figure out a way to do this with snowfall?

I have successfully used snowfall before to run the same program, but with different values before. But would snowfall allow me to run completely different programs on different cores? Could I set up each simulation loop to be a different function (i.e: func1, func2, func3, func4), and then have snowfall assign each function to a different core?

Thanks for any help


Solution

  • I don't know how it is on different OSs, but on windows your OS takes care of this. So you can open as many R sessions as you want and they will be distributed across the cores (with each process taking maximally one core). If you open more R sessions than you have CPUs, then obviously some will not be able to use a full CPU.

    So no need to use snowfall here.