Finding multiple GPUs on an Intel-based Mac
Locate, identify, and choose suitable GPUs for your app.
Overview
Your app can use multiple GPUs on an Intel-based Mac, including any built-in and external GPUs. Start by getting a list of all the system’s available GPUs, and then submit workloads to those appropriate for your app’s tasks.
Get a list of GPU devices
Your app can get an array of MTLDevice instances, each of which represents an available GPU, by calling the MTLCopyAllDevices() function.
However, that function provides a list of GPUs that are available at that moment in time. To get the current list and register for device update notifications, provide a handler to Metal by calling the MTLCopyAllDevicesWithObserver function.
Metal calls your handler to tell your app when the system adds or removes an MTLDevice from the system.
Your app can deregister its observer when it no longer needs GPU device updates from the system by calling the MTLRemoveDeviceObserver(_:) function.
Identify each GPU by type
Each GPU on a Mac computer’s system can be one of three types: integrated, discrete, or external. You can identify each MTLDevice instance’s type by inspecting its isLowPower and isRemovable properties.
GPU Type | ||
|---|---|---|
Integrated | ||
Discrete | ||
External |
For example, you can use these properties to build a list of devices for each GPU type.
Some external or discrete GPUs can also be headless, which means they aren’t connected to a display. Your app can identify whether a GPU is headless by checking a device instance’s isHeadless property.
Select the GPUs suitable for your workloads
Each GPU type has its advantages for certain tasks or workloads that you can consider for a system with multiple GPUs.
GPU type | Power consumption | Memory bandwidth |
|---|---|---|
Integrated | Low | High |
Discrete | Medium | High |
External | High | Low |
In general, start with an integrated GPU (if the system has one) to conserve power and extend the device’s battery life. If your app needs additional graphics or compute processing, consider moving some workloads to a discrete GPU, if the system has one.
External GPUs typically have significant processing power but lower bandwidth compared to internal GPUs, which makes them a good choice for tasks that don’t require much memory bandwidth for each frame, including the following:
Rendering high-complexity graphics scenes
Rendering high-resolution graphics content
Processing compute workloads in tandem with rendering graphics
Processing compute workloads that use a high arithmetic-logic unit (ALU) complexity
For more information about GPU memory bandwidth, see Adjusting for GPU memory bandwidth tradeoffs.