joaoleal / CppADCodeGen

Source Code Generation for Automatic Differentiation using Operator Overloading
Other
162 stars 36 forks source link

Add CPPAD_GIT_REPO to cppadcg cmake command line (for cppad tests tha… #63

Closed bradbell closed 3 years ago

bradbell commented 3 years ago

I am working on some CppADCodeGen examples in CppAD and need to be able to test before installing. This pull request adds the cmake command line option CPPAD_GIT_REPO, which is for this special purpose. If CPPAD_GIT_REPO is not defined, FindCppAD.cmake should drop back to your method.

bradbell commented 3 years ago

I have a mistake in the error message

"Cannot find ${library} library below CPPAD_GIT_REPO="

It should be

    "Cannot find cppad_lib library below CPPAD_GIT_REPO="
cmastalli commented 3 years ago

Hi @bradbell, This loop dependencies are not nice IMHO. Instead, can your examples be implemented in this repository? If so, this will be a clean solution :)

bradbell commented 3 years ago

I want to add an option where the CppAD user could include cppad/example/cppadcg.hpp or something like that and get a lot of the functionality of CppADCodeGen, with only a minimal amount of documentation for the interface. This is all made possible by the CppAD base2ad operation which was not available when CppADCodeGen started.

You could consider this pull request a way for me to test the idea and stay up to date with CppADCodeGen's changes.

I see your point though, one could not do a normal project dependency for this, while it would work with a cmake install, it could not be put in a packaging program like apt-get.

bradbell commented 3 years ago

Hold off on this request. I am re-thinking it (and having testing problems).

bradbell commented 3 years ago

I have check in my CppADCodeGen example to CppAD; see https://coin-or.github.io/CppAD/doc/compiled_fun.htm

The examples demonstate how base2ad can be used with CppADCodeGen so that you can use any choice, in CppAD, for evaluating the derivatives. I need to make some examples that show how to preserve the atoimic functions when doing this; i.e, during the evaluation of derivatives (using and AD type) have atomic functions call other atomic functions so that the atomic functions do not get expanded.

Due to the circular dependency problem mentioned above, I added a remark about not instlalling CppAD with this option; see the heading include_cppadcg on https://coin-or.github.io/CppAD/doc/cmake.htm#include_cppadcg

Given this, I am going to continue with my current method of kludging a local install of CppADCodeGen, for testing purposes only, and drop this pull request (by closing it).