3
2

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 Optimizing C/C++ Compiler(AOCC)を使って採掘してみる

Posted at

序文

男の人が掘るという暗号通貨を女の私も掘ってみようと思って掘るの。

説明

ハードウェア

テスト用の実験用機材なのでスペック的にははっきり言って時代遅れ。特にCPUは AMD FX-8300なので性能は期待できない。

とりあえず普通にやってみる

CentOS 7で暗号通貨採掘用のcpuminerを動作させてみる。cpuminerはGitHubで最もスターが付けられていたものを利用。

# yum groupinstall "Development Tools"
# yum install curl-devel openssl-devel
# yum install git

# cd /usr/local/src/
# git clone https://github.com/pooler/cpuminer
# cd cpuminer/
# ./autogen.sh
# ./configure CFLAGS="-O3 -march=native -funroll-loops -fomit-frame-pointer"
# make 

make install はせずにその場で実行。

# ./minerd --benchmark -a sha256d
(snip)
thread 3: 2097152 hashes, 4303 khash/s
thread 4: 2097152 hashes, 4284 khash/s
thread 0: 2097152 hashes, 4242 khash/s
thread 6: 2097152 hashes, 4233 khash/s
thread 7: 2097152 hashes, 4233 khash/s
thread 1: 2097152 hashes, 4229 khash/s
thread 5: 2097152 hashes, 4239 khash/s
thread 2: 2097152 hashes, 4240 khash/s
thread 7: 21166892 hashes, 4237 khash/s
Total: 34005 khash/s

比較材料が無いので遅いのか速いのか判断できないが、たぶん遅い。というより遅くないはずがない!

高速化を図ってみる!

今年の春あたりにAMD Optimizing C/C++ Compilerというものが出ていたらしい。これを使って採掘速度を上げられないか試してみる。

# mkdir -p /opt/amd/aocc
# cd /opt/amd/aocc/

(ここで/opt/amd/aocc/ に AOCC-1.0-Compiler.tar.xz と AOCC-1.0-GoldLinkerPlugin.tar.xz をコピーしておく)

# tar Jxvf AOCC-1.0-Compiler.tar.xz
# tar Jxvf AOCC-1.0-GoldLinkerPlugin.tar.xz
# ln -s /opt/amd/aocc/AOCC-1.0-GoldLinkerPlugin/LLVMgold.so /opt/amd/aocc/AOCC-1.0-Compiler/lib/LLVMgold.so
# bash /opt/amd/aocc/AOCC-1.0-Compiler/install.sh 
# source /opt/amd/aocc/setenv_AOCC.sh

# cd /usr/local/src/cpuminer/
# make clean
# ./configure CC=clang CFLAGS="-O3 -march=native -funroll-loops -fomit-frame-pointer"
# ./minerd --benchmark -a sha256d
(snip)
thread 0: 4096 hashes, 0.39 khash/s
thread 1: 4096 hashes, 0.38 khash/s
thread 6: 4096 hashes, 0.38 khash/s
thread 3: 4096 hashes, 0.38 khash/s
thread 2: 4096 hashes, 0.38 khash/s
thread 5: 4096 hashes, 0.38 khash/s
thread 4: 4096 hashes, 0.38 khash/s
thread 7: 4096 hashes, 0.38 khash/s
Total: 33887 khash/s

…あれ?変わって無い??

採掘アルゴリズムを変えてみる

CPU負荷がより高いらしい yescrypt を使って同様に試してみる。

gcc
# cd /usr/local/src/
# git clone https://github.com/bitzeny/cpuminer.git bitzeny-miner
# cd bitzeny-miner/
# ./autogen.sh
# ./configure CFLAGS="-O3 -march=native -funroll-loops -fomit-frame-pointer"
# make 
# ./minerd --benchmark -a yescrypt
(snip)
thread 0: 4096 hashes, 0.39 khash/s
thread 1: 4096 hashes, 0.38 khash/s
thread 6: 4096 hashes, 0.38 khash/s
thread 3: 4096 hashes, 0.38 khash/s
thread 2: 4096 hashes, 0.38 khash/s
thread 5: 4096 hashes, 0.38 khash/s
thread 4: 4096 hashes, 0.38 khash/s
thread 7: 4096 hashes, 0.38 khash/s
Total: 3.06 khash/s
aocc
# make clean
# ./configure CC=clang CFLAGS="-O3 -march=native -funroll-loops -fomit-frame-pointer"
# make
# ./minerd --benchmark -a yescrypt
(snip)
thread 5: 4096 hashes, 0.40 khash/s
thread 4: 4096 hashes, 0.40 khash/s
thread 3: 4096 hashes, 0.40 khash/s
thread 0: 1994 hashes, 0.40 khash/s
thread 2: 1994 hashes, 0.40 khash/s
thread 1: 1992 hashes, 0.40 khash/s
thread 6: 1989 hashes, 0.40 khash/s
thread 7: 1989 hashes, 0.40 khash/s
Total: 3.18 khash/s

数%程度だか高速化できた模様。Zenアーキテクチャ向けらしいのでRyzenで試せばもっとはっきりとした差が出るのかもしれないけど手元にないので試せないのが残念。

メモ

cpuminer-multi で試してみようと考えていたが、gccでのコンパイルは成功してもAOCCではNGだった。暗号通貨の採掘ではなくAOCCを試してみることが目的だったので詳細は確認していない。

3
2
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
3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?