Linux tip, Fedora tip / howto: mining bitcoins and litecoins using an nVidia card

 
back to notes and tips index

Try my online puzzle page with Calcudoku, Killer Sudoku and printable Sudoku.

mining bitcoins and litecoins using an nVidia card

These are installation and running instructions for if you have a recent nVidia card (that supports CUDA), are running Linux (I got this to work for Fedora 15, but the instructions should be transferable to most distributions), and want to mine bitcoins (BTC) or litecoins (LTC).

All steps run as root unless otherwise noted.

Instructions for cudaminer, poclbm, and cgminer are provided.


Common steps

install CUDA 5.0

Download and install the appropriate package for your distribution from the CUDA downloads page.

The CUDA installer gives you the option to install the nVidia display driver, if you don't have one installed already.

To figure out if you need the 64 bit or 32 bit version, run:
uname -i
If it says "x86_64" then you need the 64 bit version.

Note: for cudaminer, you need to install the 32 bit version (!) For my 64 bit Fedora 15 setup, the Fedora 16 installer worked fine:

chmod 755 ./cuda_5.0.35_linux_64_fedora16-1.run ./cuda_5.0.35_linux_64_fedora16-1.run


mining LTC with cudaminer

Note that if you're running Fedora 14 or older, then your gcc compiler is too old to create CUDA 5.0 executables (I was able to upgrade my Fedora 13 install to Fedora 15 using the yum feature "distro-sync". If this applies to you, check out
this page).

As stated above, install the 32 bit version of CUDA 5.0 (so even if you're on a 64 bit system):

chmod 755 ./cuda_5.0.35_linux_32_fedora16-1.run ./cuda_5.0.35_linux_32_fedora16-1.run

You also need to install 32 bit versions of glibc-devel and libcurl-devel:

yum install glibc-devel.i686 yum install libcurl-devel.i686

Download the latest cudaminer package via the bitcointalk forum. The version I used was cudaminer-2013-04-10.zip (version 2013-04-12 works as well):

unzip cudaminer-2013-04-10.zip cd cudaminer-2013-04-10 unzip cudaminer-src-2013.04.10.zip cd cudaminer-src-2013.04.10 chmod 755 configure* Next, I found I had to create a lib64 symlink (as root): cd /usr/local/cuda ln -s lib lib64 Then (in the cudaminer-src-2013.04.10 directory): ./configure.sh make This process should leave you with a cudaminer executable that you could run like this (fill in appropriate values for <username> etc.): ./cudaminer -u <username>.<workername> -p <password> -o <http://pool.host.name:port> If you get an error about an unfound libcudart.so, then set LD_LIBRARY_PATH: setenv LD_LIBRARY_PATH /usr/local/cuda/lib (if you're running tcsh) export LD_LIBRARY_PATH=/usr/local/cuda/lib (if you're running bash)

If you run into any problems, send me a note using the form at the bottom of this page.


mining coins with poclbm

install PyOpenCL

Get the latest source by running: git clone http://git.tiker.net/trees/pyopencl.git (yum install git if you don't have git installed yet)

I have boost-python installed, and am not sure if it is required (to get it, run yum install boost-python).

I had to point the configure script to the OpenCL include directory:

cd pyopencl git submodule init git submodule update ./configure.py --cl-inc-dir=/usr/local/cuda/include make make install

install poclbm

This is a "PyOpenCL" bitcoin miner. To get the latest source: git clone https://github.com/m0mchil/poclbm.git

Next, run:

cd poclbm python setup.py build python setup.py install

create a mining pool account

There are lots of places where you can do this. Let's say you created an account called "coins" at coinotron.com.

In their "My Account" section, create a "Worker": for example, "first", with its password "apw", and pick LTC as the coin to mine.

The command to start mining would then be:

./poclbm.py stratum://coins.first:apw@coinotron.com:3334 -v -w 128

For bitcoins (BTC), change the port number to 3333.

ImportError: No module named serial.serialutil

If you get this error when trying to run poclbm.py install the pyserial package: yum install pyserial

TypeError: Error when calling the metaclass bases, function() argument 1 must be code, not str

If you get this error, then you're using an older version of poclbm.py: simply update by running git clone https://github.com/m0mchil/poclbm.git and installing again.


mining coins with cgminer

install cgminer

yum install libcurl-devel git clone https://github.com/ckolivas/cgminer.git cd cgminer setenv CPPFLAGS "-I /usr/local/cuda/include" (if you're running tcsh) export CPPFLAGS="-I /usr/local/cuda/include" (if you're running bash) ./autogen.sh ./configure --enable-scrypt make

run cgminer

Some environment variables that are recommended: setenv GPU_MAX_ALLOC_PERCENT 100 setenv GPU_USE_SYNC_OBJECTS 1 (use the EXPORT syntax if you're running bash)

Using the same account as in the above example, for mining litecoins:

./cgminer -o stratum+tcp://coinotron.com:3334 -u coins.first -p apw --scrypt and for mining bitcoins: ./cgminer -o stratum+tcp://coinotron.com:3333 -u username.workername -p workerpassword Do check the official README for more parameter setting info.

some results

On a GeForce GT440, for litecoins with scrypt enabled I'm getting about 7.5-8 KH/s with cgminer and poclbm, and about 31 KH/s with cudaminer (!)

Card temperature goes up to about 75-80 degrees Celsius (but I have a resistor sitting in front of the fan to reduce RPM, so this could be made cooler).

The only miner producing accepted hashes so far is cudaminer (so possibly I'm still doing something wrong with the setup of the other miners).

Problems?

Do let me know of any issues / error messages / etc. that you run into using the form below.


← back to notes and tips index
Please do not copy the text of this tip (© Patrick Min) to your web site.