Steven G. Johnson <stevenj....@...> writes:

> ...As it turns out, I'm getting ready to release a new version of NLopt  
> that has a new object-style C API, which is more re-entrant and  
> extensible than the old one ...
> 
> Most of the things that are currently global variables, like the  
> stochastic population and the local search options, are converted into  
> parameters that you can set re-entrantly for a specific nlopt_opt  
> object.
This is a good news.
> 
> In my current snapshot, the random seed is still a global parameter;  
> my thinking is that this wouldn't have a practical impact on re- 
> entrancy since random numbers are supposed to be random/uncorrelated  
> anyway.  Is there a use case where this matters?

I think there should be such cases, just as there are cases where one needs
seeding at all.

The only difference is the model that uses library. 
Say, one uses a randomised algorithm from one thread - why they need seeding? So
that if some peculiar case is detected, it can be investigated.

Now, if there is a system that does the same from several threads, what would
differ? I'd imagine that each thread would choose a random seed to use in that
thread, and store it for post-factum investigation.

> 
> A more serious obstacle to complete re-entrancy is that I'm not sure  
> all of the pre-existing programs that NLopt wraps are re-entrant,  
> especially the Fortran-derived ones.  One would have to review the  
> source code of each to look for global/static variables.
> 
> Steven

Pity I have no time to help with such review. But it could be helpful if the
documentation could state which algorithms are re-enterant and thread-safe. Most
people use specific algorithms, and might be a helpful information. 
The same goes for other exceptions like random seeding: if next release does not
support per-thread seeding, just document it. Maybe the effort of implementation
is not worth it: see what are the responses.

Dmitri





_______________________________________________
NLopt-discuss mailing list
[email protected]
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/nlopt-discuss

Reply via email to