Skip to content

PyTorch oneDNN_aarch64 build manual for GCC(PyTorch v1.7.0)

Kazutoshi, Akao edited this page Apr 5, 2021 · 4 revisions

PyTorch-oneDNN_aarch64 build manual for GCC

Requirements

Currently, PyTorch-oneDNN_aarch64 support for ARMv8-A with SVE. If you run PyTorch-oneDNN_aarch64 on CPUs without SVE, it will be aborted because of undefined instruction exception.

Verified environment

Hardware Fujitsu FX1000 / 700
OS RedHad 8.1 / Centos 8.1
Compiler GCC 8.3.1 20190507

Installation

  1. Download PyTorch from the repository.
git clone -b fujitsu_v1.7.0_for_a64fx https://github.com/fujitsu/pytorch.git
  1. Update submodule.
cd pytorch
git submodule update --init --recursive
  1. Download and pre-build oneDNN_aarch64.
pushd third_party/ideep
mv mkl-dnn mkl-dnn_bak
git clone https://github.com/fujitsu/oneDNN.git mkl-dnn
pushd mkl-dnn
git checkout -b v2.1.0L01_aarch64 refs/tags/v2.1.0L01_aarch64
git submodule update --init --recursive
mkdir -p src/cpu/aarch64/xbyak_translator_aarch64/translator/third_party/build_xed_aarch64
pushd src/cpu/aarch64/xbyak_translator_aarch64/translator/third_party/build_xed_aarch64
../xed/mfile.py --shared examples install
cd kits
ln -sf xed-install-base-* xed
cd ../../../../
make -j48
popd
popd
popd
  1. Install the required Python module.
pip3 install pyyaml cython numpy typing-extensions dataclasses hypothesis
  1. Build PyTorch-oneDNN_aarch64.
export LD_LIBRARY_PATH=`pwd`/third_party/ideep/mkl-dnn/src/cpu/aarch64/xbyak_translator_aarch64/translator/third_party/build_xed_aarch64/kits/xed/lib:${LD_LIBRARY_PATH}
python3 setup.py install

Operation check(Resnet50)

  • Please read the Performance Tune page for FX700/FX1000 optimization methods.

Training

$ python3 scripts/fujitsu/test_train.py --batch 32 --itr 5 --type cpu_mkltensor

Evaluate

$ python3 scripts/fujitsu/test_eval.py --batch 32 --itr 5 --type cpu_mkltensor

Copyright

Copyright RIKEN, Japan 2021
Copyright FUJITSU LIMITED 2021