Getting the derivative of f90 code

Hi, is there a way to easily get derivative of f90 code? I could not make ADIFOR and other tools to work? Any good resources or blogs that does it would help out immensely. Thank you.

1 Like

Welcome to the forum, @fortran_me_up . Your question is a trifle generic, so it may be difficult to provide useful answers. If it is about obtaining the derivative of a function in an algorithm, you might have a look at flibs - a collection of Fortran modules / SVN / [r429] /trunk/src/computing/automdiff.f90. Its purpose is fairly limited, but it can give you an idea. If you want more than that, there ought to be more resources (including some commercial tools). I will leave that to others for the moment.

1 Like

I am just starting to work with Tapenade and find it very straightforward and easy to use. There is a nice tutorial at https://hakantiftikci.wordpress.com/2009/11/27/using-tapenade/ and the website is at https://team.inria.fr/ecuador/en/tapenade/

I am also interested in ADIFOR, but couldn’t find it anywhere. Do you have a URL that works?

I can’t seem to make it work. I get a lot of errors on type mismatch.

I had lots of warnings about type mismatches from Tapenade, which I suppressed with explicit conversions, just so that any real error messages would stand out.

Are the messages from Tapenade or Fortran (which compiler?). To get help you will need to provide more information. Can you post a couple of sample lines of code with the error message?

I get this error for the file.( I could not upload( new user limitation) but for demonstration purposes. I was able to change the type errors but these new errors I have no ideas.

Thank you for the pointer to the collection.

I have not tried the ADIFOR2 yet but have sent the email to the contact here ADIFOR

Is this line right?

 IF (ro .GT. REAL(1e-7, kind=pre)) THEN

doesn’t “real(A)” take only an integer argument? Also where did you get ADIFOR? I tried hard, wrote to several people and institutions, but couldn’t find it. Maybe you would share your copy?

The argument can be integer, real, or complex.

For a real argument it is either a noop or a kind conversion. I would not write that statement that way, I would instead write it directly as

IF (ro .GT. 1e-7_pre) THEN

However, the compiler probably does the same conversion at compile time, so there is no practical difference.