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

Backport of client/fingerprint: correctly fingerprint E/P cores of Apple Silicon chips into release/1.5.x #16690

Conversation

hc-github-team-nomad-core
Copy link
Contributor

Backport

This PR is auto-generated from #16672 to be assessed for backporting due to the inclusion of the label backport/1.5.x.

The below text is copied from the body of the original PR.


This PR adds detection of asymetric core types (Power (P) & Efficiency (E))
when running on M1/M2 Apple Silicon CPUs. This functionality is provided
by shoenig/go-m1cpu which makes use of the Apple IOKit framework to read
undocumented registers containing CPU performance data. Currently working
on getting that functionality merged upstream into gopsutil, but gopsutil
would still not support detecting P vs E cores like this PR does.

Also refactors the CPUFingerprinter code to handle the mixed core
types, now setting power vs efficiency cpu attributes.

For now the scheduler is still unaware of mixed core types - on Apple
platforms tasks cannot reserve cores anyway so it doesn't matter, but
at least now the total CPU shares available will be correct.

Future work should include adding support for detecting P/E cores on
the latest and upcoming Intel chips, where computation of total cpu shares
is currently incorrect. For that, we should also include updating the
scheduler to be core-type aware, so that tasks making use of resources.cores
on Linux platforms can be assigned the correct number of CPU shares for the core
type(s) they have been assigned.

node attributes before

cpu.arch                  = arm64
cpu.modelname             = Apple M2 Pro
cpu.numcores              = 12
cpu.reservablecores       = 0
cpu.totalcompute          = 1000

node attributes after

cpu.arch                  = arm64
cpu.frequency.efficiency  = 2424
cpu.frequency.power       = 3504
cpu.modelname             = Apple M2 Pro
cpu.numcores.efficiency   = 4
cpu.numcores.power        = 8
cpu.reservablecores       = 0
cpu.totalcompute          = 37728

Fixes #12029
Fixes #11046
Fixes #9408

@hc-github-team-nomad-core hc-github-team-nomad-core force-pushed the backport/cpu-detect-apple-silicon/briefly-hardy-gibbon branch from 67e12df to dcfd94b Compare March 28, 2023 13:28
@hc-github-team-nomad-core hc-github-team-nomad-core merged commit d76453a into release/1.5.x Mar 28, 2023
@hc-github-team-nomad-core hc-github-team-nomad-core force-pushed the backport/cpu-detect-apple-silicon/briefly-hardy-gibbon branch from 8535b71 to 850c06a Compare March 28, 2023 13:28
@hc-github-team-nomad-core hc-github-team-nomad-core deleted the backport/cpu-detect-apple-silicon/briefly-hardy-gibbon branch March 28, 2023 13:28
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

Successfully merging this pull request may close these issues.

2 participants