Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not work on Mac Mini M1 #1

Open
fkellner opened this issue Jul 7, 2023 · 2 comments
Open

Does not work on Mac Mini M1 #1

fkellner opened this issue Jul 7, 2023 · 2 comments

Comments

@fkellner
Copy link

fkellner commented Jul 7, 2023

Thank you for sharing your helpful script!
I tried it on a rented Mac Mini M1, and got the following output:

Architecture: arm64
Byte Order: Little Endian
CPU(s): 8
On-line CPU(s): 8
Thread(s) per core: 1
Core(s) per socket: 8
Socket(s): 1
2023/07/07 11:40:05 Error executing command  sysctl -n machdep.cpu.vendor  :  exit status 1
Vendor ID: 
CPU family: 
2023/07/07 11:40:05 Error executing command  sysctl -n machdep.cpu.model  :  exit status 1
CPU Model: 
Model name: Apple M1
2023/07/07 11:40:05 Error executing command  sysctl -n machdep.cpu.stepping  :  exit status 1
Stepping: 
2023/07/07 11:40:05 Error converting CPU MHz to int:  strconv.Atoi: parsing "": invalid syntax
CPU MHz: 0
2023/07/07 11:40:05 Error converting CPU MHz to int:  strconv.Atoi: parsing "": invalid syntax
CPU max MHz: 0
2023/07/07 11:40:05 Error converting CPU MHz to int:  strconv.Atoi: parsing "": invalid syntax
CPU min MHz: 0
Hyper-Threading Technology: 
L1d cache: 64K
L1i cache: 128K
L2 cache: 4096K
2023/07/07 11:40:06 Error converting cache size to int:  strconv.Atoi: parsing "": invalid syntax
L3 cache: 0K
Flags: 

When I run e.g. sysctl -n machdep.cpu.model, the error is sysctl: unknown oid 'machdep.cpu.model'.

I don't know if I can be of any help debugging this since the M1 is only rented for a short time, but maybe you can add a caveat in your README.md that it only works for Intel Macs :)

@fkellner
Copy link
Author

fkellner commented Jul 7, 2023

Found out that for Apple Silicon Macs, you can use sysctl hw to get info, output looks like this for me:

hw.ncpu: 8
hw.byteorder: 1234
hw.memsize: 8589934592
hw.activecpu: 8
hw.optional.arm.FEAT_AES: 1
hw.optional.arm.FEAT_BF16: 0
hw.optional.arm.FEAT_BTI: 0
hw.optional.arm.FEAT_CSV2: 1
hw.optional.arm.FEAT_CSV3: 1
hw.optional.arm.FEAT_DPB: 1
hw.optional.arm.FEAT_DPB2: 1
hw.optional.arm.FEAT_DotProd: 1
hw.optional.arm.FEAT_ECV: 1
hw.optional.arm.FEAT_FCMA: 1
hw.optional.arm.FEAT_FHM: 1
hw.optional.arm.FEAT_FP16: 1
hw.optional.arm.FEAT_FPAC: 0
hw.optional.arm.FEAT_FRINTTS: 1
hw.optional.arm.FEAT_FlagM: 1
hw.optional.arm.FEAT_FlagM2: 1
hw.optional.arm.FEAT_I8MM: 0
hw.optional.arm.FEAT_JSCVT: 1
hw.optional.arm.FEAT_LRCPC: 1
hw.optional.arm.FEAT_LRCPC2: 1
hw.optional.arm.FEAT_LSE: 1
hw.optional.arm.FEAT_LSE2: 1
hw.optional.arm.FEAT_PAuth: 1
hw.optional.arm.FEAT_PAuth2: 0
hw.optional.arm.FEAT_PMULL: 1
hw.optional.arm.FEAT_RDM: 1
hw.optional.arm.FEAT_SB: 1
hw.optional.arm.FEAT_SHA1: 1
hw.optional.arm.FEAT_SHA256: 1
hw.optional.arm.FEAT_SHA3: 1
hw.optional.arm.FEAT_SHA512: 1
hw.optional.arm.FEAT_SPECRES: 0
hw.optional.arm.FEAT_SSBS: 1
hw.optional.AdvSIMD: 1
hw.optional.AdvSIMD_HPFPCvt: 1
hw.optional.arm64: 1
hw.optional.armv8_1_atomics: 1
hw.optional.armv8_2_fhm: 1
hw.optional.armv8_2_sha3: 1
hw.optional.armv8_2_sha512: 1
hw.optional.armv8_3_compnum: 1
hw.optional.armv8_crc32: 1
hw.optional.armv8_gpi: 1
hw.optional.breakpoint: 6
hw.optional.floatingpoint: 1
hw.optional.neon: 1
hw.optional.neon_fp16: 1
hw.optional.neon_hpfp: 1
hw.optional.ucnormal_mem: 1
hw.optional.watchpoint: 4
hw.perflevel1.cpusperl2: 4
hw.perflevel1.l1dcachesize: 65536
hw.perflevel1.l1icachesize: 131072
hw.perflevel1.l2cachesize: 4194304
hw.perflevel1.logicalcpu: 4
hw.perflevel1.logicalcpu_max: 4
hw.perflevel1.physicalcpu: 4
hw.perflevel1.physicalcpu_max: 4
hw.perflevel0.cpusperl2: 4
hw.perflevel0.l1dcachesize: 131072
hw.perflevel0.l1icachesize: 196608
hw.perflevel0.l2cachesize: 12582912
hw.perflevel0.logicalcpu: 4
hw.perflevel0.logicalcpu_max: 4
hw.perflevel0.physicalcpu: 4
hw.perflevel0.physicalcpu_max: 4
hw.features.allows_security_research: 0
hw.cacheconfig: 8 1 4 0 0 0 0 0 0 0
hw.cachelinesize: 128
hw.cachesize: 3751329792 65536 4194304 0 0 0 0 0 0 0
hw.cpu64bit_capable: 1
hw.cpufamily: 458787763
hw.cpusubfamily: 2
hw.cpusubtype: 2
hw.cputype: 16777228
hw.ephemeral_storage: 0
hw.l1dcachesize: 65536
hw.l1icachesize: 131072
hw.l2cachesize: 4194304
hw.logicalcpu: 8
hw.logicalcpu_max: 8
hw.nperflevels: 2
hw.osenvironment: 
hw.packages: 1
hw.pagesize: 16384
hw.pagesize32: 16384
hw.physicalcpu: 8
hw.physicalcpu_max: 8
hw.serialdebugmode: 0
hw.tbfrequency: 24000000
hw.use_kernelmanagerd: 1
hw.use_recovery_securityd: 0
hw.targettype: J274

Probably difficult to render in lscpu style, since there are 4 fast and 4 slow cores w/ different cache sizes and clock speeds.

Found it here:
https://apple.stackexchange.com/questions/238777/how-do-i-identify-which-cpu-a-macbook-uses#answer-445882

@pncnmnp
Copy link
Owner

pncnmnp commented Jul 7, 2023

Wow, thanks for this! Yep, I'll include a caveat in the README for now. Thanks for the StackExchange link. I'll keep this issue open and see if I can add support for Apple Silicon.

pncnmnp added a commit that referenced this issue Jul 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants