jetson orin 64G 编译安装pytorch 历史记录不完善自用

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88


安装conda python=3.10
pip config set global.index-url https://mirrors.ustc.edu.cn/pypi/simple

写入.bashrc
export CUDA_VERSION=12.6
export PATH=/usr/local/cuda-12/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
export CUDA_HOME=$CUDA_HOME:/usr/local/cuda-12.6
export TORCH_CUDA_ARCH_LIST="8.7"


安装cuda 和其他
sudo apt install libasio-dev libboost-all-dev libopenblas-dev cmake libopenmpi-dev

sudo apt install libpng-dev
sudo apt-get install ffmpeg
sudo apt-get install libffmpeg-nvenc-dev
sudo apt-get install libnvjpeg-dev-12-6
sudo apt install apt-utils
sudo apt-get install libjpeg-dev zlib1g-dev libpython3-dev libopenblas-dev libavcodec-dev libavformat-dev libswscale-dev
sudo apt-get install python3-pip libopenblas-base libopenmpi-dev libomp-dev
sudo apt install cuda-12-6
sudo apt install cuda-toolkit-12-6
nvcc --version


安装 cusparselt pytorch 需要
mkdir tmp_cusparselt && cd tmp_cusparselt
arch_path='sbsa'
CUSPARSELT_NAME="libcusparse_lt-linux-sbsa-0.6.3.2-archive"
# curl --retry 3 -OLs https://developer.download.nvidia.com/compute/cusparselt/redist/libcusparse_lt/linux-${arch_path}/${CUSPARSELT_NAME}.tar.xz
tar xf ${CUSPARSELT_NAME}.tar.xz
sudo cp -a ${CUSPARSELT_NAME}/include/* /usr/local/cuda/include/
sudo cp -a ${CUSPARSELT_NAME}/lib/* /usr/local/cuda/lib64/
cd ..
rm -rf tmp_cusparselt
sudo ldconfig




git clone --recursive --branch v2.5.1 http://github.com/pytorch/pytorch
cd pytorch-v2.5.1/
export USE_NCCL=0
export USE_DISTRIBUTED=1
export USE_QNNPACK=0
export USE_PYTORCH_QNNPACK=0
export TORCH_CUDA_ARCH_LIST="8.7"
export PYTORCH_BUILD_NUMBER=1
export PYTORCH_BUILD_VERSION="2.5.1"

pip3 install -r requirements.txt


python3 setup.py bdist_wheel


python3 setup.py bdist_wheel
sudo python3 setup.py install
cd dist
pip install ./torch-2.5.1-cp310-cp310-linux_aarch64.whl





cd vision-0.20.0
python setup.py install


conda install libpng libjpeg-turbo -c pytorch
python setup.py install
LANG=C python setup.py install
sudo apt install g++-10
python setup.py install
g++ --version
python setup.py install
sudo
sudo update-alternatives --install g++
sudo update-alternatives g++
sudo update-alternatives --config g++
sudo update-alternatives --config gcc
whereis g++
g++ --version