[cfarm-users] Setting up GitLab CI for git.git on the farm

Brice Goglin Brice.Goglin at free.fr
Tue Nov 27 00:10:27 CET 2018


Le 27/11/2018 à 00:01, Segher Boessenkool via cfarm-users a écrit :
>
>> Ansible parses /proc/cpuinfo:
>>
>>   https://github.com/ansible/ansible/blob/devel/lib/ansible/module_utils/facts/hardware/linux.py#L181
>>
>> Do you know how lscpu gets its information?
> It uses /proc/cpuinfo, and /sys/devices/system/cpu/**, and
> /sys/devices/system/node/node*/cpumap.  Says strace.
>
> Maybe /sys/devices/system/cpu/cpu*/topology/thread_siblings is where it
> finds what things really are cores and what things are threads?  The source
> will tell (but who knows what lscpu does is the most proper either!)
>
> Anyway, $KERNEL_SRC/Documentation/ABI/testing/sysfs-devices-system-cpu
> and $KERNEL_SRC/Documentation/cputopology.txt should help.


Yes thread_siblings is where you can find the list of hardware threads
in the same core on Linux. You'd basically count the number of different
unique values in cpu/cpu*/thread_siblings to get the number of cores.

Instead of hardwiring Linux-specific things, many projects now just use
hwloc [1] to get such kind of topology information in a portable way
(that's what I use cfarm for). On the command-line, you'd just do
"hwloc-calc -N core all" to get the number of cores, but there's also a
C API to do that.

Brice

[1] https://www.open-mpi.org/projects/hwloc/



More information about the cfarm-users mailing list