Ok. Thanks Matt. For the tests I have run so far, my simple fix of removing all the static vars from OsiCpx seems to have worked. However, my usage for this case is very simple. I am essentially just solving the same N models on T threads over and over again with just a minor problem modifications. So, I think the thread-safey in my case is primarly cplex's - which we know that part is fine. The main "connector" through OSI seems to be the env_, lp_ vars - of which env_ was static.<br>
<br>I'll definitely keep my eye out for other issues and I'll let you know / add tickets.<br><br>Thanks,<br>Matt G<br><br><br><div class="gmail_quote"><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Matt-<br>
<br>
I'm not sure that thread safety is quite that simple. You may have<br>
eliminated some of the obvious races, but it wouldn't surprise me to<br>
find other hidden ones that don't crop up as frequently. OSI really<br>
needs a more comprehensive audit for thread safety, which we are aware<br>
of and which is on my agenda.<br>
<br>
If you have patches that you think make a good starting point, I'm glad<br>
to have them. The best place to keep them is probably attached to a<br>
ticket.<br>
<br>
Thanks.<br>
<br>
Matt<br>
<div><div></div><div class="h5"><br>
<br>
<br>
On Fri, 2009-08-28 at 01:57 -0400, Matthew Galati wrote:<br>
> FYI. If I remove all the references to static env_, version, etc...<br>
> things seem to work fine now. OsiCpx is then thread-safe.<br>
><br>
> Can this be changed? or at least provided as an option? It is a shame<br>
> if one cannot use Osi in a multi-threaded environment.<br>
> ________________________________________<br>
> From: <a href="mailto:osi-bounces@list.coin-or.org">osi-bounces@list.coin-or.org</a> [<a href="mailto:osi-bounces@list.coin-or.org">osi-bounces@list.coin-or.org</a>] On<br>
> Behalf Of Matthew Galati [<a href="mailto:magh@lehigh.edu">magh@lehigh.edu</a>]<br>
> Sent: Thursday, August 27, 2009 11:55 PM<br>
> To: <a href="mailto:osi@list.coin-or.org">osi@list.coin-or.org</a><br>
> Subject: [Osi] osicpx threaded<br>
><br>
> Has anyone successfully used more than one instance/thread of OsiCpx<br>
> simultaneously? I am trying to do this. Constructing 2 instances of<br>
> OsiCpx and using standard pthreads, solve two MILPs on 2 threads. It<br>
> crashes. Valgrind/Helgrind is showing lots of potential race<br>
> conditions. Looking a little deeper into OsiCpx, I noticed that<br>
> although I have two different CpxLp ptrs, I have one CpxEnv ptr. In<br>
> fact, the cpx env is a static variable in OsiCpx. Doesn't this make<br>
> OsiCpx not thread-safe? Is there any easy way around this?<br>
><br>
> Thanks,<br>
> Matt<br>
><br>
><br>
</div></div>> _______________________________________________<br>
> Osi mailing list<br>
> <a href="mailto:Osi@list.coin-or.org">Osi@list.coin-or.org</a><br>
> <a href="http://list.coin-or.org/mailman/listinfo/osi" target="_blank">http://list.coin-or.org/mailman/listinfo/osi</a><br>
<font color="#888888">--<br>
Matthew Saltzman<br>
<br>
Clemson University Math Sciences<br>
mjs AT clemson DOT edu<br>
<a href="http://www.math.clemson.edu/%7Emjs" target="_blank">http://www.math.clemson.edu/~mjs</a><br>
</font></blockquote></div><br>