Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save LingxiaoShawn/ab7aef0ae832e5257e025190081c785e to your computer and use it in GitHub Desktop.

Select an option

Save LingxiaoShawn/ab7aef0ae832e5257e025190081c785e to your computer and use it in GitHub Desktop.

Revisions

  1. @amir-saniyan amir-saniyan revised this gist Jul 14, 2021. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion Ubuntu 20.04 for Deep Learning.md
    Original file line number Diff line number Diff line change
    @@ -314,11 +314,14 @@ Managing environments:
    **Install Qt**:

    - https://www.qt.io/
    - https://doc.qt.io/qt-6/linux.html
    - `$ sudo apt install build-essential libgl1-mesa-dev`
    - For Android Java 8 required.
    - https://doc.qt.io/qt-6/android-getting-started.html
    - `$ sudo apt install openjdk-8-jre openjdk-8-jdk`
    - `$ sudo apt install libstdc++6 libncurses5`
    - `$ sudo apt install libsdl1.2debian`
    - Install Android SDK & Android Studio
    - https://doc.qt.io/qt-6/linux.html

    ----------------------------------------------------------------------------------------------------

  2. @amir-saniyan amir-saniyan revised this gist Jul 11, 2021. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion Ubuntu 20.04 for Deep Learning.md
    Original file line number Diff line number Diff line change
    @@ -365,7 +365,9 @@ $ sudo apt install --yes nvidia-docker2
    $ sudo systemctl restart docker

    # NOTE: --runtime=nvidia
    $ sudo docker run --rm --runtime=nvidia nvidia/cuda nvidia-smi
    $ docker run --rm --runtime=nvidia nvidia/cuda:11.0-base nvidia-smi
    # OR
    $ docker run --rm --gpus all nvidia/cuda:11.0-base nvidia-smi
    ```

    TensorFlow Docker:
  3. @amir-saniyan amir-saniyan revised this gist Jul 11, 2021. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions Ubuntu 20.04 for Deep Learning.md
    Original file line number Diff line number Diff line change
    @@ -332,8 +332,8 @@ Managing environments:

    - Edit Configurations...
    - Environment variables:
    - `PATH=$PATH:/usr/local/cuda-11.0/bin`
    - `LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-11.0/lib64:/usr/local/cuda-11.0/extras/CUPTI/lib64`
    - `PATH=$PATH:/usr/local/cuda-11.2/bin`
    - `LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-11.2/lib64:/usr/local/cuda-11.2/extras/CUPTI/lib64`

    ----------------------------------------------------------------------------------------------------

  4. @amir-saniyan amir-saniyan revised this gist Jul 11, 2021. 1 changed file with 17 additions and 16 deletions.
    33 changes: 17 additions & 16 deletions Ubuntu 20.04 for Deep Learning.md
    Original file line number Diff line number Diff line change
    @@ -187,44 +187,45 @@ $ source ~/venv/ml/bin/activate

    ----------------------------------------------------------------------------------------------------

    **Deep Learning Environment (CPU)**:
    **Deep Learning Environment (Tensorflow-CPU)**:

    - https://www.tensorflow.org/install

    ```sh
    $ python3 -m venv ~/venv/dlcpu
    $ source ~/venv/dlcpu/bin/activate
    (dlcpu) $ pip install --upgrade pip setuptools wheel
    (dlcpu) $ pip install --upgrade opencv-python opencv-contrib-python
    (dlcpu) $ pip install --upgrade tensorflow tensorboard keras
    (dlcpu) $ deactivate
    $ python3 -m venv ~/venv/tfcpu
    $ source ~/venv/tfcpu/bin/activate
    (tfcpu) $ pip install --upgrade pip setuptools wheel
    (tfcpu) $ pip install --upgrade opencv-python opencv-contrib-python
    (tfcpu) $ pip install --upgrade tensorflow-cpu tensorboard keras
    (tfcpu) $ deactivate
    ```

    ----------------------------------------------------------------------------------------------------

    **Deep Learning Environment (GPU)**:
    **Deep Learning Environment (Tensorflow-GPU)**:

    - https://www.tensorflow.org/install/gpu

    ```sh
    $ python3 -m venv ~/venv/dlgpu
    $ source ~/venv/dlgpu/bin/activate
    (dlgpu) $ pip install --upgrade pip setuptools wheel
    (dlgpu) $ pip install --upgrade opencv-python opencv-contrib-python
    (dlgpu) $ pip install --upgrade tensorflow-gpu tensorboard keras
    (dlgpu) $ deactivate
    $ python3 -m venv ~/venv/tfgpu
    $ source ~/venv/tfgpu/bin/activate
    (tfgpu) $ pip install --upgrade pip setuptools wheel
    (tfgpu) $ pip install --upgrade opencv-python opencv-contrib-python
    (tfgpu) $ pip install --upgrade tensorflow-gpu tensorboard keras
    (tfgpu) $ deactivate
    ```

    ----------------------------------------------------------------------------------------------------

    **Check GPU Support by Tensorflow**:

    ```sh
    $ source ~/venv/dlgpu/bin/activate
    $ python
    $ source ~/venv/tfgpu/bin/activate
    (tfgpu) $ python
    >>> from tensorflow.python.client import device_lib
    >>> device_lib.list_local_devices()
    >>> exit()
    (tfgpu) $ deactivate
    ```

    ----------------------------------------------------------------------------------------------------
  5. @amir-saniyan amir-saniyan revised this gist Jul 11, 2021. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions Ubuntu 20.04 for Deep Learning.md
    Original file line number Diff line number Diff line change
    @@ -179,7 +179,7 @@ $ git config --global core.editor "gedit -s"
    ```sh
    $ python3 -m venv ~/venv/ml
    $ source ~/venv/ml/bin/activate
    (ml) $ pip install --upgrade wheel pip
    (ml) $ pip install --upgrade pip setuptools wheel
    (ml) $ pip install --upgrade numpy scipy matplotlib ipython jupyter pandas sympy nose
    (ml) $ pip install --upgrade scikit-learn scikit-image
    (ml) $ deactivate
    @@ -194,7 +194,7 @@ $ source ~/venv/ml/bin/activate
    ```sh
    $ python3 -m venv ~/venv/dlcpu
    $ source ~/venv/dlcpu/bin/activate
    (dlcpu) $ pip install --upgrade wheel pip
    (dlcpu) $ pip install --upgrade pip setuptools wheel
    (dlcpu) $ pip install --upgrade opencv-python opencv-contrib-python
    (dlcpu) $ pip install --upgrade tensorflow tensorboard keras
    (dlcpu) $ deactivate
    @@ -209,7 +209,7 @@ $ source ~/venv/dlcpu/bin/activate
    ```sh
    $ python3 -m venv ~/venv/dlgpu
    $ source ~/venv/dlgpu/bin/activate
    (dlgpu) $ pip install --upgrade wheel pip
    (dlgpu) $ pip install --upgrade pip setuptools wheel
    (dlgpu) $ pip install --upgrade opencv-python opencv-contrib-python
    (dlgpu) $ pip install --upgrade tensorflow-gpu tensorboard keras
    (dlgpu) $ deactivate
  6. @amir-saniyan amir-saniyan revised this gist Jul 11, 2021. 1 changed file with 10 additions and 9 deletions.
    19 changes: 10 additions & 9 deletions Ubuntu 20.04 for Deep Learning.md
    Original file line number Diff line number Diff line change
    @@ -153,22 +153,23 @@ $ git config --global core.editor "gedit -s"
    - `$ sudo lshw -C display`
    - Install NVIDIA GPU Driver:
    - Software & Updates > Additional Drivers > NVIDIA
    - Install CUDA Toolkit (CUDA 11.0):
    - Try `$ sudo ubuntu-drivers autoinstall` if NVIDIA drivers are disabled
    - Install CUDA Toolkit (CUDA 11.2):
    - https://developer.nvidia.com/cuda-toolkit-archive
    1. Install prerequisites:
    - `$ sudo apt install linux-headers-$(uname -r)`
    2. Install `cuda_11.0.3_450.51.06_linux.run` (without Driver, use --override if gcc version not supported)
    2. Install `cuda_11.2.2_460.32.03_linux.run` (without Driver, use --override if gcc version not supported)
    3. Set up the development environment by modifying the PATH and LD_LIBRARY_PATH variables (`~/.bashrc`):
    - `export PATH=$PATH:/usr/local/cuda-11.0/bin`
    - `export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-11.0/lib64:/usr/local/cuda-11.0/extras/CUPTI/lib64`
    4. Check that GPUs are visible using the command:
    - `export PATH=$PATH:/usr/local/cuda-11.2/bin`
    - `export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-11.2/lib64:/usr/local/cuda-11.2/extras/CUPTI/lib64`
    4. Check that GPUs are visible using the following command:
    - `$ nvidia-smi`
    - Install cuDNN v8.0.5, for CUDA 11.0:
    - Install cuDNN v8.1, for CUDA 11.2:
    - https://developer.nvidia.com/cudnn
    - https://developer.nvidia.com/rdp/cudnn-archive
    - `$ sudo dpkg -i libcudnn8_8.0.5.39-1+cuda11.0_amd64.deb`
    - `$ sudo dpkg -i libcudnn8-dev_8.0.5.39-1+cuda11.0_amd64.deb`
    - `$ sudo dpkg -i libcudnn8-samples_8.0.5.39-1+cuda11.0_amd64.deb # Optional`
    - `$ sudo dpkg -i libcudnn8_8.1.1.33-1+cuda11.2_amd64.deb`
    - `$ sudo dpkg -i libcudnn8-dev_8.1.1.33-1+cuda11.2_amd64.deb`
    - `$ sudo dpkg -i libcudnn8-samples_8.1.1.33-1+cuda11.2_amd64.deb # Optional`
    - Reboot

    ----------------------------------------------------------------------------------------------------
  7. @amir-saniyan amir-saniyan revised this gist Mar 1, 2021. 1 changed file with 10 additions and 1 deletion.
    11 changes: 10 additions & 1 deletion Ubuntu 20.04 for Deep Learning.md
    Original file line number Diff line number Diff line change
    @@ -247,13 +247,22 @@ Install:
    ```sh
    $ wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
    $ chmod +x Miniconda3-latest-Linux-x86_64.sh

    $ ./Miniconda3-latest-Linux-x86_64.sh

    $ # Do you wish the installer to initialize Miniconda3
    # by running conda init?
    # yes

    $ source ~/miniconda3/bin/activate
    $ conda config --set auto_activate_base false
    $ conda deactivate
    ```

    Activate and Deactivate:

    ```sh
    $ source ~/miniconda3/bin/activate
    $ conda activate
    (base) $ conda deactivate
    ```

  8. @amir-saniyan amir-saniyan revised this gist Feb 26, 2021. 1 changed file with 60 additions and 0 deletions.
    60 changes: 60 additions & 0 deletions Ubuntu 20.04 for Deep Learning.md
    Original file line number Diff line number Diff line change
    @@ -240,6 +240,66 @@ $ pip install mkdocs mkdocs-material

    ----------------------------------------------------------------------------------------------------

    **Install Miniconda**:

    Install:

    ```sh
    $ wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
    $ chmod +x Miniconda3-latest-Linux-x86_64.sh
    $ ./Miniconda3-latest-Linux-x86_64.sh
    ```

    Activate and Deactivate:

    ```sh
    $ source ~/miniconda3/bin/activate
    (base) $ conda deactivate
    ```

    Managing conda:

    ```sh
    (base) $ conda info
    (base) $ conda update conda
    ```

    Managing environments:

    ```sh
    (base) $ conda info --envs

    (base) $ conda create --name snakes python=3.5
    (base) $ conda info --envs

    (base) $ conda activate snakes

    (snakes) $ python --version

    (snakes) $ conda search beautifulsoup4

    (snakes) $ conda install beautifulsoup4
    (snakes) $ conda list

    (snakes) $ conda update beautifulsoup4

    (snakes) $ conda uninstall beautifulsoup4
    (snakes) $ conda list

    (snakes) $ conda deactivate

    (base) $ conda remove --name snakes --all

    (base) $ conda info --envs
    ```

    - https://conda.io/
    - https://docs.conda.io/en/latest/miniconda.html
    - https://docs.conda.io/projects/conda/en/latest/user-guide/getting-started.html
    - https://anaconda.org/search

    ----------------------------------------------------------------------------------------------------

    **Install Qt**:

    - https://www.qt.io/
  9. @amir-saniyan amir-saniyan revised this gist Feb 10, 2021. 1 changed file with 13 additions and 13 deletions.
    26 changes: 13 additions & 13 deletions Ubuntu 20.04 for Deep Learning.md
    Original file line number Diff line number Diff line change
    @@ -178,10 +178,10 @@ $ git config --global core.editor "gedit -s"
    ```sh
    $ python3 -m venv ~/venv/ml
    $ source ~/venv/ml/bin/activate
    $ (ml) pip install --upgrade wheel pip
    $ (ml) pip install --upgrade numpy scipy matplotlib ipython jupyter pandas sympy nose
    $ (ml) pip install --upgrade scikit-learn scikit-image
    $ (ml) deactivate
    (ml) $ pip install --upgrade wheel pip
    (ml) $ pip install --upgrade numpy scipy matplotlib ipython jupyter pandas sympy nose
    (ml) $ pip install --upgrade scikit-learn scikit-image
    (ml) $ deactivate
    ```

    ----------------------------------------------------------------------------------------------------
    @@ -193,10 +193,10 @@ $ (ml) deactivate
    ```sh
    $ python3 -m venv ~/venv/dlcpu
    $ source ~/venv/dlcpu/bin/activate
    $ (dlcpu) pip install --upgrade wheel pip
    $ (dlcpu) pip install --upgrade opencv-python opencv-contrib-python
    $ (dlcpu) pip install --upgrade tensorflow tensorboard keras
    $ (dlcpu) deactivate
    (dlcpu) $ pip install --upgrade wheel pip
    (dlcpu) $ pip install --upgrade opencv-python opencv-contrib-python
    (dlcpu) $ pip install --upgrade tensorflow tensorboard keras
    (dlcpu) $ deactivate
    ```

    ----------------------------------------------------------------------------------------------------
    @@ -208,10 +208,10 @@ $ (dlcpu) deactivate
    ```sh
    $ python3 -m venv ~/venv/dlgpu
    $ source ~/venv/dlgpu/bin/activate
    $ (dlgpu) pip install --upgrade wheel pip
    $ (dlgpu) pip install --upgrade opencv-python opencv-contrib-python
    $ (dlgpu) pip install --upgrade tensorflow-gpu tensorboard keras
    $ (dlgpu) deactivate
    (dlgpu) $ pip install --upgrade wheel pip
    (dlgpu) $ pip install --upgrade opencv-python opencv-contrib-python
    (dlgpu) $ pip install --upgrade tensorflow-gpu tensorboard keras
    (dlgpu) $ deactivate
    ```

    ----------------------------------------------------------------------------------------------------
    @@ -228,7 +228,7 @@ $ python

    ----------------------------------------------------------------------------------------------------

    **Additional Useful Packages**:
    **Additional Useful Python Packages**:

    * Project documentation with Markdown:
    * https://www.mkdocs.org/
  10. @amir-saniyan amir-saniyan revised this gist Feb 10, 2021. 1 changed file with 12 additions and 0 deletions.
    12 changes: 12 additions & 0 deletions Ubuntu 20.04 for Deep Learning.md
    Original file line number Diff line number Diff line change
    @@ -228,6 +228,18 @@ $ python

    ----------------------------------------------------------------------------------------------------

    **Additional Useful Packages**:

    * Project documentation with Markdown:
    * https://www.mkdocs.org/
    * https://squidfunk.github.io/mkdocs-material/

    ```sh
    $ pip install mkdocs mkdocs-material
    ```

    ----------------------------------------------------------------------------------------------------

    **Install Qt**:

    - https://www.qt.io/
  11. @amir-saniyan amir-saniyan revised this gist Jan 30, 2021. 1 changed file with 8 additions and 0 deletions.
    8 changes: 8 additions & 0 deletions Ubuntu 20.04 for Deep Learning.md
    Original file line number Diff line number Diff line change
    @@ -315,6 +315,14 @@ $ # ARM Container Architecture: armv7l
    $ docker run --rm arm32v7/debian uname -m
    ```

    Model Converter:

    - https://github.com/microsoft/MMdnn

    ```sh
    $ docker run -it -v $(pwd):/models mmdnn/mmdnn:cpu.small
    ```

    ----------------------------------------------------------------------------------------------------

    **Install Additional Tools**:
  12. @amir-saniyan amir-saniyan revised this gist Jan 1, 2021. 1 changed file with 16 additions and 0 deletions.
    16 changes: 16 additions & 0 deletions Ubuntu 20.04 for Deep Learning.md
    Original file line number Diff line number Diff line change
    @@ -299,6 +299,22 @@ $ docker run -it tensorflow/tensorflow bash
    $ docker run --runtime=nvidia -it tensorflow/tensorflow:latest-gpu bash
    ```

    Running ARM Docker Containers:

    - https://en.wikipedia.org/wiki/QEMU
    - https://en.wikipedia.org/wiki/Binfmt_misc
    - https://wiki.debian.org/QemuUserEmulation
    - https://github.com/multiarch/qemu-user-static
    - https://github.com/docker-library/official-images#architectures-other-than-amd64

    ```sh
    $ sudo apt install qemu qemu-user-static binfmt-support
    $ # Host Architecture: x86_64
    $ uname -m
    $ # ARM Container Architecture: armv7l
    $ docker run --rm arm32v7/debian uname -m
    ```

    ----------------------------------------------------------------------------------------------------

    **Install Additional Tools**:
  13. @amir-saniyan amir-saniyan revised this gist Dec 23, 2020. 1 changed file with 42 additions and 0 deletions.
    42 changes: 42 additions & 0 deletions Ubuntu 20.04 for Deep Learning.md
    Original file line number Diff line number Diff line change
    @@ -147,6 +147,8 @@ $ git config --global core.editor "gedit -s"
    **Install NVIDIA Drivers for Deep Learning**:

    - https://www.tensorflow.org/install/gpu
    - TensorFlow and CUDA compatibilities:
    - https://www.tensorflow.org/install/source#gpu
    - Check Hardware:
    - `$ sudo lshw -C display`
    - Install NVIDIA GPU Driver:
    @@ -257,6 +259,46 @@ $ python
    - https://docs.docker.com/engine/install/ubuntu/
    - https://docs.docker.com/compose/install/

    Nvidia Container Toolkit:

    - https://github.com/NVIDIA/libnvidia-container
    - https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/overview.html

    - https://github.com/NVIDIA/nvidia-docker/
    - https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html#docker
    - https://hub.docker.com/r/nvidia/cuda

    Make sure you have installed the NVIDIA driver and Docker engine for your Linux distribution Note that you do not need to install the CUDA Toolkit on the host system, but the NVIDIA driver needs to be installed

    ```sh
    $ distribution=$(. /etc/os-release;echo $ID$VERSION_ID) \
    && curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add - \
    && curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list

    $ sudo apt update

    $ sudo apt install --yes nvidia-docker2

    $ sudo systemctl restart docker

    # NOTE: --runtime=nvidia
    $ sudo docker run --rm --runtime=nvidia nvidia/cuda nvidia-smi
    ```

    TensorFlow Docker:

    - https://www.tensorflow.org/install/docker
    - https://hub.docker.com/u/tensorflow/tensorflow

    ```sh
    # CPU
    $ docker run -it tensorflow/tensorflow bash

    # GPU
    # NOTE: --runtime=nvidia
    $ docker run --runtime=nvidia -it tensorflow/tensorflow:latest-gpu bash
    ```

    ----------------------------------------------------------------------------------------------------

    **Install Additional Tools**:
  14. @amir-saniyan amir-saniyan revised this gist Dec 23, 2020. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion Ubuntu 20.04 for Deep Learning.md
    Original file line number Diff line number Diff line change
    @@ -252,9 +252,10 @@ $ python

    ----------------------------------------------------------------------------------------------------

    **Install Docker Engine**:
    **Install Docker Engine & Docker Compose**:

    - https://docs.docker.com/engine/install/ubuntu/
    - https://docs.docker.com/compose/install/

    ----------------------------------------------------------------------------------------------------

  15. @amir-saniyan amir-saniyan revised this gist Dec 18, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Ubuntu 20.04 for Deep Learning.md
    Original file line number Diff line number Diff line change
    @@ -229,7 +229,7 @@ $ python
    **Install Qt**:

    - https://www.qt.io/
    - `$ sudo apt-get install build-essential libgl1-mesa-dev`
    - `$ sudo apt install build-essential libgl1-mesa-dev`
    - For Android Java 8 required.
    - `$ sudo apt install openjdk-8-jre openjdk-8-jdk`
    - Install Android SDK & Android Studio
  16. @amir-saniyan amir-saniyan revised this gist Dec 18, 2020. 1 changed file with 29 additions and 35 deletions.
    64 changes: 29 additions & 35 deletions Ubuntu 20.04 for Deep Learning.md
    Original file line number Diff line number Diff line change
    @@ -171,19 +171,29 @@ $ git config --global core.editor "gedit -s"

    ----------------------------------------------------------------------------------------------------

    **Machine Learning Environment**:

    ```sh
    $ python3 -m venv ~/venv/ml
    $ source ~/venv/ml/bin/activate
    $ (ml) pip install --upgrade wheel pip
    $ (ml) pip install --upgrade numpy scipy matplotlib ipython jupyter pandas sympy nose
    $ (ml) pip install --upgrade scikit-learn scikit-image
    $ (ml) deactivate
    ```

    ----------------------------------------------------------------------------------------------------

    **Deep Learning Environment (CPU)**:

    - https://www.tensorflow.org/install

    ```sh
    $ python3 -m venv ~/dlcpu
    $ source ~/dlcpu/bin/activate
    $ python3 -m venv ~/venv/dlcpu
    $ source ~/venv/dlcpu/bin/activate
    $ (dlcpu) pip install --upgrade wheel pip
    $ (dlcpu) pip install --upgrade numpy scipy matplotlib ipython jupyter pandas sympy nose
    $ (dlcpu) pip install --upgrade opencv-python opencv-contrib-python
    $ (dlcpu) pip install --upgrade scikit-learn scikit-image
    $ (dlcpu) pip install --upgrade tensorflow tensorboard keras
    $ (dlcpu) pip install --upgrade mmdnn
    $ (dlcpu) deactivate
    ```

    @@ -194,14 +204,11 @@ $ (dlcpu) deactivate
    - https://www.tensorflow.org/install/gpu

    ```sh
    $ python3 -m venv ~/dlgpu
    $ source ~/dlgpu/bin/activate
    $ python3 -m venv ~/venv/dlgpu
    $ source ~/venv/dlgpu/bin/activate
    $ (dlgpu) pip install --upgrade wheel pip
    $ (dlgpu) pip install --upgrade numpy scipy matplotlib ipython jupyter pandas sympy nose
    $ (dlgpu) pip install --upgrade opencv-python opencv-contrib-python
    $ (dlgpu) pip install --upgrade scikit-learn scikit-image
    $ (dlgpu) pip install --upgrade tensorflow-gpu tensorboard keras
    $ (dlgpu) pip install --upgrade mmdnn
    $ (dlgpu) deactivate
    ```

    @@ -210,23 +217,23 @@ $ (dlgpu) deactivate
    **Check GPU Support by Tensorflow**:

    ```sh
    $ source ~/dlgpu/bin/activate
    $ source ~/venv/dlgpu/bin/activate
    $ python
    >>> from tensorflow.python.client import device_lib
    >>> device_lib.list_local_devices()
    >>> exit()
    ```

    ----------------------------------------------------------------------------------------------------

    **Install Qt**:

    - https://www.qt.io/
    - `$ sudo apt install build-essential mesa-common-dev libgl1-mesa-dev libfontconfig1`
    - `$ sudo apt-get install build-essential libgl1-mesa-dev`
    - For Android Java 8 required.
    - `$ sudo apt install openjdk-8-jre openjdk-8-jdk`
    - Install Android SDK & Android Studio
    - https://wiki.qt.io/Install_Qt_5_on_Ubuntu
    - https://doc.qt.io/qt-5/linux.html
    - https://doc.qt.io/qt-6/linux.html

    ----------------------------------------------------------------------------------------------------

    @@ -240,16 +247,21 @@ $ python

    - Edit Configurations...
    - Environment variables:
    - `PATH=$PATH:/usr/local/cuda-10.1/bin`
    - `LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-10.1/lib64:/usr/local/cuda-10.1/extras/CUPTI/lib64`
    - `PATH=$PATH:/usr/local/cuda-11.0/bin`
    - `LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-11.0/lib64:/usr/local/cuda-11.0/extras/CUPTI/lib64`

    ----------------------------------------------------------------------------------------------------

    **Install Docker Engine**:

    - https://docs.docker.com/engine/install/ubuntu/

    ----------------------------------------------------------------------------------------------------

    **Install Additional Tools**:

    ```sh
    $ sudo apt install ubuntu-restricted-extras
    $ sudo apt install qemu qemu-kvm qemu-system virt-manager
    $ sudo apt install virtualbox virtualbox-dkms virtualbox-ext-pack virtualbox-guest-additions-iso
    $ sudo apt install curl wget uget unzip tar rar unrar
    $ sudo apt install gimp
    @@ -258,24 +270,6 @@ $ sudo apt install kdiff3

    - Ubuntu Software > System Load Indicator

    Virtual Machine Manager for ARM:
    ```
    <disk type="file" device="disk">
    <driver name="qemu" type="raw"/>
    <source file="/path/to/debian-X.Y.Z-armhf-DVD-1.iso"/>
    <target dev="hda" bus="virtio"/>
    <address type="virtio-mmio"/>
    <readonly/>
    </disk>
    <disk type="file" device="disk">
    <driver name="qemu" type="qcow2"/>
    <source file="/var/lib/libvirt/images/Debian-X-armhf.qcow2"/>
    <target dev="hdb" bus="virtio"/>
    <address type="virtio-mmio"/>
    </disk>
    ```

    ----------------------------------------------------------------------------------------------------

    **Install Additional Fonts**:
  17. @amir-saniyan amir-saniyan revised this gist Dec 18, 2020. 1 changed file with 9 additions and 9 deletions.
    18 changes: 9 additions & 9 deletions Ubuntu 20.04 for Deep Learning.md
    Original file line number Diff line number Diff line change
    @@ -151,22 +151,22 @@ $ git config --global core.editor "gedit -s"
    - `$ sudo lshw -C display`
    - Install NVIDIA GPU Driver:
    - Software & Updates > Additional Drivers > NVIDIA
    - Install CUDA Toolkit (CUDA 10.1):
    - Install CUDA Toolkit (CUDA 11.0):
    - https://developer.nvidia.com/cuda-toolkit-archive
    1. Install prerequisites:
    - `$ sudo apt install linux-headers-$(uname -r)`
    2. Install `cuda_10.1.243_418.87.00_linux.run` (without Driver, use --override if gcc version not supported)
    2. Install `cuda_11.0.3_450.51.06_linux.run` (without Driver, use --override if gcc version not supported)
    3. Set up the development environment by modifying the PATH and LD_LIBRARY_PATH variables (`~/.bashrc`):
    - `export PATH=$PATH:/usr/local/cuda-10.1/bin`
    - `export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-10.1/lib64:/usr/local/cuda-10.1/extras/CUPTI/lib64`
    - `export PATH=$PATH:/usr/local/cuda-11.0/bin`
    - `export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-11.0/lib64:/usr/local/cuda-11.0/extras/CUPTI/lib64`
    4. Check that GPUs are visible using the command:
    - `$ nvidia-smi`
    - Install cuDNN v7.6.5, for CUDA 10.1:
    - Install cuDNN v8.0.5, for CUDA 11.0:
    - https://developer.nvidia.com/cudnn
    - https://developer.download.nvidia.com/compute/machine-learning/repos/
    - `$ sudo dpkg -i libcudnn7_7.6.5.32-1+cuda10.1_amd64.deb`
    - `$ sudo dpkg -i libcudnn7-dev_7.6.5.32-1+cuda10.1_amd64.deb`
    - `$ sudo dpkg -i libcudnn7-doc_7.6.5.32-1+cuda10.1_amd64.deb # Optional`
    - https://developer.nvidia.com/rdp/cudnn-archive
    - `$ sudo dpkg -i libcudnn8_8.0.5.39-1+cuda11.0_amd64.deb`
    - `$ sudo dpkg -i libcudnn8-dev_8.0.5.39-1+cuda11.0_amd64.deb`
    - `$ sudo dpkg -i libcudnn8-samples_8.0.5.39-1+cuda11.0_amd64.deb # Optional`
    - Reboot

    ----------------------------------------------------------------------------------------------------
  18. @amir-saniyan amir-saniyan revised this gist Sep 3, 2020. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions Ubuntu 20.04 for Deep Learning.md
    Original file line number Diff line number Diff line change
    @@ -182,8 +182,8 @@ $ (dlcpu) pip install --upgrade wheel pip
    $ (dlcpu) pip install --upgrade numpy scipy matplotlib ipython jupyter pandas sympy nose
    $ (dlcpu) pip install --upgrade opencv-python opencv-contrib-python
    $ (dlcpu) pip install --upgrade scikit-learn scikit-image
    $ (dlcpu) pip install --upgrade tensorflow tensorboard
    $ (dlcpu) pip install --upgrade keras
    $ (dlcpu) pip install --upgrade tensorflow tensorboard keras
    $ (dlcpu) pip install --upgrade mmdnn
    $ (dlcpu) deactivate
    ```

    @@ -200,8 +200,8 @@ $ (dlgpu) pip install --upgrade wheel pip
    $ (dlgpu) pip install --upgrade numpy scipy matplotlib ipython jupyter pandas sympy nose
    $ (dlgpu) pip install --upgrade opencv-python opencv-contrib-python
    $ (dlgpu) pip install --upgrade scikit-learn scikit-image
    $ (dlgpu) pip install --upgrade tensorflow-gpu tensorboard
    $ (dlgpu) pip install --upgrade keras
    $ (dlgpu) pip install --upgrade tensorflow-gpu tensorboard keras
    $ (dlgpu) pip install --upgrade mmdnn
    $ (dlgpu) deactivate
    ```

  19. @amir-saniyan amir-saniyan revised this gist Aug 12, 2020. 1 changed file with 22 additions and 1 deletion.
    23 changes: 22 additions & 1 deletion Ubuntu 20.04 for Deep Learning.md
    Original file line number Diff line number Diff line change
    @@ -221,10 +221,12 @@ $ python
    **Install Qt**:

    - https://www.qt.io/
    - `$ sudo apt install build-essential libgl1-mesa-dev`
    - `$ sudo apt install build-essential mesa-common-dev libgl1-mesa-dev libfontconfig1`
    - For Android Java 8 required.
    - `$ sudo apt install openjdk-8-jre openjdk-8-jdk`
    - Install Android SDK & Android Studio
    - https://wiki.qt.io/Install_Qt_5_on_Ubuntu
    - https://doc.qt.io/qt-5/linux.html

    ----------------------------------------------------------------------------------------------------

    @@ -247,6 +249,7 @@ $ python

    ```sh
    $ sudo apt install ubuntu-restricted-extras
    $ sudo apt install qemu qemu-kvm qemu-system virt-manager
    $ sudo apt install virtualbox virtualbox-dkms virtualbox-ext-pack virtualbox-guest-additions-iso
    $ sudo apt install curl wget uget unzip tar rar unrar
    $ sudo apt install gimp
    @@ -255,6 +258,24 @@ $ sudo apt install kdiff3

    - Ubuntu Software > System Load Indicator

    Virtual Machine Manager for ARM:
    ```
    <disk type="file" device="disk">
    <driver name="qemu" type="raw"/>
    <source file="/path/to/debian-X.Y.Z-armhf-DVD-1.iso"/>
    <target dev="hda" bus="virtio"/>
    <address type="virtio-mmio"/>
    <readonly/>
    </disk>
    <disk type="file" device="disk">
    <driver name="qemu" type="qcow2"/>
    <source file="/var/lib/libvirt/images/Debian-X-armhf.qcow2"/>
    <target dev="hdb" bus="virtio"/>
    <address type="virtio-mmio"/>
    </disk>
    ```

    ----------------------------------------------------------------------------------------------------

    **Install Additional Fonts**:
  20. @amir-saniyan amir-saniyan revised this gist Aug 12, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Ubuntu 20.04 for Deep Learning.md
    Original file line number Diff line number Diff line change
    @@ -140,7 +140,7 @@ $ git config --global core.editor "gedit -s"

    **Install Python 3**:

    - `$ sudo apt install python3 python3-pip python3-venv python3-dev`
    - `$ sudo apt install python3 python3-wheel python3-pip python3-venv python3-dev python3-setuptools`

    ----------------------------------------------------------------------------------------------------

  21. @amir-saniyan amir-saniyan revised this gist Aug 4, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Ubuntu 20.04 for Deep Learning.md
    Original file line number Diff line number Diff line change
    @@ -248,7 +248,7 @@ $ python
    ```sh
    $ sudo apt install ubuntu-restricted-extras
    $ sudo apt install virtualbox virtualbox-dkms virtualbox-ext-pack virtualbox-guest-additions-iso
    $ sudo apt install uget
    $ sudo apt install curl wget uget unzip tar rar unrar
    $ sudo apt install gimp
    $ sudo apt install kdiff3
    ```
  22. @amir-saniyan amir-saniyan revised this gist Aug 4, 2020. 1 changed file with 25 additions and 1 deletion.
    26 changes: 25 additions & 1 deletion Ubuntu 20.04 for Deep Learning.md
    Original file line number Diff line number Diff line change
    @@ -98,7 +98,31 @@ echo

    **Install Development Tools**:

    - `$ sudo apt install build-essential pkg-config cmake cmake-qt-gui valgrind`
    - `$ sudo apt install build-essential pkg-config cmake cmake-qt-gui ninja-build valgrind`

    ----------------------------------------------------------------------------------------------------

    **Install MinGW Tools**:

    ```sh
    $ sudo apt install mingw-w64 mingw-w64-tools
    $ sudo apt install binutils-mingw-w64

    $ sudo update-alternatives --set i686-w64-mingw32-gcc /usr/bin/i686-w64-mingw32-gcc-posix
    $ sudo update-alternatives --set i686-w64-mingw32-g++ /usr/bin/i686-w64-mingw32-g++-posix

    $ sudo update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix
    $ sudo update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix
    ```

    ----------------------------------------------------------------------------------------------------

    **Install ARM Tools**:

    ```sh
    $ sudo apt install crossbuild-essential-armel crossbuild-essential-armhf crossbuild-essential-arm64
    $ sudo apt install binutils-multiarch binutils-arm-none-eabi binutils-arm-linux-gnueabi binutils-arm-linux-gnueabihf binutils-aarch64-linux-gnu
    ```

    ----------------------------------------------------------------------------------------------------

  23. @amir-saniyan amir-saniyan created this gist Apr 26, 2020.
    239 changes: 239 additions & 0 deletions Ubuntu 20.04 for Deep Learning.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,239 @@
    # Ubuntu 20.04 for Deep Learning

    In the name of God

    This gist contains steps to setup `Ubuntu 20.04` for deep learning.

    ----------------------------------------------------------------------------------------------------

    **Install Ubuntu 20.04**:

    - Computer name: Name-PC
    - Name: Name
    - User name: name
    - Password: ********

    ----------------------------------------------------------------------------------------------------

    **Update Ubuntu**:

    ```sh
    $ sudo apt update
    $ sudo apt full-upgrade --yes
    $ sudo apt autoremove --yes
    $ sudo apt autoclean --yes
    $ reboot
    ```

    ----------------------------------------------------------------------------------------------------

    **Create Update Script**:

    - Create a file (`~/full-update.sh`) with the following lines:

    ```sh
    #!/bin/bash

    if [ "$EUID" -ne 0 ]
    then echo "Error: Please run as root."
    exit
    fi

    clear

    echo "################################################################################"
    echo "Updating list of available packages..."
    echo "--------------------------------------------------------------------------------"
    apt update
    echo "################################################################################"
    echo

    echo "################################################################################"
    echo "Upgrading the system by removing/installing/upgrading packages..."
    echo "--------------------------------------------------------------------------------"
    apt full-upgrade --yes
    echo "################################################################################"
    echo

    echo "################################################################################"
    echo "Removing automatically all unused packages..."
    echo "--------------------------------------------------------------------------------"
    apt autoremove --yes
    echo "################################################################################"
    echo

    echo "################################################################################"
    echo "Clearing out the local repository of retrieved package files..."
    echo "--------------------------------------------------------------------------------"
    apt autoclean --yes
    echo "################################################################################"
    echo
    ```

    ----------------------------------------------------------------------------------------------------

    **Change Settings**:

    - Review Ubuntu Settings

    ----------------------------------------------------------------------------------------------------

    **Change Software & Updates**:

    - Review Ubuntu Software & Updates

    ----------------------------------------------------------------------------------------------------

    **Update Ubuntu**:

    - `$ sudo ~/full-update.sh`

    ----------------------------------------------------------------------------------------------------

    **Install Chrome** (https://www.google.com/chrome):

    - `$ sudo dpkg -i google-chrome-stable_current_amd64.deb`

    ----------------------------------------------------------------------------------------------------

    **Install Development Tools**:

    - `$ sudo apt install build-essential pkg-config cmake cmake-qt-gui valgrind`

    ----------------------------------------------------------------------------------------------------

    **Install Git**:

    ```sh
    $ sudo apt install git
    $ git config --global user.name "Name"
    $ git config --global user.email "name@domain.com"
    $ git config --global core.editor "gedit -s"
    ```
    - Copy your own SSH keys to `~/.ssh`

    ----------------------------------------------------------------------------------------------------

    **Install Python 3**:

    - `$ sudo apt install python3 python3-pip python3-venv python3-dev`

    ----------------------------------------------------------------------------------------------------

    **Install NVIDIA Drivers for Deep Learning**:

    - https://www.tensorflow.org/install/gpu
    - Check Hardware:
    - `$ sudo lshw -C display`
    - Install NVIDIA GPU Driver:
    - Software & Updates > Additional Drivers > NVIDIA
    - Install CUDA Toolkit (CUDA 10.1):
    - https://developer.nvidia.com/cuda-toolkit-archive
    1. Install prerequisites:
    - `$ sudo apt install linux-headers-$(uname -r)`
    2. Install `cuda_10.1.243_418.87.00_linux.run` (without Driver, use --override if gcc version not supported)
    3. Set up the development environment by modifying the PATH and LD_LIBRARY_PATH variables (`~/.bashrc`):
    - `export PATH=$PATH:/usr/local/cuda-10.1/bin`
    - `export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-10.1/lib64:/usr/local/cuda-10.1/extras/CUPTI/lib64`
    4. Check that GPUs are visible using the command:
    - `$ nvidia-smi`
    - Install cuDNN v7.6.5, for CUDA 10.1:
    - https://developer.nvidia.com/cudnn
    - https://developer.download.nvidia.com/compute/machine-learning/repos/
    - `$ sudo dpkg -i libcudnn7_7.6.5.32-1+cuda10.1_amd64.deb`
    - `$ sudo dpkg -i libcudnn7-dev_7.6.5.32-1+cuda10.1_amd64.deb`
    - `$ sudo dpkg -i libcudnn7-doc_7.6.5.32-1+cuda10.1_amd64.deb # Optional`
    - Reboot

    ----------------------------------------------------------------------------------------------------

    **Deep Learning Environment (CPU)**:

    - https://www.tensorflow.org/install

    ```sh
    $ python3 -m venv ~/dlcpu
    $ source ~/dlcpu/bin/activate
    $ (dlcpu) pip install --upgrade wheel pip
    $ (dlcpu) pip install --upgrade numpy scipy matplotlib ipython jupyter pandas sympy nose
    $ (dlcpu) pip install --upgrade opencv-python opencv-contrib-python
    $ (dlcpu) pip install --upgrade scikit-learn scikit-image
    $ (dlcpu) pip install --upgrade tensorflow tensorboard
    $ (dlcpu) pip install --upgrade keras
    $ (dlcpu) deactivate
    ```

    ----------------------------------------------------------------------------------------------------

    **Deep Learning Environment (GPU)**:

    - https://www.tensorflow.org/install/gpu

    ```sh
    $ python3 -m venv ~/dlgpu
    $ source ~/dlgpu/bin/activate
    $ (dlgpu) pip install --upgrade wheel pip
    $ (dlgpu) pip install --upgrade numpy scipy matplotlib ipython jupyter pandas sympy nose
    $ (dlgpu) pip install --upgrade opencv-python opencv-contrib-python
    $ (dlgpu) pip install --upgrade scikit-learn scikit-image
    $ (dlgpu) pip install --upgrade tensorflow-gpu tensorboard
    $ (dlgpu) pip install --upgrade keras
    $ (dlgpu) deactivate
    ```

    ----------------------------------------------------------------------------------------------------

    **Check GPU Support by Tensorflow**:

    ```sh
    $ source ~/dlgpu/bin/activate
    $ python
    >>> from tensorflow.python.client import device_lib
    >>> device_lib.list_local_devices()
    ```

    ----------------------------------------------------------------------------------------------------

    **Install Qt**:

    - https://www.qt.io/
    - `$ sudo apt install build-essential libgl1-mesa-dev`
    - For Android Java 8 required.
    - `$ sudo apt install openjdk-8-jre openjdk-8-jdk`
    - Install Android SDK & Android Studio

    ----------------------------------------------------------------------------------------------------

    **Install PyCharm**:

    - https://www.jetbrains.com/pycharm/

    ----------------------------------------------------------------------------------------------------

    **Enable GPU support for PyCharm Projects**:

    - Edit Configurations...
    - Environment variables:
    - `PATH=$PATH:/usr/local/cuda-10.1/bin`
    - `LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-10.1/lib64:/usr/local/cuda-10.1/extras/CUPTI/lib64`

    ----------------------------------------------------------------------------------------------------

    **Install Additional Tools**:

    ```sh
    $ sudo apt install ubuntu-restricted-extras
    $ sudo apt install virtualbox virtualbox-dkms virtualbox-ext-pack virtualbox-guest-additions-iso
    $ sudo apt install uget
    $ sudo apt install gimp
    $ sudo apt install kdiff3
    ```

    - Ubuntu Software > System Load Indicator

    ----------------------------------------------------------------------------------------------------

    **Install Additional Fonts**:

    - `$ mkdir ~/.fonts`
    - Copy fonts to `~/.fonts`