CoinAxis

  • Home
    Home This is where you can find all the blog posts throughout the site.
  • Categories
    Categories Displays a list of categories from this blog.
  • Tags
    Tags Displays a list of tags that have been used in the blog.
  • Login
    Login Login form

How to Configure Cgminer for Bitcoin-Litecoin (Linux)

Posted by on in Tutorials
  • Font size: Larger Smaller
  • 2 Comments
  • Print

How to configure Cgminer to mine bitcoin, and litecoin.

This seems to be a popular issue with mining crypto-currencies.  There are many nuances to get your mining configuration correct, and running stable.  Much of this is found by trial and error, because everyone's system is different.  Not to mention, each GPU has it's own personality, two identical gigabyte 7970 GPU's may behave quite differently.  Then, to make things more complex is the nature of the types of coins you are mining.  Mining bitcoin, is different than mining litecoin.  Cgminer will need to be configured properly for each coin network.

System details

b2ap3_thumbnail_GGBT-Top.jpg


Motherboard: ASUS M5A99FX PRO

Processor: AMD FX 6100 6-Core Processor

Memory/RAM: Corsair Vengeance 8GB

Power Supply: Cooler Master Silent Pro M - 1000W 80 PLUS Bronze Power Supply

Graphics card: Gigabyte AMD Radeon HD 7970

Operating system:  Xubuntu 12.04

AMD Drivers: 13.8 Beta

AMD SDK: 2.8.1.0

AMD ADL: 5.0

Cgminer: 3.3.1

 

Overview

This configuration of cgminer, I will be using a Gigabyte AMD 7970 GPU, running on Linux.  Windows configuration will be significantly different, and will be in a separate tutorial.  I am using a compiled version of cgminer for this tutorial, and there should be no difference between that, and running a binary of the same version.  This tutorial is assuming you have your AMD drivers, SDK, ADL etc... already installed, and ready to go.  

System pre-check

We need to verify that cgminer recognizes your graphics card.  In terminal, navigate to the cgminer directory.  Then enter this command:

./cgminer -n

This will return a result that should look like this:

b2ap3_thumbnail_cgminerTermcheck_022.png

Verify that there are no errors.  If this is the case, then there is issues with your Linux/AMD driver configuration.  Now that we have verified cgminer is recognizing our graphics card.  We will need to create two files.

cgminer.conf
cgminer.sh

First, open your file manager, and navigate to your cgminer directory.  Inside copy the file example.conf.  Then navigate to your home directory, this is also where your cgminer directory should be located.  Inside your home directory you will find a .cgminer directory.  This is hidden directory Ctrl+H will expose all hidden files within in the directory.  Or, you may go to View>Show Hidden Files.  Paste the example.conf you previously copied into the .cgminer directory.  Then rename your example.conf to cgminer.conf.  This will be where the default settings for cgminer will be stored.  It will access it every time you start cgminer.

Open your newly renamed cgminer.conf.  This will give you a good head start on creating your .conf file.  Depending on how you want to configure your mining rig, these settings can be static, or dynamic.  You can find all of the possible commands inside the cgminer directory, in the "README" & "SCRYPT-README" files.

b2ap3_thumbnail_cgminer-file.png  b2ap3_thumbnail_cgminer020.png  b2ap3_thumbnail_cgminer019.png

I use basic settings when I first mine with a new card.  For this example, I've modified my cgminer.conf with my pool information (p2pool).  Knowing that I'm installing a AMD 7970 for the first time, I will add either the stock gpu-clock & gpu-memory settings, or something close to it.  I don't want to over clock too high on the first go.  Here are my initial settings for litecoin (note that I did not include the "Thread-Concurrency" setting, we need to see how cgminer recognizes the TC count automatically first -- Shown below).

b2ap3_thumbnail_cgminer.conf_002.png  

Inside your file manager, navigate to your cgminer directory.  Right mouse click, Create Document>Empty File.  Name the file cgminer.sh  This file will contain the startup script for your computer, and cgminer settings.  It should contain the following information:

b2ap3_thumbnail_cgminer_001.png

Inside the script file, I automatically delete the .bin file.  I do this every time cgminer starts up.  By not deleting your .bin file, it can be the source of many problems.  The .bin file stores information about your settings.  It's good practice to automatically delete this file.  The settings are as follows:

export GPU_USE_SYNC_OBJECTS=1
export GPU_MAX_ALLOC_PERCENT=1
export DISPLAY=:0
find *.bin -delete
sleep 5
./cgminer

