stanle / madopt

Apache License 2.0
16 stars 5 forks source link

Python: ValueError: signal only works in main thread #17

Closed tarun018 closed 7 years ago

tarun018 commented 7 years ago

Hey!

I am using python multiprocessing to run 5 instances of different bonmin models in parallel. However this is giving me following error:

Traceback (most recent call last): File "State.py", line 1111, in class Driver: File "State.py", line 1114, in Driver a.EM() File "State.py", line 748, in EM rss = pr.get(timeout=5) File "/usr/lib/python2.7/multiprocessing/pool.py", line 567, in get raise self._value ValueError: signal only works in main thread

However optimization using ampl objects is perfectly fine. Is Madopt supposed to have some issues with multiprocessing ?

Please help!

stanle commented 7 years ago

Thank you for reporting this.

I can confirm the bug and I have committed a potential fix to the master branch.

please test the latest version.

tarun018 commented 7 years ago

Thanks for the quick response. However I installed madopt earlier using pip and now while building python using:

python setup.py install

I am getting linking error:

running install running build running build_py running build_ext skipping 'src/madopt.cpp' Cython extension (up-to-date) building 'madopt' extension x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c src/madopt.cpp -o build/temp.linux-x86_64-2.7/src/madopt.o --std=c++11 cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ src/madopt.cpp:1321:15: warning: ‘double pyx_f_6madopt_callback_template(void, void)’ defined but not used [-Wunused-function] static double pyx_f_6madopt_callback_template(void __pyx_v_parameter, void __pyx_v_method) { ^ c++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wl,-Bsymbolic-functions -Wl,-z,relro -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/src/madopt.o build/libmadopt.a build/libmadopt_ipopt.a build/libmadopt_bonmin.a -lipopt -lbonmin -o build/lib.linux-x86_64-2.7/madopt.so /usr/bin/ld: cannot find -lipopt /usr/bin/ld: cannot find -lbonmin collect2: error: ld returned 1 exit status

I have bonmin/build/lib in my LIBRARY_PATH as well as LD_LIBRARY_PATH.

stanle commented 7 years ago

Have you tried setting the path in cmake

cmake -DCUSTOM_LIBRARY=/path/to/bonmin/libs -DCUSTOM_INCLUDE=/path/to/bonmin/includes
tarun018 commented 7 years ago

Yes I have used the following command:

cmake -DCUSTOM_LIBRARY=/path/to/bonmin/lib -DCUSTOM_INCLUDE=/path/to/bonmin/include ..

Still getting the same linking error. I also verified that my /path/to/bonmin/lib has libbonmin.so and libipopt.so.

tarun018 commented 7 years ago

The issue seems to be reappearing again.

stanle commented 7 years ago

Sorry to hear that. But I do not know how I can help you. This seems to be an error related to your computer setup.