Use volk with custom arrays

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?
What exactly does volk_get_alignment and set_alignment do? I didn’t find
any documentation or source code yet.

Example:

//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!

Johannes

On Thu, Sep 6, 2012 at 6:48 AM, Johannes D. [email protected]
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.

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

Thanks in advance!

Johannes

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.

Tom

Thanks! That was exactly what I was looking for!

Am 06.09.2012 14:53, schrieb Tom R.:

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs