Boost logo

Boost :

Subject: Re: [boost] interest in structure of arrays container?
From: Joaquin M López Muñoz (joaquinlopezmunoz_at_[hidden])
Date: 2016-10-18 12:00:26


El 15/10/2016 a las 10:44, Andreas Schäfer escribió:
> Heya,
>
> On 21:43 Fri 14 Oct , Michael Marcin wrote:
>> Does this already exist somewhere?
> you may want to take a look at LibFlatArray. It's a struct-of-arrays
> library for C++, which also helps with vectorization and address
> generation:
>
> http://libgeodecomp.org/libflatarray.html

Jumping in a bit late, sorry. Two inconveniences I find with the approaches
I've seen so far are:

* Switching from AOS to SOA requires changing the syntax to access the code
* There is no easy way to quickly experiment with SOA vs. AOS without
rewriting /refactoring code.

I played with these concepts some months ago and came up with some sketches:

http://bannalia.blogspot.com/2015/08/c-encapsulation-for-data-oriented-design.html
http://bannalia.blogspot.com/2015/09/c-encapsulation-for-data-oriented.html
http://bannalia.blogspot.com/2015/11/soa-container-for-encapsulated-c-dod.html

(
   http://tinyurl.com/qb7gmbk
   http://tinyurl.com/nhhz9l8
   http://tinyurl.com/zmdsqyf
)

The key idea of this approach is to decouple user's code from actual
access to the
data making the former templatized on an Access policy, which can then be
changed from AOS to SOA and back without further modifications. The sketch
also includes a SOA container along this line. With a little more work it is
possible to have not only "pure" AOS and SOA but also mixed layouts where
some data members are given their own cache line while others are grouped
together etc. Switching from one to other quckly would allow for easy
profiling
and tuning for the specific access profiles of a given application.

Of course eveything above was a mere experiment very far away from
production-ready code, but maybe someone can take advantage of the ideas
to write something more robust.

Joaquín M López Muñoz


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk