Re: [C++-sig] Python Exported Method that Takes a Boost::Function Object

2010-02-01 Thread Charles Solar
Nice! A little bit of cleaning up and editing and that worked like a charm, thanks Here is what I had to do: struct timer_func_wrapper_t { timer_func_wrapper_t( bp::object callable ) : _callable( callable ) {} bool operator()() { PyGILState_STATE gstate = PyGILState_Ensure();

Re: [C++-sig] Python Exported Method that Takes a Boost::Function Object

2010-02-01 Thread Roman Yakovenko
On Mon, Feb 1, 2010 at 5:22 PM, Charles Solar wrote: > I have a method that takes a boost function object as so > > bool createTimer( boost::int64_t interval, boost::function< bool() > > function, bool recurring = false ) > > that I would like to call in python.  I tried exporting the class in Py+

Re: [C++-sig] OpenMP and boost-python?

2010-02-01 Thread Anders Wallin
> I'm not convinced of this. It is true that there may only ever be one thread > accessing the Python runtime (thus the GIL to enforce it). But you may > certainly have as many threads doing other work as you want. And if your > OpenMP-enabled code is pure C++, with no hooks into the Python runtime

Re: [C++-sig] OpenMP and boost-python?

2010-02-01 Thread Stefan Seefeld
On 02/01/2010 12:58 PM, Anders Wallin wrote: How difficult is it to make boost-python play nice with OpenMP? Anyone done it? Is this ever going to be a feature of boost-python, or always going to require special patching and hacking? I'm not sure in how much boost.python would actually n

Re: [C++-sig] OpenMP and boost-python?

2010-02-01 Thread Anders Wallin
>> How difficult is it to make boost-python play nice with OpenMP? Anyone >> done it? Is this ever going to be a feature of boost-python, or always >> going to require special patching and hacking? > I'm not sure in how much boost.python would actually need to care about > this. Presumably, some Op

Re: [C++-sig] OpenMP and boost-python?

2010-02-01 Thread troy d. straszheim
Anders Wallin wrote: Hello group, I have C++ code which uses OpenMP to parallellize some algorithms. When wrapped with boost-python only one thread seems to run at a time, and there is no speedup (as seen with pure C++) when using multiple core machines. The FAQ says this is pretty much expected

Re: [C++-sig] OpenMP and boost-python?

2010-02-01 Thread Stefan Seefeld
On 02/01/2010 12:07 PM, Anders Wallin wrote: Hello group, I have C++ code which uses OpenMP to parallellize some algorithms. When wrapped with boost-python only one thread seems to run at a time, and there is no speedup (as seen with pure C++) when using multiple core machines. The FAQ says this

[C++-sig] OpenMP and boost-python?

2010-02-01 Thread Anders Wallin
Hello group, I have C++ code which uses OpenMP to parallellize some algorithms. When wrapped with boost-python only one thread seems to run at a time, and there is no speedup (as seen with pure C++) when using multiple core machines. The FAQ says this is pretty much expected, but hints at a possib

[C++-sig] Python Exported Method that Takes a Boost::Function Object

2010-02-01 Thread Charles Solar
I have a method that takes a boost function object as so bool createTimer( boost::int64_t interval, boost::function< bool() > function, bool recurring = false ) that I would like to call in python. I tried exporting the class in Py++ but it did not look like it does anything special with that ar