- conda环境
安装conda环境,python 3.8以上,gcc支持9.4以上
conda install cmake ninja
conda install intel::mkl-static intel::mkl-include
#CUDA only: Add LAPACK support for the GPU if needed
conda install -c pytorch magma-cuda110
#or the magma-cuda* that matches your CUDA version from https://anaconda.org/pytorch/repo
#(optional) If using torch.compile with inductor/triton, install the matching version of triton
#Run from the pytorch directory after cloning
make triton
- 源码下载
git clone --recursive https://github.com/pytorch/pytorch
cd pytorch
#if you are updating an existing checkout
git submodule sync
git submodule update --init --recursive
- 安装依赖
pip install -r requirements.txt
- 安装命令
DEBUG=1是编译debug版本
export _GLIBCXX_USE_CXX11_ABI=1
export CMAKE_PREFIX_PATH=${CONDA_PREFIX:-"$(dirname $(which conda))/../"}
DEBUG=1 USE_DISTRIBUTED=0 USE_MKLDNN=0 USE_CUDA=0 BUILD_TEST=0 USE_FBGEMM=0 USE_NNPACK=0 USE_QNNPACK=0 USE_XNNPACK=0 python setup.py develop