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