---
title: CPUAccelerator
description: Accelerator for CPU devices.
canonical: >-
  https://lightning.ai/docs/fabric/stable/full-api-reference/api/generated/lightning.fabric.accelerators.CPUAccelerator
---
# CPUAccelerator {#cpuaccelerator}

### `class lightning.fabric.accelerators.CPUAccelerator` {#lightning.fabric.accelerators.CPUAccelerator}

Bases: [`Accelerator`](/docs/fabric/2.6.6/full-api-reference/api/generated/lightning.fabric.accelerators.Accelerator.md#lightning.fabric.accelerators.Accelerator "lightning.fabric.accelerators.accelerator.Accelerator")

Accelerator for CPU devices.

#### `static auto_device_count()` {#lightning.fabric.accelerators.CPUAccelerator.auto_device_count}

Get the devices when set to auto.

Return type:

[`int`](https://docs.python.org/3/builtins/functions.html#int "(in Python v3.15)")

#### `static get_parallel_devices(devices)` {#lightning.fabric.accelerators.CPUAccelerator.get_parallel_devices}

Gets parallel devices for the Accelerator.

Return type:

[`list`](https://docs.python.org/3/builtins/stdtypes.html#list "(in Python v3.15)")\[[`device`](https://docs.pytorch.org/docs/stable/tensor_attributes.html#torch.device "(in PyTorch v2.15)")\]

#### `static is_available()` {#lightning.fabric.accelerators.CPUAccelerator.is_available}

CPU is always available for execution.

Return type:

[`bool`](https://docs.python.org/3/builtins/functions.html#bool "(in Python v3.15)")

#### `static name()` {#lightning.fabric.accelerators.CPUAccelerator.name}

The name of the accelerator.

Return type:

[`str`](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)")

#### `static parse_devices(devices)` {#lightning.fabric.accelerators.CPUAccelerator.parse_devices}

Accelerator device parsing logic.

Return type:

[`int`](https://docs.python.org/3/builtins/functions.html#int "(in Python v3.15)")

#### `classmethod register_accelerators(accelerator_registry)` {#lightning.fabric.accelerators.CPUAccelerator.register_accelerators}

Register the accelerator with the registry.

Return type:

[`None`](https://docs.python.org/3/builtins/constants.html#None "(in Python v3.15)")

#### `setup_device(device)` {#lightning.fabric.accelerators.CPUAccelerator.setup_device}

Raises:

[**ValueError**](https://docs.python.org/3/builtins/exceptions.html#ValueError "(in Python v3.15)") – If the selected device is not CPU.

Return type:

[`None`](https://docs.python.org/3/builtins/constants.html#None "(in Python v3.15)")

#### `teardown()` {#lightning.fabric.accelerators.CPUAccelerator.teardown}

Clean up any state created by the accelerator.

Return type:

[`None`](https://docs.python.org/3/builtins/constants.html#None "(in Python v3.15)")

---

**Navigation**

- Parent: [Generated](/docs/fabric/2.6.6/full-api-reference/api/generated.md)
