oracle / fastr

A high-performance implementation of the R programming language, built on GraalVM.
Other
618 stars 63 forks source link

Allow multiple threads in fastR #59

Open rbotafogo opened 5 years ago

rbotafogo commented 5 years ago

Are there any plans to allow multiple threads in fastR?

When doing polyglot programming, Ruby and R for instance, we need to set the --single_thread flag. This is quite limiting for programs in Ruby that can use threads efficiently and effectively. Also, other implementations of R, such as Renjin, allow multiple threads in R. I would love to see this restriction go, although I understand that this might be a goal for some time to come.

Thanks!

steve-s commented 5 years ago

Hello Rodrigo,

we plan to support access from multiple threads but one thread at a time. You can then probably just use Mutex in Ruby to make sure that only one thread at any given moment talks to FastR.

GNU-R does not support any real parallelization (the parallel package starts new R processes to parallelize the computation), so there is no support for parallel computations in R as a language like in Ruby, e.g., there are no synchronization primitives in R. With FastR you can start more isolated FastR contexts in one JVM, but that is only possible from Java via the embedding API or via our emulation of the parallel package but that does not solve your problem.

We plan to make the interop between multi and single threaded languages easier, but it is not the biggest priority at the moment.

I will keep this issue open and add any updates on this.

rbotafogo commented 5 years ago

Hi Stepan,

Thanks for the reply and thanks for keeping the issue open. I don´t see this as urgent either, but would be nice to have it sometime.

Em qua, 13 de mar de 2019 às 15:38, Stepan Sindelar < notifications@github.com> escreveu:

Hello Rodrigo,

we plan to support access from multiple threads but one thread at a time. You can then probably just use Mutex in Ruby to make sure that only one thread at any given moment talks to FastR.

GNU-R does not support any real parallelization (the parallel package starts new R processes to parallelize the computation), so there is no support for parallel computations in R as a language like in Ruby, e.g., there are no synchronization primitives in R. With FastR you can start more isolated FastR contexts in one JVM, but that is only possible from Java via the embedding API or via our emulation of the parallel package but that does not solve your problem.

We plan to make the interop between multi and single threaded languages easier, but it is not the biggest priority at the moment.

I will keep this issue open and add any updates on this.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/oracle/fastr/issues/59#issuecomment-472552971, or mute the thread https://github.com/notifications/unsubscribe-auth/AD0H8V62FEb8ZYclRGsj03rd4PDTrM-mks5vWUXDgaJpZM4brnlI .

-- Rodrigo Botafogo