[Developers] multi-threaded derivative stuff
dave fournier
davef at otter-rsch.com
Fri Jul 27 19:35:33 PDT 2012
On 12-07-24 06:21 AM, Hans J. Skaug wrote:
Just back from hiking ... going to have a scotch on the deck watching
the ocean so
very quickly
ADMB dvariable stuff (to start) has some data structures for doing the AD.
they are global variables like
something * derivative_stuff=0;
since each thread needs its own structure one need to take all the
necessary global pointer and make then
__thread something * derivative_stuff=0;
Now derivatvie stuff is local to the thread rather than global.
and that's about it. As always there are a few special cases that
need to be dealt with. But when its done then you just need to figure
out how to
send variables values and get back the corresponding derivative stuff
between threads.
Done!
> Dave,
>
> Can you repeat some of the basics here, before going in technical detail?
> What I recall from discussion in Santa Barbara (and afterwards) is that
> OpenMP uses multi-threading but we faced difficulties for the reasons
> you mention. For this reason, and the fact that we wanted to run
> on clusters, we went for MPI (under which we have a working prototype).
>
> Hans
>
>> -----Original Message-----
>> From: developers-bounces at admb-project.org [mailto:developers-
>> bounces at admb-project.org] On Behalf Of dave fournier
>> Sent: Sunday, July 22, 2012 7:49 PM
>> To: developers at admb-project.org
>> Subject: [Developers] multi-threaded derivative stuff
>>
>> Hi All,
>>
>> I recall that at the developers conference over a year ago there was a
>> lot of
>> interest in multi-threading so long as no one actually had to produce
>> anything.
>> It appeared that global variables might be a problem. I thought it
>> might be
>> of value to produce a proof of concept example with multi-threading for
>> dvariable types. The code runs without any reported errors
>> (by valgrind) so I think I am getting close. There are also some
>> strange mysteries.
>>
>> If I write the code as
>>
>> master()
>> {
>> // stuff
>> gradient_structure gs(10000)
>> // stuff
>>
>>
>> }
>>
>> slave()
>> {
>> // stuff
>> gradient_structure gs(10000)
>> // stuff
>>
>> }
>>
>> There are some obvious problems when the destructor for gs gets called.
>> But if I write the code as
>>
>> master()
>> {
>> // stuff
>> gradient_structure * pgs = new gradient_structure(10000)
>> // stuff
>> delete pgs;
>> pgs=0;
>>
>> }
>>
>> slave()
>> {
>> // stuff
>> gradient_structure * pgs = new gradient_structure(10000)
>> // stuff
>> delete pgs;
>> pgs=0;
>> }
>>
>> all is OK. So obviously there is something I don't understand or still
>> an error in the code.
>> If anyone is interested I am happy to share the code and the problem.
>> I'll hold my
>> breath.
>>
>> Dave
>>
>> _______________________________________________
>> Developers mailing list
>> Developers at admb-project.org
>> http://lists.admb-project.org/mailman/listinfo/developers
More information about the Developers
mailing list