Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save toshihiroryuu/18c236db3d9f10031c2ead0203abcff9 to your computer and use it in GitHub Desktop.
Save toshihiroryuu/18c236db3d9f10031c2ead0203abcff9 to your computer and use it in GitHub Desktop.
CUDA Installation GPU Machine Personal Check
Building Caffe
Before Caffe can be build, Protobuf 3 needs to be build.
For best performance, you'll want:
• One or more NVIDIA GPUs - GeForce RTX 2080 Ti present
• An NVIDIA driver - NVIDIA-SMI 410.57 present
• A CUDA toolkit – to be installed
• cuDNN – to be installed
Building Protobuf :
To run Caffe and Tensorflow inside DIGITS side by side, protobuf 3 must be built from source.
Dependencies
sudo apt-get install autoconf automake libtool curl make g++ git python-dev python-setuptools unzip
Download Source
DIGITS is currently compatiable with Protobuf 3.2.x
# example location - can be customized
export PROTOBUF_ROOT=~/protobuf
git clone https://github.com/google/protobuf.git $PROTOBUF_ROOT -b '3.2.x'
Building Protobuf
cd $PROTOBUF_ROOT
./autogen.sh
./configure
make "-j$(nproc)"
sudo make install
sudo ldconfig
cd python
sudo python setup.py install --cpp_implementation
This will ensure that Protobuf 3 is installed.
To Check successfull installation of Protobuf3 use :
$ python -c "from google.protobuf.internal import api_implementation; print(api_implementation._default_implementation_type)"
It should print either python or cpp.
Got cpp as output.
System Requirements
To use CUDA on your system, you will need the following installed:
• CUDA-capable GPU - GeForce RTX 2080 Ti present
• A supported version of Linux with a gcc compiler and toolchain
Linux Version : 16.04.6 LTS (Xenial Xerus)
GCC : gcc (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0 20160609 (checked)
• NVIDIA CUDA Toolkit (available at http://developer.nvidia.com/cuda-downloads)
Pre-installation Actions
• Verify the system has a CUDA-capable GPU. - yes ( GeForce RTX 2080 Ti)
• Verify the system is running a supported version of Linux. - yes (16.04.6 LTS )
• Verify the system has gcc installed. - yes ( gcc 5.4.0 20160609)
• Verify the system has the correct kernel headers and development packages installed.
Kernel Version : Linux BLRDT0808-U 4.15.0-50-generic
$ dpkg-query -s linux-headers-$(uname -r) - to check if matching kernel headers are already available on your system
linux-headers-4.15.0-50-generic (found correct )
$ sudo apt-get install linux-headers-$(uname -r) -to install correct linux header in case incorrect
• Download the NVIDIA CUDA Toolkit.
CUDA Toolkit can be installed using either of two different installation mechanisms: distribution-specific packages - Deb packages, or
distribution-independent package - runfile packages
The Runfile installation installs the NVIDIA Driver, the CUDA Toolkit, and CUDA Samples, via an interactive ncurses-based interface
The Runfile installation does not include support for cross-platform development.
Deb packages- installation
Download Installer for Linux Ubuntu 16.04 x86_64, then follow the instruction
Installation Instructions:
1. `sudo dpkg -i cuda-repo-ubuntu1604_10.1.168-1_amd64.deb`
2. `sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/7fa2af80.pub`
3. `sudo apt-get update`
4. `sudo apt-get install cuda-toolkit-10-1` - Installs all CUDA Toolkit packages required to develop CUDA applications. Does not include the driver.(since driver is installed by run file method.)
Some actions must be taken after the installation before the CUDA Toolkit and Driver can be used.
Environment Setup
The PATH variable needs to include /usr/local/cuda-10.1/bin and /usr/local/cuda-10.1/NsightCompute-<tool-version>. <tool-version> refers to the version of Nsight Compute that ships with the CUDA toolkit, e.g. 2019.1.
To add this path to the PATH variable:
$ export PATH=/usr/local/cuda-10.1/bin:/usr/local/cuda-10.1/NsightCompute-2019.3${PATH:+:${PATH}}
In addition, when using the runfile installation method, the LD_LIBRARY_PATH variable needs to contain /usr/local/cuda-10.1/lib64 on a 64-bit system, or /usr/local/cuda-10.1/lib on a 32-bit system
• To change the environment variables for 64-bit operating systems:
$ export LD_LIBRARY_PATH=/usr/local/cuda-10.1/lib64\
${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
sudo gedit ~/.bashrc
added lines : export PATH=/usr/local/cuda-10.1/bin:/usr/local/cuda-10.1/NsightCompute-2019.3${PATH:+:${PATH}} at the end
Nsight Compute version is 2019.3
CUDNN Installing from a Debian File
1. Navigate to your <cudnnpath> directory containing cuDNN Debian file.
2. Install the runtime library, for example:
sudo dpkg -i libcudnn7_7.0.3.11-1+cuda9.0_amd64.deb
3. Install the developer library, for example:
sudo dpkg -i libcudnn7-devel_7.0.3.11-1+cuda9.0_amd64.deb
4. Install the code samples and the cuDNN Library User Guide, for example:
sudo dpkg -i libcudnn7-doc_7.0.3.11-1+cuda9.0_amd64.deb
To check installation of CuDNN, run below command, if CuDNN is installed properly then you will not get any error.
function lib_installed() { /sbin/ldconfig -N -v $(sed 's/:/ /' <<< $LD_LIBRARY_PATH) 2>/dev/null | grep $1; }
function check() { lib_installed $1 && echo "$1 is installed" || echo "ERROR: $1 is NOT installed"; }
check libcudnn
Output :
libcudart.so.10.1 -> libcudart.so.10.1.168
libcuda.so.1 -> libcuda.so.410.57
libcuda.so.1 -> libcuda.so.410.57
libcuda is installed
CuDNN is installed
TO DO :
Cudnn verifying
To verify that cuDNN is installed and is running properly, compile the mnistCUDNN sample located in the /usr/src/cudnn_samples_v7 directory in the debian file.
1. Copy the cuDNN sample to a writable path.
$cp -r /usr/src/cudnn_samples_v7/ $HOME
2. Go to the writable path.
$ cd $HOME/cudnn_samples_v7/mnistCUDNN
3. Compile the mnistCUDNN sample.
$make clean && make
4. Run the mnistCUDNN sample.
$ ./mnistCUDNN
Error got :
cudnnGetVersion() : 7501 , CUDNN_VERSION from cudnn.h : 7501 (7.5.1)
Cuda failurer version : GCC 5.4.0
Error: CUDA driver version is insufficient for CUDA runtime version
error_util.h:93
Aborting...
Install some dependencies with Deb packages for Caffe:
sudo apt-get install --no-install-recommends build-essential cmake git gfortran libatlas-base-dev libboost-filesystem-dev libboost-python-dev libboost-system-dev libboost-thread-dev libgflags-dev libgoogle-glog-dev libhdf5-serial-dev libleveldb-dev liblmdb-dev libopencv-dev libsnappy-dev python-all-dev python-dev python-h5py python-matplotlib python-numpy python-opencv python-pil python-pip python-pydot python-scipy python-skimage python-sklearn
Download source
DIGITS is currently compatiable with Caffe 0.15
# example location - can be customized
export CAFFE_ROOT=~/caffe
git clone https://github.com/NVIDIA/caffe.git $CAFFE_ROOT -b 'caffe-0.15'
Setting the CAFFE_ROOT environment variable will help DIGITS automatically detect your Caffe installation, but this is optional.
Python packages
Several PyPI packages need to be installed:
sudo pip install -r $CAFFE_ROOT/python/requirements.txt
If you hit some errors about missing imports, then use this command to install the packages in order (see discussion here):
cat $CAFFE_ROOT/python/requirements.txt | xargs -n1 sudo pip install
Build
We recommend using CMake to configure Caffe rather than the raw Makefile build for automatic dependency detection:
cd $CAFFE_ROOT
mkdir build
cd build
cmake ..
make -j"$(nproc)"
make install
export PATH=/usr/local/cuda-10.1/bin:/usr/local/cuda-10.1/NsightCompute-2019.3${PATH:+:${PATH}}
/home/quest/bin:/home//.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment