TensorFlow

From Chorke Wiki
Revision as of 08:21, 12 February 2023 by Shahed (talk | contribs) (→‎CUDA Toolkit)
Jump to navigation Jump to search

Install

sudo apt udpate
sudo apt install python3-dev python3-pip python3-venv
# sudo apt install nvidia-cuda-toolkit
apk update
apk add bash gcc musl-dev python3 python3-dev py3-pip libxslt-dev libxml2-dev
# apk add nvidia-cuda-toolkit

python3 -m venv .venv --prompt="TensorFlow"
source .venv/bin/activate
pip install --upgrade pip
python3 -m venv .venv --prompt="TensorFlow"
source .venv/bin/activate
pip install --upgrade pip

# export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
# pip install jep ads gspread

pip install tensorflow
pip show tensorflow
pip install tensorflow
pip show tensorflow

python -c 'import tensorflow as tf; print("Tensorflow Version: ", tf.__version__)'
pip uninstall tensorflow

CUDA Toolkit

verify cuda-capable gpu:
cat /proc/driver/nvidia/version
apt search nvidia-headless*
apt search nvidia-driver-*
ubuntu-drivers devices

lspci | grep -i nvidia
lsmod | grep -i nvidia
lspci | grep -e VGA
lspci | grep VGA

nvidia-smi
curl -fsSL https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/3bf863cc.pub\
| sudo gpg --dearmor -o /usr/share/keyrings/cuda-archive-keyring.gpg

cat << EOF | sudo tee /etc/apt/sources.list.d/cuda-ubuntu2204-x86_64.list >/dev/null
deb [arch=$(dpkg --print-architecture)\
 signed-by=/usr/share/keyrings/cuda-archive-keyring.gpg]\
 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/ /
EOF

sudo apt install cuda
sudo apt install cuda-drivers
Or:
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.0-1_all.deb
sudo dpkg -i cuda-keyring_1.0-1_all.deb

sudo apt update
sudo apt install cuda
sudo apt install cuda-drivers

Knowledge

python3 -m venv .venv --prompt="TensorFlow"
# source .venv/bin/activate
# (academia) $
python3 -m venv .venv --prompt="TensorFlow"
# source .venv/bin/activate
# (molecule) $
python -m venv .venv --prompt="TensorFlow"
# .venv\Scripts\activate
# (molecule) PS>

apk list --installed|grep ^bash
apk list --installed|grep  bash
apk add gcc
apk search | grep ^bash
apk search | grep  bash
apk add g++
apk info --contents bash
apk info --rdepends bash
apk add libc6-compat

sudo apt search  nvidia-cuda-toolkit
sudo apt install nvidia-cuda-toolkit
sudo find / -name 'libcudart.so*'
sudo chmod a+r /usr/lib/x86_64-linux-gnu/libcuda*
nvidia-smi
sudo apt install cuda

Installation  :
driver        »
driver & cuda »

Installation  :
driver        »
driver & cuda »

Installation  :
driver        »
driver & cuda »
Proprietary:
sudo apt install nvidia-driver-510
sudo apt install nvidia-driver-510 cuda

Proprietary:
sudo apt install nvidia-driver-525
sudo apt install nvidia-driver-525 cuda

Proprietary:
sudo apt install nvidia-headless-525
sudo apt install nvidia-headless-525 cuda
OpenSource:
sudo apt install nvidia-driver-510-open
sudo apt install nvidia-driver-510-open cuda

OpenSource:
sudo apt install nvidia-driver-525-open
sudo apt install nvidia-driver-525-open cuda

OpenSource:
sudo apt install nvidia-headless-525-open
sudo apt install nvidia-headless-525-open cuda

References