CUDA Miner Installation on a fresh Ubuntu 14.04 LTS

Image

Step by Step Guide to Cuda Mining on Ubuntu 14.04 LTS (as simple as copy paste)

  1. After Ubuntu is installed and ready, click on the ubuntu icon on the side bar or press windows key on your keyboard type additional drivers and open the application. You will have 4 to 5 choices depending on your nvidia graphics card
    • Either select the one which has recommended
    • Or choose the one which says tested
  2. Apply the changes and wait for it to install. Once it is installed press Ctrl + Alt + F6 to go to command line mode. This is because during the installation of the nvidia driver inside the cuda toolkit, Xserver (the service that enables graphical user interface has to be turned off)
  3. Once in the CLI (Command Line Interface) type (without quotes) ” sudo su ”  and enter your password
  4. Now let us begin preparing the machine for Cuda Mining…
  5. Run the command (without quotes) – ” apt-get update “
  6. Run the command (without quotes) – ” apt-get upgrade “
  7. Run the command (without quotes) – ” apt-get install freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libgl1-mesa-glx libglu1-mesa libglu1-mesa-dev libglapi-mesa libgl1-mesa-dri “
  8. Run the command (without quotes) – “cd /home/yourusername/Downloads” (Here your username is the name of the user, usually just press the tab key after typing /home/)
  9. Download the toolkit – run the command (without quotes) – “wget http://developer.download.nvidia.com/compute/cuda/6_0/rel/installers/cuda_6.0.37_linux_64.run”
  10. Give execution permission to the file you just downloaded chmod +x cuda_6.0.37_linux_64.run
  11. Stopping the display service  (without quotes) – “service lightdm stop”
  12. Run the installer (the parameter override compiler will negate any compiler version issues)  ./cuda_6.0.37_linux_64.run -override compiler
  13. Give yes for all questions, and when asked for the path where the cuda toolkit and cuda toolkit samples, press enter so that it takes the default location, it will be easier to debug.
  14. You might be asked to re run the setup after restart as the installer will try and remove the other drivers. Once restarted come back to the CLI using Ctrl + Alt + F6 and nagivate to downloads folder (without quote) – “cd /home/yourusername/Downloads/”. After that escalate privilege to root using “sudo su ” command, enter your password if asked.
  15. Run the command (without quotes)  – ” cd “
  16. Edit .bashrc file with the command (without quotes) – nano .bashrc
  17. Add the following to the end of the document – “PATH=$PATH:/usr/local/cuda-6.0/bin”, o the next line (press enter) ” LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-6.0/lib64:/lib “
  18. Press Ctrl + Y to close press enter to save. You will be back at the terminal. Run  the command (without quotes) : “source .bashrc”
  19. Run the command (without quotes) – ” apt-get install openmpi-bin openmpi-common libopenmpi-dev “
  20. Run the command (without quotes) – ” cd /home/yourusername/NVIDIA_CUDA-6.0_Samples “
  21. Run the command (without quotes) – ” make “
  22. Once the processing is complete and you are back at the cursor (make sure there are no errors.
  23. Run the command (without quotes) ” ln -s /usr/lib/x86_64-linux-gnu/libglut.so.3 /usr/lib/libglut.so “
  24. Run the command (without quotes) – ” nano /etc/ld.so.conf.d/cuda.conf “
  25. Inside the file add these 2 lines – ” /usr/local/cuda-6.0/lib64 ” ” /usr/local/cuda-6.0/lib “. Press Ctrl + Y and enter key to save and exit to terminal
  26. Run the command (without quotes) – ” nano /etc/ld.so.conf.d/NVIDIA.conf “
  27. Inside the file add these 2 lines – ” /usr/local/cuda-6.0/lib64 ” ” /usr/local/cuda-6.0/lib “. Press Ctrl + Y and enter key to save and exit to terminal
  28. Run the command (without quotes) – “ldconfig”
  29. Run the command (without quotes) – ” cd ~ “
  30. Run the command (without quotes) – ” cd /home/yourusername/Downloads/ “
  31. Run the command (without quotes) – ” wget https://github.com/cbuchner1/CudaMiner/archive/master.zip
  32. Run the command (without quotes)- “mv master.zip CudaMiner.zip” – For easy understanding
  33. Run the command (without quotes)- “unzip CudaMiner.zip”
  34. Run the command (without quotes) – ” cd sCudaMiner “
  35. Run the command (without quotes) – ” chmod a+wrx configure “
  36. Run the command (without quotes) – ” apt-get install libcurl4-gnutls-dev  autogen automake libssl-dev libssl1.0.0 libcryptokit-ocaml libcryptokit-ocaml-dev libcrypto++-dev libcrypto++9 “
  37. Run the command (without quotes) – ” ./autogen.sh “
  38. Run the command (without quotes) – ” ./configure “
  39. Run the command (without quotes) – ” make “
  40. Run the command (without quotes – ” ./cudaminer -d 0 -i 0 –benchmark “

Once this runs, it means you are ready to mine with cuda miner…

 

Will post how to mine with a pool in a couple of days..

 

Reply / Comment to this blog post or leave a message at http://mynameisvivek.in contact section, I will reach back to you..

 

Happy Mining

Deadbrain 🙂

Shouts to Christian Buchner & Damian Gregory

Advertisements

38 thoughts on “CUDA Miner Installation on a fresh Ubuntu 14.04 LTS

  1. Hello Vivek!

    Great guide! I ran into an issue at the end though while attempting to benchmark, perhaps I did not link a library file correctly?

    ./cudaminer -d 0 -i 0 -benchmark
    *** CudaMiner for nVidia GPUs by Christian Buchner ***
    This is version 2014-02-28 (beta)
    based on pooler-cpuminer 2.3.2 (c) 2010 Jeff Garzik, 2012 pooler
    Cuda additions Copyright 2013,2014 Christian Buchner
    LTC donation address: LKS1WDKGED647msBQfLBHV3Ls8sveGncnm
    BTC donation address: 16hJF5mceSojnTD3ZTUDqdRhDyPJzoRakM
    YAC donation address: Y87sptDEcpLkLeAuex6qZioDbvy1qXZEj4
    modprobe: ERROR: ../libkmod/libkmod-module.c:809 kmod_module_insert_module() could not find module by name=’nvidia_331_uvm’
    modprobe: ERROR: could not insert ‘nvidia_331_uvm’: Function not implemented
    [2014-05-05 17:22:30] FATAL: Unable to query number of CUDA devices! Is an nVidia driver installed?

    I do have the nvidia driver 331 installed, so I am unsure what is causing this. Any tips would be most appreciated, Thank you!

    • Hey Bryce,

      You are Welcome!

      Did u do the steps 16 through 18 .. Please verify these steps

      16. Edit .bashrc file with the command (without quotes) – nano .bashrc
      17. Add the following to the end of the document – “PATH=$PATH:/usr/local/cuda-6.0/bin”, o the next line (press enter) ” LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-6.0/lib64:/lib “
      18.Press Ctrl + Y to close press enter to save. You will be back at the terminal.

      Once that is done, Run the command: source .bashrc

      The problem is that of permission, the cuda miner is not avle to access the nvidia_331_uvm module..

      Please follow these steps and try restarting cuda miner benchmarking

      1. Run command nano /etc/local.d/nv_smi_pm.start
      Add these lines to the file
      mknod -m 660 /dev/nvidia-uvm c 249 0
      chgrp video /dev/nvidia-uvm

      2. Save and return to terminal (Ctrl +Y followed by enter key)
      3. Run this command -> nvidia-modprobe -c0 -u ()
      4. Run this command -> dkms install -m nvidia-337-uvm/337.12

      Plese do sudo ./cgminer -n

      It should work well now

  2. Hello Vivek!

    Thank you for the quick response and help! I went back through the library linking and made sure all was correct, and attempted your fix. Unfortunately I am met with this similar error while running “nvidia-modprobe -c 0 -u”:

    root@bRIG:/home/bryce/Downloads/Applications/CudaMiner/CudaMiner# nvidia-modprobe -c 0 -u
    modprobe: ERROR: ../libkmod/libkmod-module.c:809 kmod_module_insert_module() could not find module by name=’nvidia_331_uvm’
    modprobe: ERROR: could not insert ‘nvidia_331_uvm’: Function not implemented

    Could it be because I installed the graphic driver from the toolkit installation that is messing things up?

    Thank you again for all your help, still a Linux Novice, transitioning from mining on Windows!

    Cheers,

    Bryce

    • P.S Do you happen to know if it is possible to run both Nvidia and Amd drivers in tandem on Linux? I have an older amd card kicking around that I wouldn’t mind using for extra kh/s.

      Thank you,

      Bryce

      • Ehile we troubleshoot it with you, we will work on it together and make it happen (Both AMD and Nvidia)

  3. Thank you very much Vivek! Will do!
    Have re-installed a bunch of times now, trying to get it to work lol

    Hoping to save some time now with BTRFS snapshots, can always roll back to an earlier state if I mess it up.

  4. Hello,

    Thanks for the excellent guide. It has really helped me to reduce the amount of time websearching across the internet.

    Viveki, I’m having difficulty on step # 19 – “make”
    It shows the following error.

    nvcc -g -O2 -Xptxas “-abi=no -v” -arch=compute_10 –maxrregcount=64 –ptxas-options=-v -I./compat/jansson -o wrapnvml.o -c wrapnvml.cu
    /bin/bash: nvcc: command not found

    I am assuming my paths are not setup corrently. My (.bashrc) file looks like this

    PATH=$PATH:/usr/local/cuda-6.0/bin
    LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-6.0/lib64:/lib

    Next I use the command

    :source .bashrc

    How can I get nvcc file regonized to make the cudaminer?

    Thanks!

    • So apparently, nvcc is not on the PATH
      Are you running it with sudo. You can confirm this with:

      sudo bash -c ‘echo $PATH’
      The easiest solution is to call sudo with the absolute path of nvcc:

      sudo $(which nvcc)
      When running commands without absolute path like nvcc, sudo uses the value of the secure_path configuration in /etc/sudoers as the PATH, for example in my system:

      Defaults secure_path=”/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin”
      So even if you set PATH in one of the startup files that the shell normally sources, it won’t work. If you want to make sudo nvcc work temporarily, just to get your build working, I think you have two options:

      Edit the installer script and change the lines with sudo nvcc to sudo /path/to/nvcc
      Create a symlink to nvcc in one of the directories listed in secure_path, like this: sudo ln -s /path/to/nvcc /sbin/nvcc
      UPDATE

      If you have a hard time finding the path of nvcc, you can try these commands, in this order (they get slower and slower), until you find a match:

      which nvcc
      find /usr/local/cuda-5.0 -name nvcc
      find /usr/local/ -name nvcc
      find /opt -name nvcc
      find / -name nvcc

      If you need more assistance, Please send me a mail to vivek.p@me.com as I am a bit too busy these days, that is the only address configured on my mobile device.

  5. Hi guys, did you solved the problem?

    modprobe: ERROR: ../libkmod/libkmod-module.c:809 kmod_module_insert_module() could not find module by name=’nvidia_331_uvm’
    modprobe: ERROR: could not insert ‘nvidia_331_uvm’: Function not implemented

    if yes could you give me a hand, I am lost for now

    andrej

    • Hey,

      Thanks for following the guide..

      Try installing the nvidia-331-uvm using apt-get ( apt-get install nvidia-331-uvm) and also please send me some screenshots/error information. Are you using the same card as bryce, because each type of manufacturer / card might have a different error!

      Do let me know..

      Regards
      V

  6. Oops.. What does this Build 2 error tell me I did wrong?
    LOL..
    Step 21 “make” w/o quotations..

    root@test-XPS-630i:/home/test# cd /home/test/NVIDIA_CUDA-6.0_Samples
    root@test-XPS-630i:/home/test/NVIDIA_CUDA-6.0_Samples# make
    make[1]: Entering directory `/home/test/NVIDIA_CUDA-6.0_Samples/0_Simple/simpleMultiGPU’
    “/usr/local/cuda-6.0″/bin/nvcc -ccbin g++ -I../../common/inc -m32 -gencode arch=compute_10,code=sm_10 -gencode arch=compute_20,code=sm_20 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_32,code=sm_32 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_50,code=compute_50 -o simpleMultiGPU.o -c simpleMultiGPU.cu
    /usr/local/cuda-6.0/bin/nvcc: 7: /usr/local/cuda-6.0/bin/nvcc: Syntax error: “(” unexpected
    make[1]: *** [simpleMultiGPU.o] Error 2
    make[1]: Leaving directory `/home/test/NVIDIA_CUDA-6.0_Samples/0_Simple/simpleMultiGPU’
    make: *** [0_Simple/simpleMultiGPU/Makefile.ph_build] Error 2
    root@test-XPS-630i:/home/test/NVIDIA_CUDA-6.0_Samples#

  7. I get the error “modprobe: ERROR: could not insert ‘nvidia_331_uvm’: Invalid argument” and nvidia-331-uvm is installed. Even manual node creation does not help. What can I do?

  8. Hello Vivek,

    Thanks for such an amazing guide. Lately, i’ve been trying to install cudaminer on my Nvidia Jetson tegra K1 (Kepler GPU with 192 CUDA cores running on Ubuntu 14.04, L4T), but running the “sudo make” command drops the following error:

    gcc -std=gnu99 -DHAVE_CONFIG_H -I. -msse2 -fopenmp -pthread -fno-strict-aliasing -I./compat/jansson -DSCRYPT_KECCAK512 -DSCRYPT_CHACHA -DSCRYPT_CHOOSE_COMPILETIME -g -O2 -MT cudaminer-cpu-miner.o -MD -MP -MF .deps/cudaminer-cpu-miner.Tpo -c -o cudaminer-cpu-miner.o `test -f ‘cpu-miner.c’ || echo ‘./’`cpu-miner.c
    gcc: error: unrecognized command line option ‘-msse2’

    Unable to figure out what’s wrong and even google has no answer for it.
    Help would be appreciated. Thank you.

    • Hey adarsh,

      I went through your problem andooks like on of the components that is required for it to be compiled is missing. Can you send me a dump of the terminal screen and I can help you better.

      You can reach out to me here any time and I will reply immediately

  9. Hi Vivek,

    I’m having an issue similar to Bryce’s, but I don’t have the “nvidia_331_uvm” line in the log.

    Here is the output:
    ./cudaminer -d 0 -i 0 -benchmark

    *** CudaMiner for nVidia GPUs by Christian Buchner ***
    This is version 2014-02-28 (beta)
    based on pooler-cpuminer 2.3.2 (c) 2010 Jeff Garzik, 2012 pooler
    Cuda additions Copyright 2013,2014 Christian Buchner
    LTC donation address: LKS1WDKGED647msBQfLBHV3Ls8sveGncnm
    BTC donation address: 16hJF5mceSojnTD3ZTUDqdRhDyPJzoRakM
    YAC donation address: Y87sptDEcpLkLeAuex6qZioDbvy1qXZEj4
    [2015-03-26 04:28:31] FATAL: Unable to query number of CUDA devices! Is an nVidia driver installed?

    Any ideas?

    • The problem you are having is because of bad driver installation, please re install the driver and it will work alright, if you need further help or detailed assistance send me a PM

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s