<!--
{
  "documentType" : "article",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/getting-the-default-gpu",
  "metadataVersion" : "0.1.0",
  "role" : "article",
  "title" : "Getting the default GPU"
}
-->

# Getting the default GPU

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

## Discussion

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`](/documentation/Metal/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()`](/documentation/Metal/MTLCreateSystemDefaultDevice()).

```swift
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.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)