3 ms·
Interesting, but how does nproc get the right information ? OMP_NUM_THREADS and OMP_THREAD_LIMIT are in principle extra limitations, not the main source of inf
by s_gourichon 6y ago
Interesting, but how does nproc get the right information ?
OMP_NUM_THREADS and OMP_THREAD_LIMIT are in principle extra limitations, not the main source of information, right ?
- formerly_proven 6y agoIt's sched_getaffinity, which makes sense, since that's what taskset and friends modify. $ strace nproc sched_getaffinity(0, 128, [0, 1, 2, ..., 78, 79]) = 40 fstat(1, {st_mode=S_IFCHR|0600, st_rdev=makedev(0x88, 0xf), ...}) = 0 write(1, "80\n", 324) = 3 exit_group(0) = ? +++ exited with 0 +++
- nemetroid 6y agoIf you have OPM_NUM_THREADS and OMP_THREAD_LIMIT set it will use those, though.