Now, we need to make the cgminer.sh executable.  Do this by going into terminal, navigate to the cgminer directory (where the cgminer.sh is located), and enter the following command:

chmod +x cgminer.sh

Now that we have our cgminer.conf and cgminer.sh we can begin adjusting our cgminer settings, and optimize our card.

Initialize cgminer - Litecoin

Now it's time to start cgminer for the first time.  We will Open terminal, navigate to the cgminer directory, then execute the cgminer.sh with the following command:

./cgminer.sh

Once cgminer starts up, let it run for a few minutes to see what the hash rate, and temperature is.  Take note of this information.  Press "q" to quit cgminer.  In your file manager, navigate to the cgminer directory, and look for the scrypt.bin file.  In the file name, we will find the "Thread Concurrency" that cgminer has automatically established for the GPU.  We will use this number in our cgminer.conf file.

b2ap3_thumbnail_cgminer_firstset.png  b2ap3_thumbnail_cgminer-scryptfile.png

As you can see, the Thread Concurrency cgminer generated for my GPU is "22272".  Now we can add this to our cgminer.conf.  We will use this Thread Concurrency as our starting point. Note that we may change this later, if we can get a performance benefit.

b2ap3_thumbnail_cgminerconf-TCset.jpg

Fine Tuning

We now have a good starting point, we can now start to over clock the settings to get the best performance out of the card.  In a previous picture, I showed cgminer hashing around 660 Kh/s @ 67C, with the memory clock set at 1400, and the engine clock set to 1000.

b2ap3_thumbnail_cgminer_adjust.png

In terminal start cgminer again, by running the cgminer.sh.

Give cgminer a couple of minutes to start up, and settle on a steady hash rate.  Once this happens, press the "G" key.  This will bring up the GPU adjustment settings.  Then press "C" to change the gpu settings.  You will see the selection menu for the GPU card.  We will start with the memory settings - select "M".  It will prompt you to enter the GPU memory clock speed value. We already know that the mem-clock is set at 1400.  I will increase it to 1450, and press enter.  I will let cgminer run at this setting for a couple of minutes, while taking note of the stable hash rate increase.  If cgminer seems stable, let's increase the mem-clock to 1500....wait a couple minutes...and take note of the hash rate again.  I will continue to do this until cgminer locks up, or the hash rate dramatically drops.  Then I will back the mem-clock number down by 10.

 

My mem-clock settings seemed to be the best between 1490 - 1500.  Now it's time to adjust the gpu-engine. From the main page on cgminer, press "G", then press "C", the press "E" to change the gpu-engine speed.  For this I will increase the speed in increments of 15, waiting for a couple of minutes, and taking note of the results.  Once cgminer locks up, or the hash rate drops significantly, that is where you will finalize your gpu-engine setting. 

Things to watch out for

While fine tuning you may run into some of these frequent issues.  This typically happens on mining litecoin, or other scrypt coin.  Scrypt is more memory/bandwidth intensive than bitcoin.  You will notice the difference in the speed of hashing between bitcoin and litecoin.  If you were to achieve 700 Mh/s (mega-hashes-per second) on bitcoin.  You will achieve around 700 Kh/s (kilo-hashes-per second) while mining litecoin.  This is due to the differences in the proof of work scheme that litecoin utilizes.

In my testing, I had my Thread Concurrency set at 22272.  Mem-clock@ 1500, Engine-clock@1100.  The best Kh/s I achieved with these settings averaged around 680 Kh/s.  By simply lowering my Thread Concurrency to 8192, and keeping the same Mem & Gpu clocks the same (1500/1100), I then averaged 735 Kh/s.  This is a significant increase in hashing power, just by adjusting a single setting.  In some cases (not all), higher thread concurrency has negative effect on your hashing power.

If you must adjust your Thread Concurrency, do so in increments of 1024.  I rarely find a need to adjust the Intensity level, while using AMD 7970 GPU's.  They seem to operate the best using 2 gpu-platorm, and an Intensity of 13.  

Final Settings

b2ap3_thumbnail_Final_Conf_Tutorial_7970L.jpg  b2ap3_thumbnail_Cgminer_Final_tutorial.jpg

My cgminer.conf in an easy to copy/paste format - Litecoin:

