On Fri, 2013-12-06 at 16:54 +1030, Sean Ma wrote: [...] > > The previous mentioned problem has been identified, which is due to > the static Env in GLPK, more exactly to say, when calling GLPK we > cannot run in parallel mode.
Glpk is *not* thread safe. The reference manual warns about that. > > Therefore, I was just wondering it might be good to change the Env in > GLPK from static to be explicitly allocated by the user before > constructing the model. In that case, when we have many models running > in parallel mode, there will be no such a restriction. > > I think something similar to CPLEX would be good. First we have to > construct the Env, and then this Env will be connected to one or more > models. If you need more details, please let me know. This is insufficient to make glpk thread-safe, because (by design) it has no locks to prevent accessing the same problem object from different threads. Nevertheless it is possible to make glpk reenterable by replacing glpk/src/env/tls.c with a platform-specific version that stores 'tls' pointer in a thread local storage. Please see an example of such implementation for MS Windows dll: http://lists.gnu.org/archive/html/help-glpk/2009-12/msg00008.html . _______________________________________________ Help-glpk mailing list [email protected] https://lists.gnu.org/mailman/listinfo/help-glpk
