The following will guide you through the process of setting up your linux-based system in preparation of, and compiling the cruzbit source with CUDA support (for GPU mining with Nvidia hardware). These instructions should work for most linux-based systems (and possibly macOS, too), however they are not 'written in stone.' A familiarity with the linux command line, and operating system will help when encountering issues (but we hope there aren't any).
I highly suggest you drop into root for this entire processs. It is not required, but will remove the headache of trying to change system settings and install drivers from a regular user account.
Bring the system up to date, and install some build tools. The
update-alternatives commands require
sudo (if you are not running as root).
apt update apt -y upgrade apt install -y build-essential cmake git wget http://www.cmake.org/files/v3.12/cmake-3.12.1.tar.gz tar -xvxf cmake-3.12.1.tar.gz cd cmake-3.12.1 ./configure make make install update-alternatives --install /usr/bin/cmake cmake /usr/local/bin/cmake 1 --force
Install Nvidia display drivers.
apt search nvidia-driver
Examine the list of packages returned from the search command, locating the latest driver version in the format
nvidia-driver-xxx, for example
nvidia-driver-390. Use this package name in the following step. Then reboot your system after installation completes.
apt install nvidia-driver-xxx reboot now
Install Nvidia development toolkit. This absolutely must be run as root.
The script may take a little while to run, and will present its own 'window' with installation options. You will need to type "accept" to accept the license agreement, and then scroll to "Install" and press enter after choosing which components should be installed (leave them all selected).
wget https://developer.nvidia.com/compute/cuda/10.1/Prod/local_installers/cuda_10.1.168_418.67_linux.run sh cuda_10.1.168_418.67_linux.run
If you encounter errors during this procedure, you probably did not run the above as root. This Stack Exchange answer may help you dig yourself out of that hole.
This will install the Go language compiler and utilities. You can skip this step if you already have Go installed on your system. If you have Snap Store package manager available, Go can be installed easily.
sudo snap install go --classic
If you can not use Snap, you can install Go like this. You'll have to adjust the first line to point to the appropriate bundle for your operating system and architecture. The
nano commands witll require
sudo if you are not already running as root.
wget https://dl.google.com/go/go1.12.7.linux-amd64.tar.gz tar -xvf go1.12.7.linux-amd64.tar.gz chown -R root:root ./go mv go /usr/local nano ~/.profile
You can substitute
nano with your favorite text editor. When your .profile file is open, append the following lines to the end of the file:
export GOPATH=$HOME/work export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin
Save the file, and exit. Then load the new settings.
With Go installed, you can now build the cruzbit executables.
export GO111MODULE=on go install github.com/cruzbit/cruzbit/client go install github.com/cruzbit/cruzbit/wallet
The cruzbit GPU mining library is built separately.
make install requires
cd mkdir -p go/src/github.com/asdvxgxasjab/ cd go/src/github.com/asdvxgxasjab/ git clone https://github.com/asdvxgxasjab/cruzbit.git cd cruzbit git checkout cuda cd cuda mkdir build cd build cmake .. make make install cd ../../client go install -tags cuda
The previous step will build a
libcruzbit_cuda.so file (or
cruzbit_cuda.dll on Windows). We need to reference this file when we run the client. It should be in
/usr/local/lib if the
make install ran properly in the section above. If it did not, or if for some reason the file ended up somwhere else, adjust the path to the containing folder below.
LD_LIBRARY_PATH=/usr/local/lib client -numminers 1 ...
-numminers X to be the number of discrete GPUs in your system, and then add the rest of your client configuration options (to replace
Note that the first line output by the client should include
CUDA initialized. If it does not, you are mining with CPU.