[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-glpk] Cannot run in parallel mode due to the static Env in GLP
From: |
Andrew Makhorin |
Subject: |
Re: [Help-glpk] Cannot run in parallel mode due to the static Env in GLPK |
Date: |
Fri, 06 Dec 2013 15:29:00 +0400 |
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 .
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [Help-glpk] Cannot run in parallel mode due to the static Env in GLPK,
Andrew Makhorin <=