Bitcoin Forum

Bitcoin => Mining => Topic started by: rethaw on April 07, 2013, 05:53:56 AM



Title: Mining on Amazon EC2 (scrypt or BTC)
Post by: rethaw on April 07, 2013, 05:53:56 AM
I received $100 in AWS credit, here's how I spent it.

Choosing an instance

I selected the 12.04.1 Ubuntu Server for Cluster as the base configuration (AMI). Without selecting a cluster AMI I couldn't get access to the GPU systems in a later dialog.

Amazon lets you bid on their extra compute time with Spot Instances. You choose the amount you're willing to pay for a specific configuration, and as long as you're not outbid, it's yours.

I bid $0.356 for cg1.4xlarge. This is what you get:

Quote
Cluster GPU Quadruple Extra Large Instance

22 GiB of memory
33.5 EC2 Compute Units (2 x Intel Xeon X5570, quad-core)
2 x NVIDIA Tesla “Fermi” M2050 GPUs
1690 GB of instance storage
64-bit platform
I/O Performance: Very High (10 Gigabit Ethernet)
EBS-Optimized Available: No**
API name: cg1.4xlarge


Setting up SSH to connect to the system was easy; their web interface walks you through downloading and using a key.

As far as I can tell, only the North Virginia EC2 center has these instances.

Setting up the environment

You'll notice I've installed some GL packages. I wanted my instance to be able to compile all the CUDA SDK samples, obviously not required if you only plan to mine. I also built the files locally.

Code:
sudo apt-get update
sudo apt-get install freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libgl1-mesa-glx libglu1-mesa libglu1-mesa-dev gcc make libcurl4-openssl-dev autoconf git screen libncurses5-dev libdb4.8-dev -y

Install Drivers and CUDA

Nvidia has kindly put all of the files in a single download.

Code:
wget http://developer.download.nvidia.com/compute/cuda/5_0/rel-update-1/installers/cuda_5.0.35_linux_64_ubuntu11.10-1.run
sudo bash cuda_5.0.35_linux_64_ubuntu11.10-1.run

