On Sat, Apr 20, 2013 at 9:45 AM, Dan Filimon <[email protected]>wrote:
> Here is a preliminary version: > https://reviews.apache.org/r/10669/diff/#index_header > > Regarding the parallelization, the results would be valid as long as the > aggregating function is both commutative and associative (which we can now > check) but it adding the parallelization here might be too much work. > Actually, associativity and commutativity don't make threads safe. The problem arises from NUMA memory models. The problem is that different threads can easily wind up accessing old versions of memory that other threads are working on. One of the most important things that synchronization boundaries do is to force a partial ordering on memory operations as seen by all threads. Different threads may see different orderings, but all of the orderings will be consistent with the weak ordering specified by the synch boundaries. It is possible to do lockless thread-safe code, but it requires very clever design. Our matrices and vectors definitely are not designed that way.
