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

Monterey (and probably Big Sur) compatibility issue - fails eGPU detection #27

Open
eweiman opened this issue May 2, 2022 · 0 comments

Comments

@eweiman
Copy link

eweiman commented May 2, 2022

Attempting to run the script as-is fails on 12.3.1, another mac on 11.6.5 (that doesn't have eGPU) also fails to have any output from this command.
Deploying a workaround allows it to function correctly to set / probe the eGPU preferences on the apps.

eweiman@eweiman-mbp-osx ~ % sw_vers
ProductName:	macOS
ProductVersion:	12.3.1
BuildVersion:	21E258

This line tries to use ioreg to determine if the eGPU is connected on Mojave and later.
https://github.com/mayankk2308/set-egpu/blob/master/set-eGPU.sh#L159

# Check eGPU presence for Mojave+
check_egpu_presence() {
  (( ${IS_HIGH_SIERRA} == 1 )) && return
  EGPU_VENDOR="$(ioreg -n display@0 | grep \"vendor-id\" | cut -d "=" -f2 | sed 's/ <//' | sed 's/>//' | cut -c1-4 | sed -E 's/^(.{2})(.{2}).*$/\2\1/')"
  [[ -z "${EGPU_VENDOR}" ]] && echo -e "\nExternal GPU must be plugged in for ${BOLD}set-eGPU${NORMAL} on macOS 10.14+.\n" && exit
}

however this has zero output:

%  ioreg -n display@0 | grep \"vendor-id\" | cut -d "=" -f2 | sed 's/ <//' | sed 's/>//' | cut -c1-4 | sed -E 's/^(.{2})(.{2}).*$/\2\1/'|wc -l
       0

As a workaround I changed this line to read:
EGPU_VENDOR=AMD
Which then allowed me to run this just fine.

You'd probably be better off using system_profiler for this kind of check.

Example output (which can be quite verbose with many displays connected):

eweiman@eweiman-mbp-osx ~ % system_profiler SPDisplaysDataType
2022-05-02 11:14:58.005 system_profiler[87107:1263592] Device PreExisted [00000001000006c6] AMD Radeon RX 580
2022-05-02 11:14:58.006 system_profiler[87107:1263592] Device PreExisted [0000000100000622] Intel Iris Pro Graphics
2022-05-02 11:14:58.006 system_profiler[87107:1263592] Synchronize with Metal initialization
2022-05-02 11:15:01.012 system_profiler[87107:1263592] Can't find (Metal) name, location, locationNumber, maxTransferRate
2022-05-02 11:15:01.013 system_profiler[87107:1263592] Synchronize with Metal initialization
2022-05-02 11:15:04.013 system_profiler[87107:1263592] Can't find (Metal) name, location, locationNumber, maxTransferRate
2022-05-02 11:15:04.043 system_profiler[87107:1263592] Synchronize with Metal initialization
2022-05-02 11:15:07.044 system_profiler[87107:1263592] Can't find (Metal) name, location, locationNumber, maxTransferRate
2022-05-02 11:15:07.045 system_profiler[87107:1263592] Synchronize with Metal initialization
2022-05-02 11:15:10.053 system_profiler[87107:1263592] Can't find (Metal) name, location, locationNumber, maxTransferRate
Graphics/Displays:

    Intel Iris Pro Graphics 5200:

      Chipset Model: Intel Iris Pro Graphics 5200
      Type: GPU
      Bus: Built-In
      VRAM (Dynamic, Max): 1536 MB
      Vendor: Intel
      Device ID: 0x0d26
      Revision ID: 0x0008
      Metal Family: Supported, Metal GPUFamily macOS 1
      Displays:
        Color LCD:
          Display Type: Built-In Retina LCD
          Resolution: 2880 x 1800 Retina
          Framebuffer Depth: 24-Bit Color (ARGB8888)
          Mirror: Off
          Online: Yes
          Automatically Adjust Brightness: Yes
          Connection Type: Internal

    Radeon RX 580:

      Chipset Model: Radeon RX 580
      Type: External GPU
      Bus: PCIe
      PCIe Lane Width: x4
      VRAM (Total): 4 GB
      Vendor: AMD (0x1002)
      Device ID: 0x67df
      Revision ID: 0x00e7
      Metal Family: Supported, Metal GPUFamily macOS 1
      GPU is Removable: Yes
      Displays:
        DELL P2217H:
          Resolution: 1920 x 1080 (1080p FHD - Full High Definition)
          UI Looks like: 1920 x 1080 @ 60.00Hz
          Framebuffer Depth: 30-Bit Color (ARGB2101010)
          Display Serial Number: 4RDG97C71234
          Main Display: Yes
          Mirror: Off
          Online: Yes
          Rotation: Supported

You might be able to just grep for "External GPU" in this case, or if you really need the vendor info you could get that as well, however I don't see a reason to get that specific.

eweiman@eweiman-mbp-osx ~ % system_profiler SPDisplaysDataType 2>/dev/null|grep External
      Type: External GPU
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

1 participant