Experimentations With Litecoin (Part 2)

Sunday, August 11, 2013
By Kevin

AMD logo

Litecoin: GPU or Bust

In part 1 of my report out I gave an introduction to Litecoin and described the basics of what I did to build an initial mining setup. In part 2, I'll dive into the world of GPU mining and show you what it takes to get at least one video card up and running.

GPU Selection

Space

The first step in selecting a GPU is to figure out what kind of card will physically fit in your case. You need to have some knowledge of your motherboard and what slots are available for use. Most of the popular video cards are double-wide, which means they take up the space of two card slots. The video cards can be pretty long so make sure you have plenty of space around all the other cards, cabling, and drives inside your rig. They also can run hot so make sure you have ample air movement within your case.

Power

The second consideration is your power supply. Adding a video card and running it 24-7 will put a constant draw on your power supply. It's probably best to measure your current power consumption and subtract that from your power supply's rating. I used the Belkin Energy Cost Monitor to measure my power consumption.

The resulting value is the amount of power you have left to run a video card. Don't forget to allow a little margin. The values I found for Max Power Draw are a bit low.

Shopping

With your power budget and space constraints in mind you can start looking around for a video card. Most people recommend sticking with AMD video cards. Here are a couple resources I found useful:

The hashing rates reported on that wiki page are a bit high. I went with a Sapphire Radeon HD 5870 card with 1 GB of memory and I can only get about 312 Kh/s out of the card which is no where near the 400+ Kh/s values that some people are reporting. Hashing rate depends on a lot of things: driver version, OS, and mining software to name a few. Your mileage may vary.

My plan is to buy two of these cards since they fit well into my power budget, they're fairly efficient, and cost around $100 on eBay. I've already purchased one for $91.

Software Installation

Now that you have the hardware, you'll need some software. This comes in two parts: a video driver and the mining software.

AMD Catalyst Driver

The AMD Catalyst Driver needs to be install by hand. AMD's licensing model doesn't allow pre-built versions of this package. For installation, I followed the steps outlined in this Ubuntu Raring Installation Guide.

For my installation, I used the following versions of software:

  • AMD APP SDK 2.8
  • ADL SDK 5.0
  • AMD Catalyst 13.4

Mining Software

The GPU-based mining software is called cgminer. There are several guides out there explaining how to install this, but here are the basic instructions:

1.Install library dependencies:

  sudo apt-get install libcurl4-openssl-dev libncurses5-dev pkg-config automake yasm

2.Download and extract the AMD APP SDK from AMD's developer web site:

  tar xzf AMD-APP-SDK-v2.8.1.0-lnx64.tgz
  sudo ./Install-AMD-APP.sh

3.Download cgminer source code from github:

  git clone git://github.com/ckolivas/cgminer.git

4.Before compiling, install the AMD ADL SDK following the instructions in cgminer/ADL_SDK/readme.txt.

5.Compile the cgminer application

  ./autogen.sh
  ./configure --enable-scrypt
  make

Up-and-running

At this point, hopefully you have the video card drivers installed and cgminer compiled and ready to go.

Card Detection

You can test out your progress using the -n option to cgminer:

sudo cgminer -n

This should list all the available GPU devices. The first time I ran that command I received the following output:

  [user@computer ~ 0]$ sudo bin/cgminer -n
   [2013-08-11 12:17:55] CL Platform 0 vendor: Advanced Micro Devices, Inc.                    
   [2013-08-11 12:17:55] CL Platform 0 name: AMD Accelerated Parallel Processing                    
   [2013-08-11 12:17:55] CL Platform 0 version: OpenCL 1.2 AMD-APP (1124.2)                    
   [2013-08-11 12:17:55] Platform 0 devices: 2                    
   [2013-08-11 12:17:55]  0       Cypress                    
   [2013-08-11 12:17:55]  1       Juniper                    
   [2013-08-11 12:17:55] Failed to ADL_Adapter_ID_Get. Error -1                    
   [2013-08-11 12:17:55] Failed to ADL_Adapter_ID_Get. Error -1                    
   [2013-08-11 12:17:55] ADL found less devices than opencl!                    
   [2013-08-11 12:17:55] There is possibly more than one display attached to a GPU                    
   [2013-08-11 12:17:55] Use the gpu map feature to reliably map OpenCL to ADL                    
   [2013-08-11 12:17:55] WARNING: Number of OpenCL and ADL devices did not match!                    
   [2013-08-11 12:17:55] Hardware monitoring may NOT match up with devices!                    
   [2013-08-11 12:17:55] 2 GPU devices max detected

Notice the error about "ADL found less devices than opencl"? It means that OpenCL was able to enumerate all of my video cards, but the ADL library was not. I was still able to run cgminer at a decent rate, but I was not able to monitor or control things like GPU temperature, memory or GPU clock speed, and fan speed. This problem took me a few evenings of experimentation and googling to figure out. As it turns out, the solution was simple: make sure you have an X server running.

I'm running on Ubuntu Server Edition 13.04 so this doesn't happen by default. You can find instructions on install an X server on this Ubuntu wiki document. I opted for the basic X11 environment and just installed the xorg package.

Before you run any cgminer command, make sure you have an X server running. I start mine with:

  sudo xinit

With an X server running, I now get the following output:

  [user@computer ~ 0]$ sudo ~/bin/cgminer -n
   [2013-08-11 12:26:30] CL Platform 0 vendor: Advanced Micro Devices, Inc.                    
   [2013-08-11 12:26:30] CL Platform 0 name: AMD Accelerated Parallel Processing                    
   [2013-08-11 12:26:30] CL Platform 0 version: OpenCL 1.2 AMD-APP (1124.2)                    
   [2013-08-11 12:26:30] Platform 0 devices: 2                    
   [2013-08-11 12:26:30]  0       Cypress                    
   [2013-08-11 12:26:30]  1       Juniper                    
   [2013-08-11 12:26:30] ADL Initialisation Error! Error -1!                    
   [2013-08-11 12:26:30] 2 GPU devices max detected

The ADL initialization error I've been able to ignore. I seem to have full monitoring and control of my video card through cgminer.

Tweaking and Tuning

Tuning your video card can be quite an endeavor. There's a really good guide that comes with the cgminer git clone download named SCRYPT-README. One option is to take some time and read through that guide. A second option is to google for other people that are minging Litecoins with your video card and use their settings. A third, less optimal option is to just let cgminer call the shots and take the hashing rate that it gives you.

I did all the above and ended up with these options:

  cgminer --scrypt --auto-fan --temp-target 80 \
    --gpu-engine 885 --gpu-memclock 1250 \
    --shaders 1600 --worksize 256 \
    --intensity 18 --thread-concurrency 5824

Don't forget to add the --url and --userpass options for the pool that you chose to use. Also, there's a --benchmark option that you can (and should) use while tuning your settings.

Final Results

My final results with the Sapphire Radeon HD 5870 card was 312 Kh/s. That hashing rate for my pool results in about 2.5 Litecoins per week. When this video card is mining Litecoins, my power consumption averages around 320 Watts.

Using the Litecoin Mining Calculator from CoinWarz I punched in all my numbers and came up with some surprising results. Looks like I'll be "losing" $0.93 per week.

That's the bad news. The good news is that I'm not done yet! In part 3 I'll go into some tweaks that I made to my system and report out my final numbers.