Lightning-AI / Lightning-AI/pytorch-lightning

Why only one GPU is getting used in the kaggle kernel

Open
#20,424 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

waiting on author
Dominant language
Python
Stars
31.4k
Forks
3.8k
Avg merge
6d 7h
Merged PRs (30d)
6

Description

### Bug description

![Screenshot 2024-11-16 201845](https://github.com/user-attachments/assets/b134f148-cdc3-435d-94cf-25aa117e103e)

i initialized my trainer
```
trainer = L.Trainer(max_epochs=5,
devices=2,
strategy='ddp_notebook',
num_sanity_val_steps=0,
profiler='simple',
default_root_dir="/kaggle/working",
callbacks=[DeviceStatsMonitor(),
StochasticWeightAveraging(swa_lrs=1e-2),
#EarlyStopping(monitor='train_Loss', min_delta=0.001, patience=100, verbose=False, mode='min'),
],
enable_progress_bar=True,
enable_model_summary=True,
)
```

distributed is initialized for both the GPUs but only one is getting hit.

Also for validation loop the GPU are not in usage

![Screenshot 2024-11-16 202120](https://github.com/user-attachments/assets/57b6e021-1f25-483f-8c6c-422e0bad5859)

How can I resolve the situation to use 2 GPUs and fasten my training.

### What version are you seeing the problem on?

v2.4

### How to reproduce the bug

_No response_

### Error messages and logs

```
# Error messages and logs here please
```

### Environment

Current environment

```
#- PyTorch Lightning Version (e.g., 2.4.0):
#- PyTorch Version (e.g., 2.4):
#- Python version (e.g., 3.12):
#- OS (e.g., Linux):
#- CUDA/cuDNN version:
#- GPU models and configuration:
#- How you installed Lightning(`conda`, `pip`, source):
```

### More info

_No response_

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reported L.Trainer configuration using devices=2 and strategy='ddp_notebook', then collect the missing Lightning, PyTorch, CUDA, GPU, and installation details from the Environment section. Reproduce the training and validation behavior in the Kaggle kernel; done means identifying why only one GPU is used and documenting or validating a fix for two-GPU training.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
distributed-systems, machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.