Pages:
Author

Topic: [LTC] Cudaminer setup on Linux howto - page 2. (Read 18572 times)

newbie
Activity: 26
Merit: 0
May 12, 2013, 03:40:31 PM
#2
Thanks for the guide, got it running on a Ubuntu 13.04 AMD64 with GTS450 system. 66khash/s on a GTS450.. Wink
newbie
Activity: 7
Merit: 0
May 07, 2013, 04:38:59 PM
#1
Hi,

I originally intended to post this as an answer to the LTC/cudaminer thread but apparently as a newly registered user I am not allowed to post anywhere except here - hopefully an admin can move that to the LTC forum/the cudaminer thread ?

Anyway, I compiled and set up cudaminer (for LTC mining) on a Linux amd64 Debian Squeeze system and thought I would post the procedure here as it was not completely straightforward Wink

First of all: you need a recent official nvidia linux driver. Without it, the cudaGetDeviceCount function will return 32767 (the max value of an unsigned int, but not any proper cuda error code that I can see), and various other functions will fail as well - at best, you'll get a floating point exception, at worst cudaminer will segfault. The latest version as of this writing, 319.17 (download here: http://us.download.nvidia.com/XFree86/Linux-x86_64/319.17/NVIDIA-Linux-x86_64-319.17.run), works perfectly.

You also need CUDA 5 - any older version will not support the compute_35 GPU architecture target for nvcc, and cudaminer requires it for compiling. The problem is, if you're using the latest stable version of Debian (or other stable distributions), CUDA 5 is not available - the only version available, including in backports, is CUDA 4.

If you're using the latest ubuntu or any other "cutting edge packages" distribution: you most likely have CUDA 5 in your official repositories. Just install it through apt-get/aptitude, yum or whatever and scroll down below to the actual compiling of cudaminer.

If you're not: you need to install CUDA 5 on an "older" system (like Debian Squeeze). Fortunately, there is a way to do this. Perform the following:

For 32 bits: wget http://developer.download.nvidia.com/compute/cuda/5_0/rel-update-1/installers/cuda_5.0.35_linux_32_ubuntu10.04-1.run
For 64 bits: wget http://developer.download.nvidia.com/compute/cuda/5_0/rel-update-1/installers/cuda_5.0.35_linux_64_ubuntu10.04-1.run

You can also use aria2c -j 5 with any of the aforementionned URL to speed up the download if necessary (install aria2 prior to doing that).
Let's assume INSTALLSCRIPT is the name of the file you just downloaded (should be cuda_5.0.35_linux_32_ubuntu10.04-1.run for 32 bits and cuda_5.0.35_linux_64_ubuntu10.04-1.run for 64). Do:

chmod +x INSTALLSCRIPT
sh INSTALLSCRIPT --extract=/absolute/path

To extract the various installers script from the main installer. For example:

# cd /root
# mkdir cuda5
# wget http://developer.download.nvidia.com/compute/cuda/5_0/rel-update-1/installers/cuda_5.0.35_linux_64_ubuntu10.04-1.run
# sh cuda_5.0.35_linux_64_ubuntu10.04-1.run --extract=/root/cuda5

Wait for it to finish. You should have three files: a "cuda-samples*run" file, which installs the CUDA sample programs; a "devdriver_5.0*run" file, which install the development drivers; and a "cudatoolkit_5.0*run" file, which installs the CUDA toolkit itself (including necessary libs and nvcc).
We're only interested in the last one here (although if you are interested in experimenting with CUDA development, I suggest installing the cuda samples as well  Smiley).
Therefore, do:

chmod +x cudatoolkit_5.0*run
./cudatoolkit_5.0*run

This will launch the CUDA toolkit installation. The script will ask you several questions, amongst other things where to install the toolkit. By default, it will install it in /usr/local/cuda-5.0. I suggest using /opt/cuda-5.0 instead, but whatever. Also, it will ask you wether or not you wish to have a symlink from the installation directory to /usr/local/cuda created - say yes.

You now have the CUDA toolkit installed, even if using an older distribution/system. You can delete all the (weighty) .run files now. The rest is pretty easy:

- Download the latest cudaminer archive.
- Unzip it. Inside is an archive containing the zip file with the source code. Unzip that zip file.
- Go to the extracted source code directory.
- You'll now need to compile cudaminer itself. In order for this to work, you'll need to set up your LD_LIBRARY_PATH and PATH env variables so that the Makefile will be able to find the proper CUDA libraries and binaries (for example, nvcc). Assuming CUDA_INSTALLDIR is the directory where you've installed the CUDA toolkit (should be /usr/local/cuda-5.0 by default, could be /opt/cuda-5.0 too), do:

export LD_LIBRARY_PATH="CUDA_INSTALLDIR/lib64"
...if you're on a 64bits system
and:
export LD_LIBRARY_PATH="CUDA_INSTALLDIR/lib"
...if 32 bits

Then do:

export PATH="CUDA_INSTALLDIR/bin:$PATH"

You can now compile cudaminer. In the extracted source directory, do:

chmod +x ./configure
./configure

(this will tell you if you're missing some other libraries to compile - use your package manager to install those as needed)

Then do:

make

Remark: if at that point, you get an error related to cc1plus not being found or similar, for example:

Code:
error trying to exec 'cc1plus'

Then you either do not have g++ installed or you have a too recent version of g++ (it needs to be < 4.7 and possibly 4.6 for CUDA5.0 to compile). If that is the case, install for example g++ 4.4 using your package manager (apt-get install g++-4.4 under debian/ubuntu for example). Then do:

Code:
export CXX=g++-4.4
export CC=gcc-4.4

Before doing ./configure and make to specify that you wish to use g++/gcc 4.4. This should fix the problem. Thanks MrEHQE for the feedback on this Smiley

- Finally, you can execute cudaminer. For example:

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

(refer to the official cudaminer thread and readme for more details on the usage of cudaminer itself)

As an example, the following set of commands should compile and execute cudaminer properly on an amd64 system if the cuda toolkit has been installed as described above, and assuming you've got the latest cudaminer, cudaminer-2013-04-30.zip, in the current working directory:

$ unzip cudaminer-2013-04-30.zip
$ cd cudaminer-2013-04-30
$ unzip cudaminer-src-2013.04.30.zip
$ cd cudaminer-src-2013.04.30
$ chmod +x configure
$ export LD_LIBRARY_PATH="/usr/local/cuda/lib64"
$ export PATH="/usr/local/cuda/bin:$PATH"
$ ./configure
$ make
$ ./cudaminer -d 0 -i 0 --benchmark

Note that you'll need to do:

export LD_LIBRARY_PATH="/usr/local/cuda/lib64"

each time you wish to execute cudaminer in the future (include this in your .bashrc file to avoid the hassle if you wish). You can also of course do:

LD_LIBRARY_PATH="/usr/local/cuda/lib64" ./cudaminer ...

Hopefully this'll help other Linux users :-)
Pages:
Jump to: