Skip to content

Instantly share code, notes, and snippets.

@magic-lantern
Last active March 13, 2020 21:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save magic-lantern/2a7823cef5db40861735263c6088a943 to your computer and use it in GitHub Desktop.
Save magic-lantern/2a7823cef5db40861735263c6088a943 to your computer and use it in GitHub Desktop.
Notes on setting up various Python deep learning libraries on CentOS 7

Eureka GPU Setup Guide

Git

CentOS 7.6.1810 has a very old version of Git (v 1.8.3.1 from ~ 2013). To install a current version of Git, you have a few options:

From Source

sudo yum -y install wget perl-CPAN gettext-devel perl-devel openssl-devel zlib-devel
export VER="2.22.1"
wget https://github.com/git/git/archive/v${VER}.tar.gz
tar -xvf v${VER}.tar.gz
cd git-*
make
make install

git 2.22.1 will now be installed to ~/bin - if you want it to be used instead of the system git, modify your .bash_profile to have ~/bin come before /usr/bin

Using Conda

conda install git

As long as the conda environment is active in which git has been installed, the new git version will be used over the system git.

Nvidia setup steps

First make sure prerequisites are installed (not sure why yum doesn't install these as they are required):

sudo yum install gcc kernel-devel kernel-headers

Note, these steps should build kernel drivers which will take several minutes; if the install step is quick then it likely didn't work right.

  1. Nvidia GPU drivers: https://www.nvidia.com/Download/driverResults.aspx/150862/en-us - download apropriate GPU driver and run the following:
    • sudo rpm -i nvidia-diag-driver-local-repo-rhel7-410.129-1.0-1.x86_64.rpm
    • sudo yum clean all
    • sudo yum install cuda-drivers
    • sudo reboot
  2. Install CUDA 10.0 toolkit: https://developer.nvidia.com/cuda-10.0-download-archive?target_os=Linux&target_arch=x86_64&target_distro=CentOS&target_version=7&target_type=rpmlocal - download 2 files and run the following:
    • sudo rpm -i cuda-repo-rhel7-10-0-local-10.0.130-410.48-1.0-1.x86_64.rpm
    • sudo yum clean all
    • sudo yum install cuda
    • sudo reboot
  3. Install CUDA 10.0 patch from CUDA URL above:
    • sudo rpm -i cuda-repo-rhel7-10-0-local-nvjpeg-update-1-1.0-1.x86_64.rpm
    • sudo yum clean all
    • sudo yum install cuda-nvjpeg-10-0
    • sudo reboot
  4. Install CUDNN, requires free Nvidia Account. (download from: https://developer.nvidia.com/compute/machine-learning/cudnn/secure/7.6.4.38/Production/10.0_20190923/cudnn-10.0-linux-x64-v7.6.4.38.tgz) (installation instructions: https://docs.nvidia.com/deeplearning/sdk/cudnn-install/index.html)
    • tar -xzvf cudnn-9.0-linux-x64-v7.tgz
    • sudo cp cuda/include/cudnn.h /usr/local/cuda/include
    • sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64
    • sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*
  5. Install TensorRT: https://developer.nvidia.com/tensorrt, installation instructions: https://docs.nvidia.com/deeplearning/sdk/tensorrt-install-guide/index.html
    • sudo rpm -Uvh nv-tensorrt-repo-rhel7-cuda10.0-trt5.0.2.6-ga-20181010-1-1.x86_64.rpm
    • sudo yum clean expire-cache
    • sudo yum install --nogpgcheck tensorrt

Conda Setup

Install Anaconda:

  • wget https://repo.anaconda.com/archive/Anaconda3-2019.10-Linux-x86_64.sh
  • bash Anaconda3-2019.10-Linux-x86_64.sh

Create an environment - envname and python version as desired:

conda create -n envname python=3.6

Then switch to new environment - name as desired:

conda activate envname

Items to install in each conda environment:

  • conda install seaborn pytest statsmodels scikit-learn git
  • pip install gpustat
  • conda install -c conda-forge altair vega_datasets jupyterlab
  • conda install -c conda-forge jupytext nodejs

TensorFlow

Requires all the GPU libraries and drivers to be first installed - see https://www.tensorflow.org/install/gpu Once that is completed:

conda create -n tensorflow python=3.6
conda activate tensorflow
pip install tensorflow

Keras

Follow instructions at https://keras.io/#installation

By default Keras uses TensorFlow as the tensor backend. If you successfully get TensorFlow installed and working, you just have to then run:

conda create -n keras python=3.6
conda activate keras
pip install tensorflow
pip install keras

Pytorch

See instructions and additional options available at https://pytorch.org/get-started/locally/

conda create -n pytorch python=3.7
conda activate pytorch
conda install pytorch torchvision cudatoolkit=10.1 -c pytorch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment