You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi! I have the similar question: Is it possible to call RProvider functions in parallel? For example cal R.lm from different Threads/Tasks (PLINQ) simultaneously?
As far as I understand it, the underlying R engine can only be called from a single thread - so only a single thread can access it (and additionally, I think it also starts doing odd things when you call it from multiple threads, even when the calls are not concurrent).
In principle, I suspect that you can create multiple instances of the R.NET engine (@jmp75 would probably know), but this is not something that we are currently exposing in the R type provider (you cannot really currently initialize the R provider multiple times in a single process).
In the latest RProvider, the R engine runs in a single thread and is protected by a concurrent queue. This means that the parallel example above now runs without error. However, there could be contamination if shared state was used rather than a pure function as above. I've added a doc section for this: https://fslab.org/RProvider/expressions.html#Parallel-processing (part of #274 )
Activity
mae1st0rm commentedon Nov 16, 2015
Hi! I have the similar question: Is it possible to call RProvider functions in parallel? For example cal R.lm from different Threads/Tasks (PLINQ) simultaneously?
tpetricek commentedon Nov 17, 2015
As far as I understand it, the underlying R engine can only be called from a single thread - so only a single thread can access it (and additionally, I think it also starts doing odd things when you call it from multiple threads, even when the calls are not concurrent).
In principle, I suspect that you can create multiple instances of the R.NET engine (@jmp75 would probably know), but this is not something that we are currently exposing in the R type provider (you cannot really currently initialize the R provider multiple times in a single process).
AndrewIOM commentedon May 15, 2026
In the latest RProvider, the R engine runs in a single thread and is protected by a concurrent queue. This means that the parallel example above now runs without error. However, there could be contamination if shared state was used rather than a pure function as above. I've added a doc section for this: https://fslab.org/RProvider/expressions.html#Parallel-processing (part of #274 )
Closing as fixed.