Parallelize on a multi-CPU machine
The following tabs describe how to run multiple sweep agents in parallel on the same machine. Parallel agents are most useful on a machine with multiple CPU cores, where each agent can run on its own core. Choose the tab for the CLI or a Jupyter Notebook based on your workflow.- CLI
- Jupyter Notebook
Use the
wandb agent command to parallelize your sweep agent across multiple CPUs with the terminal. Provide the sweep ID that W&B returned when you initialized the sweep.- Open more than one terminal window on your local machine.
-
Copy and paste the following code snippet and replace
[SWEEP-ID]with your sweep ID:
Parallelize on a multi-GPU machine
The following procedure describes how to run sweep agents in parallel across multiple GPUs on the same machine, using a terminal with CUDA Toolkit. This procedure requires a machine with more than one GPU. UseCUDA_VISIBLE_DEVICES to assign each wandb agent to a different GPU so the agents run in parallel without competing for the same device.
For example, suppose you have two NVIDIA GPUs on your local machine. Replace [SWEEP-ID] in each command with the sweep ID that W&B returns when you initialize a sweep:
-
In one terminal, set
CUDA_VISIBLE_DEVICESto0and start an agent: -
In a second terminal, set
CUDA_VISIBLE_DEVICESto1and start another agent with the same sweep ID: