GithubHelp home page GithubHelp logo

Support for python 3 about adol-c HOT 12 OPEN

coin-or avatar coin-or commented on August 23, 2024
Support for python 3

from adol-c.

Comments (12)

kkulshre avatar kkulshre commented on August 23, 2024

Hi. It would be best if you open a pull-request with a fix, so that we are compatible with both python2 and python3.

from adol-c.

DiegoRomeres avatar DiegoRomeres commented on August 23, 2024

Hi, is there any news on this topic? Is anybody planning to make it compatible with python3?

from adol-c.

kkulshre avatar kkulshre commented on August 23, 2024

As I wrote before, anyone who feels like it, please open a pull-request with the fix.

from adol-c.

bradbell avatar bradbell commented on August 23, 2024

cppad_py is an alternative that works with python3; see
https://cppad-py.readthedocs.io/

from adol-c.

cklb avatar cklb commented on August 23, 2024

Hi there,

as Python 2 did reach end of life quite some time ago, I think it would be a good Idea to support Python 3 from now on forward. (Just to be clear, the current swig wrapper works with 3.11, you just can't do any division.)

I went ahead and made the required changes, however due to #42 I had to make some more changes to the build system that are possibly a little hackish.
In my opinion, it would be best to resolve the problems with the buildsystem first. Afterwards I will gladly add a test case for the changes.

My changes can be found in 7b0078e .

Best,
Stefan

from adol-c.

awalther1 avatar awalther1 commented on August 23, 2024

Hi Stefan,

thanks a lot for your comment!!

We also found some issues with the build system. I will try to integrate them within the next two weeks. It would be great if you could provide a test case after that.

Best regards

Andrea

from adol-c.

cklb avatar cklb commented on August 23, 2024

No problem, if you post it here I'll be notified.

FYI: My changes to the build system can be found in https://github.com/cklb/ADOL-C/tree/makepkg

from adol-c.

awalther1 avatar awalther1 commented on August 23, 2024

Hi Stefan,

I just tried to adapt the build system correspondingly. However, I was not completely successful. Could we discuss these issue to fix it? That would be great.

Best regards

Andrea

from adol-c.

cklb avatar cklb commented on August 23, 2024

Hey,

a few weeks ago, a colleague of mine made some changes to get the build running again. I don't think that he is on Github by luckily he collected his changes (based on the 2.7.2 release) in form of a patch and provided a package for the archlinux user repository which you can find here: https://aur.archlinux.org/packages/python-adolc.
The patch itself can be found here: https://aur.archlinux.org/cgit/aur.git/tree/setup.patch?h=python-adolc.

Best,
Stefan

from adol-c.

awalther1 avatar awalther1 commented on August 23, 2024

Hey,

thanks a lot for the patch. It should be included now in the master branch. However, the installation does not work on my system. It would be great if you could give it a try to check whether it works on your system? That might help to identify the reason.

Thanks and best regards

Andrea

from adol-c.

cklb avatar cklb commented on August 23, 2024

Hey,

it seems like one line of the patch did not get included on the master branch, it is the line 217 in ADOL-C/swig/setup.py:

-      version='2.7-trunk',
+      version='2.7.2',

without that change, the packaging module gives
packaging.version.InvalidVersion: Invalid version: '2.7-trunk' .

However, after applying that line a myriad of similar compile errors arise from the wrapper class.
One example:

adolc-python_wrap.cpp: In Funktion »adub* badouble___pow____SWIG_1(badouble*, double)«:
adolc-python_wrap.cpp:5353:16: Fehler: ungültige Umwandlung von Typ »adub« in Typ »adub*«
 5353 |         return (adub*) pow((*(self)),c);

I think the problem here is that the patch is based on the last available tagged version of ADOL-C (https://github.com/coin-or/ADOL-C/releases/tag/releases%2F2.7.2) and in the meantime changes were made to the C++ code that did not get ported to the swig wrapper, possibly because no one was using the python extension.
However, as adolc-python_wrap.cpp is generated by swig itself, the culprit is probably the interface definition in adolc-python.i.

The build commands I used are

autoreconf -fi
./configure --enable-sparse --enable-python
make 
make install

Best,
Stefan

from adol-c.

awalther1 avatar awalther1 commented on August 23, 2024

Hi,

oK, this is the same behaviour that I observe. I will try to trace down the reason for this and to fix the interface definition.

Best regards

Andrea

from adol-c.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.