According to AMD.com, the latest AMD Software 24.6.1 and AMD ROCm™ 6.1.3 now support running Linux applications on Windows using hardware acceleration with AMD Radeon™ RX 7000 Series graphics cards. This development opens new possibilities for users looking to utilize powerful machine learning and AI tools like Stable Diffusion on a Windows platform.
Step-by-Step Guide to Running AMD ROCm™ on Windows 11
Here is a detailed guide to help you get started with running AMD ROCm™ software on Windows 11:
Step 1: Install Windows Subsystem for Linux (WSL)
Begin by installing WSL from the Windows Powershell. Use the following command:
wsl --install
This command will set up the necessary environment to run Linux applications on your Windows machine.
Step 2: Install AMD ROCm™ Software
Next, proceed to install the AMD ROCm™ software. Follow these commands to complete the installation:
sudo apt update
wget https://repo.radeon.com/amdgpu-install/6.1.3/ubuntu/jammy/amdgpu-install_6.1.60103-1_all.deb
sudo apt install ./amdgpu-install_6.1.60103-1_all.deb
amdgpu-install -y --usecase=wsl,rocm --no-dkms
These steps will ensure that the ROCm™ software is correctly installed and configured to work with WSL.
Step 3: Install PyTorch for AMD ROCm™ and WSL
Finally, install Torch for AMD ROCm™ software. Use the following commands:
sudo apt install python3-pip -y
pip3 install --upgrade pip wheel
wget https://repo.radeon.com/rocm/manylinux/rocm-rel-6.1.3/torch-2.1.2%2Brocm6.1.3-cp310-cp310-linux_x86_64.whl
wget https://repo.radeon.com/rocm/manylinux/rocm-rel-6.1.3/torchvision-0.16.1%2Brocm6.1.3-cp310-cp310-linux_x86_64.whl
wget https://repo.radeon.com/rocm/manylinux/rocm-rel-6.1.3/pytorch_triton_rocm-2.1.0%2Brocm6.1.3.4d510c3a44-cp310-cp310-linux_x86_64.whl
pip3 uninstall torch torchvision pytorch-triton-rocm numpy torchaudio
pip3 install torch-2.1.2+rocm6.1.3-cp310-cp310-linux_x86_64.whl torchvision-0.16.1+rocm6.1.3-cp310-cp310-linux_x86_64.whl pytorch_triton_rocm-2.1.0+rocm6.1.3.4d510c3a44-cp310-cp310-linux_x86_64.whl numpy==1.26.4
pip3 install torchaudio==2.1.2
After completing these installations, execute the following commands to finalize the setup:
location=`pip show torch | grep Location | awk -F ": " '{print $2}'`
cd ${location}/torch/lib/
rm libhsa-runtime64.so*
cp /opt/rocm/lib/libhsa-runtime64.so.1.2 libhsa-runtime64.so
These commands ensure that the ROCm™ libraries are correctly linked and ready for use.
Running Applications
With the setup complete, you can now install and run applications that support AMD ROCm™ software without leaving the Windows environment. For instance, applications like ComfyUI can now run seamlessly with an AMD Radeon™ RX 7900 XTX.
Note: When installing new applications, check the requirements.txt file and comment out the torch lines to avoid overwriting your AMD ROCm™ software builds. Otherwise, you may need to reinstall those builds.
This new capability significantly enhances the versatility and power of Windows 11 for users leveraging AMD’s hardware for advanced computing tasks.
Image source: Shutterstock