The part1 of the tutorial discussed about setting up a powerful GPU machine for bitcoin mining. Please refer to the link here if you need to go through it.
Assuming you have AWS GPU machine available, login to the server from your laptop/Desktop. Here I am using my Apple Mac Book Pro.
ssh ubuntu@52.207.xxx.xx -i MyVPCKeypair.pem
Next install all updates. This is a good practice whenever you first login to a EC2 instance.
~$ sudo apt-get update
Then installed a set of dependencies, I am not sure whether all of them are needed.
sudo apt-get install -y freeglut3-dev libx11-dev libxmu-dev libxi-dev libgl1-mesa-glx libglu1-mesa libglu1-mesa-dev gcc make libcurl4-openssl-dev autoconf git screen libncurses5-dev opencl-headers build-essential protobuf-compiler libprotoc-dev libboost-all-dev libleveldb-dev hdf5-tools libhdf5-serial-dev libopencv-core-dev libopencv-highgui-dev libsnappy-dev libsnappy1v5 libatlas-base-dev cmake libstdc++6-4.9-dbg libgoogle-glog0v5 libgoogle-glog-dev libgflags-dev liblmdb-dev python-pip gfortran libjansson-dev uthash-dev autogen libtool pkg-config
Install NVIDIA driver by following steps.
wget http://us.download.nvidia.com/XFree86/Linux-x86_64/375.20/NVIDIA-Linux-x86_64-375.20.run
chmod +x NVIDIA-Linux-x86_64-375.20.run
sudo ./NVIDIA-Linux-x86_64-375.20.run
Then install
sudo apt install ubuntu-drivers-common
sudo ubuntu-drivers autoinstall
Now get CUDA and install/update
wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_8.0.44-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu1604_8.0.44-1_amd64.deb
sudo apt-get update
sudo apt-get install cuda
Install SSL package
sudo apt-get install libssl-dev
Get CudaMiner
git clone https://github.com/cbuchner1/CudaMiner
Make CudaMiner using below steps
cd CudaMiner/
./configure.sh
make
Here I am getting below error
/usr/local/cuda/bin/nvcc -O3 -Xptxas "-abi=no -v" -arch=compute_10 --maxrregcount=64 --ptxas-options=-v -o salsa_kernel.o -c salsa_kernel.cu
nvcc fatal : Value 'compute_10' is not defined for option 'gpu-architecture'
Makefile:946: recipe for target 'salsa_kernel.o' failed
make[2]: *** [salsa_kernel.o] Error 1
make[2]: Leaving directory '/home/ubuntu/CudaMiner'
Makefile:496: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/ubuntu/CudaMiner'
Makefile:285: recipe for target 'all' failed
make: *** [all] Error 2
To fix this issue open Makefile and modify all 'compute_10' to 'sm_30'.
Try ./configure.sh followed by make
Now I am getting below error
ptxas error : Invalid value 'no' for option -abi.
ptxas fatal : Ptx assembly aborted due to errors
Makefile:946: recipe for target 'salsa_kernel.o' failed
make[2]: *** [salsa_kernel.o] Error 255
make[2]: Leaving directory '/home/ubuntu/CudaMiner'
Makefile:496: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/ubuntu/CudaMiner'
Makefile:285: recipe for target 'all' failed
make: *** [all] Error 2
To fix this edit Makefile and change "-abi=no" to "-abi=yes"
Try ./configure.sh followed by make
Now again error
/usr/bin/ld: cudaminer-cpu-miner.o: undefined reference to symbol 'SHA256@@OPENSSL_1.0.0'
//lib/x86_64-linux-gnu/libcrypto.so.1.0.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
Makefile:376: recipe for target 'cudaminer' failed
make[2]: *** [cudaminer] Error 1
make[2]: Leaving directory '/home/ubuntu/CudaMiner'
Makefile:496: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/ubuntu/CudaMiner'
Makefile:285: recipe for target 'all' failed
make: *** [all] Error 2
To fix this run
./autogen.sh
Try ./configure.sh followed by make. Finally this time no errors.
Run cudaminer and see whether it is coming up.
./cudaminer
*** CudaMiner for nVidia GPUs by Christian Buchner ***
This is version 2014-02-28 (beta)
based on pooler-cpuminer 2.3.2 (c) 2010 Jeff Garzik, 2012 pooler
Cuda additions Copyright 2013,2014 Christian Buchner
LTC donation address: LKS1WDKGED647msBQfLBHV3Ls8sveGncnm
BTC donation address: 16hJF5mceSojnTD3ZTUDqdRhDyPJzoRakM
YAC donation address: Y87sptDEcpLkLeAuex6qZioDbvy1qXZEj4
[2017-12-13 17:12:50] NVML GPU monitoring is not available.
[2017-12-13 17:12:50] 1 miner threads started, using 'scrypt' algorithm.
[2017-12-13 17:12:50] HTTP request failed: Failed to connect to 127.0.0.1 port 9332: Connection refused
[2017-12-13 17:12:50] json_rpc_call failed, retry after 15 seconds
Even though there is an error we can see that cudaminer is coming up which is a good sign.
For Bitcoin mining you can choose one of the two options which are solo mining and joining a pool. I chose to join a mining pool.
You can choose from many available mining pools. Here in this tutorial I chose give me coins. Go to https://give-me-coins.com, sign up and create an account. You will see a dashboard similar to this.
Once logged in then go to Account->workers and create a worker.
Now we need to create a coin wallet to securely store our litecoin or bitcoin or other coins. You can use any wallet service. I used Jaxx. jaxx can be installed from https://jaxx.io. Once installed then go to LTC tab and copy the wallet address to clipboard. Remember each coin has different wallet address and make sure that you copy the correct one.
In https://give-me-coins.com go to Accounts->Settings->Profile and update 'LTC Wallet Address' with the Jaxx LTC wallet address.
Go to Support->Pool Servers and select a URL of the server according to your region. I chose 'ltc.give-me-coins.com:3333'.
Now start cudaminer by providing worker details and server info.
./cudaminer -O jineshmathewt.user:pass -o stratum+tcp://ltc.give-me-coins.com:3334 -D
Note
username :jineshmathewt.user
password:pass
server URL:ltc.give-me-coins.com:3334
-D for debug or detailed logs on console
I see console logs like below
./cudaminer -O jineshmathewt.user:pass -o stratum+tcp://ltc.give-me-coins.com:3334 -D
*** CudaMiner for nVidia GPUs by Christian Buchner ***
This is version 2014-02-28 (beta)
based on pooler-cpuminer 2.3.2 (c) 2010 Jeff Garzik, 2012 pooler
Cuda additions Copyright 2013,2014 Christian Buchner
LTC donation address: LKS1WDKGED647msBQfLBHV3Ls8sveGncnm
BTC donation address: 16hJF5mceSojnTD3ZTUDqdRhDyPJzoRakM
YAC donation address: Y87sptDEcpLkLeAuex6qZioDbvy1qXZEj4
[2017-12-13 17:36:32] NVML GPU monitoring is not available.
[2017-12-13 17:36:32] 1 miner threads started, using 'scrypt' algorithm.
[2017-12-13 17:36:32] Starting Stratum on stratum+tcp://ltc.give-me-coins.com:3334
[2017-12-13 17:36:32] Stratum session id: 050500001
[2017-12-13 17:36:32] Stratum difficulty set to 131072
[2017-12-13 17:36:32] DEBUG: job_id='1513186582 14467' extranonce2=00000000 ntime=5a316516
[2017-12-13 17:36:33] GPU #0: Tesla M60 with compute capability 5.2
[2017-12-13 17:36:33] GPU #0: interactive: 0, tex-cache: 0 , single-alloc: 0
[2017-12-13 17:36:33] GPU #0: 32 hashes / 4.0 MB per warp.
[2017-12-13 17:36:33] GPU #0: Performing auto-tuning (Patience...)
[2017-12-13 17:36:33] GPU #0: maximum total warps (BxW): 1843
[2017-12-13 17:36:34] x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 x17 x18 x19 x20 x21 x22 x23 x24
[2017-12-13 17:36:34] 8: 15.0| 33.0| 54.4|
[2017-12-13 17:47:31] GPU #0: 368016.27 hash/s with configuration T28x20
[2017-12-13 17:47:31] GPU #0: using launch configuration T28x20
[2017-12-13 17:47:32] GPU #0: Tesla M60, 387.94 khash/s
[2017-12-13 17:47:47] DEBUG: hash <= target
Hash: 0000007a7e158c8b24b898e852279209be4b69b4bc550e2cd2a17dd8fdf76364
Target: 000000ffff000000000000000000000000000000000000000000000000000000
[2017-12-13 17:47:47] GPU #0: Tesla M60, 362.88 khash/s
[2017-12-13 17:47:48] accepted: 1/1 (100.00%), 362.88 khash/s (yay!!!)
[2017-12-13 17:47:49] DEBUG: job_id='1513187269 14482' extranonce2=00000000 n
Now the mining has started , we have joined the litecoin mining pool and the run is going on.
https://give-me-coins.com dashboard will be updated with your hashing details. This would take an hour or so to update, be patient.
Now let us see the profitability of this mining. If you go to https://give-me-coins.com Calc and provide your hashing rate. This will tell you the profit you are going to make.
Most of the cases AWS charge would be more than the amount of litecoin that you are going to make and therefore mining is not profitable. But it is a great way to learn something new.
Make sure that you terminate the AWS EC2 instance soon after you are done with the experiment to avoid unexpected charges.
Happy Learning..... Thanks for your time.
Assuming you have AWS GPU machine available, login to the server from your laptop/Desktop. Here I am using my Apple Mac Book Pro.
ssh ubuntu@52.207.xxx.xx -i MyVPCKeypair.pem
Next install all updates. This is a good practice whenever you first login to a EC2 instance.
~$ sudo apt-get update
Then installed a set of dependencies, I am not sure whether all of them are needed.
sudo apt-get install -y freeglut3-dev libx11-dev libxmu-dev libxi-dev libgl1-mesa-glx libglu1-mesa libglu1-mesa-dev gcc make libcurl4-openssl-dev autoconf git screen libncurses5-dev opencl-headers build-essential protobuf-compiler libprotoc-dev libboost-all-dev libleveldb-dev hdf5-tools libhdf5-serial-dev libopencv-core-dev libopencv-highgui-dev libsnappy-dev libsnappy1v5 libatlas-base-dev cmake libstdc++6-4.9-dbg libgoogle-glog0v5 libgoogle-glog-dev libgflags-dev liblmdb-dev python-pip gfortran libjansson-dev uthash-dev autogen libtool pkg-config
Install NVIDIA driver by following steps.
wget http://us.download.nvidia.com/XFree86/Linux-x86_64/375.20/NVIDIA-Linux-x86_64-375.20.run
chmod +x NVIDIA-Linux-x86_64-375.20.run
sudo ./NVIDIA-Linux-x86_64-375.20.run
Then install
sudo apt install ubuntu-drivers-common
sudo ubuntu-drivers autoinstall
Now get CUDA and install/update
wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_8.0.44-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu1604_8.0.44-1_amd64.deb
sudo apt-get update
sudo apt-get install cuda
Install SSL package
sudo apt-get install libssl-dev
Get CudaMiner
git clone https://github.com/cbuchner1/CudaMiner
Make CudaMiner using below steps
cd CudaMiner/
./configure.sh
make
Here I am getting below error
/usr/local/cuda/bin/nvcc -O3 -Xptxas "-abi=no -v" -arch=compute_10 --maxrregcount=64 --ptxas-options=-v -o salsa_kernel.o -c salsa_kernel.cu
nvcc fatal : Value 'compute_10' is not defined for option 'gpu-architecture'
Makefile:946: recipe for target 'salsa_kernel.o' failed
make[2]: *** [salsa_kernel.o] Error 1
make[2]: Leaving directory '/home/ubuntu/CudaMiner'
Makefile:496: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/ubuntu/CudaMiner'
Makefile:285: recipe for target 'all' failed
make: *** [all] Error 2
To fix this issue open Makefile and modify all 'compute_10' to 'sm_30'.
Try ./configure.sh followed by make
Now I am getting below error
ptxas error : Invalid value 'no' for option -abi.
ptxas fatal : Ptx assembly aborted due to errors
Makefile:946: recipe for target 'salsa_kernel.o' failed
make[2]: *** [salsa_kernel.o] Error 255
make[2]: Leaving directory '/home/ubuntu/CudaMiner'
Makefile:496: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/ubuntu/CudaMiner'
Makefile:285: recipe for target 'all' failed
make: *** [all] Error 2
To fix this edit Makefile and change "-abi=no" to "-abi=yes"
Try ./configure.sh followed by make
Now again error
/usr/bin/ld: cudaminer-cpu-miner.o: undefined reference to symbol 'SHA256@@OPENSSL_1.0.0'
//lib/x86_64-linux-gnu/libcrypto.so.1.0.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
Makefile:376: recipe for target 'cudaminer' failed
make[2]: *** [cudaminer] Error 1
make[2]: Leaving directory '/home/ubuntu/CudaMiner'
Makefile:496: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/ubuntu/CudaMiner'
Makefile:285: recipe for target 'all' failed
make: *** [all] Error 2
To fix this run
./autogen.sh
Try ./configure.sh followed by make. Finally this time no errors.
Run cudaminer and see whether it is coming up.
./cudaminer
*** CudaMiner for nVidia GPUs by Christian Buchner ***
This is version 2014-02-28 (beta)
based on pooler-cpuminer 2.3.2 (c) 2010 Jeff Garzik, 2012 pooler
Cuda additions Copyright 2013,2014 Christian Buchner
LTC donation address: LKS1WDKGED647msBQfLBHV3Ls8sveGncnm
BTC donation address: 16hJF5mceSojnTD3ZTUDqdRhDyPJzoRakM
YAC donation address: Y87sptDEcpLkLeAuex6qZioDbvy1qXZEj4
[2017-12-13 17:12:50] NVML GPU monitoring is not available.
[2017-12-13 17:12:50] 1 miner threads started, using 'scrypt' algorithm.
[2017-12-13 17:12:50] HTTP request failed: Failed to connect to 127.0.0.1 port 9332: Connection refused
[2017-12-13 17:12:50] json_rpc_call failed, retry after 15 seconds
Even though there is an error we can see that cudaminer is coming up which is a good sign.
For Bitcoin mining you can choose one of the two options which are solo mining and joining a pool. I chose to join a mining pool.
You can choose from many available mining pools. Here in this tutorial I chose give me coins. Go to https://give-me-coins.com, sign up and create an account. You will see a dashboard similar to this.
Once logged in then go to Account->workers and create a worker.
Now we need to create a coin wallet to securely store our litecoin or bitcoin or other coins. You can use any wallet service. I used Jaxx. jaxx can be installed from https://jaxx.io. Once installed then go to LTC tab and copy the wallet address to clipboard. Remember each coin has different wallet address and make sure that you copy the correct one.
In https://give-me-coins.com go to Accounts->Settings->Profile and update 'LTC Wallet Address' with the Jaxx LTC wallet address.
Go to Support->Pool Servers and select a URL of the server according to your region. I chose 'ltc.give-me-coins.com:3333'.
Now start cudaminer by providing worker details and server info.
./cudaminer -O jineshmathewt.user:pass -o stratum+tcp://ltc.give-me-coins.com:3334 -D
Note
username :jineshmathewt.user
password:pass
server URL:ltc.give-me-coins.com:3334
-D for debug or detailed logs on console
I see console logs like below
./cudaminer -O jineshmathewt.user:pass -o stratum+tcp://ltc.give-me-coins.com:3334 -D
*** CudaMiner for nVidia GPUs by Christian Buchner ***
This is version 2014-02-28 (beta)
based on pooler-cpuminer 2.3.2 (c) 2010 Jeff Garzik, 2012 pooler
Cuda additions Copyright 2013,2014 Christian Buchner
LTC donation address: LKS1WDKGED647msBQfLBHV3Ls8sveGncnm
BTC donation address: 16hJF5mceSojnTD3ZTUDqdRhDyPJzoRakM
YAC donation address: Y87sptDEcpLkLeAuex6qZioDbvy1qXZEj4
[2017-12-13 17:36:32] NVML GPU monitoring is not available.
[2017-12-13 17:36:32] 1 miner threads started, using 'scrypt' algorithm.
[2017-12-13 17:36:32] Starting Stratum on stratum+tcp://ltc.give-me-coins.com:3334
[2017-12-13 17:36:32] Stratum session id: 050500001
[2017-12-13 17:36:32] Stratum difficulty set to 131072
[2017-12-13 17:36:32] DEBUG: job_id='1513186582 14467' extranonce2=00000000 ntime=5a316516
[2017-12-13 17:36:33] GPU #0: Tesla M60 with compute capability 5.2
[2017-12-13 17:36:33] GPU #0: interactive: 0, tex-cache: 0 , single-alloc: 0
[2017-12-13 17:36:33] GPU #0: 32 hashes / 4.0 MB per warp.
[2017-12-13 17:36:33] GPU #0: Performing auto-tuning (Patience...)
[2017-12-13 17:36:33] GPU #0: maximum total warps (BxW): 1843
[2017-12-13 17:36:34] x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 x17 x18 x19 x20 x21 x22 x23 x24
[2017-12-13 17:36:34] 8: 15.0| 33.0| 54.4|
[2017-12-13 17:47:31] GPU #0: 368016.27 hash/s with configuration T28x20
[2017-12-13 17:47:31] GPU #0: using launch configuration T28x20
[2017-12-13 17:47:32] GPU #0: Tesla M60, 387.94 khash/s
[2017-12-13 17:47:47] DEBUG: hash <= target
Hash: 0000007a7e158c8b24b898e852279209be4b69b4bc550e2cd2a17dd8fdf76364
Target: 000000ffff000000000000000000000000000000000000000000000000000000
[2017-12-13 17:47:47] GPU #0: Tesla M60, 362.88 khash/s
[2017-12-13 17:47:48] accepted: 1/1 (100.00%), 362.88 khash/s (yay!!!)
[2017-12-13 17:47:49] DEBUG: job_id='1513187269 14482' extranonce2=00000000 n
Now the mining has started , we have joined the litecoin mining pool and the run is going on.
https://give-me-coins.com dashboard will be updated with your hashing details. This would take an hour or so to update, be patient.
Now let us see the profitability of this mining. If you go to https://give-me-coins.com Calc and provide your hashing rate. This will tell you the profit you are going to make.
Most of the cases AWS charge would be more than the amount of litecoin that you are going to make and therefore mining is not profitable. But it is a great way to learn something new.
Make sure that you terminate the AWS EC2 instance soon after you are done with the experiment to avoid unexpected charges.
Happy Learning..... Thanks for your time.
Comments
Post a Comment