I did choose to install the samples, as mentioned above. I needed to use this script provided by nvidia (http://docs.nvidia.com/cuda/cuda-getting-started-guide-for-linux/index.html), to load the driver.

Code:
#!/bin/bash
/sbin/modprobe nvidia

if [ "$?" -eq 0 ]; then
  # Count the number of NVIDIA controllers found.
  NVDEVS=`lspci | grep -i NVIDIA`
  N3D=`echo "$NVDEVS" | grep "3D controller" | wc -l`
  NVGA=`echo "$NVDEVS" | grep "VGA compatible controller" | wc -l`

  N=`expr $N3D + $NVGA - 1`
  for i in `seq 0 $N`; do
    mknod -m 666 /dev/nvidia$i c 195 $i
  done

  mknod -m 666 /dev/nvidiactl c 195 255

else
  exit 1
fi

I wanted libglut for the samples, putting CUDA in LD_LIBRARY_PATH was necessary.

Code:
sudo ln -s /usr/lib/x86_64-linux-gnu/libglut.so /usr/lib/libglut.so
export LD_LIBRARY_PATH=/usr/local/cuda-5.0/lib64:/usr/local/cuda-5.0/lib

You can choose to `make` the CUDA samples and use one, deviceQuery, to see if you can see the Tesla's. You can also run `sudo nvidia-smi -a` to take a closer look.

Building and running cgminer

Code:
git clone https://github.com/ckolivas/cgminer.git
cd cgminer
./autogen.sh
CFLAGS="-O2 -Wall -march=native -I/usr/local/cuda/include" LDFLAGS="-L/usr/local/cuda/lib64" ./configure --enable-scrypt
make

Once `make` completes you can run cgminer to either mine LTC or BTC.

For mining BTC I got roughly 192 MH/s using:

Code:
screen ./cgminer -o http://pool:port -u user -p pass -I 10 -v 2 --verbose -w 256

And for LTC, or other scrypt-based coins:

Code:
screen ./cgminer -o http://pool:port -u user -p pass -I 11 -v 2 --shaders 448 --scrypt

For mining litecoin, you may choose to run pooler's `cpuminer` as well. Does cgminer have scrypt CPU mining?

Conclusion

If you are looking for an opportunity to learn how to use Amazon's EC2 you can do it for free. The free instances don't have access to a Tesla, but you can learn a lot without spending any money.

Mining on a Tesla is not profitable. With the roughly 200 MH/s the pair provides, and today's exchange and difficulty1, a miner can expect to mine $1.89 per day. The daily cost per instance, including two M2050s, is $8.64. If you're interested in getting your hands on some BTC, there are better ways.

What do you think would have happened in the alternate history, in which Amazon had built out an AMD GPU farm?

1 .0069 BTC/$, and a 7.6m difficulty.

http://rohitnair.info/mining-bitcoins-for-fun-and-very-little-profitability/ (http://rohitnair.info/mining-bitcoins-for-fun-and-very-little-profitability/)
Old bitcointalk EC2 topic (https://bitcointalk.org/index.php?topic=8405.0)
http://en.wikipedia.org/wiki/Nvidia_Tesla (http://en.wikipedia.org/wiki/Nvidia_Tesla)
https://github.com/jgarzik/cpuminer (https://github.com/jgarzik/cpuminer)
https://github.com/ckolivas/cgminer (https://github.com/ckolivas/cgminer)


Title: Re: Mining on Amazon EC2 (scrypt or BTC)
Post by: Landstander on April 08, 2013, 05:28:34 AM
Thank you for this. I was considering EC2 mining and you just saved me a lot of legwork.


Title: Re: Mining on Amazon EC2 (scrypt or BTC)
Post by: roy7 on April 08, 2013, 05:32:12 AM
I run a cpuminer on the free EC2 since, why not, it's free and fun. :) But I've seen 3 different people mention they are working on new cuda code that is 2x-3x faster than current cgminer on nVidia GPUs. Still won't make the Tesla EC2 worth while, but it's closer.


Title: Re: Mining on Amazon EC2 (scrypt or BTC)
Post by: rethaw on April 09, 2013, 03:15:50 AM
Thank you for this. I was considering EC2 mining and you just saved me a lot of legwork.

No problem! Hope I saved you some money too!

But I've seen 3 different people mention they are working on new cuda code that is 2x-3x faster than current cgminer on nVidia GPUs. Still won't make the Tesla EC2 worth while, but it's closer.

Care to link to a post? The next generation of Tesla still greatly underperform AMD cards for mining. With this setup the profit/loss is less than .25. However, I'm curious about improvements in nvidia kernels.


Title: Re: Mining on Amazon EC2 (scrypt or BTC)
Post by: roy7 on April 09, 2013, 03:20:36 AM
rethaw, I didn't bookmark them, but I re-found these:

https://bitcointalk.org/index.php?topic=167229.0
https://bitcointalk.org/index.php?topic=163750.0


Title: Re: Mining on Amazon EC2 (scrypt or BTC)
Post by: baad on April 09, 2013, 03:24:41 AM
Great help, thanks!


Title: Re: Mining on Amazon EC2 (scrypt or BTC)
Post by: rethaw on April 10, 2013, 04:31:47 AM
rethaw, I didn't bookmark them, but I re-found these:

https://bitcointalk.org/index.php?topic=167229.0
https://bitcointalk.org/index.php?topic=163750.0


I tried both of these out using the M2050s on EC2.

Using rpcminer-cuda, I saw a minimal improvement over cgminer for mining Bitcoin. Anecdotally 5Mhash/s faster, but without the Kepler architecture there is little benefit.

Using cudaminer, scrypt mining saw a marked improvement: at least 40kh/s faster.


Title: Re: Mining on Amazon EC2 (scrypt or BTC)
Post by: roy7 on April 10, 2013, 04:36:07 AM
Thank you for testing and reporting back. :)


Title: Re: Mining on Amazon EC2 (scrypt or BTC)
Post by: rethaw on May 14, 2013, 03:48:14 AM
In a befuddling turn of events about a month ago the price of a GPU spot instance on US-east increased by an order of magnitude (at least). Perhaps someone decided they could start mining altcoins?

https://i.imgur.com/9wmIylW.png

I paid $.36/hr in the beginning in April, the dip you see in the last two weeks is to $3.00/hr.


Title: Re: Mining on Amazon EC2 (scrypt or BTC)
Post by: roy7 on May 14, 2013, 03:57:53 AM
If Amazon ever offers ATI GPU farms, that might happen. Don't see how the Tesla farms can be cost effective though.


Title: Re: Mining on Amazon EC2 (scrypt or BTC)
Post by: Signus on May 14, 2013, 11:53:19 AM
Thank you for this. I was considering EC2 mining and you just saved me a lot of legwork.

Definitely, I gave it a shot a while back. Even at a lower difficulty it wasn't worth the cost.

They charged me for multiple server instances that wouldn't spin up. I tried to fight it because they were having problems with multiple corrupt images apparently, but they didn't feel like my problem was worth a refund. When they finally pointed me to an instance I could spin up, it couldn't get over 80Mh/s on a GPU cluster.

Even a Tesla CLUSTER should be able to produce more than that. My own CPU does that while sweating profusely, but does it nonetheless.


Title: Re: Mining on Amazon EC2 (scrypt or BTC)
Post by: endriuska on May 14, 2013, 01:13:49 PM
I run a cpuminer on the free EC2 since, why not, it's free and fun.

How many mhs or khs are you getting on free instance?


Title: Re: Mining on Amazon EC2 (scrypt or BTC)
Post by: ewitte on May 14, 2013, 01:27:15 PM
Titan and future cards are 2-3x faster with the right program.  Still not on par with AMD.  350MH on a $1k card lol.


Title: Re: Mining on Amazon EC2 (scrypt or BTC)
Post by: roy7 on May 14, 2013, 01:31:34 PM
I run a cpuminer on the free EC2 since, why not, it's free and fun.

How many mhs or khs are you getting on free instance?

I think it was like 10-15? I don't mine on it any more since I'm using it to test my pool out, but was fun learning how EC worked and such. :)


