[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] use volk with custom arrays

From: Johannes Demel
Subject: Re: [Discuss-gnuradio] use volk with custom arrays
Date: Thu, 6 Sep 2012 20:15:01 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120827 Thunderbird/15.0

Thanks! That was exactly what I was looking for!

Am 06.09.2012 14:53, schrieb Tom Rondeau:
On Thu, Sep 6, 2012 at 6:48 AM, Johannes Demel <address@hidden> wrote:
Hello list,

currently I am looking for a way to use volk on arrays. Specifically not on
input and or output buffers. So I need to align my custom arrays. How do I
do this?

Yes, Volk is designed to work on any arrays, not just withing GNU
Radio. You also don't actually need to align your arrays, in which
case you call the _u version of the kernel. But you probably want to
work on aligned memory and the aligned, _a, kernel.

What exactly does volk_get_alignment and set_alignment do? I didn't find any
documentation or source code yet.

volk_get_alignment asks the machine what the correct alignment is. On
non-AVX Intels, the answer is 16 bytes, but AVX has doubled the size
of the SIMD registers and they now require 32-byte alignment.


//define arrays like this:
int size = 10; // or what so ever.
gr_complex my_array1[size];
gr_complex my_array2[size];
gr_complex my_array3[size];

volk_32fc_x2_multiply_32fc_a(my_array3, my_array2, my_array1, size);

Is it possible to do something like this? Or am I on the wrong way?

Thanks in advance!


You want to make sure that your arrays are created on the right
alignment boundary, first. There are various ways of doing this, and
some more specific to the compiler than others. Frankly, I find the
fftwf_malloc() functions that are used with FFTW to be the most
straight-forward, effective, and cross-platform way of handling this.
So you would declare an array:

gr_complex *array = (gr_complex*)fftwf_malloc(sizeof(gr_complex)*size);

It does the right thing for your system's alignment.

There's also a fftwf_free(array) for cleaning up, too.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]