Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents

Dependencies for using GPU

  • NVIDIA driver

  • CUDA Toolkit

...

You may need to update for NVIDIA driver.

...

Setting Keras Environment

Prerequisites

For your convenience, you'd better install and use git bash.

Therefore, I will test on git bash or bash terminal integrated within VSCode.

Install Miniconda on Windows

Downloadhttps://docs.

...

conda.

...

io/

...

en/

...

latest/

...

miniconda.html

Setting Keras

Install Karas from Yaml

Code Block
languagepy
# CudaMake $yaml Driverfile.
version$ checkvi $ nvidia-smi
Tue Dec 08 16:18:18 2020       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 442.62       Driver Version: 442.62       CUDA Version: 10.2     |
|-------------------------------+----------------------+----------------------+
| GPU  Name            TCC/WDDM | Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 1060   WDDM  | 00000000:01:00.0  On |                  N/A |
| N/A   50C    P0    26W /  N/A |   1558MiB /  6144MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0      1384    C+G   Insufficient Permissions                   N/A      |
|    0      3584    C+G   ...14511.0_x64__8wekyb3d8bbwe\Video.UI.exe N/A      |
|    0      6700    C+G   ...w5n1h2txyewy\InputApp\TextInputHost.exe N/A      |
|    0      9796    C+G   C:\Windows\explorer.exe                    N/A      |
|    0     12024    C+G   ...dows.Search_cw5n1h2txyewy\SearchApp.exe N/A      |
|    0     13092    C+G   ...osoft.LockApp_cw5n1h2txyewy\LockApp.exe N/A      |
|    0     13404    C+G   ...t_cw5n1h2txyewy\ShellExperienceHost.exe N/A      |
|    0     13652    C+G   ....125.0_x64__8wekyb3d8bbwe\YourPhone.exe N/A      |
|    0     15252    C+G   ...001.0001_1447f3a4afa4575f\X-Pointer.exe N/A      |
|    0     15948    C+G   ...boxAlpha Messenger\BizboxAMessenger.exe N/A      |
|    0     16096    C+G   ...ppData\Local\slack\app-4.10.3\slack.exe N/A      |
|    0     24692    C+G   ...File Stream\44.0.12.0\GoogleDriveFS.exe N/A      |
|    0     29640    C+G   ...cal\Programs\Microsoft VS Code\Code.exe N/A      |
|    0     35504    C+G   ...ogram Files\Mozilla Firefox\firefox.exe N/A      |
|    0     38972    C+G   ...5n1h2txyewy\StartMenuExperienceHost.exe N/A      |
|    0     39284    C+G   ...mmersiveControlPanel\SystemSettings.exe N/A      |
|    0     46152    C+G   ...6)\Google\Chrome\Application\chrome.exe N/A      |
|    0     61976    C+G   ...10.2011.4.0_x64__8wekyb3d8bbwe\Maps.exe N/A      |
|    0     62280    C+G   ...ta\Local\Postman\app-7.36.0\Postman.exe N/A      |
|    0     66980    C+G   ...ogram Files\Mozilla Firefox\firefox.exe N/A      |
|    0     71656    C+G   ...x64__8wekyb3d8bbwe\Microsoft.Photos.exe N/A      |
|    0     77796    C+G   ...8wekyb3d8bbwe\Microsoft.Msn.Weather.exe N/A      |
|    0     91232    C+G   ...9.4.0_x64__8wekyb3d8bbwe\Calculator.exe N/A      |
+-----------------------------------------------------------------------------+

Setting Keras Environment

Prerequisites

For your convenience, you'd better install and use git bash.

Therefore, I will test on git bash or bash terminal integrated within VSCode.

Install Miniconda on Windows

Download: https://docs.conda.io/en/latest/miniconda.html

Setting Keras

Install Karas from Yaml

Code Block
languagepy
# Make yaml file.
$ vi environment-gpu.yml
name: deep-learning-with-python

dependencies:
  - python=3.7
  - scikit-learn
  - scipy
  - numpy
  - matplotlib
  - ipython
  - jupyter
  - pillow
  - opencv
  - graphviz
  - cython
  - pip:
      - tensorflow-gpu
      - keras
      - pydot-ng

# Create conda env
$ conda env create -f environment-gpu.yml

# Enter deep-learning-with-python env
$ conda activate deep-learning-with-python
Note

If not able to activate a certain conda env, add this instruction into .bashrc

. ~/Miniconda3/etc/profile.d/conda.sh
environment-gpu.yml
name: tf-gpu-1.15

dependencies:
  - python=3.6
  - tensorflow-gpu=1.15
  - keras=2.3.1
  - scikit-learn
  - scipy
  - numpy
  - matplotlib
  - ipython
  - jupyter
  - pillow
  - opencv
  - graphviz
  - cython
  - pip:
      - pydot-ng

# Create conda env
$ conda env create -f environment-gpu.yml

# Enter tf-gpu-1.15 env
$ conda activate tf-gpu-1.15
Note

If not able to activate a certain conda env, add this instruction into .bashrc

. ~/Miniconda3/etc/profile.d/conda.sh

Code Block
languagepy
# Check out the installed packages about cuda.
$ conda list
...
cudatoolkit               10.0.130                      0
cudnn                     7.6.5                cuda10.0_0
...
keras                     2.3.1                         0
keras-applications        1.0.8                      py_1
keras-base                2.3.1                    py36_0
keras-preprocessing       1.1.2              pyhd3eb1b0_0
...
tensorflow                1.15.0          gpu_py36h2b26d6b_0
tensorflow-base           1.15.0          gpu_py36h1afeea4_0
tensorflow-estimator      1.15.1             pyh2649769_0
tensorflow-gpu            1.15.0               h0d30ee6_0
...