Building a GPU PC, Part 19: Software – Installing CUDA and PyTorch

Building a GPU PC, Part 19: Software – Installing CUDA and PyTorch

In this installment, we install CUDA and PyTorch.

4.2 Installing CUDA (+cuDNN) and PyTorch Together


Installing PyTorch also pulls in CUDA and cuDNN for you, so let's take advantage of that.

STEP 1: Generate the PyTorch installation command

With all the groundwork finally in place, it's time to install the machine learning library PyTorch.

■ Installing PyTorch

Open the PyTorch installation guide at the link below:

https://pytorch.org/get-started/locally/

As shown below, you can generate the PyTorch installation command by picking options from a set of choices.

Category Selected
Pytorch Build Stable (1.13.1)
Your OS Linux
Package Conda
Language Python
Compute Platform CUDA 11.7

With these settings, the following installation command was generated.

conda install pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia

STEP 2: Install PyTorch

(1) Open a terminal and run:

conda install pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia

(2) Enter y, and the download and installation of the required packages will begin.

(3) After waiting around 10 minutes, the installation will finish.


That completes the installation of PyTorch with NVIDIA GPU support.

With PyTorch, the conda command above also installs the CUDA Toolkit alongside it, and since cuDNN comes bundled into PyTorch and is installed by that same conda command, there is no need to install it separately, which is very convenient.

Qualiteg Technology Consulting

Thinking beyond a DIY build toward a GPU environment for research or business?

The know-how gained from building your own GPU machine carries straight over to choosing infrastructure for research, PoCs, and production.

We build and operate our own in-house GPU cluster and develop LLM products on it. We can also support a wide range of needs, from consumer to professional use, including procuring GPU workstations for research on Intel Core and Intel Xeon architectures. Beyond workstation procurement and build support, we advise on everything that follows, from setting up training environments to optimal GPU selection, inference optimization, and distributed configurations, all grounded in our operational experience.

See our LLM infrastructure and platform technology services →

Next time, we'll write some PyTorch code that actually makes use of the GPU.


navigation

Read more