On 10/18/2011 11:18 AM, Jason Bonior wrote: > That worked. We will also try your next version whenever it is available on
Glad to hear it works; I guess zip() cant be used with swig'd vectors on some platforms (my best guess). I reworked the code a bit to my liking and it should also fix this issue. Just grab the latest master branch. > git. We will also begin building some custom blocks using grblock and numpy > and can let you know how it goes if you wish. > of course. It would be interesting to see what you come up with and possibly how performance compares. -Josh > Thanks again, > Jason > > > > On Tue, Oct 18, 2011 at 9:38 AM, Josh Blum <j...@joshknows.com> wrote: > >> >> >> On 10/18/2011 06:54 AM, Jason Bonior wrote: >>> We added some print statements to try and narrow down the problem. This >> is >>> what we changed: >>> >>> def pointer_to_ndarray(addr, dtype, nitems): >>> print "pointer_to_ndarray() start" >>> class array_like: >>> print "pointer_to_ndarray array_like class start" >>> __array_interface__ = { >>> 'data' : (addr, False), >>> 'typestr' : dtype.base.str, >>> 'descr' : dtype.base.descr, >>> 'shape' : (nitems,) + dtype.shape, >>> 'strides' : None, >>> 'version' : 3 >>> } >>> print "pointer_to_ndarray array_like class end" >>> print "pointer_to_ndarray() end" >>> return numpy.asarray(array_like()).view(dtype.base) >>> #a = numpy.asarray(array_like()).view(dtype.base) >>> #return a.tolist() >>> >>> def pointers_to_ndarrays(addrs, dtypes, nitems): >>> print "pointers_to_ndarrays() start, end" >>> print "addrs = ", addrs >>> print "dtypes = ", dtypes >>> print "nitems = ", nitems >>> >>> This is what we get: >>> >>> local@ch400l-laptop:~$ /usr/local/share/grblock/examples/adder_demo.py >>> gateway_block.__init__() start >>> gateway_handler.__init__() start >>> gateway_handler.__init__() end >>> gateway_block.__init__() end >>> gateway_handler.handle() start >>> gateway_block.__grblock_handle() start >>> gateway_block.__grblock_handle() end >>> gateway_handler.handle() end >>> gateway_handler.handle() start >>> gateway_block.__grblock_handle() start >>> pointers_to_ndarrays() start, end >>> addrs = <grblock.grblock_swig.size_t_vector_t; proxy of <Swig Object of >>> type 'std::vector< size_t > *' at 0x235a720> > >>> dtypes = [dtype('float32'), dtype('float32')] >>> nitems = [5, 5] >>> handler caught exception: Unknown exception >>> Traceback (most recent call last): >>> File "/usr/local/lib/python2.6/dist-packages/grblock/gateway.py", line >> 65, >>> in handle >>> try: self._callback() >>> File "/usr/local/lib/python2.6/dist-packages/grblock/gateway.py", line >> 137, >>> in __grblock_handle >>> [self.__message.work_args.ninput_items]*len(self.__in_sig), >>> File "/usr/local/lib/python2.6/dist-packages/grblock/gateway.py", line >> 51, >>> in pointers_to_ndarrays >>> return [pointer_to_ndarray(*args) for args in zip(addrs, dtypes, >> nitems)] >>> File >>> >> "/usr/local/lib/python2.6/dist-packages/gnuradio/gr/gnuradio_core_hier.py", >>> line 118, in next >>> return _gnuradio_core_hier.SwigPyIterator_next(self) >>> RuntimeError: Unknown exception >>> gateway_handler.handle() start >>> gateway_block.__grblock_handle() start >>> gateway_block.__grblock_handle() end >>> gateway_handler.handle() end >>> thread[thread-per-block[2]: <gr_block add 2 f32 (4)>]: caught >> unrecognized >>> exception >>> ^Cexcepted (1, 5, 9, 13, 17) >>> actual () >>> gateway_block.__init__() start >>> gateway_handler.__init__() start >>> gateway_handler.__init__() end >>> gateway_block.__init__() end >>> gateway_handler.handle() start >>> gateway_block.__grblock_handle() start >>> gateway_block.__grblock_handle() end >>> gateway_handler.handle() end >>> gateway_handler.handle() start >>> gateway_block.__grblock_handle() start >>> pointers_to_ndarrays() start, end >>> addrs = <grblock.grblock_swig.size_t_vector_t; proxy of <Swig Object of >>> type 'std::vector< size_t > *' at 0x235aa20> > >>> dtypes = [dtype('complex64'), dtype('complex64')] >>> nitems = [5, 5] >>> handler caught exception: Unknown exception >>> Traceback (most recent call last): >>> File "/usr/local/lib/python2.6/dist-packages/grblock/gateway.py", line >> 65, >>> in handle >>> try: self._callback() >>> File "/usr/local/lib/python2.6/dist-packages/grblock/gateway.py", line >> 137, >>> in __grblock_handle >>> [self.__message.work_args.ninput_items]*len(self.__in_sig), >>> File "/usr/local/lib/python2.6/dist-packages/grblock/gateway.py", line >> 51, >>> in pointers_to_ndarrays >>> return [pointer_to_ndarray(*args) for args in zip(addrs, dtypes, >> nitems)] >>> File >>> >> "/usr/local/lib/python2.6/dist-packages/gnuradio/gr/gnuradio_core_hier.py", >>> line 118, in next >>> return _gnuradio_core_hier.SwigPyIterator_next(self) >>> RuntimeError: Unknown exception >>> gateway_handler.handle() start >>> gateway_block.__grblock_handle() start >>> gateway_block.__grblock_handle() end >>> gateway_handler.handle() end >>> thread[thread-per-block[2]: <gr_block add 2 fc32 (10)>]: caught >> unrecognized >>> exception >>> ^Cexcepted (1, 5j, 9, 13j, 17) >>> actual () >>> >>> >>> I have been on the digest subscription of gr discuss so I did not have >> the >>> address to make sure I submit to the correct thread. I will on future >>> messages. >>> >> >> Hey thanks for doing that. The best I can make out is that maybe its >> failing on the zip operation. Possibly because of the swigged-up vector >> of addrs... >> >> Can you try this diff? >> One liner: http://pastebin.com/kc7QfB1L >> >> -Josh >> > _______________________________________________ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org https://lists.gnu.org/mailman/listinfo/discuss-gnuradio