Skip to content

Commit 57ad1cd

Browse files
committed
aarch64: cd: switch from libomp to libgomp
In the current version of the scripts, torch libraries are linked to llvm openmp becasue conda openblas-openmp is linked to it. to switch to gnu libgomp, we are building the openblas from sources instead of installing from conda.
1 parent 4e10974 commit 57ad1cd

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

aarch64_linux/aarch64_ci_setup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ if [[ "$DESIRED_PYTHON" == "3.8" ]]; then
3030
else
3131
pip install -q --pre numpy==2.0.0rc1
3232
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
33+
conda install -y -c conda-forge pyyaml==6.0.1 patchelf==0.17.2 pygit2==1.13.2 ninja==1.11.1 scons==4.5.2
3434

3535
python --version
3636
conda --version

aarch64_linux/aarch64_wheel_ci_build.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,22 @@ 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", "NO_SHARED=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+
33+
1834
def build_ArmComputeLibrary() -> None:
1935
'''
2036
Using ArmComputeLibrary for aarch64 PyTorch
@@ -95,14 +111,17 @@ def parse_arguments():
95111
elif branch.startswith(("v1.", "v2.")):
96112
build_vars += f"BUILD_TEST=0 PYTORCH_BUILD_VERSION={branch[1:branch.find('-')]} PYTORCH_BUILD_NUMBER=1 "
97113

114+
build_OpenBLAS()
98115
if enable_mkldnn:
99116
build_ArmComputeLibrary()
100117
print("build pytorch with mkldnn+acl backend")
101118
build_vars += "USE_MKLDNN=ON USE_MKLDNN_ACL=ON " \
102119
"ACL_ROOT_DIR=/acl " \
103120
"LD_LIBRARY_PATH=/pytorch/build/lib:/acl/build:$LD_LIBRARY_PATH " \
104121
"ACL_INCLUDE_DIR=/acl/build " \
105-
"ACL_LIBRARY=/acl/build "
122+
"ACL_LIBRARY=/acl/build " \
123+
"BLAS=OpenBLAS " \
124+
"OpenBLAS_HOME=/OpenBLAS "
106125
else:
107126
print("build pytorch without mkldnn backend")
108127

0 commit comments

Comments
 (0)