**Audience:** Users looking to save money and run large models faster using single or multiple
----
What is a GPU?
--------------
A Graphics Processing Unit (GPU), is a specialized hardware accelerator designed to speed up mathematical computations used in gaming and deep learning.
----
Train on 1 GPU
--------------
Make sure you're running on a machine with at least one GPU. There's no need to specify any NVIDIA flags
as Lightning will do it for you.
..testcode::
:skipif:torch.cuda.device_count() < 1
trainer = Trainer(accelerator="gpu", devices=1)
----------------
.._multi_gpu:
Train on multiple GPUs
----------------------
To use multiple GPUs, set the number of devices in the Trainer or the index of the GPUs.
..code::
trainer = Trainer(accelerator="gpu", devices=4)
Choosing GPU devices
^^^^^^^^^^^^^^^^^^^^
You can select the GPU devices using ranges, a list of indices or a string containing
a comma separated list of GPU ids:
..testsetup::
k = 1
..testcode::
:skipif:torch.cuda.device_count() < 2
# DEFAULT (int) specifies how many GPUs to use per node
This is especially useful when GPUs are configured to be in "exclusive compute mode", such that only one process at a time is allowed access to the device.
This special mode is often enabled on server GPUs or systems shared among multiple users.