Git Product home page Git Product logo

Comments (16)

mbdevpl avatar mbdevpl commented on July 30, 2024

Oh, it seems the way cache size is presented to the tool by underlying library (cpuinfo) is even messier than I anticipated...

from system-query.

undertherain avatar undertherain commented on July 30, 2024

https://pint.readthedocs.io/en/0.9/
?

from system-query.

undertherain avatar undertherain commented on July 30, 2024

hm... or what was the package to help converting all sorts of numeric prefixes

from system-query.

undertherain avatar undertherain commented on July 30, 2024

just for the reference, here's full cpuinfo output

$ cpuinfo
Python Version: 3.7.5.final.0 (64 bit)
Cpuinfo Version: (5, 0, 0)
Vendor ID: AuthenticAMD
Hardware Raw: 
Brand: AMD Ryzen 5 3600 6-Core Processor
Hz Advertised: 3.5980 GHz
Hz Actual: 3.5980 GHz
Hz Advertised Raw: (3598009000, 0)
Hz Actual Raw: (3598009000, 0)
Arch: X86_64
Bits: 64
Count: 12
Raw Arch String: x86_64
L1 Data Cache Size: 192 KiB
L1 Instruction Cache Size: 192 KiB
L2 Cache Size: 3 MiB
L2 Cache Line Size: 6
L2 Cache Associativity: 0x200
L3 Cache Size: 512 KB
Stepping: 
Model: 113
Family: 23
Processor Type: 
Extended Model: 7
Extended Family: 8
Flags: 3dnowprefetch, abm, adx, aes, aperfmperf, apic, arat, avic, avx, avx2, bmi1, bmi2, bpext, cat_l3, cdp_l3, clflush, clflushopt, clwb, clzero, cmov, cmp_legacy, constant_tsc, cpb, cpuid, cqm, cqm_llc, cqm_mbm_local, cqm_mbm_total, cqm_occup_llc, cr8_legacy, cx16, cx8, dbx, de, decodeassists, extapic, extd_apicid, f16c, flushbyasid, fma, fpu, fsgsbase, fxsr, fxsr_opt, ht, hw_pstate, ibpb, ibs, irperf, lahf_lm, lbrv, lm, mba, mca, mce, misalignsse, mmx, mmxext, monitor, movbe, msr, mtrr, mwaitx, nonstop_tsc, nopl, npt, nrip_save, nx, osvw, osxsave, overflow_recov, pae, pat, pausefilter, pci_l2i, pclmulqdq, pdpe1gb, perfctr_core, perfctr_llc, perfctr_nb, pfthreshold, pge, pni, popcnt, pqe, pqm, pse, pse36, rdpid, rdrand, rdrnd, rdseed, rdt_a, rdtscp, rep_good, sep, sev, sha, sha_ni, skinit, smap, smca, sme, smep, ssbd, sse, sse2, sse4_1, sse4_2, sse4a, ssse3, stibp, succor, svm, svm_lock, syscall, tce, topoext, tsc, tsc_scale, umip, v_vmsave_vmload, vgif, vmcb_clean, vme, vmmcall, wbnoinvd, wdt, xgetbv1, xsave, xsavec, xsaveerptr, xsaveopt, xsaves

from system-query.

mbdevpl avatar mbdevpl commented on July 30, 2024

@undertherain Using pint almost solved it (see branch feature/handle-cache-units) but unfortunately it errors out on something as trivial as KB :/ Any quick ideas?

