MCPcopy Create free account
hub / github.com/alibaba/BladeDISC / config_mkldnn

Function config_mkldnn

scripts/python/common_setup.py:269–338  ·  view source on GitHub ↗
(root, args)

Source from the content-addressed store, hash-verified

267 return os.path.join(root, "third_party", "bazel", "acl")
268
269def config_mkldnn(root, args):
270 build_dir = mkldnn_build_dir(root)
271 ensure_empty_dir(build_dir, clear_hidden=False)
272 mkl_dir = mkl_install_dir(root)
273 acl_dir = acl_root_dir(root)
274 acl_patch_dir = extra_acl_patch_dir(root)
275 ensure_empty_dir(mkl_dir, clear_hidden=False)
276 ensure_empty_dir(acl_dir, clear_hidden=False)
277 if args.x86:
278 with cwd(mkl_dir):
279 # download mkl-lib/include
280 download_cmd = """
281 unset HTTPS_PROXY
282 wget -nv https://pai-blade.oss-accelerate.aliyuncs.com/build_deps/mkl/mkl-static-2022.0.1-intel_117.tar.bz2 -O mkl-static-2022.0.1-intel_117.tar.bz2
283 tar xjvf mkl-static-2022.0.1-intel_117.tar.bz2
284 rm -rf mkl-static-2022.0.1-intel_117.tar.bz2
285 wget -nv https://pai-blade.oss-accelerate.aliyuncs.com/build_deps/mkl/mkl-include-2022.0.1-h8d4b97c_803.tar.bz2 -O mkl-include-2022.0.1-h8d4b97c_803.tar.bz2
286 tar xjvf mkl-include-2022.0.1-h8d4b97c_803.tar.bz2
287 rm -rf mkl-include-2022.0.1-h8d4b97c_803.tar.bz2
288 """
289 execute(download_cmd)
290
291 if args.aarch64:
292 with cwd(acl_dir):
293 arch = args.target_cpu_arch or "arm64-v8a"
294 # downlaod and build acl for onednn
295 cmd = '''
296 readonly ACL_REPO="https://github.com/ARM-software/ComputeLibrary.git"
297 MAKE_NP="-j$(grep -c processor /proc/cpuinfo)"
298
299 ACL_DIR={}
300 git clone --branch v22.02 --depth 1 $ACL_REPO $ACL_DIR
301 cd $ACL_DIR
302 EXTRA_ACL_PATCH_DIR={}
303 for file in $EXTRA_ACL_PATCH_DIR/acl_*.patch
304 do
305 if [[ $file == *makefile* ]]; then
306 continue
307 fi
308 patch -p1 < $file
309 done
310
311 scons --silent $MAKE_NP Werror=0 debug=0 neon=1 opencl=0 openmp=1 embed_kernels=0 os=linux arch={} build=native extra_cxx_flags="-fPIC"
312
313 exit $?
314 ''&#x27;.format(acl_dir, acl_patch_dir, arch)
315 execute(cmd)
316 # a workaround for static linking
317 execute('rm -f build/*.so')
318 execute('mv build/libarm_compute-static.a build/libarm_compute.a')
319 execute('mv build/libarm_compute_core-static.a build/libarm_compute_core.a')
320 execute('mv build/libarm_compute_graph-static.a build/libarm_compute_graph.a')
321
322 with cwd(build_dir):
323 cc = which("gcc")
324 cxx = which("g++")
325 flags = " -DMKL_ROOT={} ".format(mkl_dir)
326 envs = " CC={} CXX={} ".format(cc, cxx)

Callers 2

mainFunction · 0.90
common_setup.pyFile · 0.70

Calls 9

mkldnn_build_dirFunction · 0.70
ensure_empty_dirFunction · 0.70
mkl_install_dirFunction · 0.70
acl_root_dirFunction · 0.70
extra_acl_patch_dirFunction · 0.70
cwdFunction · 0.70
executeFunction · 0.70
whichFunction · 0.70
formatMethod · 0.45

Tested by

no test coverage detected