Obtain, identify, and choose suitable GPUs for your app.
Every GPU that's available on a Mac is represented by a
MTLDevice. A user can have multiple GPUs built in or connected to their system, and you can use one or many of these GPUs for your app's graphics rendering or compute processing workloads. Query the list of devices available to a system, identify the GPU types, and choose the best option (or options) for your app.
Getting the List of Available Devices
MTLCopy function to get a list of all the Metal devices available to a system and register an observer that's called whenever this list changes (or may change due to a safe disconnect request).
To deregister the observer, call the
Identify the GPU Types
Three GPU types could be present in any given system: external, integrated, and discrete. To identify the GPU types, query these
Choose a Suitable GPU for Your Workloads
Different types of GPUs have different power and bandwidth characteristics.
Given a system with multiple GPUs, you can use different types of GPUs for different types of workloads in your app.
Use an integrated GPU for:
Executing simple graphics or compute workloads with minimal GPU processing needs
Conserving power (namely, battery life)
Use a discrete GPU for:
Rendering medium- to high-complexity graphics scenes (with or without compute processing)
Rendering low- to medium-resolution graphics content (with or without compute processing)
Satisfying high per-frame bandwidth demands between GPUs or displays
Use an external GPU for:
Processing compute workloads with high ALU complexity
Rendering high-complexity graphics scenes (with or without compute processing)
Rendering high-resolution graphics content (with or without compute processing)
Satisfying low to medium per-frame bandwidth demands between GPUs or displays