Getting the default GPU
Select the system’s default GPU device on which to run your Metal code.
Overview
To use the Metal framework, start by getting a GPU device. All of the instances your app needs to interact with Metal come from an MTLDevice that you acquire at runtime. Some devices, such as those with iOS and tvOS have a single GPU that you can access by calling MTLCreateSystemDefaultDevice().
if(!(device = MTLCreateSystemDefaultDevice()))
{
NSLog(@"Failed to get the system's default Metal device.");
}On macOS devices that have multiple GPUs, such as a MacBook Pro, the system default is the discrete GPU.