Skip to content

Commit 2fa4a66

Browse files
committed
aarch64: cd: upgrade to manylinux 2_28 and remove conda dependency
1 parent ef4a28a commit 2fa4a66

File tree

2 files changed

+58
-30
lines changed

2 files changed

+58
-30
lines changed

aarch64_linux/aarch64_ci_setup.sh

Lines changed: 38 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,45 @@
22
set -eux -o pipefail
33

44
# This script is used to prepare the Docker container for aarch64_ci_wheel_build.py python script
5-
# as we need to install conda and setup the python version for the build.
6-
7-
CONDA_PYTHON_EXE=/opt/conda/bin/python
8-
CONDA_EXE=/opt/conda/bin/conda
9-
CONDA_ENV_NAME=aarch64_env
10-
PATH=/opt/conda/bin:$PATH
11-
LD_LIBRARY_PATH=/opt/conda/envs/${CONDA_ENV_NAME}/lib/:/opt/conda/lib:$LD_LIBRARY_PATH
12-
13-
###############################################################################
14-
# Install conda
15-
# disable SSL_verify due to getting "Could not find a suitable TLS CA certificate bundle, invalid path"
16-
# when using Python version, less than the conda latest
17-
###############################################################################
18-
echo 'Installing conda-forge'
19-
curl -L -o /mambaforge.sh https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-aarch64.sh
20-
chmod +x /mambaforge.sh
21-
/mambaforge.sh -b -p /opt/conda
22-
rm /mambaforge.sh
23-
source /opt/conda/etc/profile.d/conda.sh
24-
conda config --set ssl_verify False
25-
conda create -y -c conda-forge -n "${CONDA_ENV_NAME}" python=${DESIRED_PYTHON}
26-
conda activate "${CONDA_ENV_NAME}"
5+
# as we need to setup the required python version and install few tools.
276

28-
if [[ "$DESIRED_PYTHON" == "3.8" ]]; then
29-
pip install -q numpy==1.24.4
7+
dnf update
8+
9+
if [ "$DESIRED_PYTHON" == "3.8" ] || [ "$DESIRED_PYTHON" == "3.9" ] || [ "$DESIRED_PYTHON" == "3.11" ]; then
10+
dnf install -y python$DESIRED_PYTHON
11+
12+
elif [ "$DESIRED_PYTHON" == "3.10" ] || [ "$DESIRED_PYTHON" == "3.12" ]; then
13+
dnf install -y epel-release
14+
dnf install -y gcc openssl-devel bzip2-devel libffi-devel zlib-devel wget make
15+
if [ "$DESIRED_PYTHON" == "3.10" ]; then
16+
PYTHON_INSTALLED_VERSION="3.10.14"
17+
else
18+
PYTHON_INSTALLED_VERSION="3.12.3"
19+
fi
20+
wget https://www.python.org/ftp/python/${PYTHON_INSTALLED_VERSION}/Python-${PYTHON_INSTALLED_VERSION}.tgz
21+
tar xzf Python-${PYTHON_INSTALLED_VERSION}.tgz
22+
cd Python-${PYTHON_INSTALLED_VERSION}
23+
./configure --with-system-ffi --with-computed-gotos --enable-loadable-sqlite-extensions
24+
make -j 8
25+
make altinstall
26+
cd ..
27+
rm Python-${PYTHON_INSTALLED_VERSION}.tgz
3028
else
31-
pip install -q --pre numpy==2.0.0rc1
29+
echo "unsupported python version passed. 3.8, 3.9, 3.10 or 3.11 are the only supported versions"
30+
exit 1
3231
fi
33-
conda install -y -c conda-forge pyyaml==6.0.1 patchelf==0.17.2 pygit2==1.13.2 openblas==0.3.25=*openmp* ninja==1.11.1 scons==4.5.2
3432

35-
python --version
36-
conda --version
33+
/usr/local/bin/python${DESIRED_PYTHON} -m venv appenv${DESIRED_PYTHON}
34+
35+
source appenv${DESIRED_PYTHON}/bin/activate
36+
37+
python3 --version
38+
39+
dnf install -y python3-devel python3-pip
40+
41+
python3 -m pip install dataclasses typing-extensions scons pyyaml pygit2 ninja patchelf Cython
42+
if [[ "$DESIRED_PYTHON" == "3.8" ]]; then
43+
python3 -m pip install -q numpy==1.24.4
44+
else
45+
python3 -m pip install -q --pre numpy==2.0.0rc1
46+
fi

aarch64_linux/aarch64_wheel_ci_build.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,21 @@ def list_dir(path: str) -> List[str]:
1515
return check_output(["ls", "-1", path]).decode().split("\n")
1616

1717

18+
def build_OpenBLAS() -> None:
19+
'''
20+
Building OpenBLAS, because the package in many linux is old
21+
'''
22+
print('Building OpenBLAS')
23+
openblas_build_flags=["NUM_THREADS=128", "USE_OPENMP=1", "DYNAMIC_ARCH=1", "TARGET=ARMV8", "CFLAGS=-O3"]
24+
openblas_checkout_dir="OpenBLAS"
25+
26+
check_call(["git", "clone", "https://github.com/OpenMathLib/OpenBLAS.git", "-b", "v0.3.25",
27+
"--depth", "1", "--shallow-submodules"])
28+
29+
check_call(["make", "-j8"] + openblas_build_flags,
30+
cwd=openblas_checkout_dir)
31+
check_call(["make", "-j8"] + openblas_build_flags + ["install"], cwd=openblas_checkout_dir)
32+
1833
def build_ArmComputeLibrary() -> None:
1934
'''
2035
Using ArmComputeLibrary for aarch64 PyTorch
@@ -27,7 +42,7 @@ def build_ArmComputeLibrary() -> None:
2742
os.makedirs(acl_install_dir)
2843
check_call(["git", "clone", "https://github.com/ARM-software/ComputeLibrary.git", "-b", "v23.08",
2944
"--depth", "1", "--shallow-submodules"])
30-
check_call(["scons", "Werror=1", "-j8", f"build_dir=/{acl_install_dir}/build"] + acl_build_flags,
45+
check_call(["scons", "Werror=0", "-j8", f"build_dir=/{acl_install_dir}/build"] + acl_build_flags,
3146
cwd=acl_checkout_dir)
3247
for d in ["arm_compute", "include", "utils", "support", "src"]:
3348
shutil.copytree(f"{acl_checkout_dir}/{d}", f"{acl_install_dir}/{d}")
@@ -95,14 +110,17 @@ def parse_arguments():
95110
elif branch.startswith(("v1.", "v2.")):
96111
build_vars += f"BUILD_TEST=0 PYTORCH_BUILD_VERSION={branch[1:branch.find('-')]} PYTORCH_BUILD_NUMBER=1 "
97112

113+
build_OpenBLAS()
98114
if enable_mkldnn:
99115
build_ArmComputeLibrary()
100116
print("build pytorch with mkldnn+acl backend")
101117
build_vars += "USE_MKLDNN=ON USE_MKLDNN_ACL=ON " \
102118
"ACL_ROOT_DIR=/acl " \
103119
"LD_LIBRARY_PATH=/pytorch/build/lib:/acl/build:$LD_LIBRARY_PATH " \
104120
"ACL_INCLUDE_DIR=/acl/build " \
105-
"ACL_LIBRARY=/acl/build "
121+
"ACL_LIBRARY=/acl/build " \
122+
"BLAS=OpenBLAS " \
123+
"OpenBLAS_HOME=/OpenBLAS "
106124
else:
107125
print("build pytorch without mkldnn backend")
108126

0 commit comments

Comments
 (0)