Title: Re: Mining on Amazon EC2 (scrypt or BTC)
Post by: endriuska on May 14, 2013, 01:37:38 PM
was it on windows or unix?


Title: Re: Mining on Amazon EC2 (scrypt or BTC)
Post by: ewitte on May 14, 2013, 01:46:12 PM
You can usually get 6-10KH per core on a newish Xeon.  I've tried it on a dual 8 core and pulled about 165MH/s off it (with hyperthreading on).


Title: Re: Mining on Amazon EC2 (scrypt or BTC)
Post by: roy7 on May 14, 2013, 01:47:33 PM
was it on windows or unix?

I was running Ubuntu on a micro server.


Title: Re: Mining on Amazon EC2 (scrypt or BTC)
Post by: Molex1701 on October 25, 2013, 05:37:34 PM
12.04.1 Ubuntu Server for Cluster

I guess they don't offer this version any more. I only see one for HVM instances and didn't see cgi as an option there.   I do see a red hat and that does offer cgi instances there.  Its 0.346 per hour. I've been wondering with BTC at $160 and higher if worth it?  Even ltc at 2.20 ish.  I got a number of credits to use.

Well I'll see if I can get it going and let you know stats.  I'm not very good at linux stuff though :(



Title: Re: Mining on Amazon EC2 (scrypt or BTC)
Post by: Gotta go fast! on October 27, 2013, 02:16:42 PM
12.04.1 Ubuntu Server for Cluster

I guess they don't offer this version any more. I only see one for HVM instances and didn't see cgi as an option there.   I do see a red hat and that does offer cgi instances there.  Its 0.346 per hour. I've been wondering with BTC at $160 and higher if worth it?  Even ltc at 2.20 ish.  I got a number of credits to use.

Well I'll see if I can get it going and let you know stats.  I'm not very good at linux stuff though :(



You would waste a lot of money by mining bitcoin on an Amazon EC3 instance. Remember that they are not ASIC miners!!


Title: Re: Mining on Amazon EC2 (scrypt or BTC)
Post by: Aalesund on October 27, 2013, 05:53:58 PM
I think you'll have a good profit if you mining alternative currencies as SRC.
For them, you need a good and powerful CPU.
The people use EC2 for CPU mining, SRC or QRK, however QRK is very cheap, so it is better to mine SRC.


Title: Re: Mining on Amazon EC2 (scrypt or BTC)
Post by: jeppe on October 28, 2013, 08:37:03 PM
would prime coin be worth mining on a free EC2 ??


Title: Re: Mining on Amazon EC2 (scrypt or BTC)
Post by: Molex1701 on October 29, 2013, 05:41:53 AM
12.04.1 Ubuntu Server for Cluster

I guess they don't offer this version any more. I only see one for HVM instances and didn't see cgi as an option there.   I do see a red hat and that does offer cgi instances there.  Its 0.346 per hour. I've been wondering with BTC at $160 and higher if worth it?  Even ltc at 2.20 ish.  I got a number of credits to use.

Well I'll see if I can get it going and let you know stats.  I'm not very good at linux stuff though :(



Even at the price it wouldnt run because I guess too low bid.  So gave up trying


Title: Re: Mining on Amazon EC2 (scrypt or BTC)
Post by: rethaw on November 06, 2013, 03:55:39 AM
would prime coin be worth mining on a free EC2 ??

It definitely was at one point, check out this thread:

https://bitcointalk.org/index.php?topic=252944.0