CUDA & Litecoin2014/02/01 12:04

CentOS6.5をインストールして、早速CUDAをインストールしてみました。手順は基本以下のサイトを参考にしました。初期状態が違う為か微妙に異なってはいます。全てrootで作業しました。「init 3」は実行しませんでしたが、大丈夫の様です。

http://www.softek.co.jp/SPG/Pgi/TIPS/public/accel/cuda55_install.html

以下に示す通り、CentOSをインストールしただけではNVIDIAのドライバーは入っていません。

ll /dev/*nv*
crw-r-----. 1 root kmem 10, 144 Jan 31 21:18 /dev/nvram

lspci | grep -i nVidia
01:00.0 VGA compatible controller: NVIDIA Corporation GK107 [GeForce GTX 650] (rev a1)
01:00.1 Audio device: NVIDIA Corporation GK107 HDMI Audio Controller (rev a1)

uname -a
Linux localhost.localdomain 2.6.32-431.3.1.el6.x86_64 #1 SMP Fri Jan 3 21:39:27 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

yum install http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm

以下のサイトから「cuda-repo-rhel6-5.5-0.x86_64.rpm」をDL。

https://developer.nvidia.com/cuda-downloads

ll cuda-repo-rhel6-5.5-0.x86_64.rpm
-rw-rw-r--. 1 root root 2276 Jan 31 21:41 cuda-repo-rhel6-5.5-0.x86_64.rpm

rpm --install cuda-repo-rhel6-5.5-0.x86_64.rpm 

ls /etc/yum.repos.d/
CentOS-Base.repo CentOS-Vault.repo mirrors-rpmforge-extras
CentOS-Debuginfo.repo cuda.repo mirrors-rpmforge-testing
CentOS-Media.repo mirrors-rpmforge rpmforge.repo

yum clean expire-cache
yum install cuda
yum install gcc-c++

これでインストールは終了です。この後環境変数を変更します。

vi .bashrc
(前略)
export PATH=/usr/local/cuda-5.5/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-5.5/lib64:/lib:$LD_LIBRARY_PATH
:wq

サンプルプログラムを作成します。

vi test.c
main()
{printf("hello\n");}
:wq

which nvcc
/usr/local/cuda-5.5/bin/nvcc

nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2013 NVIDIA Corporation
Built on Wed_Jul_17_18:36:13_PDT_2013
Cuda compilation tools, release 5.5, V5.5.0

nvcc test.c
test.c: In function ‘main’:
test.c:3: warning: incompatible implicit declaration of built-in function ‘printf’

./a.out
hello

ldd a.out
linux-vdso.so.1 => (0x00007fff13ece000)
librt.so.1 => /lib64/librt.so.1 (0x0000003e35400000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x0000003e35000000)
libdl.so.2 => /lib64/libdl.so.2 (0x0000003e34800000)
libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x0000003e41800000)
libm.so.6 => /lib64/libm.so.6 (0x0000003e35800000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x0000003e3fc00000)
libc.so.6 => /lib64/libc.so.6 (0x0000003e34c00000)
/lib64/ld-linux-x86-64.so.2 (0x0000003e34400000)

インストールは成功したのではないでしょうか、リブート後に以下のファイルが出来ています。GPUが使えるようになりました。

ll /dev/*nv*
crw-rw-rw-. 1 root root 195, 0 Feb 1 10:48 /dev/nvidia0
crw-rw-rw-. 1 root root 195, 255 Feb 1 10:48 /dev/nvidiactl
crw-r-----. 1 root kmem 10, 144 Feb 1 10:46 /dev/nvram

CUDAの次はGPUを使うLItecoinの採掘をしてみました。以下の記事を参考にしております。LD_LIBRARY_PATH 部分は既に設定済みなので必要ないです。

http://satok.asablo.jp/blog/2014/01/05/7178376

コンパイルに成功しました、採掘可能な様です。

ll cudaminer
-rwxr-xr-x. 1 root root 10597092 Feb 1 11:46 cudaminer

./cudaminer -d 0 -i 0 --benchmark
*** CudaMiner for nVidia GPUs by Christian Buchner ***
This is version 2014-01-20 (beta)
based on pooler-cpuminer 2.3.2 (c) 2010 Jeff Garzik, 2012 pooler
Cuda additions Copyright 2013,2014 Christian Buchner
My donation address: LKS1WDKGED647msBQfLBHV3Ls8sveGncnm

[2014-02-01 11:47:23] 1 miner threads started, using 'scrypt' algorithm.
[2014-02-01 11:47:38] GPU #0: GeForce GTX 650 with compute capability 3.0
[2014-02-01 11:47:38] GPU #0: interactive: 0, tex-cache: 0 , single-alloc: 0
[2014-02-01 11:47:38] GPU #0: 8 hashes / 1.0 MB per warp.
[2014-02-01 11:47:38] GPU #0: Performing auto-tuning (Patience...)
[2014-02-01 11:47:38] GPU #0: maximum total warps (BxW): 948
^C

採掘に成功しましたログは以下の通りです。

./cudaminer -o stratum+tcp://ltc.2chpool.com:3333 -u user_id.worker_id -p worker_password

*** CudaMiner for nVidia GPUs by Christian Buchner ***
This is version 2014-01-20 (beta)
based on pooler-cpuminer 2.3.2 (c) 2010 Jeff Garzik, 2012 pooler
Cuda additions Copyright 2013,2014 Christian Buchner
My donation address: LKS1WDKGED647msBQfLBHV3Ls8sveGncnm

[2014-02-01 11:51:39] 1 miner threads started, using 'scrypt' algorithm.
[2014-02-01 11:51:39] Starting Stratum on stratum+tcp://ltc.2chpool.com:3333
[2014-02-01 11:51:39] Stratum detected new block
[2014-02-01 11:51:40] GPU #0: GeForce GTX 650 with compute capability 3.0
[2014-02-01 11:51:40] GPU #0: interactive: 1, tex-cache: 0 , single-alloc: 0
[2014-02-01 11:51:40] GPU #0: 8 hashes / 1.0 MB per warp.
[2014-02-01 11:51:40] GPU #0: Performing auto-tuning (Patience...)
[2014-02-01 11:51:40] GPU #0: maximum total warps (BxW): 951
[2014-02-01 11:51:47] GPU #0: 20469.36 hash/s with configuration K4x32
[2014-02-01 11:51:47] GPU #0: using launch configuration K4x32
[2014-02-01 11:51:47] GPU #0: GeForce GTX 650, 67.23 khash/s
[2014-02-01 11:51:55] Stratum detected new block
[2014-02-01 11:51:55] GPU #0: GeForce GTX 650, 75.59 khash/s
[2014-02-01 11:52:31] GPU #0: GeForce GTX 650, 75.67 khash/s
[2014-02-01 11:52:31] accepted: 1/1 (100.00%), 75.67 khash/s (yay!!!)
[2014-02-01 11:52:35] Stratum detected new block
[2014-02-01 11:52:35] GPU #0: GeForce GTX 650, 75.12 khash/s
[2014-02-01 11:52:53] GPU #0: GeForce GTX 650, 75.60 khash/s
[2014-02-01 11:52:54] accepted: 2/2 (100.00%), 75.60 khash/s (yay!!!)
[2014-02-01 11:53:41] GPU #0: GeForce GTX 650, 75.67 khash/s
[2014-02-01 11:53:41] accepted: 3/3 (100.00%), 75.67 khash/s (yay!!!)
[2014-02-01 11:53:55] GPU #0: GeForce GTX 650, 75.56 khash/s
[2014-02-01 11:53:55] accepted: 4/4 (100.00%), 75.56 khash/s (yay!!!)
[2014-02-01 11:54:26] GPU #0: GeForce GTX 650, 75.66 khash/s
[2014-02-01 11:54:26] accepted: 5/5 (100.00%), 75.66 khash/s (yay!!!)

cpuminer2014/02/01 13:40

今度はcpuminerを試してみました。以下のサイトの通りです。

http://satok.asablo.jp/blog/2014/01/07/7179764

ログは以下の通りです。

ll minerd
-rwxr-xr-x. 1 root root 290095 Feb 1 13:37 minerd

./minerd -a scrypt -o stratum+tcp://ltc.2chpool.com:3333 -u user_id.worker_id -p worker_password

[2014-02-01 13:38:28] Binding thread 0 to cpu 0
[2014-02-01 13:38:28] Starting Stratum on stratum+tcp://ltc.2chpool.com:3333
[2014-02-01 13:38:28] 2 miner threads started, using 'scrypt' algorithm.
[2014-02-01 13:38:28] Binding thread 1 to cpu 1
[2014-02-01 13:38:29] Stratum detected new block
[2014-02-01 13:38:30] thread 1: 4104 hashes, 6.95 khash/s
[2014-02-01 13:38:30] thread 0: 4104 hashes, 6.92 khash/s
[2014-02-01 13:39:08] thread 0: 265224 hashes, 6.97 khash/s
[2014-02-01 13:39:08] accepted: 1/1 (100.00%), 13.92 khash/s (yay!!!)
[2014-02-01 13:39:30] thread 1: 417048 hashes, 6.98 khash/s
[2014-02-01 13:39:55] thread 1: 179616 hashes, 6.99 khash/s
[2014-02-01 13:39:55] accepted: 2/2 (100.00%), 13.95 khash/s (yay!!!)
Google
WWW このブログ内