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: Brice Goglin (Brice.Goglin_at_[hidden])
Date: 2010-03-12 01:12:37


Jeff Squyres wrote:
> 1. thread A calls hwloc_topology_init(&a)
> 2. thread A calls hwloc_topology_load(a)
> 3. thread A launches thread B
> 4. thread B calls hwloc_topology_get_*(a...)
> 5. thread A calls hwloc_topology_load(a)
>
> On the one hand, you could say that an app would be dumb to do this. But OTOH, if we say that hwloc is "thread safe", it might be a reasonable expectation to assume that multiple threads can read/write topologies simultaneously and hwloc makes it safe. It depends on exactly what you mean by "thread safe" (kinda like MPI's 4 different levels of thread support).
>
> Which do we want for hwloc?
>

I don't think we want to support this. If somebody really wants the
above, he wants two threads to work on different topologies, so he
should use two different topology variables.

I guess we a thread-safety section in hwloc.doxy to document that all
topology modifiers (most of hwloc_topology_* functions, not all of them)
cannot run concurrently.

Brice