{
"pools" : [
{
"url" : "192.168.XX.XX:9327",
"user" : "username",
"pass" : "password"
}
],
"intensity" : "13",
"vectors" : "1",
"worksize" : "256",
"kernel" : "scrypt",
"lookup-gap" : "2",
"thread-concurrency" : "8192",
"shaders" : "0",
"gpu-engine" : "1100",
"gpu-fan" : "85",
"gpu-memclock" : "1500",
"gpu-memdiff" : "0",
"gpu-powertune" : "0",
"temp-cutoff" : "95",
"temp-overheat" : "85",
"temp-target" : "75",
"api-port" : "4028",
"expiry" : "120",
"gpu-dyninterval" : "7",
"gpu-platform" : "0",
"gpu-threads" : "2",
"log" : "5",
"no-pool-disable" : true,
"queue" : "1",
"scan-time" : "30",
"scrypt" : true,
"temp-hysteresis" : "3",
"shares" : "0",
"kernel-path" : "/usr/local/bin"
} 

Initialize cgminer - bitcoin

Now it's time to start cgminer for the first time.  We will Open terminal, navigate to the cgminer directory, then execute the cgminer.sh with the following command:

./cgminer.sh

I entered in the stock GPU settings into my cgminer.conf file (GPU Engine 1100, Mem Clock: 1350).  Once cgminer started, I took note of the hashing speed, and temperature.  My first settings yielded around 650 Mh/s @ 64C.   

b2ap3_thumbnail_cgminerconf_BTC-default.jpg  b2ap3_thumbnail_cgminer_btc_default.jpg

Fine Tuning

Fine tuning your GPU to mine bitcoin is a little more straight forward, than litecoin.  Inside cgminer, press the "G" key.  Then, press the "C" key.  This will place you at the main settings window, and we can start to adjust the settings.  The first thing that I do, is lower the memory clock as far as possible.  By pressing "M", then enter lower memory setting.  I usually start at 1000, then move downwards.  Using Linux, I was only able to lower my memory settings to 950, so this is my mem-clock setting I started with.  (Note:  High memory clock speed is not necessary for mining bitcoin.  This is the opposite of litecoin).  

The adjustment of the gpu settings using linux is not the same as using windows.  There are some definite limitations.  When I increased the engine clock, the memory clock would reset to the default mem-clock settings.  For example, I increased the gpu-engine to 1160, and I had to increase the mem-clock to 1015 for it to hold.  That's up significantly from the E:1100/M950 settings It was at before.  So be aware about this quirk.

Final Settings

My final settings are gpu-engine: 1130, mem-clock: 980.  These settings seemed stable and yielded around 680 Mh/s @ 64C.  

b2ap3_thumbnail_cgminerCONF_BTC_final.jpg  b2ap3_thumbnail_cgminer_BTC_final.jpg

My cgminer.conf in an easy to copy/paste format - bitcoin

{
"pools" : [
{
"url" : "Pool address",
"user" : "username",
"pass" : "password"
}
],
"intensity" : "8",
"gpu-engine" : "1130",
"gpu-fan" : "85",
"gpu-memclock" : "980",
"gpu-memdiff" : "0",
"gpu-powertune" : "20",
"gpu-vddc" : "1.112",
"temp-cutoff" : "95",
"temp-overheat" : "85",
"temp-target" : "75",
"api-port" : "4028",
"expiry" : "120",
"gpu-dyninterval" : "7",
"gpu-platform" : "0",
"gpu-threads" : "2",
"log" : "5",
"no-pool-disable" : true,
"queue" : "1",
"scan-time" : "60",
"temp-hysteresis" : "3",
"kernel" : "poclbm",
"kernel-path" : "/usr/local/bin"
}

If you are just getting started with Linux, you can read the tutorial on how to: Install, and build cgminer to work on Linux.

If this tutorial helped you, then please consider sharing on facebook/twitter/google+ and/or making a donation by purchasing something from our store, or donation page.  Thank You

Register at coinaxis, to stay on top of bitcoin & litecoin news, read informative articles, tutorials, and reviews. By joining, you can receive discounts on products, and/or ask the community questions in our forum.

Last modified on
Rate this blog entry:
5

People in this conversation

Leave your comments

Post comment as a guest

0 / 1000 Character restriction
Your text should be in between 10-1000 characters

Popular Articles

How to Configure Cgminer for Litecoin & Bitcoin (Windows 8)
Tutorials
Rate this blog entry:
13
How To Configure Linux, and build Cgminer for bitcoin and litecoin.
Tutorials
Rate this blog entry:
7
How to Configure Cgminer for Bitcoin-Litecoin (Linux)
Tutorials
Rate this blog entry:
5
How To Buy Litecoin - CoinAxis
Tutorials
Rate this blog entry:
11
Google+