Thursday, December 26, 2013

Compiling CudaMiner on Fedora 20

Are you interested in getting into the scrypt based cryptocurrency mining game, but only have a lowly Nvidia card? Lucky for you, it is entirely possible to mine scrypt based coins (eg. Litecoin, Feathercoin) using an Nvidia GPU. CudaMiner makes it possible.


While not particularly competitive in coin mining performance, mining with an Nvidia card can still be a fun way to dabble in the world of cryptocurrency without  investing in any new hardware.

This guide assumes you have Nvidia's CUDA setup. If you don't, you can follow my other guide.

There are several dependencies we need to get squared away:

# yum install automake gcc gcc-c++ glibc-devel libcurl-devel openssl-devel git

Now, checkout the latest copy of CudaMiner into the directory you want to work in (note, people have reported all manner of performance variations between different versions of CudaMiner, feel free to play around with versions):

$ git clone https://github.com/cbuchner1/CudaMiner.git

This should have cloned the CudaMiner source into a 'CudaMiner' directory.

Now, export the CUDA environment variables, and do an autogen and configure:

$ export PATH=/usr/local/cuda-6.0/bin:$PATH
$ export LD_LIBRARY_PATH=/usr/local/cuda-6.0/lib64:$LD_LIBRARY_PATH
$ cd CudaMiner/
$ ./autogen.sh
$ ./configure 

The Makefile generated by the above does not properly pull in the use dynamic libraries linker option ('-ldl'), so we need to modify the Makefile.

Open the Makefile in your text editor of choice, and edit the LDFLAGS line to include '-ldl'. My generated Makefile didn't specify any LDFLAGS, so my LDFLAGS line looks like the one below:

LDFLAGS = -ldl

Once you have made the above changes you are ready to build:

$ make

When compiling is complete, you can test your install:

$ ./cudaminer -d 0 -i 0 --benchmark

If you see something like:

       *** CudaMiner for nVidia GPUs by Christian Buchner ***
                 This is version 2013-12-18 (beta)
    based on pooler-cpuminer 2.3.2 (c) 2010 Jeff Garzik, 2012 pooler
           Cuda additions Copyright 2013 Christian Buchner
       My donation address: LKS1WDKGED647msBQfLBHV3Ls8sveGncnm

[2013-12-18 21:34:30] 1 miner threads started, using 'scrypt' algorithm.
[2013-12-18 21:34:59] GPU #0: GeForce GTX 560 with compute capability 2.1
[2013-12-18 21:34:59] GPU #0: interactive: 0, tex-cache: 0 , single-alloc: 0
[2013-12-18 21:34:59] GPU #0: Performing auto-tuning (Patience...)
[2013-12-18 21:34:59] GPU #0: maximum warps: 409
[2013-12-18 21:36:55] GPU #0:  139.52 khash/s with configuration F84x4
[2013-12-18 21:36:55] GPU #0: using launch configuration F84x4
[2013-12-18 21:36:55] GPU #0: GeForce GTX 560, 10752 hashes, 0.07 khash/s
[2013-12-18 21:36:55] Total: 0.07 khash/s
[2013-12-18 21:36:55] GPU #0: GeForce GTX 560, 10752 hashes, 66.38 khash/s
[2013-12-18 21:36:55] Total: 66.38 khash/s
[2013-12-18 21:36:58] GPU #0: GeForce GTX 560, 333312 hashes, 130.03 khash/s
[2013-12-18 21:36:58] Total: 130.03 khash/s

You are ready to start mining. Google up a mining guide for  your scrypt coin of choice, and have a ball. Keep in mind, you will have to eventually either set up the CUDA paths in your '.bashrc', or you will have to export them every time you want to run CudaMiner. Alternatively, you can use a script similar to the one below:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
CUDA_BIN_PATH=/usr/local/cuda-6.0/bin
CUDA_LD_PATH=/usr/local/cuda-6.0/lib64

STRATUM=YOUR_POOLS_STRATUM
USERNAME=YOUR_POOL_USERNAME
PASSWORD=YOUR_POOL_PASSWORD

export PATH=.:$CUDA_BIN_PATH:$PATH
export LD_LIBRARY_PATH=$CUDA_LD_PATH:$LD_LIBRARY_PATH

cudaminer -H 1 -d 0 -i 0 -o stratum+tcp://$STRATUM -O $USERNAME:$PASSWORD

If this helped you, you can tip me in BTC: 18ymUR1XyZ68NCzjrzYtMRP2ztk8LjAgBL

Otherwise, feel free to ask questions in the comments.

Update 2014-3-20:
Sometime after 2014-02-04, the CudaMiner devs added OpenSSL support. This is a good thing. Unfortunately, this does not get configured properly on Fedora (I'm guessing all Linuxes are impacted). While I am able to fix the Makefile (install openssl-devel, add -lcrypto to LDFLAGS in Makefile), they added Keccak support around the same time. I have not had the time to figure out how to get Keccak enabled CudaMiner to compile on Fedora. If I do, I will add another update to this post.

For now, if you don't need Keccak or OpenSSL support, you can checkout a tag that compiles. After the git clone step above, do:


$ cd CudaMiner
$ git checkout 2014-02-02

And proceed as normal.


Update 2014-4-8:
I've had some more time to look at this, and have figured out how to get the latest git version to compile. I've updated the post to reflect this. Special thanks to the folks in this bug report.


Update 2014-7-12:
I've updated this to reflect the fact CUDA 6 is out. It can be installed using my CUDA on Fedora 20 guide.

8 comments:

  1. when i try to make i get returned.

    /usr/bin/ld: cudaminer-cpu-miner.o: undefined reference to symbol 'SHA256@@libcrypto.so.10'
    /usr/bin/ld: note: 'SHA256@@libcrypto.so.10' is defined in DSO /lib64/libcrypto.so.10 so try adding it to the linker command line
    /lib64/libcrypto.so.10: could not read symbols: Invalid operation
    collect2: error: ld returned 1 exit status
    make[2]: *** [cudaminer] Error 1
    make[2]: Leaving directory `/home/jaison/CudaMiner'
    make[1]: *** [all-recursive] Error 1
    make[1]: Leaving directory `/home/jaison/CudaMiner'
    make: *** [all] Error 2

    ReplyDelete
    Replies
    1. Do you have 'openssl-libs' installed?

      # yum install openssl-libs

      What if you do:

      $ export LD_LIBRARY_PATH=/usr/local/cuda-5.5/lib64:/lib64:$LD_LIBRARY_PATH

      Before compiling?

      What version of Cudaminer are you trying to compile? The latest git revision?

      Delete
  2. I have openssl-libs

    Compiling latest git version 5.5. I did export that path initially. I went ahead and added it directly to my .bashrc and everything compiled just fine then. Thanks.

    ReplyDelete
    Replies
    1. can you expound on what you did?

      Delete
    2. I'm not Jai B, but I did get the latest git version of CudaMiner to compile. I've updated the post accordingly. Hopefully it works for you!

      Delete
  3. I'm having the same error and modifying my path statements has not resolved the error. I do also have openssl-libs installed. Could this be related to the kernel version? Any other ideas?

    Thanks,

    ReplyDelete
    Replies
    1. Kernel version shouldn't enter into it.

      You say you have openssl-libs installed, what about openssl-devel?

      # yum install openssl-devel

      Delete
    2. There are a couple of issues to work around.

      For now, I recommend deleting your download of CudaMiner, doing a fresh git clone, then following instructions in my post update.

      Delete