L1 cache size obtained via pint: 512 KiB -> 512 kibibyte
L2 cache size obtained via pint: 8 MiB -> 8 mebibyte
Traceback (most recent call last):
  File "/home/mateusz/Software/Spack/opt/spack/linux-gentoo2-zen/gcc-9.2.0/python-3.6.8-rdgskhgabrwtw3hh7vrfk7fvdrb536sj/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/mateusz/Software/Spack/opt/spack/linux-gentoo2-zen/gcc-9.2.0/python-3.6.8-rdgskhgabrwtw3hh7vrfk7fvdrb536sj/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/mateusz/Projects/system-query/system_query/__main__.py", line 7, in <module>
    main()
  File "/home/mateusz/Projects/system-query/system_query/main.py", line 41, in main
    query_and_export(query_scope=args.scope, export_format=args.format, export_target=target)
  File "/home/mateusz/Projects/system-query/system_query/query.py", line 29, in query_and_export
    info = query(query_scope, **kwargs)
  File "/home/mateusz/Projects/system-query/system_query/query.py", line 36, in query
    info = query_all(**kwargs)
  File "/home/mateusz/Projects/system-query/system_query/all_info.py", line 20, in query_all
    'cpu': query_cpu(**kwargs),
  File "/home/mateusz/Projects/system-query/system_query/cpu_info.py", line 61, in query_cpu
    cache = _get_cache_sizes(cpu)
  File "/home/mateusz/Projects/system-query/system_query/cpu_info.py", line 51, in _get_cache_sizes
    return {lvl: _get_cache_size(lvl, cpuinfo_data) for lvl in range(1, 4)}
  File "/home/mateusz/Projects/system-query/system_query/cpu_info.py", line 51, in <dictcomp>
    return {lvl: _get_cache_size(lvl, cpuinfo_data) for lvl in range(1, 4)}
  File "/home/mateusz/Projects/system-query/system_query/cpu_info.py", line 42, in _get_cache_size
    value = ureg(raw_value)
  File "/home/mateusz/Software/Spack/opt/spack/linux-gentoo2-zen/gcc-9.2.0/python-3.6.8-rdgskhgabrwtw3hh7vrfk7fvdrb536sj/lib/python3.6/site-packages/pint/registry.py", line 865, in parse_expression
    return build_eval_tree(gen).evaluate(lambda x: self._eval_token(x,
  File "/home/mateusz/Software/Spack/opt/spack/linux-gentoo2-zen/gcc-9.2.0/python-3.6.8-rdgskhgabrwtw3hh7vrfk7fvdrb536sj/lib/python3.6/site-packages/pint/pint_eval.py", line 85, in evaluate
    return bin_op[op_text](left, self.right.evaluate(define_op, bin_op, un_op))
  File "/home/mateusz/Software/Spack/opt/spack/linux-gentoo2-zen/gcc-9.2.0/python-3.6.8-rdgskhgabrwtw3hh7vrfk7fvdrb536sj/lib/python3.6/site-packages/pint/pint_eval.py", line 94, in evaluate
    return define_op(self.left)
  File "/home/mateusz/Software/Spack/opt/spack/linux-gentoo2-zen/gcc-9.2.0/python-3.6.8-rdgskhgabrwtw3hh7vrfk7fvdrb536sj/lib/python3.6/site-packages/pint/registry.py", line 867, in <lambda>
    **values))
  File "/home/mateusz/Software/Spack/opt/spack/linux-gentoo2-zen/gcc-9.2.0/python-3.6.8-rdgskhgabrwtw3hh7vrfk7fvdrb536sj/lib/python3.6/site-packages/pint/registry.py", line 846, in _eval_token
    case_sensitive=case_sensitive) : 1}))
  File "/home/mateusz/Software/Spack/opt/spack/linux-gentoo2-zen/gcc-9.2.0/python-3.6.8-rdgskhgabrwtw3hh7vrfk7fvdrb536sj/lib/python3.6/site-packages/pint/registry.py", line 478, in get_name
    raise UndefinedUnitError(name_or_alias)
pint.errors.UndefinedUnitError: 'KB' is not defined in the unit registry

from system-query.

undertherain avatar undertherain commented on July 30, 2024

Oh, it looks like it is not working on my old core-i7 as well, I was just using old version

from system-query.

mbdevpl avatar mbdevpl commented on July 30, 2024

From cpuinfo:

Brand: AMD Ryzen Threadripper 1950X 16-Core Processor
...
L1 Data Cache Size: 512 KiB
L1 Instruction Cache Size: 1 MiB
L2 Cache Size: 8 MiB
L2 Cache Line Size: 6
L2 Cache Associativity: 0x200
L3 Cache Size: 512 KB

... It amazes me that someone wrote L1 in KiB and L3 in KB...

from system-query.

mbdevpl avatar mbdevpl commented on July 30, 2024

@undertherain What do you think, should I work around it by assuming that KB is the same as kB (i.e. x 1000)? Or should it be KiB (i.e. x 1024)?

from system-query.

undertherain avatar undertherain commented on July 30, 2024

on what cpuinfo reports: yeah, it is indeed pretty inconsistent, but isn't it somebody's hobby project quickly put together in python?

on pint: maybe it was bad idea to suggest using it. though at least I remembered now how it is called :)

from system-query.

undertherain avatar undertherain commented on July 30, 2024

on KB vs KiB: I'd suggest doing it correctly, the problem is we are not sure if authors of py-cpuinfo got it right...

from system-query.

undertherain avatar undertherain commented on July 30, 2024

and for time being: to just catch and exception an omit cache sizes in report...

from system-query.

mbdevpl avatar mbdevpl commented on July 30, 2024

I don't think verification of whether what cpuinfo reports from multitude of processors conforms to SI or not is within the scope of system-query ;) But yeah, I agree we should do it correctly - the problem is that KB (with capital K) is quite a controversial suffix, and there is no international consensus on what it describes... Sometimes it's x1024, sometimes it's x1000.

from system-query.

mbdevpl avatar mbdevpl commented on July 30, 2024

And for the record: for now I decided to assume x1000... But in retrospect x1024 might be more common in memory sizes, vs x1000 being more common in disk sizes...

from system-query.

mbdevpl avatar mbdevpl commented on July 30, 2024

Oh well, I'll change to x1024 and release new system-query version to pypi if you don't mind.

from system-query.

undertherain avatar undertherain commented on July 30, 2024

from system-query.

mbdevpl avatar mbdevpl commented on July 30, 2024

Cool! And for those who ever visit this issue - for cache sizes I assume the confusion mentioned in the JEDEC standard is still ongoing: https://en.wikipedia.org/wiki/JEDEC_memory_standards#Unit_prefixes_for_semiconductor_storage_capacity

from system-query.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.