esa / pagmo

A C++ / Python platform to perform parallel computations of optimisation tasks (global and local) via the asynchronous generalized island model. State of the art optimization algorithms are included. A common interface is provided to other optimization frameworks/algorithms such as NLOPT, SciPy, SNOPT, IPOPT, GSL
GNU General Public License v3.0
268 stars 87 forks source link

Linking issue #193

Open martinsimon88 opened 7 years ago

martinsimon88 commented 7 years ago

Hello guys! I am getting an error when building on Ubuntu 16.04:

[ 49%] Built target pagmo_static[ 49%] Linking CXX executable mainsrc/libpagmo.a(jde.cpp.o): In function void boost::serialization::throw_exception<boost::archive::archive_exception>(boost::archive::archive_exception const&):jde.cpp:(.text._ZN5boost13serialization15throw_exceptionINS_7archive17archive_exceptionEEEvRKT_[_ZN5boost13serialization15throw_exceptionINS_7archive17archive_exceptionEEEvRKT_]+0x1d): undefined reference to boost::archive::archive_exception::archive_exception(boost::archive::archive_exception const&)collect2: error: ld returned 1 exit statusCMakeFiles/main.dir/build.make:99: recipe for target 'main' failedmake[2]: *** [main] Error 1CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/main.dir/all' failedmake[1]: *** [CMakeFiles/main.dir/all] Error 2Makefile:138: recipe for target 'all' failedmake: *** [all] Error 2

I read the solution of #69 to change the order of linking, but my CMakeCache.txt has the following lines already:

# Link main to pagmo_static library. IF(BUILD_MAIN) ADD_EXECUTABLE(main main.cpp) TARGET_LINK_LIBRARIES(main pagmo_static ${MANDATORY_LIBRARIES}) ENDIF(BUILD_MAIN)

I also built GCC from source like this: https://solarianprogrammer.com/2016/10/07/building-gcc-ubuntu-linux/, but haven't figured out how to let pagmo know of this source-built GCC.

I tried building PyGMO and main separately, which did not work either. Although PyGMO compiled without errors, when using it gave me:

ImportError: /usr/lib/python2.7/dist-packages/PyGMO/core/_core.so: undefined symbol: _ZN5boost7archive17archive_exceptionC1ERKS1_

I appreciate any feedback :)

darioizzo commented 7 years ago

pagmo is not maintained anymore. We are currently deploying pagmo2, it has already many of the functionalities of the old pagmo and mainly it is easily installable.

Check here the github proj: https://github.com/esa/pagmo2 Check here the differences with respect to pagmo 1: https://github.com/esa/pagmo2/wiki/From-1.x-to-2.x Check here the current docs for pagmo2: https://esa.github.io/pagmo2/

martinsimon88 commented 7 years ago

Hello and thanks for the fast reply!

I am using pygmo inside another module called Spearmint-PESM, where parts of pygmo are called as:

´from PyGMO.problem import base from PyGMO import * from PyGMO.util import hypervolume´

What would be equivalent for this in the new code? :)

Thanks! Martin

PS: pip install pygmo doesn't seem to be working on Ubuntu 16.04

On Mon, Apr 17, 2017 at 7:21 PM, Dario Izzo notifications@github.com wrote:

pagmo is not maintained anymore. We are currently deploying pagmo2, it has already many of the functionalities of the old pagmo and mainly it is easily installable.

Check here the github proj: https://github.com/esa/pagmo2 Check here the differences with respect to pagmo 1: https://github.com/esa/pagmo2/wiki/From-1.x-to-2.x Check here the current docs for pagmo2: https://esa.github.io/pagmo2/

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/esa/pagmo/issues/193#issuecomment-294533432, or mute the thread https://github.com/notifications/unsubscribe-auth/ALnA1zeFoRRjBZFt_d8ztQJ5qpNNNuYDks5rw5-YgaJpZM4M_PGQ .

jmllorens commented 7 years ago

Hi Martin,

I compile PyGMO 1 in 16.04 without any problem. This is the output of ldd ./core/_core.so. The only library in my $HOME is libpagmo, the rest are system libraries. Hope this helps.

    linux-vdso.so.1 =>  (0x00007fffaa7ed000)

    libpagmo.so => /home/jmllorens/SOFTWARE/local/lib/libpagmo.so (0x00007f950fa44000)

    libboost_system.so.1.58.0 => /usr/lib/x86_64-linux-gnu/libboost_system.so.1.58.0 (0x00007f950f812000)

    libboost_thread.so.1.58.0 => /usr/lib/x86_64-linux-gnu/libboost_thread.so.1.58.0 (0x00007f950f5ec000)

    libboost_serialization.so.1.58.0 => /usr/lib/x86_64-linux-gnu/libboost_serialization.so.1.58.0 (0x00007f950f38a000)

    libboost_python-py27.so.1.58.0 => /usr/lib/x86_64-linux-gnu/libboost_python-py27.so.1.58.0 (0x00007f950f13e000)

    libpython2.7.so.1.0 => /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0 (0x00007f950ebb0000)

    libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f950e82d000)

    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f950e617000)

    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f950e24e000)

    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f950e030000)

    libgsl.so.19 => /usr/lib/x86_64-linux-gnu/libgsl.so.19 (0x00007f950dbf1000)

    libgslcblas.so.0 => /usr/lib/x86_64-linux-gnu/libgslcblas.so.0 (0x00007f950d9b3000)

    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f950d6a9000)

    librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f950d4a1000)

    libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f950d286000)

    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f950d082000)

    libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007f950ce7f000)

    /lib64/ld-linux-x86-64.so.2 (0x000055cbac7a7000)
