Parallel Programming and Cryptocurrencies

Lately I’ve been spending a lot of brain cycles learning parallel programming tools and APIs. These are tools that let you write code to run on your video card (GPU) and/or multiple CPU cores at once. I’ve learned the basics of NVIDIA CUDA, OpenCL, OpenMP, and C++ AMP over the past few weeks. They’re neat things to know, but I’m not really sure what I’d use them for since most of the applications are scientific computing and math-intensive things and that’s not something I’ve ever really focused on.

One of the most useless things that GPUs are used for is mining bitcoins and litecoins. They’re a virtual currency that is created by using math to turn lots of electricity into coins that are worth anywhere from slightly less to a lot less than you paid for the electricity. This imaginary currency will gradually disappear as governments obliterate the exchanges that you can trade them on. They’re doing that because alternative currencies are a threat to them – they’re hard to tax, easy to launder, and undermine the authority of a central bank. These are all generally good things unless you’re a government. Bitcoins and litecoin wallets and exchanges are also frequently hacked/robbed, but nobody knows yet whether those thieving hackers are government-sponsored.

Now that I’ve made it clear that cryptocurrencies are dumb, one thing they are great for is exploring and learning about the capabilities of different hardware and parallel computing APIs. There are plenty of open source mining programs that use CUDA, OpenCL, or CPU-based hash calculations, and you can run a miner on almost anything. If you want to waste electricity, you’ve got options.

I have a wide range of hardware at home and have benchmarked quite a few things. Here are the speeds of various bits of hardware in Litecoin kilohashes per second:

460 hashes/sec – Asus EEE 701 PC with 630 MHz single-core Celeron processor.
1500 hashes/sec – HP Touchpad Tablet with 1.2 GHz dual-core ARM processor.
6200 hashes/sec – Compaq laptop with Core 2 Duo T8100 processor.
13650 hashes/sec – NVIDIA Geforce GT 610 512MB PCI video card.
27400 hashes/sec – NVIDIA Geforce GT 650M 2GB laptop video card.
37000 hashes/sec – AMD Phenom II 1100T six-core processor.
41000 hashes/sec – MSI laptop with i7-3920XM quad-core processor.
52000 hashes/sec – NVIDIA Geforce 640 1GB PCI-E video card.
NULL hashes/sec – ATI Radeon HD 6870 1GB PCI-E video card.

I don’t have much ATI graphics hardware, and for good reason, because one thing is still true – there is *ALWAYS* something broken in their drivers, and in the case of my 6870, OpenCL doesn’t work right on it, so it’s pretty much a brick for this experiment.

The most interesting bit was getting a litecoin miner running on my HP Touchpad. There is a miner daemon called “Pooler’s CPUMiner” that can be compiled for ARM. It almost compiled with the TouchPad SDK, but it required some adjustments to library settings and compile flags to get it to work. After a bit of tinkering I got it to run on the device at a blistering 1510 hashes per second. When the device’s screen is off the CPU runs at half speed, so with the screen off it gets 760 hashes per second. Because I know the masses will be clamoring for a TouchPad binary, I’ve posted it on Github: https://github.com/Xangis/cpuminer

This was an interesting experiment and I’ve managed to generate nearly 10 cents in imaginary money. It only took just over $1 of electricity to get there.