On Aug 17 2009, Paul H. Hargrove wrote:
>+ I wonder if one can do any "introspection" with the dynamic linker to
>detect hybrid OpenMP (no "I") apps and avoid pinning them by default
>(examining OMP_NUM_THREADS in the environment is no good, since that
>variable may have a site default value other than 1 or empty). To me
>this is the most obvious class of application that will suffer from
>imposing pinning by default.
This is a bit off-thread, but my experience with tuning 'threading'
(mainly OpenMP) is that it makes tuning processes (e.g. MPI) look
trivial. You need affinity even more than you do for processes,
but few operating systems provide a way of binding threads to cores.
You can try tweaking the POSIX scheduling parameters, but I failed
to find a system on which they were connected to anything. All right,
this is all a little out of date now, but I'll bet it hasn't changed
That being so, a reasonable test would be to check for ANY secondary
thread in the process and/or threading call, and to throw in the towel
that that point. I don't know ELF, but the latter can be done in most
reasonably advanced linkers (by using weak externals).
Despite their uncleanliness, some heuristics of this nature are probably
the only viable solution, for the reasons that Jeff described. I stand
by my term "gratuitous hack"!