之前的记录
Kylin Linux Advanced Server V10 (Tercel) aarch64安装NVIDIA-Linux-aarch64-520.61.05.run驱动Tesla T4 16G笔记_hkNaruto的博客-CSDN博客
Ubuntu 22.04 x86_64 源码编译 pytorch-v2.0.1 笔记_hkNaruto的博客-CSDN博客
Ubuntu 22.04 x86_64 源码编译 pytorch-v2.0.1 笔记【2】编译成功_hkNaruto的博客-CSDN博客
arm64环境编译
环境
[root@ceph3 pytorch]# gcc -v
使用内建 specs。
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/aarch64-linux-gnu/9.2.0/lto-wrapper
目标:aarch64-linux-gnu
配置为:../configure --prefix=/usr/local --mandir=/usr/local/share/man --infodir=/usr/local/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,fortran,lto --enable-plugin --enable-initfini-array --disable-libgcj --without-isl --without-cloog --enable-gnu-indirect-function --build=aarch64-linux-gnu --with-stage1-ldflags=' -Wl,-z,relro,-z,now' --with-boot-ldflags=' -Wl,-z,relro,-z,now' --with-multilib-list=lp64
线程模型:posix
gcc 版本 9.2.0 (GCC)
[root@ceph3 pytorch]# nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2022 NVIDIA Corporation
Built on Wed_Sep_21_10:34:49_PDT_2022
Cuda compilation tools, release 11.8, V11.8.89
Build cuda_11.8.r11.8/compiler.31833905_0
编译python3.10.12
安装依赖
yum install -y autoconf \
bzip2 \
bzip2-devel \
desktop-file-utils \
expat-devel \
gdb \
git \
gmp-devel \
libX11-devel \
libappstream-glib \
libffi-devel \
libtirpc-devel \
mesa-libGL-devel \
ncurses-devel \
net-tools \
openssl-devel \
python-rpm-macros \
python3-setuptools \
readline-devel \
sqlite-devel \
systemtap-sdt-devel \
tcl-devel \
tk-devel \
xz-devel \
zlib-devel \
bluez-libs \
dejavu-fonts-common \
dejavu-sans-fonts \
emacs-filesystem \
fontconfig \
fontconfig-devel \
fontpackages-filesystem \
freetype-devel \
gdk-pixbuf2 \
gl-manpages \
glib-networking \
gnutls \
gsettings-desktop-schemas \
jbigkit-libs \
json-glib \
keyutils-libs-devel \
krb5-devel \
libX11 \
libX11-common \
libXau \
libXau-devel \
libXdamage \
libXdamage-devel \
libXext \
libXext-devel \
libXfixes \
libXfixes-devel \
libXft \
libXft-devel \
libXrender \
libXrender-devel \
libXxf86vm \
libXxf86vm-devel \
libarchive \
libcom_err-devel \
libdrm-devel \
libglvnd \
libglvnd-core-devel \
libglvnd-devel \
libglvnd-egl \
libglvnd-gles \
libglvnd-glx \
libglvnd-opengl \
libjpeg-turbo \
libkadm5 \
libmodman \
libpng-devel \
libproxy \
libselinux-devel \
libsepol-devel \
libsoup \
libtiff \
libtirpc \
libuuid-devel \
libverto-devel \
libwayland-client \
libwayland-server \
libxcb \
libxcb-devel \
libxshmfence \
m4 \
mesa-khr-devel \
mesa-libEGL \
mesa-libGL \
mesa-libgbm \
mesa-libglapi \
nettle \
pcre-devel \
perl-Data-Dumper \
perl-Error \
perl-Git \
perl-TermReadKey \
python-srpm-macros \
python3 \
python3-libs \
rsync \
tcl \
tk \
trousers \
xorg-x11-proto-devel \
expat \
freetype \
krb5-libs \
libblkid \
libmount \
libsmartcols \
libuuid \
util-linux \
xz \
xz-libs \
zlib
编译python
[root@ceph3 Python-3.10.12]# ./configure --prefix=/usr/local/Python-3.10.12 --enable-optimizations
[root@ceph3 Python-3.10.12]# make -j64
[root@ceph3 Python-3.10.12]# make install -j64
查看版本
[root@ceph3 Python-3.10.12]# /usr/local/Python-3.10.12/bin/python3 -V
Python 3.10.12
安装pyyaml
https://github.com/yaml/pyyaml/archive/refs/tags/6.0.1.tar.gz
[root@ceph3 yeqiang]# cd pyyaml-6.0.1/
[root@ceph3 pyyaml-6.0.1]# /usr/local/Python-3.10.12/bin/python3 setup.py install
注意:有报错(目前看不影响)
building 'yaml._yaml' extension
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/local/Python-3.10.12/include/python3.10 -c yaml/_yaml.c -o build/temp.linux-aarch64-cpython-310/yaml/_yaml.o
gcc: 错误:yaml/_yaml.c:没有那个文件或目录
gcc: 致命错误:没有输入文件
编译中断。
Error compiling module, falling back to pure Python
安装typing_extensions
下载
yeqiang@yeqiang-MS-7B23:~/Downloads$ python3 -m pip download typing_extensions
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting typing_extensions
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/ec/6b/63cc3df74987c36fe26157ee12e09e8f9db4de771e0f3404263117e75b95/typing_extensions-4.7.1-py3-none-any.whl (33 kB)
Saved ./typing_extensions-4.7.1-py3-none-any.whl
Successfully downloaded typing_extensions
安装
[root@ceph3 yeqiang]# /usr/local/Python-3.10.12/bin/python3 -m pip install typing_extensions-4.7.1-py3-none-any.whl
编译pytorch
rsync把已经在x86编译成果的源代码同步到arm64服务器上。
[root@ceph3 pytorch]# export USE_CUDA=1
[root@ceph3 pytorch]# export PATH=/usr/local/cmake-3.27.4-linux-aarch64/bin:/usr/local/cuda/bin:$PATH
[root@ceph3 pytorch]# rm build -rf
[root@ceph3 pytorch]# /usr/local/Python-3.10.12/bin/python3 setup.py build
成功了
[root@ceph3 pytorch]# /usr/local/Python-3.10.12/bin/python3 setup.py install
参考:
官方参考文档:
https://devguide.python.org/getting-started/setup-building/#install-dependencies
CentOS7 yum-builddep python3 依赖信息参考:
Dependencies Resolved
================================================================================
Package Arch Version Repository
Size
================================================================================
Installing:
autoconf noarch 2.69-11.el7 base 701 k
bluez-libs-devel x86_64 5.44-7.el7 base 48 k
bzip2 x86_64 1.0.6-13.el7 base 52 k
bzip2-devel x86_64 1.0.6-13.el7 base 218 k
desktop-file-utils x86_64 0.23-2.el7 base 67 k
expat-devel x86_64 2.1.0-15.el7_9 updates 58 k
gdb x86_64 7.6.1-120.el7 base 2.4 M
gdbm-devel x86_64 1.10-8.el7 base 47 k
git x86_64 1.8.3.1-25.el7_9 updates 4.4 M
gmp-devel x86_64 1:6.0.0-15.el7 base 181 k
libX11-devel x86_64 1.6.7-4.el7_9 updates 981 k
libappstream-glib x86_64 0.7.8-2.el7 base 286 k
libffi-devel x86_64 3.0.13-19.el7 base 23 k
libtirpc-devel x86_64 0.2.4-0.16.el7 base 91 k
mesa-libGL-devel x86_64 18.3.4-12.el7_9 updates 164 k
ncurses-devel x86_64 5.9-14.20130511.el7_4 base 712 k
net-tools x86_64 2.0-0.25.20131004git.el7 base 306 k
openssl-devel x86_64 1:1.0.2k-26.el7_9 updates 1.5 M
python-rpm-macros noarch 3-34.el7 base 9.1 k
python3-pip noarch 9.0.3-8.el7 base 1.6 M
python3-setuptools noarch 39.2.0-10.el7 base 629 k
readline-devel x86_64 6.2-11.el7 base 139 k
sqlite-devel x86_64 3.7.17-8.el7_7.1 base 104 k
systemtap-sdt-devel x86_64 4.0-13.el7 base 76 k
tcl-devel x86_64 1:8.5.13-8.el7 base 165 k
tix-devel x86_64 1:8.4.3-12.el7 base 139 k
tk-devel x86_64 1:8.5.13-6.el7 base 488 k
xz-devel x86_64 5.2.2-2.el7_9 updates 46 k
zlib-devel x86_64 1.2.7-21.el7_9 updates 50 k
Installing for dependencies:
bluez-libs x86_64 5.44-7.el7 base 81 k
dejavu-fonts-common noarch 2.33-6.el7 base 64 k
dejavu-sans-fonts noarch 2.33-6.el7 base 1.4 M
emacs-filesystem noarch 1:24.3-23.el7_9.1 updates 58 k
fontconfig x86_64 2.13.0-4.3.el7 base 254 k
fontconfig-devel x86_64 2.13.0-4.3.el7 base 138 k
fontpackages-filesystem noarch 1.44-8.el7 base 9.9 k
freetype-devel x86_64 2.8-14.el7_9.1 updates 447 k
gdk-pixbuf2 x86_64 2.36.12-3.el7 base 570 k
gl-manpages noarch 1.1-7.20130122.el7 base 994 k
glib-networking x86_64 2.56.1-1.el7 base 145 k
gnutls x86_64 3.3.29-9.el7_6 base 680 k
gsettings-desktop-schemas x86_64 3.28.0-3.el7 base 606 k
jasper-libs x86_64 1.900.1-33.el7 base 150 k
jbigkit-libs x86_64 2.0-11.el7 base 46 k
json-glib x86_64 1.4.2-2.el7 base 134 k
keyutils-libs-devel x86_64 1.5.8-3.el7 base 37 k
krb5-devel x86_64 1.15.1-55.el7_9 updates 273 k
libX11 x86_64 1.6.7-4.el7_9 updates 607 k
libX11-common noarch 1.6.7-4.el7_9 updates 164 k
libXau x86_64 1.0.8-2.1.el7 base 29 k
libXau-devel x86_64 1.0.8-2.1.el7 base 14 k
libXdamage x86_64 1.1.4-4.1.el7 base 20 k
libXdamage-devel x86_64 1.1.4-4.1.el7 base 9.7 k
libXext x86_64 1.3.3-3.el7 base 39 k
libXext-devel x86_64 1.3.3-3.el7 base 75 k
libXfixes x86_64 5.0.3-1.el7 base 18 k
libXfixes-devel x86_64 5.0.3-1.el7 base 13 k
libXft x86_64 2.3.2-2.el7 base 58 k
libXft-devel x86_64 2.3.2-2.el7 base 19 k
libXrender x86_64 0.9.10-1.el7 base 26 k
libXrender-devel x86_64 0.9.10-1.el7 base 17 k
libXxf86vm x86_64 1.1.4-1.el7 base 18 k
libXxf86vm-devel x86_64 1.1.4-1.el7 base 18 k
libarchive x86_64 3.1.2-14.el7_7 base 319 k
libcom_err-devel x86_64 1.42.9-19.el7 base 32 k
libdrm-devel x86_64 2.4.97-2.el7 base 143 k
libgcab1 x86_64 0.7-4.el7_4 base 66 k
libglvnd x86_64 1:1.0.1-0.8.git5baa1e5.el7 base 89 k
libglvnd-core-devel x86_64 1:1.0.1-0.8.git5baa1e5.el7 base 20 k
libglvnd-devel x86_64 1:1.0.1-0.8.git5baa1e5.el7 base 11 k
libglvnd-egl x86_64 1:1.0.1-0.8.git5baa1e5.el7 base 44 k
libglvnd-gles x86_64 1:1.0.1-0.8.git5baa1e5.el7 base 34 k
libglvnd-glx x86_64 1:1.0.1-0.8.git5baa1e5.el7 base 125 k
libglvnd-opengl x86_64 1:1.0.1-0.8.git5baa1e5.el7 base 43 k
libjpeg-turbo x86_64 1.2.90-8.el7 base 135 k
libkadm5 x86_64 1.15.1-55.el7_9 updates 180 k
libmodman x86_64 2.0.1-8.el7 base 28 k
libpng-devel x86_64 2:1.5.13-8.el7 base 122 k
libproxy x86_64 0.4.11-11.el7 base 64 k
libselinux-devel x86_64 2.5-15.el7 base 187 k
libsepol-devel x86_64 2.5-10.el7 base 77 k
libsoup x86_64 2.62.2-2.el7 base 411 k
libtiff x86_64 4.0.3-35.el7 base 172 k
libtirpc x86_64 0.2.4-0.16.el7 base 89 k
libuuid-devel x86_64 2.23.2-65.el7_9.1 updates 93 k
libverto-devel x86_64 0.2.5-4.el7 base 12 k
libwayland-client x86_64 1.15.0-1.el7 base 33 k
libwayland-server x86_64 1.15.0-1.el7 base 39 k
libxcb x86_64 1.13-1.el7 base 214 k
libxcb-devel x86_64 1.13-1.el7 base 1.1 M
libxshmfence x86_64 1.2-1.el7 base 7.2 k
m4 x86_64 1.4.16-10.el7 base 256 k
mesa-khr-devel x86_64 18.3.4-12.el7_9 updates 20 k
mesa-libEGL x86_64 18.3.4-12.el7_9 updates 110 k
mesa-libGL x86_64 18.3.4-12.el7_9 updates 166 k
mesa-libgbm x86_64 18.3.4-12.el7_9 updates 39 k
mesa-libglapi x86_64 18.3.4-12.el7_9 updates 46 k
nettle x86_64 2.7.1-9.el7_9 updates 328 k
pcre-devel x86_64 8.32-17.el7 base 480 k
perl-Data-Dumper x86_64 2.145-3.el7 base 47 k
perl-Error noarch 1:0.17020-2.el7 base 32 k
perl-Git noarch 1.8.3.1-25.el7_9 updates 56 k
perl-TermReadKey x86_64 2.30-20.el7 base 31 k
pyparsing noarch 1.5.6-9.el7 base 94 k
python-srpm-macros noarch 3-34.el7 base 8.8 k
python3 x86_64 3.6.8-19.el7_9 updates 70 k
python3-libs x86_64 3.6.8-19.el7_9 updates 6.9 M
rsync x86_64 3.1.2-12.el7_9 updates 408 k
tcl x86_64 1:8.5.13-8.el7 base 1.9 M
tix x86_64 1:8.4.3-12.el7 base 254 k
tk x86_64 1:8.5.13-6.el7 base 1.4 M
trousers x86_64 0.3.14-2.el7 base 289 k
xorg-x11-proto-devel noarch 2018.4-1.el7 base 280 k
Updating for dependencies:
expat x86_64 2.1.0-15.el7_9 updates 83 k
freetype x86_64 2.8-14.el7_9.1 updates 380 k
krb5-libs x86_64 1.15.1-55.el7_9 updates 810 k
libblkid x86_64 2.23.2-65.el7_9.1 updates 183 k
libmount x86_64 2.23.2-65.el7_9.1 updates 185 k
libsmartcols x86_64 2.23.2-65.el7_9.1 updates 143 k
libuuid x86_64 2.23.2-65.el7_9.1 updates 84 k
openssl x86_64 1:1.0.2k-26.el7_9 updates 494 k
openssl-libs x86_64 1:1.0.2k-26.el7_9 updates 1.2 M
util-linux x86_64 2.23.2-65.el7_9.1 updates 2.0 M
xz x86_64 5.2.2-2.el7_9 updates 229 k
xz-libs x86_64 5.2.2-2.el7_9 updates 103 k
zlib x86_64 1.2.7-21.el7_9 updates 90 k
安装结果待验证
笔记:
麒麟V10无对应库
No match for argument: bluez-libs-devel
No match for argument: gdbm-devel
No match for argument: python3-pip
No match for argument: tix-devel
No match for argument: jasper-libs
No match for argument: libgcab1
No match for argument: pyparsing
No match for argument: tix
Error: Unable to find a match: bluez-libs-devel gdbm-devel python3-pip tix-devel jasper-libs libgcab1 pyparsing tix
Error:
Problem: cannot install both openssl-libs-1:1.1.1f-2.ky10.aarch64 and openssl-libs-1:1.1.1f-4.p04.ky10.aarch64
- package openssl-devel-1:1.1.1f-2.ky10.aarch64 requires openssl-libs(aarch-64) = 1:1.1.1f-2.ky10, but none of the providers can be installed
- cannot install the best candidate for the job
- conflicting requests
(try to add '--allowerasing' to command line to replace conflicting packages or '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)
已存在openssl库,但是版本有对不上,去掉openssl openssl-lib的安装指令