---
title: "createDevice(): function in Runtime, TypeShade API reference"
description: "createDevice, a function in Runtime. Open the owner of a host's kernel calls: on the first tier of prefer that opens, on a GPUDevice the host already has…"
url: https://typeshade.dev/api/createdevice/
language: en
---

# `createDevice()`

Function in Runtime

Open the owner of a host's kernel calls: on the first tier of prefer that opens, on a GPUDevice the host already has, or on the device of a program runtime.

`import { createDevice } from 'typeshade'`
`import { createDevice } from 'typeshade/runtime'`

The signature, the description and the examples come from the compiler's own source at commit af54ddad5.

## Syntax

```ts
async function createDevice(options: DeviceOptions = {}): Promise<Device>
```

## Parameters

**`options` optional `DeviceOptions`**

`prefer`, `device` or `runtime`, one of them; instance-local WebGPU `limits` and `features`; `poolBytes`, `fp64Flavor` and `timeBudgetMs`, the time one chunk of a long kernel may take (change 0074). Omitted `fp64Flavor` means `'auto'`, resolved from this device without requesting an unrelated adapter.

## Return value

`Promise<Device>`

the device.

## Exceptions

**`TypeError`**

`TypeError` for options that do not fit, a word that is not a flavor among them; `RangeError` for a `timeBudgetMs` that is not a finite number from 1 to 60000; `Error` naming each tier’s reason when no tier of `prefer` opens.

## Description

The device’s `array()` makes the `Buffer`s its calls take, `fuse()` runs a body’s calls as one plan on it, and `dispose()` frees what it made. Two devices in one context are independent, and the process-global `configure()`, `array()` and `fuse()` describe the default owner as before.

## In the guide

- [The CPU oracle](https://typeshade.dev/guide/internals/the-cpu-oracle/)
- [Capabilities & extensions](https://typeshade.dev/guide/internals/capabilities-extensions/)

## Source

[`src/runtime/device.ts`, line 753](https://github.com/typeshade/typeshade/blob/af54ddad5/src/runtime/device.ts#L753), at commit af54ddad5
