Re: getting processor numbers

Andi Kleen
2007-04-03T17:12:29Z

Ulrich Drepper <drepper@redhat.com> writes:

> More and more code depends on knowing the number of processors in the
> system to efficiently scale the code. E.g., in OpenMP it is used by
> default to determine how many threads to create.

There are more uses for it.

> Creating more threads
> than there are processors/cores doesn't make sense.

There was a proposal some time ago to put that into the ELF aux vector
Unfortunately there was disagreement on what information to put
there exactly (full topology, only limited numbers etc.)

My proposal was number of CPUs, number of cores, number of nodes
as three 16 bit numbers.

-Andi