Open MPI logo

Hardware Locality Development Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Hardware Locality Development mailing list

Subject: Re: [hwloc-devel] thread safety
From: Samuel Thibault (samuel.thibault_at_[hidden])
Date: 2010-03-12 11:45:40


Jeff Squyres, le Fri 12 Mar 2010 08:38:48 -0800, a écrit :
> On Mar 12, 2010, at 8:31 AM, Samuel Thibault wrote:
> > 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.
>
> Ok, fine.
>
> I'm not understanding how this conversation corresponds to one of your prior statements on this thread that you thought hwloc was already thread safe.

It is as thread safe as libc usually is, i.e. it does not have any
global state, everything is held in the hwloc_topology_t structures, and
if you work on the same structure in separate threads, unless it is just
reading there can be issues.

> The discussion we've had sounds like it's somewhat equivalent to MPI_THREAD_SERIALIZED -- you can do whatever you want as long as you ensure a) there's only writer 1 thread to a given object at a time, and b) the app is responsible for all synchronization and memory consistency.

Yes, except that the structure can also be read concurrently, provided
that you properly synchronize passing the structure to other threads.

Just like how e.g. libc's gettimeofday() does.

Samuel