Skip to content

Commit 77a7bfe

Browse files
committed
aarch64: cd: switch from libomp to libgomp
In the current version of the 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 77a7bfe

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-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: 19 additions & 0 deletions
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
@@ -186,6 +202,7 @@ def parse_arguments():
186202
elif branch.startswith(("v1.", "v2.")):
187203
build_vars += f"BUILD_TEST=0 PYTORCH_BUILD_VERSION={branch[1:branch.find('-')]} PYTORCH_BUILD_NUMBER=1 "
188204

205+
build_OpenBLAS()
189206
if enable_mkldnn:
190207
build_ArmComputeLibrary()
191208
print("build pytorch with mkldnn+acl backend")
@@ -195,6 +212,8 @@ def parse_arguments():
195212
"LD_LIBRARY_PATH=/pytorch/build/lib:/acl/build:$LD_LIBRARY_PATH "
196213
"ACL_INCLUDE_DIR=/acl/build "
197214
"ACL_LIBRARY=/acl/build "
215+
"BLAS=OpenBLAS "
216+
"OpenBLAS_HOME=/OpenBLAS "
198217
)
199218
else:
200219
print("build pytorch without mkldnn backend")

0 commit comments

Comments
 (0)