Urgent.News

What's breaking now, across thousands of outlets.

Tech

Installing PyTorch with ROCm Acceleration on Ubuntu 24.04

PyTorch is an open-source framework for building and training machine learning models, especially deep learning networks. ROCm is AMD's platform for GPU computing, enabling high-performance computing and machine learning on AMD GPUs. A ROCm-enabled PyTorch container is a pre-built, portable environment with PyTorch configured to run efficiently on AMD GPUs, so you can skip manually setting up or…

PyTorch is a popular open-source machine learning framework for deep learning models. AMD's ROCm platform provides GPU computing capabilities for high-performance computing and machine learning on AMD GPUs. A pre-configured PyTorch container with ROCm support allows for easy GPU acceleration without manual setup.

To utilize ROCm-enabled PyTorch, begin by ensuring Docker is installed on your server with ROCm GPU support enabled. Pull the PyTorch container using Docker:

docker pull rocm/pytorch:latest

Run a temporary container with GPU device access and high memory:

docker run --rm -it --device = /dev/kfd --device = /dev/dri --security-opt seccomp = unconfined --shm-size 8G rocm/pytorch:latest

Verify GPU availability within the container using rocm-smi and Python:

rocm-smi

python3 -c "import torch; print(torch.cuda.is_available())"

If the output indicates GPU availability, exit and remove the temporary container. Now, install PyTorch directly on the host using Pip, selecting appropriate options from the PyTorch Start Locally page. Run the generated command in your terminal, handling potential download timeouts with --timeout or --no-cache-dir flags if necessary.

Verify the GPU's availability in your host environment with:

python3 -c "import torch; print(torch.cuda.is_available())"

Once confirmed, consider benchmarking training throughput on AMD GPUs against CPU workflows, exploring JAX or TensorFlow with ROCm acceleration, and setting up a Jupyter environment for interactive model prototyping on GPU. For further guidance, consult the comprehensive guide available on Vultr Docs.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

More from Wednesday 16 September →