Difference: PreparingThePC (1 vs. 5)

Revision 52023-10-17 - UliRaich

Line: 1 to 1
 
META TOPICPARENT name="TinyML"

Preparing the PC for Tensorflow

Setting up a virtual Python environment

Line: 41 to 41
  TensorFlow relies on the cuda toolkit and on the NVidia display driver. Even after installing the newest version of cuda, TensorFlow did not see the GPU. An intensive search with Google finally showed that (at the moment of writing this page) TensorFlow version 2 only works with cuda 11.8 and cuDNN 8.6.
Changed:
<
<
https://medium.com/@juancrrn/installing-cuda-and-cudnn-in-ubuntu-20-04-for-deep-learning-dad8841714d6 describes how to install cuda-11.8 and cudnn-8.6 and how to test the installation.
>
>
https://medium.com/@juancrrn/installing-cuda-and-cudnn-in-ubuntu-20-04-for-deep-learning-dad8841714d6 and https://gist.github.com/MihailCosmin/affa6b1b71b43787e9228c25fe15aeba decribe how to install cuda-11.8 and cudnn-8.6 and how to test the installation.
  The script testGPU.py below shows the number of GPUs that TensorFlow has fouind:   #!/home/uli/.virtualenvs/AI/bin/python
import tensorflow as tf
print("Num GPUs Available: ", len(tf.config.list_physical_devices('GPU')))

Revision 42023-09-21 - UliRaich

Line: 1 to 1
 
META TOPICPARENT name="TinyML"

Preparing the PC for Tensorflow

Setting up a virtual Python environment

Line: 35 to 35
  nvidia.png
Changed:
<
<
TensorFlow relies on the cuda toolkit and on the NVidia display driver. I had difficulties to install these with the .deb files but succeeded to do so using the .run file.
>
>
When looking at the Software & Updates program we see that the nvidia-driver-535 is used to control the NVidia GeForce GTX 950 module. Make sure that the nouveau driver is disabled!
 
Changed:
<
<
cuda_download.png
>
>
displayDriver.png
 
Changed:
<
<
To run the installer script I had to boot into single user mode, avoiding to start the desktop system. This can be done typing "e" at the boot screen and adding "single" to the boot command.
>
>
TensorFlow relies on the cuda toolkit and on the NVidia display driver. Even after installing the newest version of cuda, TensorFlow did not see the GPU. An intensive search with Google finally showed that (at the moment of writing this page) TensorFlow version 2 only works with cuda 11.8 and cuDNN 8.6.
 
Changed:
<
<
In the "Additional Drivers" tab of the Software & Updates program you see that we are using the manually installed NVidia driver:
>
>
https://medium.com/@juancrrn/installing-cuda-and-cudnn-in-ubuntu-20-04-for-deep-learning-dad8841714d6 describes how to install cuda-11.8 and cudnn-8.6 and how to test the installation.
 
Changed:
<
<
driver_used.png
>
>
The script testGPU.py below shows the number of GPUs that TensorFlow has fouind:   #!/home/uli/.virtualenvs/AI/bin/python
import tensorflow as tf
print("Num GPUs Available: ", len(tf.config.list_physical_devices('GPU')))
 
Changed:
<
<
When trying a very simple TensorFlow program: #!/usr/bin/python3
import tensorflow as tf
import numpy as np
from tensorflow import keras
model = tf.keras.Sequential([keras.layers.Dense(units=1, input_shape=[1])])
>
>
After installation of cuda-11.8 and cuDNN-8.6 this is what I get, when I run the script:
 
Changed:
<
<
I get:
>
>
GPU_warnings.png
 
Changed:
<
<
gpu_good.png
>
>
To get rid of these warnings I first had to install tensorrt from the NVidia WEB site.

To irradicate the NUMA mode warning I followed:

https://askubuntu.com/questions/1379119/how-to-set-the-numa-node-for-an-nvidia-gpu-persistently

When running the testGPU program now, things seem to be ok and I should be able to use my NVidia GPU.

GPU_ok.png

  -- Uli Raich - 2022-01-31

Comments

Changed:
<
<
<--/commentPlugin-->
>
>

<--/commentPlugin-->
 
META FILEATTACHMENT attachment="cuda_download.png" attr="" comment="" date="1643626582" name="cuda_download.png" path="cuda_download.png" size="52637" user="UliRaich" version="1"
META FILEATTACHMENT attachment="nvidia.png" attr="" comment="" date="1643626582" name="nvidia.png" path="nvidia.png" size="13000" user="UliRaich" version="1"
Line: 64 to 72
 
