[ADOL-C] using adolc with openmp

Ian Washington washinid at mcmaster.ca
Tue Mar 18 14:39:41 EDT 2014


Thanks Brad,

I'll have a look into CppAD. Your solution seems like what I was 
thinking: on the master thread, create a bunch of tapes (or deep copies 
of a single tape) dedicated to each particular worker thread. It would 
then seem that a similar approach is possible for adolc. My main concern 
was avoiding a repetitive and unnecessary re-taping on each thread.

On another note, I am also trying to use MPI in a similar fashion where 
I would communicate the tape created on one process to another process. 
I was thinking of creating a derived mpi data type and then a simple 
point-to-point communication. Now the questions become: (1) how to do I 
get a reference to the created tapes; (2) how do I determine the size of 
the taped function (once I know where they are in memory is simple 
sizeof() might work?). It seems like 'tapestats()' gives some of this 
info. But perhaps, in the case of MPI, an easier approach might be to 
just re-tape on each process and avoid tape communication altogether.

Does anybody have any thoughts on how to simultaneous evaluate 
derivatives at different values on a distributed system using ADOL-C and 
MPI. In my case, the function remains the same and I am just interested 
in computing derivatives at different independent variable values.

Regards,
Ian.



On 03/18/2014 01:11 PM, Brad Bell wrote:
> You can do this in CppAD. First you create the tape and then you use 
> the assignment operator to make multiple copies of it; each for use 
> with a different thread; see
> http://www.coin-or.org/CppAD/Doc/funconstruct.xml#Assignment%20Operator
>
> In your case, you could have a vector of ADFun functions
>     CppAD::vector< ADFun<Base> > g(n_thread)
>     for(i_thread = 0; i_thread < n_thread; i_thread++)
>         g[i_thread] = f;
> would make n_thread copies of the taped function. Note that the 
> default constructor is used for each ADFun g[i]. Also note that any 
> simple vector template class could be used in place of CppAD::vector.
>
> P.S.
> Note that the multi-threaded example multi_newton example retapes the 
> function for each derivative evaluation; see
> http://www.coin-or.org/CppAD/Doc/multi_newton_time.cpp.xml#use_ad
> You could modify this example to test having one tape, copying it, and 
> then reusing it.
>
>
>
>
>
> On 3/17/2014 2:49 PM, Ian Washington wrote:
>> Hello all,
>>
>> I have a similar question related to using adolc and openmp, somewhat 
>> based on 
>> http://list.coin-or.org/pipermail/adol-c/2014-February/000951.html
>>
>> In my case, I have no openmp directives in the function to be traced 
>> and all I want to do is evaluate a traced function at different 
>> independent variable values in an openmp for loop.
>>
>> My question is:
>>
>> Is it possible to only trace the function on one thread and then 
>> simultaneously evaluate the derivatives (at different values) using 
>> multiple threads?
>>
>> I'm thinking this is not possible because the same memory location 
>> would be simultaneously accessed and written to, and thus I would 
>> need to have an independent function trace (i.e., independent memory 
>> location) for each thread.
>>
>> Off the top of my head I guess I could create a whole bunch of 
>> function traces indexed by different tags and then just refer to the 
>> appropriate tag depending on the particular thread, but this seems 
>> quite inefficient.
>>
>> Does anybody have any thoughts on how I could do this ?
>>
>> Thanks,
>> Ian.
>>
>>
>>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/adol-c/attachments/20140318/c40a6e61/attachment.html>


More information about the ADOL-C mailing list