0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

AMD MIGraphXのビルドについてメモ

Posted at

AMD環境向けグラフ最適化エンジンのMIGraphXの環境構築・動作検証メモです
https://rocmsoftwareplatform.github.io/AMDMIGraphX/doc/html/
https://github.com/ROCmSoftwarePlatform/AMDMIGraphX
https://github.com/ROCmSoftwarePlatform/AMDMIGraphX/wiki

環境構築等はこちらを準拠しております.

ROCm2.9での変更点

FP16/INT8のサポートが追加されたそうです

詳細はこちらをご覧ください

環境

CPU Xeon E5-2603 v4
GPU RadeonⅦ
RAM DDR4 48GB

OS Ubuntu 18.04.3 LTS
Kernel Linux rocm 5.0.0-31-generic
Python環境 miniconda 4.7.10
ROCm vesion 2.9.6
cmake version 3.10.2
GNU gdb (Ubuntu 8.1-0ubuntu3.1) 8.1.0.20180409-git
MIGraphX Version 0.4

上記の環境を整えた上で本テストを行いました.

環境構築

依存関係・ビルド環境を整える.

ビルドにはROCM build tool(rbuild) が必要です
https://github.com/RadeonOpenCompute/rbuild

pipから直接installできるようになっているのでこれを使います.

また今回作業したディレクトリは/Home/user直下ではなく/test_dirを作ってから作業しました。
今回掲示したエラーコード内にユーザーディレクトリ名等が含まれている為適時読み替えてご参照ください.


conda create -n rbuild python=3.6
conda activate rbuild
pip install https://github.com/RadeonOpenCompute/rbuild/archive/master.tar.gz
sudo apt install cmake

MIGraphXのビルド

git clone https://github.com/ROCmSoftwarePlatform/AMDMIGraphX.git
cd ./AMDMIGraphX/
rbuild build -d depend --cxx=/opt/rocm/bin/hcc

rbuildはちゃんとMIGraphXのディレクトリ内で動かさないと動作しないのでちゃんとcdしてください
またビルドは相当時間がかかります.40分~数時間単位で時間を見積もってください

ライブラリのビルドとインストール

cd build
make
sudo make install

ランニングテスト

make check

数分かかります.

今回の検証では最後にクリアできなかったテストがありました

The following tests FAILED:
	 36 - test_gpu_ops_test (Failed)
	 37 - test_gpu_quantization (Failed)
Errors while running CTest
test/CMakeFiles/check.dir/build.make:57: recipe for target 'test/CMakeFiles/check' failed
make[3]: *** [test/CMakeFiles/check] Error 8
CMakeFiles/Makefile2:10508: recipe for target 'test/CMakeFiles/check.dir/all' failed
make[2]: *** [test/CMakeFiles/check.dir/all] Error 2
CMakeFiles/Makefile2:10515: recipe for target 'test/CMakeFiles/check.dir/rule' failed
make[1]: *** [test/CMakeFiles/check.dir/rule] Error 2
Makefile:3850: recipe for target 'check' failed
make: *** [check] Error 2

36 - test_gpu_ops_test (Failed)
37 - test_gpu_quantization (Failed)

この2つがクリアできてない.

ログを読み返すと

 89/191 Test  #37: test_gpu_quantization .................................................***Failed   14.06 sec
 48/191 Test  #36: test_gpu_ops_test .....................................................***Failed  Error regular expression found in output. Regex=[FAILED] 25.42 sec
[   RUN    ] test_literals
FAILED: test_literals
    what(): Missing metadata for __global__ function: _ZN8migraphx9version_13gpu6device8launcherIZZNS2_9gs_launchEP12ihipStream_tjjENKUlT_E_clIZZNS2_18nary_standard_implIZNS2_4reluES5_RKNS0_8argumentESC_E3$_0JSA_EEEvS5_S6_SA_DpT0_ENKUlTyTyS6_SF_E_clIPfJSI_EEEDaS6_SF_EUlTyS6_E_EEDaS6_EUlTyS6_E_EEvS6_

@0 = check_context -> float_type, {}, {}
scratch = @param:scratch -> float_type, {16}, {1}
output = @param:output -> float_type, {4, 4, 1, 1}, {4, 1, 1, 1}
@1 = hip::load_literal[shape=float_type, {4, 3, 3, 3}, {27, 9, 3, 1},id=0] -> float_type, {4, 3, 3, 3}, {27, 9, 3, 1}
@2 = load[offset=0,end=0](scratch) -> int8_type, {0}, {1}
@3 = load[offset=0,end=64](scratch) -> float_type, {4, 4, 1, 1}, {4, 1, 1, 1}
@4 = gpu::convolution[padding={0, 0},stride={1, 1},dilation={1, 1},padding_mode=0,group=1](@1,@1,@2,@3) -> float_type, {4, 4, 1, 1}, {4, 1, 1, 1}
@5 = gpu::relu(@4,output) -> float_type, {4, 4, 1, 1}, {4, 1, 1, 1}

CMake Error at gdb/test_test_gpu_ops_test/run.cmake:12 (message):
  Test failed

上記のエラーで落ちているようだ.

似たような報告が上がっており
https://github.com/ROCmSoftwarePlatform/AMDMIGraphX/issues/379

67/190 Test #36: test_gpu_quantization .................................................***Failed Error regular expression found in output. Regex=[FAILED] 17.09 sec
[ RUN ] target_copy
void target_copy()
/home/mev/source/AMDMIGraphX/test/gpu/quantization.cpp:65:
FAILED: migraphx::verify_range(cpu_result, gpu_result) 0
CMake Error at gdb/test_test_gpu_quantization/run.cmake:12 (message):
Test failed

テストの通し番号が変わっている気がするがまだ改善されていないのかこちらの環境と同じ場所で落ちている.

こちらでも単体で実行したときのエラーを改めて見ていると上記報告とはエラーの内容が異なっています
本バージョンではint8にも対応したこともあって仕様が変わっているので不思議ではないですが・・

~/test_dir/AMDMIGraphX/build/bin$ ./test_gpu_quantization 
[   RUN    ] gpu_target_copy
[ COMPLETE ] gpu_target_copy
[   RUN    ] int8_quantization
terminate called after throwing an instance of 'std::runtime_error'
  what():  Missing metadata for __global__ function: _ZN8migraphx9version_13gpu6device8launcherIZZNS2_9gs_launchEP12ihipStream_tjjENKUlT_E_clIZZNS2_18nary_standard_implIZNS2_3mulES5_RKNS0_8argumentESC_SC_E3$_0JSA_SA_EEEvS5_S6_SA_DpT0_ENKUlTyTyS6_SF_E_clIPfJSI_SI_EEEDaS6_SF_EUlTyS6_E_EEDaS6_EUlTyS6_E_EEvS6_
Aborted (core dumped)

ひとまず推論(BERTモデル)が動くか試してみる(現在作業中)

色々不調な部分があるようですが動くかどうか試してみます

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?