darioizzo commented 7 years ago

Martin we are deploying the PyPi packages just these days, so for pip install you probably have to wait for the package to be uploaded.

If you try to install from source I am curious to see if you get problem. We think the new build system is rather robust ...

For the hypervolume, check the tutorial here (pygmo2): https://esa.github.io/pagmo2/docs/python/tutorials/hypervolume.html

Let me know if you have problems ....

darioizzo commented 7 years ago

You can check what packages are available here: https://pypi.python.org/pypi/pygmo/

At the moment in linux py36 and 64 bits is available. Soon also the others .... we are waitning for the CI to finish building

martinsimon88 commented 7 years ago

Thanks!

building pygmo2 from source went smooth.

How much of the classes and functions have been changed when comparing pygmo and pygmo2? I would prefer to work with pygmo2, but don't want to have a vast debugging project in my hands. :)

Thanks! Martin

On Tue, Apr 18, 2017 at 10:56 AM, Dario Izzo notifications@github.com wrote:

You can check what packages are available here: https://pypi.python.org/pypi/pygmo/

At the moment in linux py36 and 64 bits is available. Soon also the others .... we are waitning for the CI to finish building

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/esa/pagmo/issues/193#issuecomment-294736036, or mute the thread https://github.com/notifications/unsubscribe-auth/ALnA1-2Aw7h9dd77qM1sAoZhFleTJf-Dks5rxHqpgaJpZM4M_PGQ .

bluescarni commented 7 years ago

The full set of pip packages will be ready with the next version of pagmo (hopefully 2.1, but might be 2.n if we made some mistakes in the CI and need to rectify them). We will have pip packages for Windows and Linux 64bit, Python 2.7 & 3.5 + 3.6.

conda packages are in preparation as well:

https://github.com/conda-forge/pagmo-feedstock https://github.com/conda-forge/pygmo-feedstock

darioizzo commented 7 years ago

pygmo2 is a complete rewrite of the code. So transition requires to recode your classes. Main differences are (from the user point of view)

1 - No need to derive from a base class to instantiate a problem 2 - No separate functions for obj and constraints in the user defined problems. Everything is returned by one fitness method: obj, ec, ic (objectives, equalities, inequalities). Check the tutorial on how to code a problem here: https://esa.github.io/pagmo2/docs/python/tutorials/coding_udp_simple.html

If you mainly need access to the algorithms (a list of the available ones in pygmo2 can be found here: https://esa.github.io/pagmo2/docs/python/algorithms/py_algorithms.html) I suggest you to make the effort and change to pygmo2 as we will be developing it and dropping all development for pygmo1

If you do not want to make the effort (understandable) then I cannot offer much support on your installation problems (pygmo had a rather buggy build system ....), but we can still try to help on syntactic issues ....

martinsimon88 commented 7 years ago

Is there an example of how to do this in pygmo2? http://esa.github.io/pygmo/tutorials/adding_a_new_algorithm.html#adding-a-new-algorithm

Thank you! Martin

On Tue, Apr 18, 2017 at 11:26 AM, Dario Izzo notifications@github.com wrote:

pygmo2 is a complete rewrite of the code. So transition requires to recode your classes. Main differences are (from the user point of view)

1 - No need to derive from a base class to instantiate a problem 2 - No separate functions for obj and constraints in the user defined problems. Everything is returned by one fitness method: obj, ec, ic (objectives, equalities, inequalities). Check the tutorial on how to code a problem here: https://esa.github.io/pagmo2/docs/python/tutorials/coding_ udp_simple.html

If you mainly need access to the algorithms (a list of the available ones in pygmo2 can be found here: https://esa.github.io/pagmo2/ docs/python/algorithms/py_algorithms.html) I suggest you to make the effort and change to pygmo2 as we will be developing it and dropping all development for pygmo1

If you do not want to make the effort (understandable) then I cannot offer much support on your installation problems (pygmo had a rather buggy build system ....), but we can still try to help on syntactic issues ....

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/esa/pagmo/issues/193#issuecomment-294744096, or mute the thread https://github.com/notifications/unsubscribe-auth/ALnA1w7KQWCeEpA5lVzBc2gHmqhck-1Jks5rxIHJgaJpZM4M_PGQ .

darioizzo commented 7 years ago

Not yet, but its rather easy (something like):

class my_algorithm:
     """
     A dumb algorithm doing nothing
     """
     #This is the 'juice' of the algorithm, the method 
     #where the actual optimzation is coded.
     def evolve(self, pop):
           return pop
     def get_name(self):
             return "Null Algorithm (Python)"
     def extra_info(self):
             return "Not much to add"

then:

algo = pygmo.algorithm(my_algorithm())

check the docs of pygmo.algorithm here: https://esa.github.io/pagmo2/docs/python/py_algorithm.html and the docs of pygmo.population here: https://esa.github.io/pagmo2/docs/python/py_population.html