CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

Automatic Differentiation

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 4, 2008, 05:39
Default Automatic Differentiation
  #1
Frauke Ramseck
Guest
 
Posts: n/a
Can anyone recommend a tool for Automatic Differentiation? I need extremely accurate Jacobians (and possibly Hessian) for use in an implicit flux scheme. Performance is the most important criterion and to lesser degree usability. Any suggestions or comments are welcome.
  Reply With Quote

Old   March 4, 2008, 06:11
Default Re: Automatic Differentiation
  #2
Praveen. C
Guest
 
Posts: n/a
What is the language of your code ?

If performance is most important then you should use a source transformation tool. For fortran Tapenade is a good choice. For C I dont know of any free tool but there is a commercial one called TAMC.
  Reply With Quote

Old   March 4, 2008, 06:52
Default Re: Automatic Differentiation
  #3
John Bush
Guest
 
Posts: n/a
I can highly recommend the AD tools ADF (for Fortran) and ADC (for C/C++) (from vivlabs). For the Jacobian, these tools produce AD code that is only 20-30% slower than hand code. In my application with 100,000+ equations it also scales well (no performance degrading when going from 1,000 to 100,000 equations). ADF and ADC use the operator overloading methods, thus only minimal code changes are necessary.

It's a commercial tool, but I believe they offer academic licenses too (which applies to me). You can check out their web site at http://www.vivlabs.com.
  Reply With Quote

Old   March 4, 2008, 09:14
Default Re: Automatic Differentiation
  #4
Praveen. C
Guest
 
Posts: n/a
Tools which use operator overloading are very slow and require large memory. ADF/ADC also uses overloading but they claim to get good performance. But I did not see any examples. Do you know of any papers which contain application of this tool ?

For C/C++, adolc is pretty easy to use but I found it is very slow compared to a source transformation approach (Tapenade).
  Reply With Quote

Old   March 4, 2008, 09:37
Default Re: Automatic Differentiation
  #5
John Bush
Guest
 
Posts: n/a
I have not yet compared ADF/ADC to source transformation tools, but I've tested adolc and CppAd. I agree with you that adolc is pretty easy to use but also found it is very slow, especially compared to ADF/ADC.

I can only report about my own application, where I need to get fast derivatives for large and sparse systems. I find that 30% performance degradation compared to hand code is quite acceptable provided there is no performance penalty if you increase the number of equations.

Last year they were giving out trial versions, thus you might be able to test ADF/ADC on your own application for free.
  Reply With Quote

Old   March 4, 2008, 10:16
Default Re: Automatic Differentiation
  #6
Frauke Ramseck
Guest
 
Posts: n/a
Thank you very much for all the help, it is really much appreciated.

I am mostly looking to apply automatic differentiation to Fortran codes. Another requirement I forgot to write about is that I need it for commercial purposes. It seems that Tapenade is not free for commercial use.

I am relatively new to this field and got a bit confused about the differences between the source transformation and the operator overloading approach.

I will probably give ADF a try, if it is not too expensive.
  Reply With Quote

Old   March 5, 2008, 03:15
Default Re: Automatic Differentiation
  #7
Praveen. C
Guest
 
Posts: n/a
Does ADF/ADC provide reverse mode of differentiation ? I could not find this information on their website which is rather strange. But digging up a paper written by the company founder, I suspect it has only forward mode of differentiation. So that is one more aspect you must keep in mind. Reverse mode is very efficient when you have small number of dependent variables and large number of independent variables. While Tapenade is not free for commercial use you can buy a license for your use, I think it would be cheaper than buying a commercial product, since Tapenade is developed by a government lab. Another tool you can look at ADIFOR but I think it also provides forward mode only. For you application forward mode would be good enough I guess. You want to use AD for an implicit scheme. So what you need is not the jacobian but the product of a jacobian with a given vector. You can then use matrix-free methods like GMRES to solve your equation. What is the size of your jacobians ?
  Reply With Quote

Old   March 5, 2008, 06:06
Default Re: Automatic Differentiation
  #8
John Bush
Guest
 
Posts: n/a
Do you know the cost of Tapenade for commercial use? A tool developed by a govermant lab may not be cheaper.

In any case, I get your point about source transformation tools. Yes, they probably give you the very best performance, but you really have to factor in the additional programming effort. Why would you be willing to go this extra mile if operator overloading techniques have matured to a point where performance difference is on the order of a few ten percents? Within this range other factors such as the choice of the compiler have to be considered too.

Like most other AD tools ADF/ADC provide utility functions for efficient computation of a jacobian times a given vector.
  Reply With Quote

Old   March 5, 2008, 06:19
Default Re: Automatic Differentiation
  #9
Praveen. C
Guest
 
Posts: n/a
As far as I know there is no fixed price for Tapenade. You must contact them and find out. But I am sure it will be cheaper than commercial tools.

In most cases, Tapenade does not require rewriting your code. You may have to rewrite your code only if there are some pathological situations like some severe non-differentiability. Otherwise the code remains untouched. In ADF/ADC you still have to add some extra code. In Tapenade the specification of dependent, independent, etc. is external so you do not modify your code at all. Everything can be automated using makefiles. If your code changes then all you have to do is run make to differentiate and generate new executable.
  Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
cppAD (Automatic Differentiation) Behzad60 Main CFD Forum 0 November 13, 2010 09:47
RPM in Wind Turbine Pankaj CFX 9 November 23, 2009 04:05
transient simulation of a rotating rectangle icesniffer CFX 1 August 8, 2009 07:25
Automatic Differentiation eriks OpenFOAM Post-Processing 2 October 30, 2006 12:35
Automatic Differentiation (AD) for PDE's dav Main CFD Forum 4 February 4, 2003 16:26


All times are GMT -4. The time now is 21:20.