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

Andy Lutomirski luto at amacapital.net
Sat Nov 29 20:01:13 PST 2014


On Sat, Nov 29, 2014 at 7:31 PM, Rob Landley <rob at landley.net> wrote:
> 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?

I once lobbied for waf (a build system) to call sched_getaffinity and
count the number of allowed cpus rather than looking at /proc/cpuinfo.
I didn't get very far.

--Andy

>
>> 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
> _______________________________________________
> Toybox mailing list
> Toybox at lists.landley.net
> http://lists.landley.net/listinfo.cgi/toybox-landley.net



-- 
Andy Lutomirski
AMA Capital Management, LLC

 1417320073.0


More information about the Toybox mailing list