How to Enable and Verify GPU Acceleration in Kaggle Notebooks
Learn how to turn on GPU acceleration in a Kaggle Notebook, verify it works with TensorFlow or PyTorch, understand the weekly quota, and avoid common pitfalls.
20 May 2026, 15:52 UTC

Enable GPU in a Kaggle Notebook
To run machine‑learning workloads on a GPU in Kaggle, you must select the accelerator in the notebook settings before the session starts. The setting applies to the current session only; each time you restart the notebook you need to re‑select GPU if you want it.
Steps to enable
- Open or create a Kaggle Notebook.
- Click the
Settingsicon (gear) in the right‑hand sidebar. - In the
Acceleratordropdown, chooseGPU. - Press
Save. The notebook will restart and provision a Tesla T4 GPU for the session.
Verify GPU Availability
After the notebook has started, run a quick check in a code cell to confirm that the framework can see the GPU.
TensorFlow verification
import tensorflow as tf
# List physical GPUs; returns a list if any are visible
print('TensorFlow GPUs:', tf.config.list_physical_devices('GPU'))
PyTorch verification
import torch
print('PyTorch GPU available:', torch.cuda.is_available())
if torch.cuda.is_available():
print('Device name:', torch.cuda.get_device_name(0))
If the GPU is active, the TensorFlow snippet will output a non‑empty list and the PyTorch snippet will print TrueFalse, the accelerator was not attached.
Weekly GPU Quota and Practical Limits
Kaggle allocates GPU time per account:
- Verified accounts: up to 30 hours per week.
- Unverified accounts: up to 20 hours per week.
Once the quota is exhausted, any further notebooks that request GPU will fall back to CPU until the weekly counter resets. The quota is shared across all notebooks, competitions, and datasets you run.
Checking your usage
Visit Account → Settings → GPU Usage to see the current week’s consumption and the remaining time.
Common Mistakes and Best Practices
1. Assuming GPU persists across sessions
Each time you stop and start a notebook, the session ends and the GPU is released. You must re‑enable the accelerator in Settings for the next run.
2. Expecting installed packages to survive
The notebook’s filesystem is ephemeral except for the /kaggle mount. Packages installed with pip or conda in a cell are lost when the kernel restarts. Re‑install them in an initialization cell or use the Install tab in the UI.
3. Using the GPU for interactive debugging
Frequent kernel restarts each consume a new GPU session and count toward your quota. For debugging, prefer CPU or limit the number of restarts.
4. Storing training data in the temporary /tmp directory
/tmp offers about 5 GB but is cleared on session shutdown. Persist data by loading from Kaggle Datasets, uploading files to the notebook, or fetching from external URLs each session.
Verification Checklist
- Set accelerator to GPU in Settings and save.
- Run the TensorFlow or PyTorch verification snippet; confirm a GPU is reported.
- Execute
!nvidia-smiin a code cell; you should see a Tesla T4 with memory usage. - Check Account → Settings → GPU Usage to ensure the session counted toward your weekly quota.
Following these steps ensures you are actually using the GPU and helps you avoid unexpected quota consumption or silent fallback to CPU.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.