0
0
PyTorchml~5 mins

DataParallel basics in PyTorch - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is DataParallel in PyTorch?
DataParallel is a PyTorch feature that helps run a model on multiple GPUs by splitting input data across them and combining results automatically.
Click to reveal answer
beginner
How does DataParallel split the input data?
DataParallel splits the input batch into smaller chunks, sending each chunk to a different GPU to process in parallel.
Click to reveal answer
beginner
What happens to the model outputs in DataParallel?
After each GPU processes its chunk, DataParallel gathers all outputs and combines them into a single output on the main GPU.
Click to reveal answer
beginner
How do you wrap a PyTorch model with DataParallel?
You wrap your model by calling model = torch.nn.DataParallel(model). This enables multi-GPU usage automatically.
Click to reveal answer
intermediate
What is a key limitation of DataParallel?
DataParallel uses one main GPU to gather results, which can create a bottleneck and limit scaling to many GPUs.
Click to reveal answer
What does DataParallel do with input data in PyTorch?
ARuns model on CPU only
BCombines multiple models into one
CConverts data to a different format
DSplits input data across multiple GPUs
How do you enable DataParallel for a model in PyTorch?
Amodel = DataParallel(model)
Bmodel = torch.DataParallel(model)
Cmodel = torch.nn.DataParallel(model)
Dmodel.parallelize()
Where does DataParallel gather the outputs from multiple GPUs?
AOn the main GPU
BOn the CPU
COn each GPU separately
DIt does not gather outputs
What is a downside of using DataParallel?
AMain GPU can become a bottleneck
BIt only works on CPUs
CIt requires manual data splitting
DIt does not support GPUs
Which PyTorch module provides DataParallel?
Atorch.optim
Btorch.nn
Ctorch.utils.data
Dtorch.cuda
Explain how DataParallel works in PyTorch to use multiple GPUs.
Think about how data and results move between GPUs.
You got /4 concepts.
    Describe one advantage and one limitation of using DataParallel.
    Consider what makes it simple and what slows it down.
    You got /2 concepts.