---
title: "Companion"
sidebar_label: "Companion"
description: "Kotlin binding reference: Companion."
---

<!-- Generated by tools/api_reference/generate_api_docs.py. Do not edit. -->

//[clika-runtime](../../../../index.md)/[io.clika.runtime](../../index.md)/[Device](../index.md)/[Companion](index.md)

# Companion

[common]\
object [Companion](index.md)

## Properties

| Name | Summary |
|---|---|
| [CPU](CPU-property.md) | [common]<br>val [CPU](CPU-property.md): [Device](../index.md)<br>The whole-machine host CPU. |
| [WHOLE_MACHINE](WHOLE_MACHINE.md) | [common]<br>const val [WHOLE_MACHINE](WHOLE_MACHINE.md): [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)<br>The CPU index naming the whole machine: every core, over memory the OS places on first touch. |

## Functions

| Name | Summary |
|---|---|
| [cpu](cpu.md) | [common]<br>fun [cpu](cpu.md)(socket: [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) = WHOLE_MACHINE): [Device](../index.md)<br>`cpu()` is every core; `cpu(i)` is socket `i`. |
| [cuda](cuda.md) | [common]<br>fun [cuda](cuda.md)(index: [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) = 0): [Device](../index.md)<br>The `index`-th CUDA device. |
| [gpu](gpu.md) | [common]<br>fun [gpu](gpu.md)(index: [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) = 0): [Device](../index.md)<br>The generic accelerator: the first GPU backend that loads and exposes a device on this host, else the CPU (said once at warning level on the runtime's log channel). |
| [htp](htp.md) | [common]<br>fun [htp](htp.md)(index: [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) = 0): [Device](../index.md)<br>The `index`-th HTP device. |
| [metal](metal.md) | [common]<br>fun [metal](metal.md)(index: [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) = 0): [Device](../index.md)<br>The `index`-th Metal device. |
| [parse](parse.md) | [common]<br>fun [parse](parse.md)(text: [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)): [Device](../index.md)<br>Parse `"cpu"`, `"gpu"`, `"cuda"`, `"cuda:1"`, `"vulkan:0"`, `"metal"`, `"htp"` or `"tpu"` (case-insensitive; an absent index means the backend's default device). |
| [tpu](tpu.md) | [common]<br>fun [tpu](tpu.md)(index: [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) = 0): [Device](../index.md)<br>The `index`-th TPU device. |
| [vulkan](vulkan.md) | [common]<br>fun [vulkan](vulkan.md)(index: [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) = 0): [Device](../index.md)<br>The `index`-th Vulkan device. |