MetaScale/nt2 — comment on commit fb22ca3decae0387db6fa0c418bd6cf47a4016b1
File: modules/sdk/include/nt2/sdk/config/cache.hpp line 45
By jfalcou:

The shared cache is indeed L3, mind slip.
For the flase sharing stuff, here's what happens. Consdier a shared cache with line able ot contains 4 double.
Then you have a 3x3 table.

the non padded layout in the cache is :

elem0 elem1 elem2 elem3
elem4 elem5 elem6 elem7
elem8 - - -

the padded layout in the cache is :

elem0 elem1 elem2 -
elem3 elem4 elem5 -
elem6 elem7 elem8 -

In case of no padding, as we put an openMP directive on the outer loops, the 2 first thread will try to access elem0-2 and elem 3-5 at the same time.
But as elem0-3 are on the same line, false sharign occurs.

In the padded case, same access pattern, but conveniently, each elem pack is on its own line, thus making each thread not polluting its siblings cache state.

For this to occurs, this has to be done in the *shared* cache and as you see, the way we openMPify the loop make it so one thread == one line or more.

And for an outside information poit, see Franck coruse on the subject (false sharign is in the final slides) :

http://dl.dropbox.com/u/3819406/OpenMP.pdf