codezonediitj / adaboost

Implementation of AdaBoost Algorithm
Other
9 stars 16 forks source link

Boost.Python or SWIG or PyBindGen #4

Closed czgdp1807 closed 4 years ago

czgdp1807 commented 4 years ago

Description of the problem

I was just exploring options to generate Python wrappers for C++ code and came across PyBindGen . SWIG is fine but I think PyBindGen is more logical to use. What do you say?

I was going through the Boost.Python as well and I believe that this is much better than both of the above alternatives due to the greatest amount of content available on the web.

Example of the problem

References/Other comments

[1] https://pybindgen.readthedocs.io/en/latest/tutorial/#what-is-pybindgen

czgdp1807 commented 4 years ago

So, at the end of the day, I think we can go for Boost.Python. An ad-hoc method to generate the bindings is as follows,

g++ -I /usr/include/python2.7 -fpic -c -o file_name.o file_name.cpp
g++ -o file_name.so -shared file_name.o -lboost_python -lpython2.7
czgdp1807 commented 4 years ago

A note, We will be required to create shared objects for python bindings using nvcc which can be done by commands similar to the following,

nvcc -I /usr/include/python2.7 -Xcompiler -fpic -c -o file_name.o file_name.cu
nvcc -o file_name.so -shared file_name.o -lboost_python -lpython2.7