[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-glpk] Parallel runs of glpk

From: Mathieu Dutour
Subject: Re: [Help-glpk] Parallel runs of glpk
Date: Thu, 15 Dec 2016 15:56:11 +0100

Hi Andrew,

What about replacing
static void *tls = NULL;
thread_local void *tls = NULL;

The "thread_local" is certainly supported in C++ from C++11
and C11 has the _Thread_local.
and so it should be portable and address the issue cleanly.

Now, my second question would be for the "tls".
The variable "tls" is used by tls_set_ptr and tls_get_ptr which
are only used by glp_init_env, glp_free_env and get_env_ptr.

Proposed solution:
--- As of now the glp_init_env and glp_free_env are taking
a void. But we get very simply put a ENV *env as part of
their input. The "env" would then no longer be a global variable
but instead be a scope variable in the frame where the solver
is called.

--- several function glpapi06.c / glpapi08.c and glpapi09.c
are using get_env_ptr to get the pointer. Instead we could add
the env variable as part of their input.

I may be very naive but the only negative impact I see from
this solution is API breaks.


On 14 December 2016 at 18:56, Andrew Makhorin <address@hidden> wrote:
On Wed, 2016-12-14 at 18:28 +0100, Mathieu Dutour wrote:
>         Please see
> .
>         If you are interested in this solution, I can post you a
>         reentrant
>         version of glpk/src/env/tls.c for GNU/Linux or MS Windows
>         (from an old
>         glpk distribution).
> Yes, thank you!
> I think this is the right solution.

For a GNU/Linux version see

Attached is a MS Windows dll version.

You need to replace glpk/src/env/tls.c and then rebuild the package as

reply via email to

[Prev in Thread] Current Thread [Next in Thread]