Hey everyone. Anecdotally,
strace lscpu 2> logfile cat logfile shows a number of parses of /sys followed by some parsing of /proc specifically: open("/proc/cpuinfo", O_RDONLY) = 3 uname({sysname="Linux", nodename="cgraff1-host", ...}) = 0 fstat(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0 read(3, "processor\t: 0\nvendor_id\t: Genuin"..., 1024) = 1024 read(3, "000\ncache size\t: 3072 KB\nphysica"..., 1024) = 1024 read(3, "ags\t\t: fpu vme de pse tsc msr pa"..., 1024) = 1024 read(3, "n pebs bts rep_good nopl xtopolo"..., 1024) = 336 cat /proc/cpuinfo cat /sys/devices/system/cpu/online from man lscpu: "lscpu gathers CPU architecture information from sysfs and /proc/cpuinfo" In general, top style implementions are proc parsing programs Some libc offer sysinfo.h capabilities which may be of some use as well. man sysinfo Graff May there be peace and love for all peoples of the sacred earth such that we can study mathematics and science as one. On 11/26/18, Baptiste Jonglez via cfarm-users <cfarm-users@lists.tetaneutral.net> wrote: > On 25-11-18, Segher Boessenkool via cfarm-users wrote: >> On Sun, Nov 25, 2018 at 01:14:31PM +0100, Stefan Ring via cfarm-users >> wrote: >> > On Sun, Nov 25, 2018 at 10:25 AM Baptiste Jonglez via cfarm-users >> > <cfarm-users@lists.tetaneutral.net> wrote: >> > > >> > > According to ansible [https://cfarm.tetaneutral.net/machines/list/] >> > > gcc112 >> > > has 160 cores, and gcc135 has 128 cores. Is ansible getting this >> > > wrong? >> > >> > 8 threads per core. It really does not make sense to target more than >> > one job for each core. Things will just get horribly slow. >> >> No, that's not true, up to 4 jobs per core still gives considerable >> speedup (and 8 a little too, depends). Performance _per thread_ is lower >> of course, but aggregate is higher. SMT4 gets about twice as much work >> done as single-threaded (which means each thread gets about half as much >> done, but the total doubles). Very roughly, depends on what you are >> doing >> exactly, etc. >> >> lscpu gets it right on all these machines btw (110, 112, 135); what does >> ansible use? > > 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? > > If somebody comes up with an ansible patch that gets the number of > CPU/cores/threads right on most farm machines, we can easily backport it > to the live cfarm system (we are already doing this with a patch from > Anatoly to properly support SPARC64, for gcc202). > _______________________________________________ cfarm-users mailing list cfarm-users@lists.tetaneutral.net https://lists.tetaneutral.net/listinfo/cfarm-users