Instructions on how to build pytorch for rocm on ubuntu 24.04, for an rx6800. This would also apply for other amd cards not directly supported by the first-party pytorch .whl's. Pre-requisite is that you have installed ROCM.
- Clone https://github.com/pytorch/pytorch
- Find your LLVM target using: https://llvm.org/docs/AMDGPUUsage.html. This is your GPU Architecture. In my situation with an RX 6800, that is
gfx1030
. - Specify your GPU architecture by setting the environment variable
PYTORCH_ROCM_ARCH
- Build Pytorch from scratch - following the conda instructions, with one exception. Use
python setup.py bdist_wheel
to build the.whl
, the default instructions are to install for development.