After being busy with buying a house, moving and then having to replace desktop's power supply, I decided to get back into crypto mining. I realize that 2015 is a bit past the prime for GPU mining the major scrypt cryptos (with the release of scrypt ASICs), so this will be more useful for mining lesser-knows altcoins.
Getting cgminer
running on Linux along with the AMD drivers and SDKs is not a straightforward task, so I wanted to write this guide for fellow crypto mining enthusiasts.
I had trouble getting cgminer
working with the most recent Catalyst drivers and AMD SDKs, so I had to search around for versions that worked best for crypto mining on Linux. I found the specific software versions here: http://infinitecointalk.org/index.php?topic=1128.0
AMD/ATI configuration
Software you need:
- AMD Catalyst v13.12 GPU driver
- AMD APP (Accelerated Parallel Processing) v2.9
- ADL (AMD Display Library) SDK v6.0
Install Catalyst:
unzip amd-catalyst-13.12-linux-x86.x86_64.zip
sudo ./amd-catalyst-13.12-linux-x86.x86_64.run
- Choose the option to install driver, with automatic installation options
- Reboot
Install APP SDK:
tar -xvf AMD-APP-SDK-linux-v2.9-1.599.381-GA-x64.tar.bz2
sudo ./AMD-APP-SDK-v2.9-1.599.381-GA-linux64.sh
- Use default location
/opt
, which installed the SDK on my machine to/opt/AMDAPPSDK-2.9-1
- Reboot (again)
Initial graphics card configuration:
sudo aticonfig --adapter=all -f --initial
- Reboot (for the last time)
Check graphics card settings:
sudo aticonfig --lsa
You should get output in your terminal like this:
* 0. 01:00.0 AMD Radeon HD 7800 Series
* - Default adapter
If that's what you see, then your GPU is good to go! Otherwise, go back over the previous steps to make sure you didn't miss anything.
cgminer
Download cgminer
Use apt-get install git
if you don't have git
on your machine already.
git clone https://github.com/Kalroth/cgminer-3.7.2-kalroth.git
mv cgminer-3.7.2-kalroth/ cgminer
Copy ADL SDK include files to cgminer directory
cp /home/USER/ADL_SDK/include/* /home/USER/cgminer/ADL_SDK/
Compile cgminer
cd cgminer
run ./autogen.sh
Disregard the OpenCL...............: Detection overrided. GPU mining support DISABLED error.
You will take care of enabling OpenCL with the next command.
CFLAGS="-O2 -Wall -march=native -I /opt/AMDAPPSDK-2.9-1/include/" LDFLAGS="-L/opt/AMDAPPSDK-2.9-1/lib/x86_64" ./configure --enable-opencl --enable-scrypt
Note: if you are running 32-bit Ubuntu, change the /opt/AMDAPPSDK-2.9-1/lib/x86_64
path to /opt/AMDAPPSDK-2.9-1/lib/x86
.
If the previous command fails, check the APP SDK path to make sure it's correct. The default install location for me was /opt/AMDAPPSDK-2.9-1/
.
Run make to compile cgminer
:
make
You're ready to mine!
After installing you have to set some environment variables to get the correct performance out of your card.
Run the following four commands:
export DISPLAY=:0
export GPU_USE_SYNC_OBJECTS=1
export GPU_MAX_ALLOC_PERCENT=100
export GPU_MAX_HEAP_SIZE=100
I created an executable that I can run to set all of these variables at once. I find this makes it easier to start mining after rebooting.
vim export-settings
Paste the following into vim
:
#!/bin/bash
export DISPLAY=:0
export GPU_USE_SYNC_OBJECTS=1
export GPU_MAX_ALLOC_PERCENT=100
export GPU_MAX_HEAP_SIZE=100
Update the file to make it executable:
chmod +x export-settings
Run the export-settings
file, then start cgminer
with your pool URL and credentials:
./export-settings
./cgminer -o stratum+tcp://pool.com:3000 -u USERNAME -p PASSWORD --config cgminer.conf
Using a cgminer.conf
file isn't necessary, but it really cuts down on the arguments you have to run every time you start cgminer
. Here are the contents of my cgminer.conf
:
{
"scrypt" : true,
"kernel-path" : "/usr/local/bin",
"auto-gpu" : true,
"temp-cutoff" : "80",
"temp-overheat" : "75",
"temp-target" : "70",
"gpu-engine" : "1050",
"gpu-memclock" : "1450",
"gpu-threads" : "2",
"intensity" : "17",
"thread-concurrency" : "7168",
"worksize" : "256"
}
I like to mine a bunch of different cryptocurrencies, so I create shell scripts in my cgminer
directory, that way I don't have to pass in the pool URL and my user credentials every time. For example, I have litecoin
, dogecoin
, hobonickels
, and bottlecaps
scripts that I will run when I want to mine that crypto.
Here's what my hobonickels
shell script looks like:
#!/bin/bash
./cgminer --scrypt -o stratum+tcp://stratum.hbn.theblocksfactory.com:3336 -u GenBurnside.gpu -p x -I 17 --config ./cgminer.conf
Thanks for reading, and happy mining! Please let me know if you have any problems, suggestions, updates, complaints, or anything else.