Skip to content

Commit aecee1a

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

File tree

2 files changed

+49
-28
lines changed

2 files changed

+49
-28
lines changed

Diff for: aarch64_linux/aarch64_ci_setup.sh

+29-26
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,38 @@
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

7+
dnf update
8+
9+
if [ "$DESIRED_PYTHON" == "3.10" ]; then
10+
dnf install -y epel-release
11+
dnf install -y gcc openssl-devel bzip2-devel libffi-devel zlib-devel wget make
12+
wget https://www.python.org/ftp/python/3.10.14/Python-3.10.14.tgz
13+
tar xzf Python-3.10.14.tgz
14+
cd Python-3.10.14
15+
./configure --with-system-ffi --with-computed-gotos --enable-loadable-sqlite-extensions
16+
make -j 8
17+
make altinstall
18+
rm ../Python-3.10.14.tgz
19+
elif [ "$DESIRED_PYTHON" == "3.8" ] || [ "$DESIRED_PYTHON" == "3.9" ] || [ "$DESIRED_PYTHON" == "3.11" ]; then
20+
dnf install -y python$DESIRED_PYTHON
21+
else
22+
echo "unsupported python version passed. 3.8, 3.9, 3.10 or 3.11 are the only supported versions"
23+
exit 1
24+
fi
25+
26+
/usr/local/bin/python$DESIRED_PYTHON -m venv appenv
27+
28+
source appenv/bin/activate
29+
30+
python3 --version
31+
32+
dnf install -y python3-devel python3-pip
33+
34+
pip3 install dataclasses typing-extensions scons pyyaml pygit2 ninja patchelf Cython
2835
if [[ "$DESIRED_PYTHON" == "3.8" ]]; then
2936
pip install -q numpy==1.24.4
3037
else
3138
pip install -q --pre numpy==2.0.0rc1
3239
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
34-
35-
python --version
36-
conda --version

Diff for: aarch64_linux/aarch64_wheel_ci_build.py

+20-2
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)