Spaghetti Programming

Mining Litecoin with the ATI 7970

Litecoin

Hardware

I decided to jump on the cryptocurrency bandwagon and start mining. Here are the parts I selected for my rig:

  • Processor: AMD Athlon II X2 270 - Amazon Link

  • Motherboard: ASRock 970 Motherboard - Amazon Link

  • Memory: Corsair XMS3 4 GB DDR3 - Amazon Link

  • GPUs: 4 of the ATI Radeon 7970 - Amazon Link

  • Power Supply: Seasonic SS-1250XM - Amazon Link

  • Hard Drive: Spare 2.5 inch laptop SATA drive that I had laying around

  • 1x Riser Cables: 2 16x to 1x PCI-E Riser Cables - Amazon Link

  • 16x Riser Cables: 2 16x PCI-E Riser Cables - Amazon Link

  • Case: Old milk crate sitting in my basement

  • Operating System: GNU/Linux (is there really any other choice?)

The ATI 7970 is probably not the most cost effective choice from a dollar vs. hash rate perspective. As of now the 7950 seems to be the way to go, but I didn't find that out until I bought the hardware. The 7970 takes a good bit of tweaking to get running at optimal hash rate. People claim about 750Kh/s, but I was never able to get my cards to clock high enough to get those numbers. Still I was able to get reasonable performance out of them and am seeing 715Kh/s ish from each card. This results in about 2.85Mh/s total. This setup is hungry and pulls about 1100 watts as measured by a P3 Kill A Watt when crunching hashes.

Software

The following software runs the rig. Once this is all installed mining can begin.

  • Xubuntu 12.04
  • AMD APP SDK 2.7
  • AMD Catalyst Driver 13.4
  • cgminer 3.0.0

Unfortunately X must be running for mining to happen. I'd rather not run the window manager, but that is just the way the AMD driver works. You must have the relevant section in your xorg config file to load the fglrx driver. AMD provides a tool to generate the relevant section:

sudo aticonfig --adapter=all --initial

You can see what adapters the system has detected with:

sudo aticonfig --list-adapters

Once all cards are detected mining can begin. I use this simple script to start cgminer:

#!/bin/bash

export GPU_MAX_ALLOC_PERCENT=100
export GPU_USE_SYNC_OBJECTS=1
export DISPLAY=:0

/home/crypt/Downloads/cgminer-3.0.0-x86_64-built/cgminer
Here is the cgminer.conf which controls all the cgminer settings. The cgminer config file is just a JSON file. Make sure you put plenty of pool servers in the pools array in case of pool outages. I find it much easier to manage everything using the conf file rather than a command line a mile long to specify all the options.
{
"pools" : [
    {
        "url" : "stratum+tcp://server00:port",
        "user" : "worker.1",
        "pass" : "xxx"
    },
    {
        "url" : "http://server00:port",
        "user" : "worker.1",
        "pass" : "xxx"
    }
]
,
"intensity" : "13,13,13,13",
"vectors" : "1,1,1,1",
"worksize" : "256,256,256,256",
"kernel" : "scrypt,scrypt,scrypt,scrypt",
"lookup-gap" : "2,2,2,2",
"thread-concurrency" : "10240,10240,10240,10240",
"shaders" : "2048,2048,2048,2048",
"gpu-engine" : "1045,1045,1045,1045",
"gpu-fan" : "100,100,100,100",
"gpu-memclock" : "1500,1500,1500,1500",
"gpu-memdiff" : "0,0,0,0",
"gpu-powertune" : "0,0,0,0",
"gpu-vddc" : "0.000,0.000,0.000,0.000",
"temp-cutoff" : "95,95,95,95",
"temp-overheat" : "85,85,85,85",
"temp-target" : "75,75,75,75",
"api-port" : "4028",
"expiry" : "120",
"gpu-dyninterval" : "7",
"gpu-platform" : "0",
"gpu-threads" : "2",
"hotplug" : "5",
"log" : "5",
"no-pool-disable" : true,
"queue" : "1",
"scan-time" : "60",
"scrypt" : true,
"temp-hysteresis" : "3",
"shares" : "0",
"kernel-path" : "/usr/local/bin"
}
The rig is managed remotely via ssh with cgminer running in a screen session. Output:
 cgminer version 3.0.0 - Started: [2013-05-08 19:18:30]
--------------------------------------------------------------------------------
 (5s):2.856M (avg):2.858Mh/s | A:10305  R:99  HW:0  U:80.7/m  WU:2609.0/m
 ST: 2  SS: 0  NB: 74  LW: 2533  GF: 0  RF: 0
 Connected to stratum.server00.com diff 32 with stratum as user worker.1
 Block: 26e37d2565fc4d97...  Diff:30.8M  Started: [21:25:55]  Best share: 445K
--------------------------------------------------------------------------------
 [P]ool management [G]PU management [S]ettings [D]isplay options [Q]uit
 GPU 0:  71.0C 3138RPM | 717.3K/717.3Kh/s | A:2555 R:29 HW:0 U:20.00/m I:13
 GPU 1:  63.0C 3099RPM | 710.1K/711.0Kh/s | A:2564 R:28 HW:0 U:20.07/m I:13
 GPU 2:  72.0C 3070RPM | 714.9K/716.1Kh/s | A:2602 R:20 HW:0 U:20.37/m I:13
 GPU 3:  69.0C 3053RPM | 713.7K/714.6Kh/s | A:2585 R:22 HW:0 U:20.24/m I:13
--------------------------------------------------------------------------------