Jeff Squyres, le Fri 12 Mar 2010 08:25:11 -0800, a écrit : > On Mar 12, 2010, at 8:16 AM, Samuel Thibault wrote: > > > With a full memory barrier, you do not have any issue. > > So we're saying that the only way to use hwloc safely with multiple different > thread readers and writers is to do a full memory barrier across the entire > machine?
That is the only way to safely do anything with shared memory on a parallel machine. Mutexes and spinlocks have to do it, or else they are buggy. > That seems like a big hammer, It is a way smaller hammer than, say, a mutex or a spinlock. > and can have performance implications on other parts of the system that you > aren't even using. It _has_ to be done, else your application is buggy, it is not just hwloc. > Is it sufficient, for example, for the app to mark the entire topology struct > instance volatile? I.e.: No, because that will not automatically issue hardware memory barriers, which are needed on basically all architectures but x86 (which has in-order stores) to ensure seeing writes coherently. Samuel