Tuesday, April 18, 2023

Installing TensorFlow on Pop!_OS using Tensorman

Pop!_OS allows easy installation and management of Tensorflow using 'tensorman'.

Installing TensorFlow on Pop!_OS using Tensorman
Installing TensorFlow on Pop!_OS using Tensorman

First, make sure you have all the updates installed:

sudo apt update
sudo apt full-upgrade

Then, install the tensorman package:

sudo apt install tensorman

 In order to get Nvidia CUDA support, install the nvidia docker package:

sudo apt install nvidia-docker2

You then need to add the currect user to the docker group:

sudo usermod -aG docker $USER

... and add a kernel parameter:

sudo kernelstub --add-options "systemd.unified_cgroup_hierarchy=0"

Then, reboot the system.


After rebooting, use the tensorman command to install the latest tensorflow image:

tensorman pull latest

In order to test the installation you can use the following sample tensorflow script:

#!/usr/bin/python3
import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
tf.print(hello)
tf.print('Using TensorFlow version: ' + tf.__version__)
with tf.device('/gpu:0'):
    a = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='a')
    b = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[3, 2], name='b')
    c = tf.matmul(a, b)
tf.print(c)

Save this script as hello-world.py, and run it with the following command:

tensorman run --gpu python ./hello-world.py

If the script runs without an error, then you have successfully installed tensorman.


Check out the full step-by-step tutorial below at YouTube:



No comments:

Post a Comment