META FILEATTACHMENT attachment="libcudart.png" attr="" comment="" date="1643626913" name="libcudart.png" path="libcudart.png" size="37871" user="UliRaich" version="1"
META FILEATTACHMENT attachment="gpu_good.png" attr="" comment="" date="1643626582" name="gpu_good.png" path="gpu_good.png" size="46971" user="UliRaich" version="1"
META FILEATTACHMENT attachment="graphicsCard.png" attr="" comment="" date="1643626913" name="graphicsCard.png" path="graphicsCard.png" size="39171" user="UliRaich" version="1"
Added:
>
>
META FILEATTACHMENT attachment="displayDriver.png" attr="" comment="" date="1695319151" name="displayDriver.png" path="displayDriver.png" size="104774" user="UliRaich" version="1"
META FILEATTACHMENT attachment="GPU_warnings.png" attr="" comment="" date="1695320777" name="GPU_warnings.png" path="GPU_warnings.png" size="118104" user="UliRaich" version="1"
META FILEATTACHMENT attachment="GPU_ok.png" attr="" comment="" date="1695323567" name="GPU_ok.png" path="GPU_ok.png" size="41303" user="UliRaich" version="1"

Revision 32022-02-21 - UliRaich

Line: 1 to 1
 
META TOPICPARENT name="TinyML"

Preparing the PC for Tensorflow

Setting up a virtual Python environment

Line: 45 to 45
  driver_used.png
Changed:
<
<
When trying a very simple TensorFlow program:
>
>
When trying a very simple TensorFlow program:
 #!/usr/bin/python3
import tensorflow as tf
import numpy as np
from tensorflow import keras
model = tf.keras.Sequential([keras.layers.Dense(units=1, input_shape=[1])])

I get:

Revision 22022-01-31 - UliRaich

Line: 1 to 1
 
META TOPICPARENT name="TinyML"

Preparing the PC for Tensorflow

Setting up a virtual Python environment

Line: 12 to 12
 switch to a virtual environment with the "workon" command:

e.g. workon AI

Added:
>
>
The virtual environment used to build ML models should include and maybe a few others.
 

Setting up the GPU

When trying my first simple TensorFlow program I saw this warning:

Revision 12022-01-31 - UliRaich

Line: 1 to 1
Added:
>
>
META TOPICPARENT name="TinyML"

Preparing the PC for Tensorflow

Setting up a virtual Python environment

The procedure is described in https://www.freecodecamp.org/news/virtualenv-with-virtualenvwrapper-on-ubuntu-18-04.

Once his is done you can create a new virtual environment with:

mkvirtualenv name_of_env (e.g. mkvirtualenv AI)

switch to a virtual environment with the "workon" command:

e.g. workon AI

Setting up the GPU

When trying my first simple TensorFlow program I saw this warning:

libcudart.png

My PC, being a "gaming machine", uses an nVIDIA GeForce GTX 950M graphics card whose GPU (Graphics Processing Unit) can be used by TensorFlow to speed up number crunching.

nvidia.png

TensorFlow relies on the cuda toolkit and on the NVidia display driver. I had difficulties to install these with the .deb files but succeeded to do so using the .run file.

cuda_download.png

To run the installer script I had to boot into single user mode, avoiding to start the desktop system. This can be done typing "e" at the boot screen and adding "single" to the boot command.

In the "Additional Drivers" tab of the Software & Updates program you see that we are using the manually installed NVidia driver:

driver_used.png

When trying a very simple TensorFlow program: #!/usr/bin/python3
import tensorflow as tf
import numpy as np
from tensorflow import keras
model = tf.keras.Sequential([keras.layers.Dense(units=1, input_shape=[1])])

I get:

gpu_good.png

-- Uli Raich - 2022-01-31

Comments

<--/commentPlugin-->

META FILEATTACHMENT attachment="cuda_download.png" attr="" comment="" date="1643626582" name="cuda_download.png" path="cuda_download.png" size="52637" user="UliRaich" version="1"
META FILEATTACHMENT attachment="nvidia.png" attr="" comment="" date="1643626582" name="nvidia.png" path="nvidia.png" size="13000" user="UliRaich" version="1"
META FILEATTACHMENT attachment="driver_used.png" attr="" comment="" date="1643626582" name="driver_used.png" path="driver_used.png" size="76697" user="UliRaich" version="1"
META FILEATTACHMENT attachment="libcudart.png" attr="" comment="" date="1643626913" name="libcudart.png" path="libcudart.png" size="37871" user="UliRaich" version="1"
META FILEATTACHMENT attachment="gpu_good.png" attr="" comment="" date="1643626582" name="gpu_good.png" path="gpu_good.png" size="46971" user="UliRaich" version="1"
META FILEATTACHMENT attachment="graphicsCard.png" attr="" comment="" date="1643626913" name="graphicsCard.png" path="graphicsCard.png" size="39171" user="UliRaich" version="1"
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback