Getting the Default GPU

Select the system's default GPU device on which to run your Metal code.


To use the Metal framework, you start by getting a GPU device. All of the objects your app needs to interact with Metal come from a MTLDevice that you acquire at runtime. iOS and tvOS devices have only one GPU that you access by calling MTLCreateSystemDefaultDevice:

guard let device = MTLCreateSystemDefaultDevice() else { 
    fatalError( "Failed to get the system's default Metal device." ) 

On macOS devices that are built with multiple GPUs, like Macbook, the system default is the discrete GPU.

See Also


GPU Selection in macOS

Select one or more GPUs on which to run your Metal code by considering GPU capabilities, power, or performance characteristics.


The Metal interface to a GPU that you use to draw graphics or do parallel computation.

GPU Features

Find feature information for specific GPU families.