[gmx-developers] checking CPU set
pronk at kth.se
Tue Oct 30 08:49:00 CET 2012
What's the practical difference between the two cases? In both cases, the thread is allowed to run on all CPUs in the system, right?
On Oct 30, 2012, at 00:32 , Szilárd Páll <szilard.pall at cbr.su.se> wrote:
> In order to be nice and not have mdrun override externally set CPU affinities I want to check whether the affinity is default or it has been changed (by taskset, OpenMP library, etc.). Initially I want to implement this for GNU platforms with sched.h.
> While I initially though if no affinity is set the cpu set should be empty, in fact it in this case CPU_ISSET will give the same result as if all CPUs were in the set -- which actually makes sense. However, this left me quite clueless about how to distinguish between the case when all CPUs are present in the cpu set and when e.g. all CPU are set by taskset, e.g.
> $ taskset 0xF mdrun # quite useless on a quad-core machine
> Does anybody have an idea how to distinguish these two cases. It would be possible, because e.g. hwloc-ps can do it (but they do it based on their own mask-representation which makes is a bit hard to figure out what I need from their code).
> gmx-developers mailing list
> gmx-developers at gromacs.org
> Please don't post (un)subscribe requests to the list. Use the
> www interface or send it to gmx-developers-request at gromacs.org.
More information about the gromacs.org_gmx-developers