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

fix 'eb --show-system-info' on Apple M1 system #4015

Merged
merged 1 commit into from May 30, 2022

Conversation

boegel
Copy link
Member

@boegel boegel commented May 30, 2022

This fixes various small issues that pop up on Apple M1:

  • add fallback to "sysctl -n machdep.cpu.brand_string" in get_cpu_vendor to determine CPU type, since "sysctl -n machdep.cpu.vendor" is not supported on Apple M1 systems;
  • add Apple as known CPU vendor;
  • avoid that get_cpu_speed crashes when it fails to determine CPU speed via "sysctl -n hw.cpufrequency_max" (which returns empty string on Apple M1), and just return None;
  • avoid crash in get_cpu_features because "sysctl -n machdep.cpu.extfeatures" is not supported on Apple M1 (and leave list of CPU features empty, for now);
  • also includes fixes for systemtools tests so they pass on Apple M1;

Also requires #4014 for all systemtools tests to pass on Apple M1

fixes #4013

@boegel boegel added the bug fix label May 30, 2022
@boegel boegel added this to the 4.5.5 milestone May 30, 2022
Copy link
Member

@ocaisa ocaisa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also looks ok, can you add an example of the output since I can't test this?

@boegel
Copy link
Member Author

boegel commented May 30, 2022

This fixes a hard crash early on when running eb on Apple M1:

Traceback (most recent call last):
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/Users/kehoste/work/easybuild-framework/easybuild/main.py", line 597, in <module>
    main()
  File "/Users/kehoste/work/easybuild-framework/easybuild/main.py", line 234, in main
    init_session_state = session_state()
  File "/Users/kehoste/work/easybuild-framework/easybuild/tools/testing.py", line 137, in session_state
    'system_info': get_system_info(),
  File "/Users/kehoste/work/easybuild-framework/easybuild/tools/systemtools.py", line 1068, in get_system_info
    'cpu_speed': get_cpu_speed(),
  File "/Users/kehoste/work/easybuild-framework/easybuild/tools/systemtools.py", line 538, in get_cpu_speed
    cpu_freq = float(out.strip()) // (1000 ** 2)
ValueError: could not convert string to float: ''

@boegel
Copy link
Member Author

boegel commented May 30, 2022

Example output on Apple M1:

$ eb --show-system-info
System information (vpne020.ugent.be):

* OS:
  -> name: UNKNOWN
  -> type: Darwin
  -> version: UNKNOWN
  -> platform name: arm64-apple-darwin

* CPU:
  -> vendor: Apple
  -> architecture: AArch64
  -> family: ARM
  -> arch name: m1
  -> model: Apple M1
  -> speed: None
  -> cores: 8
  -> features:

* software:
  -> glibc version: UNKNOWN
  -> Python binary: /Library/Developer/CommandLineTools/usr/bin/python3
  -> Python version: 3.8.9

There's room for improvement, but this is way better than only producing a nasty traceback on macOS @ Apple M1...

@ocaisa
Copy link
Member

ocaisa commented May 30, 2022

Agreed

@ocaisa ocaisa merged commit 4c3b052 into easybuilders:develop May 30, 2022
@boegel boegel deleted the apple_m1_systemtools_fixes branch May 30, 2022 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

--show-system-info fails on Apple Silicon M1
2 participants