Skip to content

Instantly share code, notes, and snippets.

@marios2019
Forked from wangruohui/Caffe Ubuntu 15.10.md
Created July 15, 2020 11:17

Revisions

  1. Ruohui Wang revised this gist Oct 10, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Caffe Ubuntu 15.10.md
    Original file line number Diff line number Diff line change
    @@ -13,7 +13,7 @@ Reboot your machine and verify everything works by issuing `nvidia-smi` or runni
    1. [How to do it manually](http://www.resultsovercoffee.com/2011/01/cuda-in-runlevel-3.html)
    2. [Understanding character special file](http://unix.stackexchange.com/questions/60034/what-are-character-special-and-block-special-files-in-a-unix-system)

    More infomation related to NVIDIA driver and CUDA installation can be found [here](https://gist.github.com/wangruohui/df039f0dc434d6486f5d4d098aa52d07)
    *More infomation related to NVIDIA driver and CUDA installation can be found [here](https://gist.github.com/wangruohui/df039f0dc434d6486f5d4d098aa52d07).*

    ### Install CUDA 7.5
    CUDA 7.5 is provided by neither Ubuntu official nor CUDA repositories for Ubuntu 15.10. But we can still install it using `.run` file.
  2. Ruohui Wang revised this gist Aug 29, 2016. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions Caffe Ubuntu 15.10.md
    Original file line number Diff line number Diff line change
    @@ -9,12 +9,12 @@ The `nvidia-modprobe` utility is used to load NVIDIA kernel modules and create N

    Reboot your machine and verify everything works by issuing `nvidia-smi` or running `deviceQuery` in CUDA samples.

    More infomation related to NVIDIA driver and CUDA installation can be found [here](https://gist.github.com/wangruohui/df039f0dc434d6486f5d4d098aa52d07)

    ###### References
    1. [How to do it manually](http://www.resultsovercoffee.com/2011/01/cuda-in-runlevel-3.html)
    2. [Understanding character special file](http://unix.stackexchange.com/questions/60034/what-are-character-special-and-block-special-files-in-a-unix-system)

    More infomation related to NVIDIA driver and CUDA installation can be found [here](https://gist.github.com/wangruohui/df039f0dc434d6486f5d4d098aa52d07)

    ### Install CUDA 7.5
    CUDA 7.5 is provided by neither Ubuntu official nor CUDA repositories for Ubuntu 15.10. But we can still install it using `.run` file.
    ```
  3. Ruohui Wang revised this gist Aug 29, 2016. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions Caffe Ubuntu 15.10.md
    Original file line number Diff line number Diff line change
    @@ -9,6 +9,8 @@ The `nvidia-modprobe` utility is used to load NVIDIA kernel modules and create N

    Reboot your machine and verify everything works by issuing `nvidia-smi` or running `deviceQuery` in CUDA samples.

    More infomation related to NVIDIA driver and CUDA installation can be found [here](https://gist.github.com/wangruohui/df039f0dc434d6486f5d4d098aa52d07)

    ###### References
    1. [How to do it manually](http://www.resultsovercoffee.com/2011/01/cuda-in-runlevel-3.html)
    2. [Understanding character special file](http://unix.stackexchange.com/questions/60034/what-are-character-special-and-block-special-files-in-a-unix-system)
    @@ -28,8 +30,6 @@ sudo bash -c "echo /usr/local/cuda/lib64/ > /etc/ld.so.conf.d/cuda.conf"
    sudo ldconfig
    ```

    More infomation related to NVIDIA driver and CUDA installation can be found [here](https://gist.github.com/wangruohui/df039f0dc434d6486f5d4d098aa52d07)

    ### Install all other dependencies
    Follow instructions [here](http://caffe.berkeleyvision.org/install_apt.html)

  4. Ruohui Wang revised this gist Aug 29, 2016. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions Caffe Ubuntu 15.10.md
    Original file line number Diff line number Diff line change
    @@ -28,6 +28,8 @@ sudo bash -c "echo /usr/local/cuda/lib64/ > /etc/ld.so.conf.d/cuda.conf"
    sudo ldconfig
    ```

    More infomation related to NVIDIA driver and CUDA installation can be found [here](https://gist.github.com/wangruohui/df039f0dc434d6486f5d4d098aa52d07)

    ### Install all other dependencies
    Follow instructions [here](http://caffe.berkeleyvision.org/install_apt.html)

  5. Ruohui Wang revised this gist Mar 12, 2016. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions Caffe Ubuntu 15.10.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    Ubuntu 15.10 have been released for a couple of days. It is a bleeding-edge system coming with Linux kernel 4.2 and GCC 5. However, compiling and running [Caffe](http://caffe.berkeleyvision.org) on this new system is no longer as smooth as on earlier versions. I have done some research related to this issue and finally find a way out. I summarized it here in this small tutorial and I hope more people and enjoy this new system without breaking their works.
    Ubuntu 15.10 have been released for a couple of days. It is a bleeding-edge system coming with Linux kernel 4.2 and GCC 5. However, compiling and running [Caffe](http://caffe.berkeleyvision.org) on this new system is no longer as smooth as on earlier versions. I have done some research related to this issue and finally find a way out. I summarize it here in this short tutorial and I hope more people and enjoy this new system without breaking their works.

    ### Install NVIDIA Driver
    The latest NVIDIA driver is officially included in Ubuntu 15.10 repositories. One can install it directly via `apt-get`.
    @@ -85,5 +85,5 @@ make runtest -j8
    Hopefully all tests pass.

    ### Notes
    1. Running `sudo make runtest` once may help you fix a lot of runtime errors until next reboot. But it is not a recommended way.
    1. Running `sudo make runtest` once may help you fix a lot of runtime errors until next reboot, although it is not a recommended way.
    2. You might need to append `LC_ALL="en_US.UTF-8"` to `/etc/environment` and reboot your machine if there are runtime errors related to `locale::facet::_S_create_c_locale name not valid`.
  6. wangruohui revised this gist Jan 1, 2016. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions Caffe Ubuntu 15.10.md
    Original file line number Diff line number Diff line change
    @@ -64,8 +64,8 @@ This is because of change of default path and name of `hdf5` head files and libr

    Append `/usr/include/hdf5/serial/` to `INCLUDE_DIRS` at line 85 in `Makefile.config`.
    ```
    --- INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/local/include/
    +++ INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/local/include/ /usr/include/hdf5/serial/
    --- INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include
    +++ INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial/
    ```

    Modify `hdf5_hl` and `hdf5` to `hdf5_serial_hl` and `hdf5_serial` at line 173 in `Makefile`
  7. wangruohui revised this gist Jan 1, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Caffe Ubuntu 15.10.md
    Original file line number Diff line number Diff line change
    @@ -19,7 +19,7 @@ CUDA 7.5 is provided by neither Ubuntu official nor CUDA repositories for Ubuntu
    cd ~
    wget http://developer.download.nvidia.com/compute/cuda/7.5/Prod/local_installers/cuda_7.5.18_linux.run
    chmod +x cuda_7.5.18_linux.run
    ./cuda_7.5.18_linux.run --extract=/home/<USERNAME>
    ./cuda_7.5.18_linux.run --extract=/home/$USER
    sudo ./cuda-linux64-rel-7.5.18-19867135.run
    ```
    Follow the instructions there and configure runtime library after the installation finishes.
  8. wangruohui renamed this gist Nov 20, 2015. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  9. wangruohui created this gist Nov 17, 2015.
    89 changes: 89 additions & 0 deletions CaffeUbuntu1510.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,89 @@
    Ubuntu 15.10 have been released for a couple of days. It is a bleeding-edge system coming with Linux kernel 4.2 and GCC 5. However, compiling and running [Caffe](http://caffe.berkeleyvision.org) on this new system is no longer as smooth as on earlier versions. I have done some research related to this issue and finally find a way out. I summarized it here in this small tutorial and I hope more people and enjoy this new system without breaking their works.

    ### Install NVIDIA Driver
    The latest NVIDIA driver is officially included in Ubuntu 15.10 repositories. One can install it directly via `apt-get`.
    ```
    sudo apt-get install nvidia-352-updates nvidia-modprobe
    ```
    The `nvidia-modprobe` utility is used to load NVIDIA kernel modules and create NVIDIA character device files automatically everytime your machine boots up.

    Reboot your machine and verify everything works by issuing `nvidia-smi` or running `deviceQuery` in CUDA samples.

    ###### References
    1. [How to do it manually](http://www.resultsovercoffee.com/2011/01/cuda-in-runlevel-3.html)
    2. [Understanding character special file](http://unix.stackexchange.com/questions/60034/what-are-character-special-and-block-special-files-in-a-unix-system)

    ### Install CUDA 7.5
    CUDA 7.5 is provided by neither Ubuntu official nor CUDA repositories for Ubuntu 15.10. But we can still install it using `.run` file.
    ```
    cd ~
    wget http://developer.download.nvidia.com/compute/cuda/7.5/Prod/local_installers/cuda_7.5.18_linux.run
    chmod +x cuda_7.5.18_linux.run
    ./cuda_7.5.18_linux.run --extract=/home/<USERNAME>
    sudo ./cuda-linux64-rel-7.5.18-19867135.run
    ```
    Follow the instructions there and configure runtime library after the installation finishes.
    ```
    sudo bash -c "echo /usr/local/cuda/lib64/ > /etc/ld.so.conf.d/cuda.conf"
    sudo ldconfig
    ```

    ### Install all other dependencies
    Follow instructions [here](http://caffe.berkeleyvision.org/install_apt.html)

    ### Download Caffe
    ```
    cd ~
    git clone https://github.com/BVLC/caffe.git
    ```
    By now you should be unable to compile it due to serveral incompatibility problems. Let's fix them one by one.

    ### Hack CUDA to support GCC 5
    By default, CUDA 7.5 does not support compling with GCC 4.10 or later versions. It will report the following errors when compiling Caffe.
    ```
    In file included from /usr/local/cuda/include/cuda_runtime.h:76:0,
    from <command-line>:0:
    /usr/local/cuda/include/host_config.h:115:2: error: #error -- unsupported GNU version! gcc versions later than 4.9 are not supported!
    #error -- unsupported GNU version! gcc versions later than 4.9 are not supported!
    ^
    ```
    You can try install `gcc-4.9` and `g++-4.9` to solve this problem temporarily. But the linker will report `undefined references` errors later because all other libraries (`protobuf`,`leveldb`,`opencv`) in Ubuntu 15.10 are compiled with GCC version 5.2. They are not compatible.

    To solve this problem we have to "hack" the CUDA toolkit by editing `/usr/local/cuda/include/host_config.h`. Comment line 115.
    ```
    --- #error -- unsupported GNU version! gcc versions later than 4.9 are not supported!
    +++ //#error -- unsupported GNU version! gcc versions later than 4.9 are not supported!
    ```

    ### Fix `hdf5` naming problem
    Your machine may report the following error when compiling Caffe even though `libhdf5-serial-dev` package has been already installed in it.
    ```
    ./include/caffe/util/hdf5.hpp:6:18: fatal error: hdf5.h: No such file or directory
    ```
    This is because of change of default path and name of `hdf5` head files and libraries in Ubuntu 15.10. To solve this problem, we can simply modify `Makefile` files.

    Append `/usr/include/hdf5/serial/` to `INCLUDE_DIRS` at line 85 in `Makefile.config`.
    ```
    --- INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/local/include/
    +++ INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/local/include/ /usr/include/hdf5/serial/
    ```

    Modify `hdf5_hl` and `hdf5` to `hdf5_serial_hl` and `hdf5_serial` at line 173 in `Makefile`
    ```
    --- LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_hl hdf5
    +++ LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_serial_hl hdf5_serial
    ```

    ### Compile and Test Caffe
    By now, all incompatibility issues should have been solved. We can start to compile and test Caffe.
    ```
    cd ~/caffe
    make -j8
    make test -j8
    make runtest -j8
    ```
    Hopefully all tests pass.

    ### Notes
    1. Running `sudo make runtest` once may help you fix a lot of runtime errors until next reboot. But it is not a recommended way.
    2. You might need to append `LC_ALL="en_US.UTF-8"` to `/etc/environment` and reboot your machine if there are runtime errors related to `locale::facet::_S_create_c_locale name not valid`.