Environment Configuration
Before compiling and building the source code, you need to install the dependent components of the required version.
- Install system dependencies.
1 2 3 4
dnf install -y \ --setopt=install_weak_deps=False \ --setopt=tsflags=nodocs \ python3-pip python3-devel gcc gcc-c++ make cmake git ninja-build
- Install the Python build tools and runtime dependencies.
1 2
python3 -m pip install --upgrade pip setuptools wheel packaging ninja cmake pybind11 numpy einops
- Install PyTorch of the CUDA version.
- Method 1: Use the official precompiled wheel.
1python3 -m pip install --index-url https://download.pytorch.org/whl/cu130 torch==2.11.0+cu130
- Method 2: Use the locally built wheel. Replace the path with the actual wheel file path.
1python3 -m pip install --force-reinstall /path/to/torch-2.11.0+cu130-*.whl
To install PyTorch of the CUDA version, you can use either of the following methods: Use the precompiled wheel released by PyTorch that matches the CUDA version, or use the locally built CUDA wheel that has been verified in the current environment. Regardless of the source you choose, before continuing with the source code build of FlashAttention, ensure that both torch.backends.cuda.is_built() and torch.cuda.is_available() return True.
- Method 1: Use the official precompiled wheel.
Parent topic: Preparations for Development