Open tlucz opened 5 years ago
it is most likely due to the use of global variables in the C code we have imported from GNU R. I thought we had rewritten offending code, but will need to check on this.
Indeed, one of the support routines declares a large number of static local variables that we missed: https://github.com/bedatadriven/renjin/blob/fadaeddd657d3afb7ac6686f289ce0b37e7ee8ec/packages/stats/src/main/c/lbfgsb.c#L320
I will see if it's easier to refactor the many many global variables into a working data structure, or if we can use the global variable transformer that has worked so well with the graphics package.
Hi, Thanks for a quick reaction. When do you plan to release a new version with this fix?
Hello, Is there a plan to merge the fix?
Hello,
We faced a problem with multithreading in Renjin. The 'optim' function with 'L-BFGS' method calculates different results when is invoked from many threads.
A simple Java project was prepared to reproduce the problem. Also the code is attached at the bottom of this mail.
https://github.com/tlucz/parallel-optim
When we run the code with THREADS_NUMBER=1 we get following correct results (every time the same):
But when we run it with more threads e.g. THREADS_NUMBER = 2 we get different results for the calls and sometimes even an errors:
Separate ScriptEngine is created for each thread as it is described in Renjin documentation.
code: