Re: [Discuss-gnuradio] output operand requires a reduction, but reduction is not enabled
Hi Martin, Sorry for the very slow reply. Life is hectic here! I found that if I removed the SNR input, that provides many few inputs that the other (its an SNR value *per packet*, so there is only 1 input item to this for every 768 to the other input), the output buffer increases to Out_bA1.shape(512,) Est_bA1m.shape(3840,) Len(out_bA1) = 512 So the output buffer seems dominated by the input that has fewer items coming in??? I managed to resolve the problem completely by changing Ninput_items_required[i] = noutput_items/pow(2,13) In 'forecast', perhaps there are more elegant solutions, but this seems to work fine (there is only one output). Regards, David -Original Message- From: discuss-gnuradio-bounces+david.halls=toshiba-trel@gnu.org [mailto:discuss-gnuradio-bounces+david.halls=toshiba-trel@gnu.org] On Behalf Of Martin Braun Sent: 12 March 2014 08:54 To: discuss-gnuradio@gnu.org Subject: Re: [Discuss-gnuradio] output operand requires a reduction, but reduction is not enabled On 11.03.2014 17:10, David Halls wrote: Hi, Yes, the len(output_items[0]), is either 1 or 2... If I set_output_multiple to 10, then this value raises to 10. Can you post the entire block code? M It is dominated by the fact that one of the inputs to my block is much lower than the other?? Input[0] is the data stream and has say 768 items, input[1] is the packet average SNR, so it only has 1 or 2 items in the same period. Forecast is currently For I in range (len(ninput_items_required)): Ninput_items_required[i] = noutput_items Does this need to be altered for my case where I have two inputs with very different requirements. If I ever get my head around the scheduler in GNU radio, it will be a happy day :) D -Original Message- From: discuss-gnuradio-bounces+david.halls=toshiba-trel@gnu.org mailto:discuss-gnuradio-bounces+david.halls=toshiba-trel@gnu.org [mailto:discuss-gnuradio-bounces+david.halls=toshiba-trel@gnu.org] On Behalf Of Martin Braun Sent: 11 March 2014 15:27 To: discuss-gnuradio@gnu.org mailto:discuss-gnuradio@gnu.org Subject: Re: [Discuss-gnuradio] output operand requires a reduction, but reduction is not enabled On 03/11/2014 04:24 PM, David Halls wrote: Please see the papers we've submitted so far this year. Not exactly WNC, yet... We're putting one together as we speak though. I am not sure I understand your reply fully... Len(out_bA1) is only 1 or 2, so I can only set one or two elements? Is this before or after you assign something? What's len(output_items[0])? How can I extend the length of out_bA1, so I can output all of est_bA1m? You can't, not in the work function. You can do things like set_output_multiple() to influence the size of the output buffer. Or alternatively Is it possible for me to set output_items[0][0:len(est_bA1m)] = est_bA1m That would work, if len(est_bA1m) len(output_items[0]) AND they have the right shape (in matrix terms). ___ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org mailto:Discuss-gnuradio@gnu.org https://lists.gnu.org/mailman/listinfo/discuss-gnuradio NOTE: The information in this email and any attachments may be confidential and/or legally privileged. This message may be read, copied and used only by the intended recipient. If you are not the intended recipient, please destroy this message, delete any copies held on your system and notify the sender immediately. Toshiba Research Europe Limited, registered in England and Wales (2519556). Registered Office 208 Cambridge Science Park, Milton Road, Cambridge CB4 0GZ, England. Web: www.toshiba.eu/research/trl http://www.toshiba.eu/research/trl -- -- This email has been scanned for email related threats and delivered safely by Mimecast. For more information please visit http://www.mimecast.com -- -- ___ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org https://lists.gnu.org/mailman/listinfo/discuss-gnuradio NOTE: The information in this email and any attachments may be confidential and/or legally privileged. This message may be read, copied and used only by the intended recipient. If you are not the intended recipient, please destroy this message, delete any copies held on your system and notify the sender immediately. Toshiba Research Europe Limited, registered in England and Wales (2519556). Registered Office 208 Cambridge Science Park, Milton Road, Cambridge CB4 0GZ, England. Web: www.toshiba.eu/research/trl --- This email has been scanned for email related threats and delivered safely by
[Discuss-gnuradio] output operand requires a reduction, but reduction is not enabled
Thanks Martin, this is clear and makes sense. I should have read the numpy data types more thoroughly and worked it out. Anyway... My collaborators are writing their Wireless Network Coding bits in Python. Once I get this block working, I can combined it with the relay work I was doing and we will have a pretty exciting setup to report!! :) I have one more problem though... I have out_bA1 = output_items[0] ... ...code ... out_bA1[0:len(est_bA1m)] = est_bA1m where out_bA1.shape = (1,) est_bA1m.shape = (3840,) I get the error output operand requires a reduction, but reduction is not enabled *Sometimes* I get out_bA1.shape = (2,) est_bA1m.shape = (3840,) and I get the error operands could not be broadcast together with shapes (2) (3840) I wondered if the problem is with 'forecast' (which I have not changed since the template was created by gr_modtool) or having to set_output_multiple? The scheduling aspect of GNU radio seems complex. If I use out_bA1 = est_bA1m Then it *runs* OK, but the output of the block i.e. output_items[0] is then no longer altered and 0's are output. Many thanks, David -Original Message- From: discuss-gnuradio-bounces+david.halls=toshiba-trel@gnu.org [mailto:discuss-gnuradio-bounces+david.halls=toshiba-trel@gnu.org] On Behalf Of Martin Braun Sent: 11 March 2014 08:33 To: discuss-gnuradio@gnu.org Subject: Re: [Discuss-gnuradio] Python block, itemsize mismatch On 03/11/2014 02:06 AM, David Halls wrote: You're a genius! It works. Interestingly for a float it requires numpy.float32 or a similar error occurs. Yes, in GNU Radio we consistently use 32-bit floats. A complex value consists of two of these, hence the 64 bits. Note that this is just for buffers. A lot of blocks use double internally (i.e. 64-bit float, or 128-bit complex) for accuracy reason. However, for signals, it's just a waste of bandwidth (most of time, SNR will trump quantization noise anyway). M ___ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org https://lists.gnu.org/mailman/listinfo/discuss-gnuradio NOTE: The information in this email and any attachments may be confidential and/or legally privileged. This message may be read, copied and used only by the intended recipient. If you are not the intended recipient, please destroy this message, delete any copies held on your system and notify the sender immediately. Toshiba Research Europe Limited, registered in England and Wales (2519556). Registered Office 208 Cambridge Science Park, Milton Road, Cambridge CB4 0GZ, England. Web: www.toshiba.eu/research/trl --- This email has been scanned for email related threats and delivered safely by Mimecast. For more information please visit http://www.mimecast.com --- ___ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
Re: [Discuss-gnuradio] output operand requires a reduction, but reduction is not enabled
On 03/11/2014 03:30 PM, David Halls wrote: Thanks Martin, this is clear and makes sense. I should have read the numpy data types more thoroughly and worked it out. Anyway... My collaborators are writing their Wireless Network Coding bits in Python. Once I get this block working, I can combined it with the relay work I was doing and we will have a pretty exciting setup to report!! :) That is very interesting to hear -- I hope you'll be publishing some papers and code around network coding! I have one more problem though... I have out_bA1 = output_items[0] ... ...code ... out_bA1[0:len(est_bA1m)] = est_bA1m where out_bA1.shape = (1,) est_bA1m.shape = (3840,) I get the error output operand requires a reduction, but reduction is not enabled *Sometimes* I get out_bA1.shape = (2,) est_bA1m.shape = (3840,) and I get the error operands could not be broadcast together with shapes (2) (3840) I wondered if the problem is with 'forecast' (which I have not changed since the template was created by gr_modtool) or having to set_output_multiple? The scheduling aspect of GNU radio seems complex. This is a Python error, basically it's saying that the arrays have the wrong shapes. Note that in your example, out_bA1 has a limited size before you do any assigning. Make sure you stay within valid index ranges. If you want to do it very fool-proof (albeit ugly), try: for i in range(len(out_bA1)): out_bA1[i] = # whatever if i (matches whatever condition): break If I use out_bA1 = est_bA1m Then it *runs* OK, but the output of the block i.e. output_items[0] is then no longer altered and 0's are output. That's because you're rebinding out_bA1, and the original buffer is not written to. MB Many thanks, David -Original Message- From: discuss-gnuradio-bounces+david.halls=toshiba-trel@gnu.org mailto:discuss-gnuradio-bounces+david.halls=toshiba-trel@gnu.org [mailto:discuss-gnuradio-bounces+david.halls=toshiba-trel@gnu.org] On Behalf Of Martin Braun Sent: 11 March 2014 08:33 To: discuss-gnuradio@gnu.org mailto:discuss-gnuradio@gnu.org Subject: Re: [Discuss-gnuradio] Python block, itemsize mismatch On 03/11/2014 02:06 AM, David Halls wrote: You're a genius! It works. Interestingly for a float it requires numpy.float32 or a similar error occurs. Yes, in GNU Radio we consistently use 32-bit floats. A complex value consists of two of these, hence the 64 bits. Note that this is just for buffers. A lot of blocks use double internally (i.e. 64-bit float, or 128-bit complex) for accuracy reason. However, for signals, it's just a waste of bandwidth (most of time, SNR will trump quantization noise anyway). M ___ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org mailto:Discuss-gnuradio@gnu.org https://lists.gnu.org/mailman/listinfo/discuss-gnuradio NOTE: The information in this email and any attachments may be confidential and/or legally privileged. This message may be read, copied and used only by the intended recipient. If you are not the intended recipient, please destroy this message, delete any copies held on your system and notify the sender immediately. Toshiba Research Europe Limited, registered in England and Wales (2519556). Registered Office 208 Cambridge Science Park, Milton Road, Cambridge CB4 0GZ, England. Web: www.toshiba.eu/research/trl http://www.toshiba.eu/research/trl This email has been scanned for email related threats and delivered safely by Mimecast. For more information please visit http://www.mimecast.com ___ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
Re: [Discuss-gnuradio] output operand requires a reduction, but reduction is not enabled
On 03/11/2014 04:24 PM, David Halls wrote: Please see the papers we've submitted so far this year. Not exactly WNC, yet... We're putting one together as we speak though. I am not sure I understand your reply fully... Len(out_bA1) is only 1 or 2, so I can only set one or two elements? Is this before or after you assign something? What's len(output_items[0])? How can I extend the length of out_bA1, so I can output all of est_bA1m? You can't, not in the work function. You can do things like set_output_multiple() to influence the size of the output buffer. Or alternatively Is it possible for me to set output_items[0][0:len(est_bA1m)] = est_bA1m That would work, if len(est_bA1m) len(output_items[0]) AND they have the right shape (in matrix terms). ___ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
Re: [Discuss-gnuradio] output operand requires a reduction, but reduction is not enabled
Hi, Yes, the len(output_items[0]), is either 1 or 2... If I set_output_multiple to 10, then this value raises to 10. It is dominated by the fact that one of the inputs to my block is much lower than the other?? Input[0] is the data stream and has say 768 items, input[1] is the packet average SNR, so it only has 1 or 2 items in the same period. Forecast is currently For I in range (len(ninput_items_required)): Ninput_items_required[i] = noutput_items Does this need to be altered for my case where I have two inputs with very different requirements. If I ever get my head around the scheduler in GNU radio, it will be a happy day :) D -Original Message- From: discuss-gnuradio-bounces+david.halls=toshiba-trel@gnu.org [mailto:discuss-gnuradio-bounces+david.halls=toshiba-trel@gnu.org] On Behalf Of Martin Braun Sent: 11 March 2014 15:27 To: discuss-gnuradio@gnu.org Subject: Re: [Discuss-gnuradio] output operand requires a reduction, but reduction is not enabled On 03/11/2014 04:24 PM, David Halls wrote: Please see the papers we've submitted so far this year. Not exactly WNC, yet... We're putting one together as we speak though. I am not sure I understand your reply fully... Len(out_bA1) is only 1 or 2, so I can only set one or two elements? Is this before or after you assign something? What's len(output_items[0])? How can I extend the length of out_bA1, so I can output all of est_bA1m? You can't, not in the work function. You can do things like set_output_multiple() to influence the size of the output buffer. Or alternatively Is it possible for me to set output_items[0][0:len(est_bA1m)] = est_bA1m That would work, if len(est_bA1m) len(output_items[0]) AND they have the right shape (in matrix terms). ___ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org https://lists.gnu.org/mailman/listinfo/discuss-gnuradio NOTE: The information in this email and any attachments may be confidential and/or legally privileged. This message may be read, copied and used only by the intended recipient. If you are not the intended recipient, please destroy this message, delete any copies held on your system and notify the sender immediately. Toshiba Research Europe Limited, registered in England and Wales (2519556). Registered Office 208 Cambridge Science Park, Milton Road, Cambridge CB4 0GZ, England. Web: www.toshiba.eu/research/trl --- This email has been scanned for email related threats and delivered safely by Mimecast. For more information please visit http://www.mimecast.com --- ___ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org https://lists.gnu.org/mailman/listinfo/discuss-gnuradio