0

keras installation on ubuntu 16.04 with CUDA and cuDNN

  1. install CUDA
    download cuda-repo-ubuntu1604_8.0.44-1_amd64.deb from here

    1. sudo dpkg -i cuda-repo-ubuntu1604_8.0.44-1_amd64.deb
    2. sudo apt-get update
    3. sudo apt-get cuda
  2. update path settings
    add the following lines at the end of ~/.bashrc and type “source ~/.bashrc” on terminal.

    1. # for CUDA and cuDNN
    2. export PATH=/usr/local/cuda-8.0/bin:$PATH
    3. export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64:$LD_LIBRARY_PATH
  3. install cuDNN
    download cuDNN package from here

    1. tar xzvf cudnn-8.0-linux-x64-v5.1.tgz
    2. sudo cp -a cuda/lib64/* /usr/local/cuda-8.0/lib64/
    3. sudo cp -a cuda/include/* /usr/local/cuda-8.0/include/
    4. sudo ldconfig
  4. install theano
    pip install –upgrade –no-deps git+https://github.com/Theano/Theano.git

    1. create ~/.theanorc and write down the following lines
      [global]device = gpu
      floatX = float32

      [nvcc]
      flags=-D_FORCE_INLINES

      [cuda]
      root = /usr/local/cuda-8.0

  5. install keras
    pip install –upgrade –no-deps git+https://github.com/fchollet/keras.git

If python outputs any tensorflow-related warning, edit backend information in ~/.keras/keras.json from tensorflow to theano.

Advertisements
0

cuda toolkit installation on Ubuntu 16.04 after upgrading from Ubuntu 14.04

This post explains how to upgrade cuda toolkit on ubuntu 16.04 after upgrading OS from ubuntu 14.04.

I got the following error when I tried to upgrade cuda toolkit from 7.5 to 8.0 by

sudo dpkg -i cuda-repo-ubuntu1604_8.0.44-1_amd64.deb

on terminal outputs the following error.

Selecting previously unselected package cuda-repo-ubuntu1604.
(Reading database ... 743925 files and directories currently installed.)
Preparing to unpack cuda-repo-ubuntu1604_8.0.44-1_amd64.deb ...
Unpacking cuda-repo-ubuntu1604 (8.0.44-1) ...
dpkg: error processing archive cuda-repo-ubuntu1604_8.0.44-1_amd64.deb (--install):
 trying to overwrite '/etc/apt/sources.list.d/cuda.list', which is also in package cuda-repo-ubuntu1404 8.0.44-1
Errors were encountered while processing:
 cuda-repo-ubuntu1604_8.0.44-1_amd64.deb

The above error indicates that there’s a conflict between the current cuda-related repository (for ubuntu 14.04) and the new upgrade (for ubuntu 16.04).

My solution was first remove the repository settings for ubuntu 14.04 by typing

sudo dpkg --purge cuda-repo-ubuntu1404

and then install the toolkit as

  1. sudo dpkg -i cuda-repo-ubuntu1604_8.0.44-1_amd64.deb
  2. sudo apt-get update
  3. sudo apt-get install cuda
0

unable to update cuda *** on Ubuntu 14.04

You may have GPG error (NO PUBKEY) related to nvidia’s cuda when you apt-get update like:
GPG error: http://developer.download.nvidia.com Release: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY F60F4B3D7FA2AF80

The solution is to add public key to your system. In my case, the following command first downloads an appropriate pubkey file and then add the downloaded key to the system.

wget -qO – http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/7fa2af80.pub | sudo apt-key add –

0

OpenCV 3.1.0 for Python2.7

 

  • PYTHON2_EXECUTABLE: /opt/anaconda/anaconda2/bin/python2.7
  • PYTHON2_INCLUDE_DIR: /opt/anaconda/anaconda2/include
  • PYTHON2_INCLUDE_DIR2:
  • PYTHON2_LIBRARY: /opt/anaconda/anaconda2/lib/libpython2.7.so
  • PYTHON2_LIBRARY_DEBUG:
  • PYTHON2_NUMPY_INCLUDE_DIRS: /opt/anaconda/anaconda2/lib/python2.7/site-packages/numpy/core/include
  • PYTHON2_PACKAGES_PATH: /opt/anaconda/anaconda2/lib/python2.7/site-packages
0

install Python package gurobi on Ubuntu 16.04

gurobi is a commercial optimization solver for a variety of problems such as linear programming, quadratic programming, etc.

With Anaconda, you can install gurobi by two lines of commands and registering your license at the license center.

conda config --add channels http://conda.anaconda.org/gurobi
conda install gurobi

Once your registration is done, you might be able to get a license key as grbgetkey ********-****-****-****-************. You can register the license key by executing the command on your terminal.

0

Error of Android Studio: Cannot launch AVD in emulator

I got the following error when I booted an emulator on Android Studio:

Cannot launch AVD in emulator.
Output:
sh: 1: glxinfo: not found
libGL error: unable to load driver: radeonsi_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: radeonsi
libGL error: unable to load driver: swrast_dri.so
libGL error: failed to load driver: swrast
X Error of failed request:  BadValue (integer parameter out of range for operation)
emulator: WARNING: VM heap size set below hardware specified minimum of 128MB
  Major opcode of failed request:  155 (GLX)
emulator: WARNING: Setting VM heap size to 384MB
  Minor opcode of failed request:  24 (X_GLXCreateNewContext)
  Value in failed request:  0x0
  Serial number of failed request:  33
  Current serial number in output stream:  34
QObject::~QObject: Timers cannot be stopped from another thread

The solution is posted here.

sudo apt-get install lib64stdc++6 (if it is not installed)
cd ~/Android/Sdk/tools/lib64/libstdc++
mv libstdc++.so.6 libstdc++.so.6.original
ln -s /usr/lib64/libstdc++.so.6 ~/Android/Sdk/tools/lib64/libstdc++
sudo apt-get install mesa-utils (if it is not installed)