[SciPy-user] Automatic Differentiation with PYADOLC and Removing Boost::Python dependency

David Cournapeau cournape@gmail....
Thu Mar 26 11:43:20 CDT 2009

On Fri, Mar 27, 2009 at 12:41 AM, Ravi <lists_ravi@lavabit.com> wrote:
> Hi Sebastian,
>  Thank you for writing a wrapper for ADOL-C.
> On Thursday 26 March 2009 05:50:24 Sebastian Walter wrote:
>> I have implemented a wrapper for  the C++ Automatic Differentiation
>> (AD) tool ADOL-C.
>> You can use it to differentiate complex algorithms to arbitrary order.
>> It works quite well with numpy.
>> You can have a look at it at http://github.com/b45ch1/pyadolc .
> >From a quick look at your code, the C++ wrapper seems really nice. The python
> wrapper, though, has some cosmetic problems:
> 1. The entry point function BOOST_PYTHON_MODULE( _adolc ) should be part of
> the cpp file, not the hpp file.
> 2. In my experience, it is difficult to maintain docstrings in the C/C++
> portion of the code. It would be a lot easier to add the docstrings to the
> python part of the python wrapper; see the boost.python documentation for
> examples. With this method, if the docstrings need to change, you will not
> need to recompile the C/C++ files.
> 3. I don't understand why the addition of unary operators for badouble messes
> up any remaining computations. Could you please post a reduced example on
> cplusplus-sig exhibiting the problem?
> [snip example usage]
>> Removing Boost::Python dependency ?
>> ===============================
>> I have used Boost::Python to wrap it, but I am not happy with that
>> additional dependency!
>> So I wondered if someone could give me advice how to avoid users

> Given the straightforward nature of your boost.python usage, it will compile
> with boost versions from 1.34.1 (perhaps even older versions) to the
> forthcoming 1.39. Most (if not all) linux distributions supply one of those
> versions of boost. For linux users, your code is straightforward to compile
> and use (though I'd have preferred a CMake-based system).

For python packages, distutils is often the best bet, for better or
worse. Since there is a dependency on a non trivial library which is
built through autoconf, windows support may not be straightforward
(depending on your definition on windows - if cygwin is ok, then it is
not really a problem). The autoconf script looks quite easy, though
(not many checks - certainly nothing that cannot be done through
distutils and numpy extensions of it)

It boils down to how much you are ready to work on it, I think. But
from quickly looking at it, you could build the library and your
wrapper entirely from distutils - you could then build binary
installers, tarballs, etc... automatically from distutils "for free".


More information about the SciPy-user mailing list