Open MPI logo

Hardware Locality Development Mailing List Archives

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

Subject: [hwloc-devel] thread safety
From: Jeff Squyres (jsquyres_at_[hidden])
Date: 2010-03-11 20:34:59

On Mar 11, 2010, at 3:57 PM, Samuel Thibault wrote:

> > What *is* hwloc's policy about thread safety, anyway?
> It would be odd to not be threadsafe, considering the target
> applications :) and I believe hwloc is already.

Hmm. I'm not so sure. Consider:

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?

Jeff Squyres
For corporate legal information go to: