Skip to content

Commit 075abc1

Browse files
committed
aarch64: cd: switch from libomp to libgomp
In the current version of the CD scripts, torch libraries are linked to llvm openmp because 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 a79e1ce commit 075abc1

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
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 & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,23 @@ 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",
24+
"TARGET=ARMV8", "CFLAGS=-O3"]
25+
openblas_checkout_dir="OpenBLAS"
26+
27+
check_call(["git", "clone", "https://github.com/OpenMathLib/OpenBLAS.git", "-b", "v0.3.25",
28+
"--depth", "1", "--shallow-submodules"])
29+
30+
check_call(["make", "-j8"] + openblas_build_flags,
31+
cwd=openblas_checkout_dir)
32+
check_call(["make", "-j8"] + openblas_build_flags + ["install"], cwd=openblas_checkout_dir)
33+
34+
1835
def build_ArmComputeLibrary() -> None:
1936
"""
2037
Using ArmComputeLibrary for aarch64 PyTorch
@@ -186,6 +203,7 @@ def parse_arguments():
186203
elif branch.startswith(("v1.", "v2.")):
187204
build_vars += f"BUILD_TEST=0 PYTORCH_BUILD_VERSION={branch[1:branch.find('-')]} PYTORCH_BUILD_NUMBER=1 "
188205

206+
build_OpenBLAS()
189207
if enable_mkldnn:
190208
build_ArmComputeLibrary()
191209
print("build pytorch with mkldnn+acl backend")
@@ -195,6 +213,8 @@ def parse_arguments():
195213
"LD_LIBRARY_PATH=/pytorch/build/lib:/acl/build:$LD_LIBRARY_PATH "
196214
"ACL_INCLUDE_DIR=/acl/build "
197215
"ACL_LIBRARY=/acl/build "
216+
"BLAS=OpenBLAS "
217+
"OpenBLAS_HOME=/OpenBLAS "
198218
)
199219
else:
200220
print("build pytorch without mkldnn backend")

0 commit comments

Comments
 (0)