[vLLM] How to Fix "To use CUDA with multiprocessing, you must use the 'spawn' start method"

[vLLM] How to Fix "To use CUDA with multiprocessing, you must use the 'spawn' start method"
Photo by Andy Holmes / Unsplash

When using vLLM on WSL and trying to serve a single LLM across multiple GPUs with tensor parallelism, you will often run into an error like the following.

RuntimeError: Cannot re-initialize CUDA in forked subprocess. To use CUDA with multiprocessing, you must use the 'spawn' start method

A typical scenario where you encounter this is when you specify the tensor parallelism option in vLLM's startup options, as shown below.

--tensor-parallel-size 2

In other words, the error is telling you to use "spawn" instead of "fork" when using CUDA with multiprocessing.

To tell vLLM this, set the environment variable as shown on the second line below, and vLLM will use "spawn".

export CUDA_VISIBLE_DEVICES=0,1
export VLLM_WORKER_MULTIPROC_METHOD=spawn

Read more

Ubuntu's Automatic Updates Bumped the Kernel Alone, and the GPU Vanished After a Reboot: Why the NVIDIA Module Gets Left Behind, and Three Ways to Prevent It

Ubuntu's Automatic Updates Bumped the Kernel Alone, and the GPU Vanished After a Reboot: Why the NVIDIA Module Gets Left Behind, and Three Ways to Prevent It

Reboot an Ubuntu 24.04 GPU server and nvidia-smi stops working. The cause: unattended-upgrades updated the kernel alone and skipped the NVIDIA module over a dependency it could not resolve. How we traced it in the logs, recovered with one install, and compared three fixes including apt-mark hold.

By Qualiteg Product Development Team