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
- 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
Run sweep agents in parallel across multiple GPUs on the same machine by usingCUDA_VISIBLE_DEVICES to assign each wandb agent to a different GPU, so the agents run in parallel without competing for the same device.
To follow this procedure, you need:
- A machine with more than one GPU.
- The NVIDIA CUDA Toolkit installed.
- A terminal.
[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 separate terminal, set
CUDA_VISIBLE_DEVICESto1and start another agent with the same sweep ID: