[Toybox] Working on nproc-do we check OMP_NUM_THREADS ?

Rob Landley rob at landley.net
Sat Nov 29 19:31:54 PST 2014


On 11/29/14 19:52, Isaac Dunham wrote:
> Hello,
> I noticed that nproc was on the TODO list now and started writing it.
> I've gotten it *almost* ready, but there's one difference between current 
> behavior and GNU nproc: 
> 
> GNU nproc without --all will treat OMP_NUM_THREADS as the number of CPUs,
> interpreting 0x as hex and all other numbers as decimal.
>
> The number of cpus to ignore is then subtracted, and the result printed
> in decimal.

Does the taskset info work in here at all? If your task is currently
restricted to a subset of the available processors, does this still
return the number the OS has for the whole system?

> Currently, I'm ignoring OMP_NUM_THREADS, mainly because I haven't written
> the code yet. If we should check it, I'd be happy to write the code.
> Current code is attached.
> 
> OMP_NUM_THREADS is an environment variable that OpenMP uses to check 
> how many threads to start; it overrides a check for the number of CPUs
> in OpenMP-based software.

The first google hit for OMP_NUM_THREADS is the Microsoft Developer
Network, and the second says GNU in the title, and between the two I'm
pretty _happy_ not to support it.

Rob

 1417318314.0


More information about the Toybox mailing list