help-glpk
[Top][All Lists]
Advanced

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

Re: [Help-glpk] Thread-safety


From: François Galea
Subject: Re: [Help-glpk] Thread-safety
Date: Tue, 12 Dec 2006 01:19:26 +0100
User-agent: IceDove 1.5.0.8 (X11/20061116)

Andrew Makhorin a écrit :
I would like to know if GLPK is thread-safe or not. It seems it's using
a global "pointer" (in the glplib1a.c file) variable quite intensively, thus I imagine GLPK is not thread-safe. I have not investigated very much in the code of GLPK, so maybe I have missed a crucial point about this subject.

All glpk routines are reenterable except two platform-dependent routines
lib_set_ptr and lib_get_ptr which are placed in file glplib1a.c. A generic
version of these routines uses a static storage to store the pointer (to
glpk environmental block). There is a version of these routines for
32-bit Windows (sysdep/w32/glplib1a.c) which uses TLS, so that version
is reenterable; however, for GNU/Linux such a version is not implemented.

Reentarabiliy differs from thread-safety in the sense that though
reenterable routines can be used in a multi-thread program, different
threads cannot share the same program object (LPX), because the glpk
routines have no synchronization features.

What I need is indeed reentrability : what I want to do is solve different subproblems of the same problem in parallel, so each LPX is local to one thread only.

I think it should be possible to implement an GNU/Linux equivalent for your TLS-based routines, using the pthread_setspecific family of routines of the POSIX threads library. I can have a look at it, if you like.

regards,

François


--
François Galea
Equipe OPALE - Laboratoire PRiSM
Université de Versailles-Saint Quentin en Yvelines
45 av Etats-Unis F-78035 Versailles CEDEX
Tél. : +33 1 39 25 40 50





reply via email to

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