[CppAD] multithreading
Brad Bell
bradbell at seanet.com
Mon Mar 5 22:17:32 EST 2012
On 02/27/2012 01:27 AM, Dominik Skanda wrote:
> Hello,
>
> I try to use CppAD in multi threading mode using posix threads.
> I don't want to tape parallel I only want to construct an ADFun Object
> and use copies of this ADFun object in several threads, whereby each
> copy of an ADFun object gets used in only one thread.
> I also try to copy the ADFun object within a thread.
> I have not found out how to resolve this operation by use of the
> documentation.
> I have added a short example (small as possible) so that it is hopefully
> clear what I'm trying to explain.
> I compiled it with: "g++ main.cpp -I./ -g -lpthread"
>
> The program performs but by using
> "valgrind --tool=helgrind ./a.out"
> I get a lot of errors in the context of multi threading.
>
> Can someone help me to set it up correctly?
>
> Many thanks
>
> Dominik
>
... snip ...
The example
http://www.coin-or.org/CppAD/Doc/simple_ad_pthread.cpp.xml
is a simple example of a multi-threading program with pthreads and CppAD.
When run with helgrind, it generates the following output:
[bradbell at brad multi_thread]$ valgrind --tool=helgrind ./pthread_test
simple_ad
==2269== Helgrind, a thread error detector
==2269== Copyright (C) 2007-2010, and GNU GPL'd, by OpenWorks LLP et al.
==2269== Using Valgrind-3.6.1 and LibVEX; rerun with -h for copyright info
==2269== Command: ./pthread_test simple_ad
==2269==
gmtime = 'Tue Mar 6 03:13:15 2012';
cppad_version = 'cppad-20120304';
team_name = 'pthread';
command = './pthread_test simple_ad';
memory_leak = false;
OK = true;
==2269==
==2269== For counts of detected and suppressed errors, rerun with: -v
==2269== Use --history-level=approx or =none to gain increased speed, at
==2269== the cost of reduced accuracy of conflicting-access information
==2269== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 3 from 1)
[bradbell at brad multi_thread]$
More information about the CppAD
mailing list