I’ve been looking at building a deep learning rig for a little while, but kept putting it off by telling myself that AWS was cheaper. Unfortunately, AWS is also an outrageous pain-in-the-arse for ad-hoc projects, so I found myself simply avoiding deep learning because of the long training times on my Macbook. More recently I’ve been playing around with cryptocurrencies, and got drawn in by the idea that you can earn back the cost of hardware by mining currencies on GPUs. Can I build a deep learning rig which pays for itself by mining cryptocurrencies when I’m not using it?
I smell a project!
Can a PC pay itself back by mining cryptocurrencies?
This is the first question I set out to investigate. Firstly, I had to check that the workflow is possible, so I used Boot Camp to install Windows on my Macbook Pro, and then started using the AMD GPU in my Macbook to mine for coins using Awesome Miner. Unfortunately, almost all of the mining software and tools are for Windows, and the most heavily optimised (profitable) are almost exclusively for Windows users. Sigh.
This actually worked, and Awesome Miner estimated I was making about $1 (USD) per day. This roughly lines up with what I calculated for the Macbook using whattomine.com, which means that I can probably trust this site to be reasonably accurate when calculating potential profits for the new machine. I ran this setup for a couple of days to make sure I could test out the whole process, and after a few days and nights of mining on my fairly weak Macbook GPU, I had enough currency to cash out and transfer real profits to my own wallet. Given the small volume I took a 40% haircut due to the transaction fee, but given this is about testing the pipeline I’m not overly concerned about transaction fees at this point.
By the way, I’m using Litecoin instead of Bitcoin as the main currency for my earnings. Awesome Miner automatically switches algorithm (and coin) based on what is most profitable for my hardware at any given point in time, then I can use Mining Pool Hub’s auto-exchange feature to automatically convert all of these currencies into a single currency for me to accumulate. Litecoin has faster transaction times and lower fees, so given the size and frequency of these transactions I lose a lot less currency and have much lower payout thresholds than if I was using Bitcoin. I can always swap for other coins later using Shapeshift.
With the end-to-end process verified (the money turned up in my wallet 👌) I set out to calculate the potential revenue from a new system. I made some assumptions here:
- GPU mining only (CPU mining is barely profitable)
- Electricity cost is AUD$0.23/kWh (Sydney)
- System power usage when mining is approx 333W (based on PC Part Picker, and being 1⁄3 of a kW makes the maths clean)
- The GPU is an nVidia GTX 1080, as this is pretty much the second most powerful card on the market, and almost definitely the most cost effective for mining
- Mining revenue is USD$5/day or AUD$6.5/day (based on the top three currencies returning higher than this on whattomine.com when using the GTX 1080
- Currencies and mining revenues remain constant (not a valid assumption, but recently they’ve been going up so this improves profitability)
Based on all these assumptions, it looks like total profits per day in AUD are roughly $6.5 (revenue) minus $1.84 (8kWh of electricity), leaving roughly $4.50/day profit. I’m being a bit rubbery with the numbers, because mining revenues move all over the place, and staying on the conservative side. Using $4.50/day profit, you can pay off about $1,500 worth of deep learning rig every 12 months, allowing for a bit of down time so you can actually use it to train models!
With that all said and done, I’ve at least convinced myself that I’m allowed to build myself a powerful deep learning rig 😊. Stay tuned for the next part in what is likely to become a bit of a saga - building a cost-effective deep learning machine!
Part 2: Building a cost-effective Deep Learning dream machine
Edit: Now that I’ve built the machine, I can verify my calculations! Right now it’s making US$6.80/day on the GPU and $0.70/day on the CPU, so I’m definitely making profit! Happy days.