@@ -13,23 +13,16 @@ def list_dir(path: str) -> List[str]:
13
13
return subprocess .check_output (["ls" , "-1" , path ]).decode ().split ("\n " )
14
14
15
15
16
- '''
17
- Using OpenBLAS with PyTorch
18
- '''
19
- def build_OpenBLAS (git_clone_flags : str = "" ) -> None :
20
- print ('Building OpenBLAS' )
21
- os .system (f"cd /; git clone https://github.com/xianyi/OpenBLAS -b v0.3.21 { git_clone_flags } " )
22
- make_flags = "NUM_THREADS=64 USE_OPENMP=1 NO_SHARED=1 DYNAMIC_ARCH=1 TARGET=ARMV8 "
23
- os .system (f"cd OpenBLAS; make { make_flags } -j8; make { make_flags } install; cd /; rm -rf OpenBLAS" )
24
-
25
-
26
16
'''
27
17
Using ArmComputeLibrary for aarch64 PyTorch
28
18
'''
29
19
def build_ArmComputeLibrary (git_clone_flags : str = "" ) -> None :
30
20
print ('Building Arm Compute Library' )
31
21
os .system ("cd / && mkdir /acl" )
32
- os .system (f"git clone https://github.com/ARM-software/ComputeLibrary.git -b v22.11 { git_clone_flags } " )
22
+ os .system (f"git clone https://github.com/ARM-software/ComputeLibrary.git -b v23.05.1 { git_clone_flags } " )
23
+ os .system ('sed -i -e \' s/"armv8.2-a"/"armv8-a"/g\' ComputeLibrary/SConscript; '
24
+ 'sed -i -e \' s/-march=armv8.2-a+fp16/-march=armv8-a/g\' ComputeLibrary/SConstruct; '
25
+ 'sed -i -e \' s/"-march=armv8.2-a"/"-march=armv8-a"/g\' ComputeLibrary/filedefs.json' )
33
26
os .system (f"cd ComputeLibrary; export acl_install_dir=/acl; " \
34
27
f"scons Werror=1 -j8 debug=0 neon=1 opencl=0 os=linux openmp=1 cppthreads=0 arch=armv8.2-a multi_isa=1 build=native build_dir=$acl_install_dir/build; " \
35
28
f"cp -r arm_compute $acl_install_dir; " \
@@ -89,9 +82,6 @@ def parse_arguments():
89
82
git_clone_flags = " --depth 1 --shallow-submodules"
90
83
os .system (f"conda install -y ninja scons" )
91
84
92
- print ("Build and Install OpenBLAS" )
93
- build_OpenBLAS (git_clone_flags )
94
-
95
85
print ('Building PyTorch wheel' )
96
86
build_vars = "CMAKE_SHARED_LINKER_FLAGS=-Wl,-z,max-page-size=0x10000 "
97
87
os .system (f"python setup.py clean" )
@@ -107,7 +97,7 @@ def parse_arguments():
107
97
print ("build pytorch with mkldnn+acl backend" )
108
98
build_vars += "USE_MKLDNN=ON USE_MKLDNN_ACL=ON " \
109
99
"ACL_ROOT_DIR=/acl " \
110
- "LD_LIBRARY_PATH=/pytorch/build/lib:/acl/build " \
100
+ "LD_LIBRARY_PATH=/pytorch/build/lib:/acl/build:$LD_LIBRARY_PATH " \
111
101
"ACL_INCLUDE_DIR=/acl/build " \
112
102
"ACL_LIBRARY=/acl/build "
113
103
else :
0 commit comments