forum.alglib.net
http://forum.alglib.net/

multy-threads in alglib.nleqsolver
http://forum.alglib.net/viewtopic.php?f=2&t=632
Page 1 of 1

Author:  serbib [ Sun Oct 21, 2012 2:58 pm ]
Post subject:  multy-threads in alglib.nleqsolver

Question about multy-threads in alglib.nleqsolver (C#).
I have two (or more) Backgroundworker-based objects and hence work with two independent threads.
But a delegate - ndimensional_func(double[] arg, ref double func, object obj) - has the "ref" link. My results are sometimes "intersects" because of reference "func" can be common.
Using of two or more references ("alglib2x.dll"...) is impossible in .net, so: is any way to "split" nleqsolver-based calculations?

Author:  Sergey.Bochkanov [ Sun Oct 21, 2012 6:55 pm ]
Post subject:  Re: multy-threads in alglib.nleqsolver

As long as different threads work with different instances of nleqsolver class, everything is thread-safe. If you want to launch two solvers in parallel, create two instances. Does it solve your problem?

Author:  serbib [ Sun Oct 21, 2012 7:33 pm ]
Post subject:  Re: multy-threads in alglib.nleqsolver

Of course, there two instances were been created... But I found that the reason of the problem was in incorrect boundary (input) parameters transmittion : there were data from public static fields of mainform. When standard object DoWorkEventArgs of the Backgroundworker is used for parameters setup, it works Ok and it is possible to load a multi-core processor. Thanks!

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/