workhorsy / py-cpuinfo

A module for getting CPU info with pure Python
MIT License
312 stars 59 forks source link

When run with ccache in PATH, results are not stable #137

Closed thomwiggers closed 3 years ago

thomwiggers commented 4 years ago

I'm getting unstable results if I run py-cpuinfo while ccache is in the PATH.

Run 1:

Python Version: 3.8.1.final.0 (64 bit)
Cpuinfo Version: (5, 0, 0)
Vendor ID: GenuineIntel
Hardware Raw: 
Brand: Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
Hz Advertised: 1.8000 GHz
Hz Actual: 3.1316 GHz
Hz Advertised Raw: (1800000000, 0)
Hz Actual Raw: (3131559000, 0)
Arch: X86_64
Bits: 64
Count: 8
Raw Arch String: x86_64
L1 Data Cache Size: 128 KiB
L1 Instruction Cache Size: 128 KiB
L2 Cache Size: 1 MiB
L2 Cache Line Size: 6
L2 Cache Associativity: 0x100
L3 Cache Size: 8192 KB
Stepping: 10
Model: 142
Family: 6
Processor Type: 
Extended Model: 8
Extended Family: 
Flags: 3dnowprefetch, abm, acpi, adx, aes, aperfmperf, apic, arat, arch_perfmon, art, avx, avx2, bmi1, bmi2, bts, clflush, clflushopt, cmov, constant_tsc, cpuid, cpuid_fault, cx16, cx8, de, ds_cpl, dtes64, dtherm, dts, epb, ept, ept_ad, erms, est, f16c, flexpriority, flush_l1d, fma, fpu, fsgsbase, fxsr, ht, hwp, hwp_act_window, hwp_epp, hwp_notify, ibpb, ibrs, ida, intel_pt, invpcid, invpcid_single, lahf_lm, lm, mca, mce, md_clear, mmx, monitor, movbe, mpx, msr, mtrr, nonstop_tsc, nopl, nx, osxsave, pae, pat, pbe, pcid, pclmulqdq, pdcm, pdpe1gb, pebs, pge, pln, pni, popcnt, pse, pse36, pti, pts, rdrand, rdrnd, rdseed, rdtscp, rep_good, sdbg, sep, sgx, smap, smep, ss, ssbd, sse, sse2, sse4_1, sse4_2, ssse3, stibp, syscall, tm, tm2, tpr_shadow, tsc, tsc_adjust, tsc_deadline_timer, tscdeadline, vme, vmx, vnmi, vpid, x2apic, xgetbv1, xsave, xsavec, xsaveopt, xsaves, xtopology, xtpr
Python Version: 3.8.1.final.0 (64 bit)
Cpuinfo Version: (5, 0, 0)
Vendor ID: GenuineIntel
Hardware Raw: 
Brand: Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
Hz Advertised: 1.8000 GHz
Hz Actual: 3.2469 GHz
Hz Advertised Raw: (1800000000, 0)
Hz Actual Raw: (3246864000, 0)
Arch: X86_64
Bits: 64
Count: 8
Raw Arch String: x86_64
L1 Data Cache Size: 128 KiB
L1 Instruction Cache Size: 128 KiB
L2 Cache Size: 1 MiB
L2 Cache Line Size: 
L2 Cache Associativity: 
L3 Cache Size: 8192 KB
Stepping: 10
Model: 142
Family: 6
Processor Type: 
Extended Model: 
Extended Family: 
Flags: 3dnowprefetch, abm, acpi, adx, aes, aperfmperf, apic, arat, arch_perfmon, art, avx, avx2, bmi1, bmi2, bts, clflush, clflushopt, cmov, constant_tsc, cpuid, cpuid_fault, cx16, cx8, de, ds_cpl, dtes64, dtherm, dts, epb, ept, ept_ad, erms, est, f16c, flexpriority, flush_l1d, fma, fpu, fsgsbase, fxsr, ht, hwp, hwp_act_window, hwp_epp, hwp_notify, ibpb, ibrs, ida, intel_pt, invpcid, invpcid_single, lahf_lm, lm, mca, mce, md_clear, mmx, monitor, movbe, mpx, msr, mtrr, nonstop_tsc, nopl, nx, pae, pat, pbe, pcid, pclmulqdq, pdcm, pdpe1gb, pebs, pge, pln, pni, popcnt, pse, pse36, pti, pts, rdrand, rdseed, rdtscp, rep_good, sdbg, sep, smap, smep, ss, ssbd, sse, sse2, sse4_1, sse4_2, ssse3, stibp, syscall, tm, tm2, tpr_shadow, tsc, tsc_adjust, tsc_deadline_timer, vme, vmx, vnmi, vpid, x2apic, xgetbv1, xsave, xsavec, xsaveopt, xsaves, xtopology, xtpr

If I run this code snippet with only /bin:/usr/bin on my path, nothing ever changes:

import cpuinfo
z = cpuinfo.get_cpu_info()
while True:
  assert set(z['flags']).difference(set(cpuinfo.get_cpu_info()['flags'])) == set()
workhorsy commented 4 years ago

Can you give a brief explanation of what ccache is regarding Python? I've never herd of ccache. It seems to be a program to cache native code compiles, so you don't have to rebuild the same program. Does Python use this some how? Py-cpuinfo does not compile anything, but it does run raw byte code, and call external programs.

thomwiggers commented 4 years ago

That is a very good question that I have no idea about, I just can reproduce this 100% of the time....

thomwiggers commented 3 years ago

I can't reproduce this anymore; maybe it was Travis CI's fault.